[sr-dev] git:master:780a37d9: registrar Add expiry value to the xavp.

Olle E. Johansson oej at edvina.net
Tue May 3 22:01:32 CEST 2016


Module: kamailio
Branch: master
Commit: 780a37d9c2d462289a2fad5c6dd25339cceaf6d9
URL: https://github.com/kamailio/kamailio/commit/780a37d9c2d462289a2fad5c6dd25339cceaf6d9

Author: Olle E. Johansson <oej at edvina.net>
Committer: Olle E. Johansson <oej at edvina.net>
Date: 2016-05-03T21:59:13+02:00

registrar Add expiry value to the xavp.

Quite handy if Kamailio for some reason changes the expiry value (min, max
or variations caused by expiry_range)

---

Modified: modules/registrar/README
Modified: modules/registrar/doc/registrar.xml
Modified: modules/registrar/doc/registrar_admin.xml
Modified: modules/registrar/reply.c

---

Diff:  https://github.com/kamailio/kamailio/commit/780a37d9c2d462289a2fad5c6dd25339cceaf6d9.diff
Patch: https://github.com/kamailio/kamailio/commit/780a37d9c2d462289a2fad5c6dd25339cceaf6d9.patch

---

diff --git a/modules/registrar/README b/modules/registrar/README
index fd6505f..104298f 100644
--- a/modules/registrar/README
+++ b/modules/registrar/README
@@ -3,6 +3,7 @@ registrar Module
 Jan Janak
 
    FhG FOKUS
+   <jan at iptel.org>
 
 Daniel-Constantin Mierla
 
@@ -12,10 +13,17 @@ Juha Heinanen
 
    <jh at tutpro.com>
 
+Olle E. Johansson
+
+   Edvina AB
+   <oej at edvina.net>
+
 Edited by
 
 Jan Janak
 
+   <jan at iptel.org>
+
 Edited by
 
 Bogdan-Andre Iancu
@@ -679,6 +687,7 @@ modparam("registrar", "xavp_cfg", "reg")
    $xavp(class[0]=>attribute). Valid inner XAVP names:
      * ruid - the record's internal unique id.
      * contact - the record's contact value.
+     * expires - the record's expires value.
      * received - the record's received value.
 
    For example. if this parameter is set to 'ulrcd', then values are set
diff --git a/modules/registrar/doc/registrar.xml b/modules/registrar/doc/registrar.xml
index 8e8143c..ec46234 100644
--- a/modules/registrar/doc/registrar.xml
+++ b/modules/registrar/doc/registrar.xml
@@ -17,9 +17,7 @@
 		<firstname>Jan</firstname>
 		<surname>Janak</surname>
 		<affiliation><orgname>&fhg;</orgname></affiliation>
-		<address>
-			<email>jan at iptel.org</email>
-		</address>
+		<email>jan at iptel.org</email>
 		</author>
 		<author>
 		<firstname>Daniel-Constantin</firstname>
@@ -31,12 +29,16 @@
 		<surname>Heinanen</surname>
 		<email>jh at tutpro.com</email>
 		</author>
+		<author>
+		<firstname>Olle E.</firstname>
+		<surname>Johansson</surname>
+		<affiliation><orgname>Edvina AB</orgname></affiliation>
+		<email>oej at edvina.net</email>
+		</author>
 		<editor>
 		<firstname>Jan</firstname>
 		<surname>Janak</surname>
-		<address>
-			<email>jan at iptel.org</email>
-		</address>
+		<email>jan at iptel.org</email>
 		</editor>
 		<editor>
 		<firstname>Bogdan-Andre</firstname>
diff --git a/modules/registrar/doc/registrar_admin.xml b/modules/registrar/doc/registrar_admin.xml
index 5443abc..7cce1cf 100644
--- a/modules/registrar/doc/registrar_admin.xml
+++ b/modules/registrar/doc/registrar_admin.xml
@@ -755,6 +755,11 @@ modparam("registrar", "xavp_cfg", "reg")
 		</listitem>
 		<listitem>
 			<para>
+				<emphasis>expires</emphasis> - the record's expires value.
+			</para>
+		</listitem>
+		<listitem>
+			<para>
 				<emphasis>received</emphasis> - the record's received value.
 			</para>
 		</listitem>
diff --git a/modules/registrar/reply.c b/modules/registrar/reply.c
index 6889d23..7c7971e 100644
--- a/modules/registrar/reply.c
+++ b/modules/registrar/reply.c
@@ -176,6 +176,7 @@ int build_contact(sip_msg_t *msg, ucontact_t* c, str *host)
 	sr_xavp_t *xavp=NULL;
 	sr_xavp_t *list=NULL;
 	str xname = {"ruid", 4};
+	str ename = {"expires", 7};
 	sr_xval_t xval;
 
 
@@ -334,9 +335,18 @@ int build_contact(sip_msg_t *msg, ucontact_t* c, str *host)
 				memset(&xval, 0, sizeof(sr_xval_t));
 				xval.type = SR_XTYPE_STR;
 				xval.v.s = c->ruid;
+
 				if(xavp_add_value(&xname, &xval, &xavp)==NULL) {
 					LM_ERR("cannot add ruid value to xavp\n");
 				}
+				/* Add contact expiry */
+				memset(&xval, 0, sizeof(sr_xval_t));
+				xval.type = SR_XTYPE_INT;
+				xval.v.i = (int)(c->expires - act_time);
+
+				if(xavp_add_value(&ename, &xval, &xavp)==NULL) {
+					LM_ERR("cannot add expires value to xavp\n");
+				}
 			}
 		}
 




More information about the sr-dev mailing list