Module: kamailio
Branch: master
Commit: efe36cf0bab16addb2a42a696f58ee38477f9e7f
URL:
https://github.com/kamailio/kamailio/commit/efe36cf0bab16addb2a42a696f58ee3…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-11-23T07:44:09+01:00
pv: new variable $Rn - return receiving socket name
---
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/efe36cf0bab16addb2a42a696f58ee3…
Patch:
https://github.com/kamailio/kamailio/commit/efe36cf0bab16addb2a42a696f58ee3…
---
diff --git a/src/modules/pv/pv.c b/src/modules/pv/pv.c
index 9367103bfe..bd80bafed7 100644
--- a/src/modules/pv/pv.c
+++ b/src/modules/pv/pv.c
@@ -410,6 +410,9 @@ static pv_export_t mod_pvs[] = {
{{"Rut", (sizeof("Rut")-1)}, /* */
PVT_OTHER, pv_get_rcvaddr_uri_full, 0,
0, 0, 0, 0},
+ {{"Rn", (sizeof("Rn")-1)}, /* */
+ PVT_OTHER, pv_get_rcvsname, 0,
+ 0, 0, 0, 0},
{{"RAi", (sizeof("RAi")-1)}, /* */
PVT_OTHER, pv_get_rcv_advertised_ip, 0,
0, 0, 0, 0},
diff --git a/src/modules/pv/pv_core.c b/src/modules/pv/pv_core.c
index f7af431341..e569a393e8 100644
--- a/src/modules/pv/pv_core.c
+++ b/src/modules/pv/pv_core.c
@@ -858,6 +858,19 @@ int pv_get_rcvport(struct sip_msg *msg, pv_param_t *param,
&msg->rcv.bind_address->port_no_str);
}
+int pv_get_rcvsname(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->sockname.s==NULL)
+ return pv_get_null(msg, param, res);
+
+ return pv_get_strval(msg, param, res, &msg->rcv.bind_address->sockname);
+}
+
int pv_get_rcvaddr_uri_helper(struct sip_msg *msg, pv_param_t *param,
int tmode, pv_value_t *res)
{
diff --git a/src/modules/pv/pv_core.h b/src/modules/pv/pv_core.h
index cf87a7e0c9..29ec9f25a4 100644
--- a/src/modules/pv/pv_core.h
+++ b/src/modules/pv/pv_core.h
@@ -163,6 +163,9 @@ int pv_get_rcvaddr_uri(struct sip_msg *msg, pv_param_t *param,
int pv_get_rcvaddr_uri_full(struct sip_msg *msg, pv_param_t *param,
pv_value_t *res);
+int pv_get_rcvsname(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);