Skip to content

Commit

Permalink
Merge pull request #106 from kamailio/coudot/registrar_ulc_conid
Browse files Browse the repository at this point in the history
registrar: make connection id available in $ulc()
  • Loading branch information
miconda committed Mar 7, 2015
2 parents 8da7ee8 + 824c31c commit dbdf843
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/registrar/README
Expand Up @@ -1068,6 +1068,7 @@ event_route[usrloc:contact-expired] {
* ruid - record unique ID
* reg-id - reg-id value
* instance - instance value
* conid - TCP socket internal connection ID ($null if UDP)

The pseudo-variable accepts positive index value to access a specific
contact record.
Expand Down
4 changes: 4 additions & 0 deletions modules/registrar/doc/registrar_admin.xml
Expand Up @@ -1455,6 +1455,10 @@ event_route[usrloc:contact-expired] {
<para><emphasis>instance</emphasis> - instance value
</para>
</listitem>
<listitem>
<para><emphasis>conid</emphasis> - TCP socket internal connection ID ($null if UDP)
</para>
</listitem>
</itemizedlist>
<para>
The pseudo-variable accepts positive index value to access
Expand Down
10 changes: 10 additions & 0 deletions modules/registrar/regpv.c
Expand Up @@ -269,6 +269,10 @@ int pv_get_ulc(struct sip_msg *msg, pv_param_t *param,
if(c->instance.len>0)
return pv_get_strval(msg, param, res, &c->instance);
break;
case 21: /* conid */
if (c->sock && (c->sock->proto == PROTO_TCP || c->sock->proto == PROTO_TLS || c->sock->proto == PROTO_WS || c->sock->proto == PROTO_WSS))
return pv_get_sintval(msg, param, res, c->tcpconn_id);
break;
}

return pv_get_null(msg, param, res);
Expand Down Expand Up @@ -363,6 +367,8 @@ int pv_parse_ulc_name(pv_spec_p sp, str *in)
rp->attr = 17;
else if(strncmp(pa.s, "regid", 5)==0)
rp->attr = 19;
else if(strncmp(pa.s, "conid", 5)==0)
rp->attr = 21;
else goto error;
break;
case 6:
Expand Down Expand Up @@ -538,6 +544,10 @@ int pv_fetch_contacts(struct sip_msg* msg, char* table, char* uri,
c0->instance.len = ptr->instance.len;
p += c0->instance.len;
}
if (ptr->sock->proto == PROTO_TCP || ptr->sock->proto == PROTO_TLS || ptr->sock->proto == PROTO_WS || ptr->sock->proto == PROTO_WSS)
{
c0->tcpconn_id = ptr->tcpconn_id;
}

if(ptr0==NULL)
{
Expand Down

0 comments on commit dbdf843

Please sign in to comment.