Module: kamailio
Branch: master
Commit: c8e2c77c28a6aed6996c05060fa3d24c3e0a933a
URL:
https://github.com/kamailio/kamailio/commit/c8e2c77c28a6aed6996c05060fa3d24…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-09-27T09:33:29+02:00
pv: new var $prid - get protocol id (int value)
---
Modified: src/modules/pv/pv.c
Modified: src/modules/pv/pv_core.c
Modified: src/modules/pv/pv_core.h
---
Diff:
https://github.com/kamailio/kamailio/commit/c8e2c77c28a6aed6996c05060fa3d24…
Patch:
https://github.com/kamailio/kamailio/commit/c8e2c77c28a6aed6996c05060fa3d24…
---
diff --git a/src/modules/pv/pv.c b/src/modules/pv/pv.c
index e7afac57b9..45531c52d9 100644
--- a/src/modules/pv/pv.c
+++ b/src/modules/pv/pv.c
@@ -304,6 +304,9 @@ static pv_export_t mod_pvs[] = {
{{"pr", (sizeof("pr")-1)}, /* */
PVT_OTHER, pv_get_proto, 0,
0, 0, 0, 0},
+ {{"prid", (sizeof("prid")-1)}, /* */
+ PVT_OTHER, pv_get_protoid, 0,
+ 0, 0, 0, 0},
{{"proto", (sizeof("proto")-1)}, /* */
PVT_OTHER, pv_get_proto, 0,
0, 0, 0, 0},
diff --git a/src/modules/pv/pv_core.c b/src/modules/pv/pv_core.c
index 34b03a411f..45d189d74f 100644
--- a/src/modules/pv/pv_core.c
+++ b/src/modules/pv/pv_core.c
@@ -1237,6 +1237,17 @@ int pv_get_proto(struct sip_msg *msg, pv_param_t *param,
return pv_get_strintval(msg, param, res, &s, (int)msg->rcv.proto);
}
+/* proto id of received message */
+int pv_get_protoid(struct sip_msg *msg, pv_param_t *param,
+ pv_value_t *res)
+{
+ str s;
+ if(msg==NULL)
+ return -1;
+
+ return pv_get_sintval(msg, param, res, (int)msg->rcv.proto);
+}
+
int pv_get_dset(struct sip_msg *msg, pv_param_t *param,
pv_value_t *res)
{
diff --git a/src/modules/pv/pv_core.h b/src/modules/pv/pv_core.h
index ac36ef315a..0fd79b7346 100644
--- a/src/modules/pv/pv_core.h
+++ b/src/modules/pv/pv_core.h
@@ -187,6 +187,9 @@ int pv_get_pai(struct sip_msg *msg, pv_param_t *param,
int pv_get_proto(struct sip_msg *msg, pv_param_t *param,
pv_value_t *res);
+int pv_get_protoid(struct sip_msg *msg, pv_param_t *param,
+ pv_value_t *res);
+
int pv_get_dset(struct sip_msg *msg, pv_param_t *param,
pv_value_t *res);