Module: kamailio
Branch: master
Commit: 490fa49f72022b334340a58a92d63b5b6f661c87
URL:
https://github.com/kamailio/kamailio/commit/490fa49f72022b334340a58a92d63b5…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2015-11-23T09:54:36+01:00
pv: $snd(sproto) returns sending protocol as string
---
Modified: modules/pv/pv_branch.c
---
Diff:
https://github.com/kamailio/kamailio/commit/490fa49f72022b334340a58a92d63b5…
Patch:
https://github.com/kamailio/kamailio/commit/490fa49f72022b334340a58a92d63b5…
---
diff --git a/modules/pv/pv_branch.c b/modules/pv/pv_branch.c
index 34626b3..738c06c 100644
--- a/modules/pv/pv_branch.c
+++ b/modules/pv/pv_branch.c
@@ -425,6 +425,11 @@ int pv_get_sndfrom(struct sip_msg *msg, pv_param_t *param,
case 5: /* len */
return pv_get_uintval(msg, param, res,
(int)snd_inf->len);
+ case 6: /* sproto */
+ if(get_valid_proto_string((int)snd_inf->send_sock->proto,
+ 0, 0, &s)<0)
+ return pv_get_null(msg, param, res);
+ return pv_get_strval(msg, param, res, &s);
default:
/* 0 - ip */
return pv_get_strval(msg, param, res,
@@ -463,6 +468,11 @@ int pv_get_sndto(struct sip_msg *msg, pv_param_t *param,
case 5: /* len */
return pv_get_uintval(msg, param, res,
(int)snd_inf->len);
+ case 6: /* sproto */
+ if(get_valid_proto_string((int)snd_inf->send_sock->proto,
+ 0, 0, &s)<0)
+ return pv_get_null(msg, param, res);
+ return pv_get_strval(msg, param, res, &s);
default:
/* 0 - ip */
su2ip_addr(&ip, snd_inf->to);
@@ -505,6 +515,11 @@ int pv_parse_snd_name(pv_spec_p sp, str *in)
sp->pvp.pvn.u.isname.name.n = 3;
else goto error;
break;
+ case 6:
+ if(strncmp(in->s, "sproto", 6)==0)
+ sp->pvp.pvn.u.isname.name.n = 6;
+ else goto error;
+ break;
default:
goto error;
}