Browse code

ruxc: set response variable

Daniel-Constantin Mierla authored on 19/07/2021 08:19:14
Showing 1 changed files
... ...
@@ -122,6 +122,7 @@ static int ki_ruxc_http_get_helper(sip_msg_t *_msg, str *url, str *hdrs,
122 122
 {
123 123
 	RuxcHTTPRequest v_http_request = {0};
124 124
 	RuxcHTTPResponse v_http_response = {0};
125
+	pv_value_t val = {0};
125 126
 	int ret;
126 127
 
127 128
     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,
147 148
 			LM_DBG("response code: %d - data len: %d - data: [%.*s]\n",
148 149
 					v_http_response.rescode, v_http_response.resdata_len,
149 150
 					v_http_response.resdata_len, v_http_response.resdata);
151
+			val.rs.s = v_http_response.resdata;
152
+			val.rs.len = v_http_response.resdata_len;
153
+			val.flags = PV_VAL_STR;
154
+			if(dst->setf) {
155
+				dst->setf(_msg, &dst->pvp, (int)EQ_T, &val);
156
+			} else {
157
+				LM_WARN("target pv is not writable\n");
158
+			}
150 159
 		}
151 160
 		ret = v_http_response.rescode;
152 161
 	}
... ...
@@ -209,6 +218,7 @@ static int ki_ruxc_http_post_helper(sip_msg_t *_msg, str *url, str *body, str *h
209 218
 {
210 219
 	RuxcHTTPRequest v_http_request = {0};
211 220
 	RuxcHTTPResponse v_http_response = {0};
221
+	pv_value_t val = {0};
212 222
 	int ret;
213 223
 
214 224
     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
239 249
 			LM_DBG("response code: %d - data len: %d - data: [%.*s]\n",
240 250
 					v_http_response.rescode, v_http_response.resdata_len,
241 251
 					v_http_response.resdata_len, v_http_response.resdata);
252
+			val.rs.s = v_http_response.resdata;
253
+			val.rs.len = v_http_response.resdata_len;
254
+			val.flags = PV_VAL_STR;
255
+			if(dst->setf) {
256
+				dst->setf(_msg, &dst->pvp, (int)EQ_T, &val);
257
+			} else {
258
+				LM_WARN("target pv is not writable\n");
259
+			}
242 260
 		}
243 261
 		ret = v_http_response.rescode;
244 262
 	}