Module: kamailio
Branch: master
Commit: 20a961624bbe164d9120b7c9ac60df8ff1daaae4
URL:
https://github.com/kamailio/kamailio/commit/20a961624bbe164d9120b7c9ac60df8…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: GitHub <noreply(a)github.com>
Date: 2017-06-20T18:54:12+02:00
Merge pull request #1158 from kamailio/pv-received-adv-address
pv: add received ip/port pvars for advertised ip/port
---
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/20a961624bbe164d9120b7c9ac60df8…
Patch:
https://github.com/kamailio/kamailio/commit/20a961624bbe164d9120b7c9ac60df8…
---
diff --git a/src/modules/pv/pv.c b/src/modules/pv/pv.c
index d619517c07..e9dc36c4d5 100644
--- a/src/modules/pv/pv.c
+++ b/src/modules/pv/pv.c
@@ -375,6 +375,12 @@ static pv_export_t mod_pvs[] = {
{{"Rp", (sizeof("Rp")-1)}, /* */
PVT_OTHER, pv_get_rcvport, 0,
0, 0, 0, 0},
+ {{"RAi", (sizeof("RAi")-1)}, /* */
+ PVT_OTHER, pv_get_rcv_advertised_ip, 0,
+ 0, 0, 0, 0},
+ {{"RAp", (sizeof("RAp")-1)}, /* */
+ PVT_OTHER, pv_get_rcv_advertised_port, 0,
+ 0, 0, 0, 0},
{{"sf", (sizeof("sf")-1)}, /* */
PVT_OTHER, pv_get_sflags, pv_set_sflags,
0, 0, 0, 0},
@@ -950,4 +956,4 @@ int mod_register(char *path, int *dlflags, void *p1, void *p2)
return -1;
}
return register_trans_mod(path, mod_trans);
-}
\ No newline at end of file
+}
diff --git a/src/modules/pv/pv_core.c b/src/modules/pv/pv_core.c
index cf0b60670f..c39f105852 100644
--- a/src/modules/pv/pv_core.c
+++ b/src/modules/pv/pv_core.c
@@ -739,6 +739,34 @@ int pv_get_rcvport(struct sip_msg *msg, pv_param_t *param,
&msg->rcv.bind_address->port_no_str);
}
+int pv_get_rcv_advertised_ip(struct sip_msg *msg, pv_param_t *param,
+ pv_value_t *res)
+{
+ if(msg==NULL)
+ return -1;
+
+ if(msg->rcv.bind_address!=NULL
+ && msg->rcv.bind_address->useinfo.address_str.len > 0) {
+ return pv_get_strval(msg, param, res,
&msg->rcv.bind_address->useinfo.address_str);
+ }
+
+ return pv_get_rcvip(msg, param, res);
+}
+
+int pv_get_rcv_advertised_port(struct sip_msg *msg, pv_param_t *param,
+ pv_value_t *res)
+{
+ if(msg==NULL)
+ return -1;
+
+ if(msg->rcv.bind_address!=NULL
+ && msg->rcv.bind_address->useinfo.port_no_str.len > 0) {
+ return pv_get_strval(msg, param, res,
&msg->rcv.bind_address->useinfo.port_no_str);
+ }
+
+ return pv_get_rcvport(msg, param, res);
+}
+
/**
*
*/
diff --git a/src/modules/pv/pv_core.h b/src/modules/pv/pv_core.h
index 98e6b56554..3a112a1e31 100644
--- a/src/modules/pv/pv_core.h
+++ b/src/modules/pv/pv_core.h
@@ -142,6 +142,12 @@ int pv_get_rcvip(struct sip_msg *msg, pv_param_t *param,
int pv_get_rcvport(struct sip_msg *msg, pv_param_t *param,
pv_value_t *res);
+int pv_get_rcv_advertised_ip(struct sip_msg *msg, pv_param_t *param,
+ pv_value_t *res);
+
+int pv_get_rcv_advertised_port(struct sip_msg *msg, pv_param_t *param,
+ pv_value_t *res);
+
int pv_get_force_sock(struct sip_msg *msg, pv_param_t *param,
pv_value_t *res);