[sr-dev] git:master:b6b91a6d: rtjson: reuse r-uri if not given in the rtjson field
Daniel-Constantin Mierla
miconda at gmail.com
Wed Mar 6 08:17:19 CET 2019
Module: kamailio
Branch: master
Commit: b6b91a6d517675e9891e83b57dcdf90d7db0673d
URL: https://github.com/kamailio/kamailio/commit/b6b91a6d517675e9891e83b57dcdf90d7db0673d
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2019-03-06T08:16:59+01:00
rtjson: reuse r-uri if not given in the rtjson field
---
Modified: src/modules/rtjson/rtjson_routing.c
---
Diff: https://github.com/kamailio/kamailio/commit/b6b91a6d517675e9891e83b57dcdf90d7db0673d.diff
Patch: https://github.com/kamailio/kamailio/commit/b6b91a6d517675e9891e83b57dcdf90d7db0673d.patch
---
diff --git a/src/modules/rtjson/rtjson_routing.c b/src/modules/rtjson/rtjson_routing.c
index 705a5649d3..91ebffac0b 100644
--- a/src/modules/rtjson/rtjson_routing.c
+++ b/src/modules/rtjson/rtjson_routing.c
@@ -520,12 +520,16 @@ int rtjson_append_branch(sip_msg_t *msg, srjson_doc_t *jdoc, srjson_t *nj)
rj = srjson_GetObjectItem(jdoc, nj, "uri");
if(rj==NULL || rj->type!=srjson_String || rj->valuestring==NULL) {
- return -1;
+ if (msg->new_uri.s!=NULL) {
+ uri = msg->new_uri;
+ } else {
+ uri = msg->first_line.u.request.uri;
+ }
+ } else {
+ uri.s = rj->valuestring;
+ uri.len = strlen(uri.s);
}
- uri.s = rj->valuestring;
- uri.len = strlen(uri.s);
-
rj = srjson_GetObjectItem(jdoc, nj, "dst_uri");
if(rj!=NULL && rj->type==srjson_String && rj->valuestring!=NULL) {
duri.s = rj->valuestring;
More information about the sr-dev
mailing list