[sr-dev] git:master:c5e2c397: pv: $fsp - return send socket port, or 0 if $fs not set

Daniel-Constantin Mierla miconda at gmail.com
Tue Jan 5 16:58:36 CET 2021


Module: kamailio
Branch: master
Commit: c5e2c397d962aa4099df4b0b59f69fa89a045754
URL: https://github.com/kamailio/kamailio/commit/c5e2c397d962aa4099df4b0b59f69fa89a045754

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-01-05T16:52:32+01:00

pv: $fsp - return send socket port, or 0 if $fs not set

---

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/c5e2c397d962aa4099df4b0b59f69fa89a045754.diff
Patch: https://github.com/kamailio/kamailio/commit/c5e2c397d962aa4099df4b0b59f69fa89a045754.patch

---

diff --git a/src/modules/pv/pv.c b/src/modules/pv/pv.c
index 20f0979d86..f797f3ab7d 100644
--- a/src/modules/pv/pv.c
+++ b/src/modules/pv/pv.c
@@ -253,6 +253,9 @@ static pv_export_t mod_pvs[] = {
 	{{"fsn", (sizeof("fsn")-1)}, /* */
 		PVT_OTHER, pv_get_force_sock_name, pv_set_force_sock_name,
 		0, 0, 0, 0},
+	{{"fsp", (sizeof("fsp")-1)}, /* */
+		PVT_OTHER, pv_get_force_sock_port, 0,
+		0, 0, 0, 0},
 	{{"ft", (sizeof("ft")-1)}, /* */
 		PVT_OTHER, pv_get_from_attr, 0,
 		0, 0, pv_init_iname, 4},
diff --git a/src/modules/pv/pv_core.c b/src/modules/pv/pv_core.c
index 746e12e3ed..5137048e10 100644
--- a/src/modules/pv/pv_core.c
+++ b/src/modules/pv/pv_core.c
@@ -1075,6 +1075,19 @@ int pv_get_force_sock_name(struct sip_msg *msg, pv_param_t *param,
 	return pv_get_strval(msg, param, res, &msg->force_send_socket->sockname);
 }
 
+int pv_get_force_sock_port(struct sip_msg *msg, pv_param_t *param,
+		pv_value_t *res)
+{
+	if(msg==NULL)
+		return -1;
+
+	if (msg->force_send_socket==0)
+		return pv_get_uintval(msg, param, res, 0);
+
+	return pv_get_intstrval(msg, param, res, (int)msg->force_send_socket->port_no,
+			&msg->force_send_socket->port_no_str);
+}
+
 int pv_get_useragent(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 865a48a2c0..2979e4cf9c 100644
--- a/src/modules/pv/pv_core.h
+++ b/src/modules/pv/pv_core.h
@@ -184,6 +184,9 @@ int pv_get_force_sock(struct sip_msg *msg, pv_param_t *param,
 int pv_get_force_sock_name(struct sip_msg *msg, pv_param_t *param,
 		pv_value_t *res);
 
+int pv_get_force_sock_port(struct sip_msg *msg, pv_param_t *param,
+		pv_value_t *res);
+
 int pv_get_useragent(struct sip_msg *msg, pv_param_t *param,
 		pv_value_t *res);
 




More information about the sr-dev mailing list