Browse code

pv: new variable $Rn - return receiving socket name

Daniel-Constantin Mierla authored on 23/11/2020 06:44:09
Showing 3 changed files
... ...
@@ -410,6 +410,9 @@ static pv_export_t mod_pvs[] = {
410 410
 	{{"Rut", (sizeof("Rut")-1)}, /* */
411 411
 		PVT_OTHER, pv_get_rcvaddr_uri_full, 0,
412 412
 		0, 0, 0, 0},
413
+	{{"Rn", (sizeof("Rn")-1)}, /* */
414
+		PVT_OTHER, pv_get_rcvsname, 0,
415
+		0, 0, 0, 0},
413 416
 	{{"RAi", (sizeof("RAi")-1)}, /* */
414 417
 		PVT_OTHER, pv_get_rcv_advertised_ip, 0,
415 418
 		0, 0, 0, 0},
... ...
@@ -858,6 +858,19 @@ int pv_get_rcvport(struct sip_msg *msg, pv_param_t *param,
858 858
 			&msg->rcv.bind_address->port_no_str);
859 859
 }
860 860
 
861
+int pv_get_rcvsname(struct sip_msg *msg, pv_param_t *param,
862
+		pv_value_t *res)
863
+{
864
+	if(msg==NULL)
865
+		return -1;
866
+
867
+	if(msg->rcv.bind_address==NULL
868
+			|| msg->rcv.bind_address->sockname.s==NULL)
869
+		return pv_get_null(msg, param, res);
870
+
871
+	return pv_get_strval(msg, param, res, &msg->rcv.bind_address->sockname);
872
+}
873
+
861 874
 int pv_get_rcvaddr_uri_helper(struct sip_msg *msg, pv_param_t *param,
862 875
 		int tmode, pv_value_t *res)
863 876
 {
... ...
@@ -163,6 +163,9 @@ int pv_get_rcvaddr_uri(struct sip_msg *msg, pv_param_t *param,
163 163
 int pv_get_rcvaddr_uri_full(struct sip_msg *msg, pv_param_t *param,
164 164
 		pv_value_t *res);
165 165
 
166
+int pv_get_rcvsname(struct sip_msg *msg, pv_param_t *param,
167
+		pv_value_t *res);
168
+
166 169
 int pv_get_rcv_advertised_ip(struct sip_msg *msg, pv_param_t *param,
167 170
 		pv_value_t *res);
168 171