registrar Add expiry value to the xavp.
authorOlle E. Johansson <oej@edvina.net>
Tue, 3 May 2016 19:59:13 +0000 (21:59 +0200)
committerOlle E. Johansson <oej@edvina.net>
Tue, 3 May 2016 19:59:13 +0000 (21:59 +0200)
Quite handy if Kamailio for some reason changes the expiry value (min, max
or variations caused by expiry_range)

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

index fd6505f..104298f 100644 (file)
@@ -3,6 +3,7 @@ registrar Module
 Jan Janak
 
    FhG FOKUS
+   <jan@iptel.org>
 
 Daniel-Constantin Mierla
 
@@ -12,10 +13,17 @@ Juha Heinanen
 
    <jh@tutpro.com>
 
+Olle E. Johansson
+
+   Edvina AB
+   <oej@edvina.net>
+
 Edited by
 
 Jan Janak
 
+   <jan@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
index 8e8143c..ec46234 100644 (file)
@@ -17,9 +17,7 @@
                <firstname>Jan</firstname>
                <surname>Janak</surname>
                <affiliation><orgname>&fhg;</orgname></affiliation>
-               <address>
-                       <email>jan@iptel.org</email>
-               </address>
+               <email>jan@iptel.org</email>
                </author>
                <author>
                <firstname>Daniel-Constantin</firstname>
                <surname>Heinanen</surname>
                <email>jh@tutpro.com</email>
                </author>
+               <author>
+               <firstname>Olle E.</firstname>
+               <surname>Johansson</surname>
+               <affiliation><orgname>Edvina AB</orgname></affiliation>
+               <email>oej@edvina.net</email>
+               </author>
                <editor>
                <firstname>Jan</firstname>
                <surname>Janak</surname>
-               <address>
-                       <email>jan@iptel.org</email>
-               </address>
+               <email>jan@iptel.org</email>
                </editor>
                <editor>
                <firstname>Bogdan-Andre</firstname>
index 5443abc..7cce1cf 100644 (file)
@@ -753,6 +753,11 @@ modparam("registrar", "xavp_cfg", "reg")
                                <emphasis>contact</emphasis> - the record's contact value.
                        </para>
                </listitem>
+               <listitem>
+                       <para>
+                               <emphasis>expires</emphasis> - the record's expires value.
+                       </para>
+               </listitem>
                <listitem>
                        <para>
                                <emphasis>received</emphasis> - the record's received value.
index 6889d23..7c7971e 100644 (file)
@@ -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");
+                               }
                        }
                }