[sr-dev] git:master:adb4d30a: pv: new variable $rsi - return status code for replies and 0 for requests

Daniel-Constantin Mierla miconda at gmail.com
Tue Nov 16 09:12:49 CET 2021


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-11-16T09:10:38+01:00

pv: new variable $rsi - return status code for replies and 0 for requests

---

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

---

diff --git a/src/modules/pv/pv.c b/src/modules/pv/pv.c
index 65108bdc8c..9de6bc49af 100644
--- a/src/modules/pv/pv.c
+++ b/src/modules/pv/pv.c
@@ -379,6 +379,9 @@ static pv_export_t mod_pvs[] = {
 	{{"rs", (sizeof("rs")-1)}, /* */
 		PVT_OTHER, pv_get_status, 0,
 		0, 0, 0, 0},
+	{{"rsi", (sizeof("rsi")-1)}, /* */
+		PVT_OTHER, pv_get_statusi, 0,
+		0, 0, 0, 0},
 	{{"rt", (sizeof("rt")-1)}, /* */
 		PVT_OTHER, pv_get_refer_to, 0,
 		0, 0, 0, 0},
diff --git a/src/modules/pv/pv_core.c b/src/modules/pv/pv_core.c
index 352114d259..ac15bfac2b 100644
--- a/src/modules/pv/pv_core.c
+++ b/src/modules/pv/pv_core.c
@@ -248,6 +248,20 @@ int pv_get_status(struct sip_msg *msg, pv_param_t *param,
 			&msg->first_line.u.reply.status);
 }
 
+int pv_get_statusi(struct sip_msg *msg, pv_param_t *param,
+		pv_value_t *res)
+{
+	if(msg==NULL)
+		return -1;
+
+	if(msg->first_line.type != SIP_REPLY)
+		return pv_get_sintval(msg, param, res, 0);
+
+	return pv_get_intstrval(msg, param, res,
+			(int)msg->first_line.u.reply.statuscode,
+			&msg->first_line.u.reply.status);
+}
+
 int pv_get_reason(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 6406d9054a..5e0f6860b5 100644
--- a/src/modules/pv/pv_core.h
+++ b/src/modules/pv/pv_core.h
@@ -55,6 +55,9 @@ int pv_get_msgtypes(struct sip_msg *msg, pv_param_t *param,
 int pv_get_status(struct sip_msg *msg, pv_param_t *param,
 		pv_value_t *res);
 
+int pv_get_statusi(struct sip_msg *msg, pv_param_t *param,
+		pv_value_t *res);
+
 int pv_get_reason(struct sip_msg *msg, pv_param_t *param,
 		pv_value_t *res);
 




More information about the sr-dev mailing list