Module: kamailio
Branch: master
Commit: c32a5f64de4ff731488d9f6bf64651117d26d46e
URL:
https://github.com/kamailio/kamailio/commit/c32a5f64de4ff731488d9f6bf646511…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2016-12-09T10:16:31+01:00
sipcapture: added $hep(src_ip) variable
- reworked patch from GH #879
---
Modified: src/modules/sipcapture/sipcapture.c
---
Diff:
https://github.com/kamailio/kamailio/commit/c32a5f64de4ff731488d9f6bf646511…
Patch:
https://github.com/kamailio/kamailio/commit/c32a5f64de4ff731488d9f6bf646511…
---
diff --git a/src/modules/sipcapture/sipcapture.c b/src/modules/sipcapture/sipcapture.c
index 117db74..b5bbe7b 100644
--- a/src/modules/sipcapture/sipcapture.c
+++ b/src/modules/sipcapture/sipcapture.c
@@ -2835,6 +2835,11 @@ static int pv_parse_hep_name (pv_spec_p sp, str *in)
else goto error;
}
break;
+ case 6:
+ {
+ if(!strncmp(in->s, "src_ip", 6)) sp->pvp.pvn.u.isname.name.n = 2;
+ else goto error;
+ }
case 7:
{
if(!strncmp(in->s, "version", 7)) sp->pvp.pvn.u.isname.name.n =
0;
@@ -2857,17 +2862,24 @@ static int pv_parse_hep_name (pv_spec_p sp, str *in)
static int pv_get_hep(struct sip_msg *msg, pv_param_t *param, pv_value_t *res)
{
+ static char sc_buf_ip[IP_ADDR_MAX_STR_SIZE+12];
+ int sc_buf_ip_len;
+
if(param==NULL) return -1;
switch(param->pvn.u.isname.name.n)
{
case 0:
- return pv_get_uintval(msg, param, res, hep_version(msg));
- case 1:
- return pv_get_uintval(msg, param, res, hep_version(msg));
+ return pv_get_uintval(msg, param, res, hep_version(msg));
+ case 1:
+ return pv_get_uintval(msg, param, res, hep_version(msg));
+ case 2:
+ sc_buf_ip_len=ip_addr2sbuf(&msg->rcv.src_ip, sc_buf_ip,
+ sizeof(sc_buf_ip)-1);
+ sc_buf_ip[sc_buf_ip_len]=0;
+ return pv_get_strlval(msg, param, res, sc_buf_ip, sc_buf_ip_len);
default:
return hepv3_get_chunk(msg, msg->buf, msg->len,
param->pvn.u.isname.name.n, param, res);
}
return 0;
}
-