[sr-dev] git:carstenbock/ims: - add a parameter to disable the setting of a version in the XML of reginfo-XML 's

Carsten Bock carsten at bock.info
Thu Mar 24 09:46:01 CET 2011


Module: sip-router
Branch: carstenbock/ims
Commit: b0be0501a1812cea565af9e3c93c7970642fb135
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b0be0501a1812cea565af9e3c93c7970642fb135

Author: Carsten Bock <carsten at bock.info>
Committer: Carsten Bock <carsten at bock.info>
Date:   Thu Mar 24 00:40:45 2011 +0100

- add a parameter to disable the setting of a version in the XML of reginfo-XML's

---

 modules_k/pua/add_events.c      |   13 ++++++++++---
 modules_k/pua/doc/pua_admin.xml |   26 ++++++++++++++++++++++++++
 modules_k/pua/pua.c             |    2 ++
 modules_k/pua/pua.h             |    2 ++
 4 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/modules_k/pua/add_events.c b/modules_k/pua/add_events.c
index f285161..76a12db 100644
--- a/modules_k/pua/add_events.c
+++ b/modules_k/pua/add_events.c
@@ -86,9 +86,16 @@ int pua_add_events(void)
 	}
 	
 	/* add application/reginfo+xml */
-	if(add_pua_event(REGINFO_EVENT, "reg", "application/reginfo+xml", reginfo_process_body)< 0) {
-		LM_ERR("while adding event application/reginfo+xml\n");
-		return -1;
+	if (dlginfo_increase_version) {
+		if(add_pua_event(REGINFO_EVENT, "reg", "application/reginfo+xml", reginfo_process_body)< 0) {
+			LM_ERR("while adding event application/reginfo+xml with version increase\n");
+			return -1;
+		}
+	} else {
+		if(add_pua_event(REGINFO_EVENT, "reg", "application/reginfo+xml", dlg_process_body)< 0) {
+			LM_ERR("while adding event application/reginfo+xml\n");
+			return -1;
+		}
 	}
 	
 	return 0;
diff --git a/modules_k/pua/doc/pua_admin.xml b/modules_k/pua/doc/pua_admin.xml
index 981dcf2..0868de4 100644
--- a/modules_k/pua/doc/pua_admin.xml
+++ b/modules_k/pua/doc/pua_admin.xml
@@ -233,6 +233,32 @@ modparam("pua", "dlginfo_increase_version", 1)
 </programlisting>
 		</example>
 	</section>
+	<section>
+		<title><varname>reginfo_increase_version</varname> (int)</title>
+		<para>
+		When sending PUBLISHs for Event: reg, the body contains an
+		XML document according to RFC 4235(?). This XML document contains a 
+		version attribute to easily detect changes in the registration state.
+		By setting this parameter, the pua module parses the XML document and
+		sets the version attribute to the proper value. If the receiver of
+		the PUBLISH does not care about the version parameter (e.g. like
+		&kamailio; presence_reginfo module) it makes no sense to waste 
+		CPU resources for parsing the XML body and the parameter should be 
+		set to 0.
+		</para>
+		<para>
+		<emphasis>Default value is <quote>0</quote>.
+		</emphasis>
+		</para>
+		<example>
+		<title>Set <varname>reginfo_increase_version</varname> parameter</title>
+		<programlisting format="linespecific">
+...
+modparam("pua", "reginfo_increase_version", 1)
+...
+</programlisting>
+		</example>
+	</section>
 	</section>
 
 	<section>
diff --git a/modules_k/pua/pua.c b/modules_k/pua/pua.c
index bf73187..6600a98 100644
--- a/modules_k/pua/pua.c
+++ b/modules_k/pua/pua.c
@@ -67,6 +67,7 @@ int update_period= 100;
 str outbound_proxy = {0, 0};
 int startup_time = 0;
 int dlginfo_increase_version = 0;
+int reginfo_increase_version = 0;
 pua_event_t* pua_evlist= NULL;
 
 /* database connection */
@@ -123,6 +124,7 @@ static param_export_t params[]={
 	{"update_period",	 INT_PARAM, &update_period       },
 	{"outbound_proxy",	 STR_PARAM, &outbound_proxy.s    },
 	{"dlginfo_increase_version",	 INT_PARAM, &dlginfo_increase_version},
+	{"reginfo_increase_version",	 INT_PARAM, &reginfo_increase_version},
 	{0,							 0,			0            }
 };
 
diff --git a/modules_k/pua/pua.h b/modules_k/pua/pua.h
index 19e59ec..3db757a 100644
--- a/modules_k/pua/pua.h
+++ b/modules_k/pua/pua.h
@@ -43,4 +43,6 @@ extern int pua_ul_publish;
 extern int default_expires;
 extern str outbound_proxy;
 
+int reginfo_increase_version;
+
 #endif




More information about the sr-dev mailing list