[sr-dev] [kamailio/kamailio] rtjson from replace (#868)

dnadares notifications at github.com
Tue Nov 29 18:43:27 CET 2016


The **rtjson** module is updating the "from" sip header twice with the "from" and "to" json fields.  By the way "to" sip header keeps unchanged. 

This is the json example:

`....
response.routes[0].headers = {
                                "from": {
                                        "display": "Anonymous",
                                        "uri": "sip:anonymous at anonymous.invalid"
                                },
                                "to": {
                                        "display": "44444444",
                                        "uri": "sip:44444444 at 172.16.213.38"
                                },
        };
....
`
The result would be: 
From: Anonymous4444444444<sip:anonymous at anonymous.invalidsip:4444444444 at 172.16.213.38>;tag=1.
To: sut <sip:0115555555 at 172.16.213.38:5060>.

I modified one line and now works correctly

`diff --git a/modules/rtjson/rtjson_routing.c b/modules/rtjson/rtjson_routing.c
index 5542e63..60bdcad 100644
--- a/modules/rtjson/rtjson_routing.c
+++ b/modules/rtjson/rtjson_routing.c
@@ -481,7 +481,7 @@ int rtjson_prepare_branch(sip_msg_t *msg, srjson_doc_t *jdoc, srjson_t *nj)
                                xuri.len = strlen(xuri.s);
                        }
                        if(xdsp.len>0 || xuri.len>0) {
                      **-         uacb.replace_from(msg, &xdsp, &xuri);
                      +        uacb.replace_to(msg, &xdsp, &xuri);**
                        }
                }
        }`

From: Anonymous <sip:anonymous at anonymous.invalid>;tag=1.
To: 4444444444 <sip:4444444444 at 172.16.213.38>.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/868
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20161129/3c803cf2/attachment.html>


More information about the sr-dev mailing list