[sr-dev] git:master:abba6969: ruxc: set response variable

Daniel-Constantin Mierla miconda at gmail.com
Mon Jul 19 10:19:43 CEST 2021


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-07-19T10:19:14+02:00

ruxc: set response variable

---

Modified: src/modules/ruxc/ruxc_mod.c

---

Diff:  https://github.com/kamailio/kamailio/commit/abba69691efad80d208aeb000bf0382f94dfec71.diff
Patch: https://github.com/kamailio/kamailio/commit/abba69691efad80d208aeb000bf0382f94dfec71.patch

---

diff --git a/src/modules/ruxc/ruxc_mod.c b/src/modules/ruxc/ruxc_mod.c
index 2f5e6ae86a..2d100d373c 100644
--- a/src/modules/ruxc/ruxc_mod.c
+++ b/src/modules/ruxc/ruxc_mod.c
@@ -122,6 +122,7 @@ static int ki_ruxc_http_get_helper(sip_msg_t *_msg, str *url, str *hdrs,
 {
 	RuxcHTTPRequest v_http_request = {0};
 	RuxcHTTPResponse v_http_response = {0};
+	pv_value_t val = {0};
 	int ret;
 
     v_http_request.timeout = _ruxc_http_timeout;
@@ -147,6 +148,14 @@ static int ki_ruxc_http_get_helper(sip_msg_t *_msg, str *url, str *hdrs,
 			LM_DBG("response code: %d - data len: %d - data: [%.*s]\n",
 					v_http_response.rescode, v_http_response.resdata_len,
 					v_http_response.resdata_len, v_http_response.resdata);
+			val.rs.s = v_http_response.resdata;
+			val.rs.len = v_http_response.resdata_len;
+			val.flags = PV_VAL_STR;
+			if(dst->setf) {
+				dst->setf(_msg, &dst->pvp, (int)EQ_T, &val);
+			} else {
+				LM_WARN("target pv is not writable\n");
+			}
 		}
 		ret = v_http_response.rescode;
 	}
@@ -209,6 +218,7 @@ static int ki_ruxc_http_post_helper(sip_msg_t *_msg, str *url, str *body, str *h
 {
 	RuxcHTTPRequest v_http_request = {0};
 	RuxcHTTPResponse v_http_response = {0};
+	pv_value_t val = {0};
 	int ret;
 
     v_http_request.timeout = _ruxc_http_timeout;
@@ -239,6 +249,14 @@ static int ki_ruxc_http_post_helper(sip_msg_t *_msg, str *url, str *body, str *h
 			LM_DBG("response code: %d - data len: %d - data: [%.*s]\n",
 					v_http_response.rescode, v_http_response.resdata_len,
 					v_http_response.resdata_len, v_http_response.resdata);
+			val.rs.s = v_http_response.resdata;
+			val.rs.len = v_http_response.resdata_len;
+			val.flags = PV_VAL_STR;
+			if(dst->setf) {
+				dst->setf(_msg, &dst->pvp, (int)EQ_T, &val);
+			} else {
+				LM_WARN("target pv is not writable\n");
+			}
 		}
 		ret = v_http_response.rescode;
 	}




More information about the sr-dev mailing list