Hello,

the replacement of From and To is done via the uac module -- inside it is the code for doing these operations. rtjson doesn't have much to do with subsequent operations.

But iirc, the module does the update only for URIs, being the required values not to be changed from RFC point of view.

You can try with uac configured to use dialog for storing From/To values instead of relying on record route parameters -- I haven't tried myself.

Cheers,
Daniel

On 06/12/2016 19:24, Diego Nadares wrote:
Hi Guys,

We are modifying "from" and "to" headers with rtjson module via a json struct. It works fine in INVITE, TRYING, RINGING and OK but not in the following messages. Kamailio It's changing ONLY "from" and "to" URI BUT NOT the DISPLAY NAME. I think it's the tm module but I can't figure out how to confirm this. Maybe I need to configure something else in my cfg or could it be a bug?

My json struct that is handled by rtjson module

      response.routing = "serial";
        //response.routing = "parallel";
        response.routes = [];
        response.routes[0] = {};
        response.routes[0].uri = "sip:1111111111@172.16.213.31:5060";
        response.routes[0].headers = { // Headers to be modified
                "from": {
                        "display": "1111111111",
                        "uri": "sip:111111111@172.16.213.38"
                },
                "to": { 
                        "display": "2222222222",
                        "uri": "sip:2222222222@172.16.213.38"
                },
        };
        response.routes[0].headers.extra = {};//"X-Hdr-A: abc\r\nX-Hdr-B: bcd\r\n";

This is part of my cfg

....
modparam("dialog","dlg_flag", FLD_START)
modparam("uac","restore_mode","auto")
modparam("uac", "restore_dlg", 1)
....

        # account only INVITEs
        if (is_method("INVITE") && !has_totag()) {
                setflag(FLT_ACC); # do accounting
                setflag(FLD_START); # do accounting
                setflag(FLT_ACCMISSED);
                setflag(FLT_ACCFAILED);
        }
.....


From source/Aleg:
From: sipp <sip:sipp@172.16.213.21:5060>;tag=1.
To: sut <sip:5555555555@172.16.213.38:5060>.

To dest/Bleg:
From: 1111111111 <sip:111111111@172.16.213.38>;tag=1.
To: 2222222222 <sip:2222222222@172.16.213.38>.

Incorrect display name in BYE and ACK:
From: sipp <sip:111111111@172.16.213.38>;tag=1.
To: sut <sip:2222222222@172.16.213.38>;tag=2.


interface: any
filter: ( port 5060 ) and (ip or ip6)
#
U 2016/12/06 15:52:13.638731 172.16.213.21:5060 -> 172.16.213.38:5060
INVITE sip:5555555555@172.16.213.38:5060 SIP/2.0.
Via: SIP/2.0/UDP 172.16.213.21:5060;branch=z9hG4bK-12775-1-0.
From: sipp <sip:sipp@172.16.213.21:5060>;tag=1.
To: sut <sip:5555555555@172.16.213.38:5060>.
Call-ID: 1-12775@172.16.213.21.
CSeq: 1 INVITE.
Contact: "SIPP" <sip:sipp@172.16.213.21:5060>.
Max-Forwards: 70.
Subject: Performance Test.
Content-Type: multipart/mixed;boundary=uniqueBoundary.
Remote-Party-ID: <sip:sipp@172.16.213.21>:5060;party=calling;id-type=subscriber;privacy=off;screen=no>.
Content-Length:   549.
.
--uniqueBoundary.
Content-Type: application/sdp.
.
v=0.
o=user1 53655765 2353687637 IN IP4 172.16.213.21.
s=-.
c=IN IP4 172.16.213.21.
t=0 0.
m=audio 6000 RTP/AVP 8.
a=rtpmap:8 PCMA/8000.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-11,16.
.
--uniqueBoundary.
Content-Type: application/gtd.
Content-Disposition: signal;handling=optional.
.
IAM,.
CGN,04,y,1,y,4,1143617400.
CIC,0000000573.
CPC,09.
CPN,02,y,1,52381660.
FCI,n,n,n,n,y,n,n,u.
GCI,f7140cc78a611601838a002128d7e512.
NOC,0,n,1,n.
PRN,q761*,AR*,oper2,1993.
TMR,02.
.
--uniqueBoundary--.
................
#
U 2016/12/06 15:52:13.734159 172.16.213.38:5060 -> 172.16.213.21:5060
SIP/2.0 100 trying -- your call is important to us.
Via: SIP/2.0/UDP 172.16.213.21:5060;branch=z9hG4bK-12775-1-0.
From: sipp <sip:sipp@172.16.213.21:5060>;tag=1.
To: sut <sip:5555555555@172.16.213.38:5060>.
Call-ID: 1-12775@172.16.213.21.
CSeq: 1 INVITE.
Server: kamailio (4.4.4 (x86_64/linux)).
Content-Length: 0.
.
................
#
U 2016/12/06 15:52:13.878600 172.16.213.38:5060 -> 172.16.213.31:5060
INVITE sip:1111111111@172.16.213.31:5060 SIP/2.0.
Via: SIP/2.0/UDP 172.16.213.38;branch=z9hG4bKabaa.840cc83114975a34a37b7af020d37b65.1.
From: 1111111111 <sip:111111111@172.16.213.38>;tag=1.
To: 2222222222 <sip:2222222222@172.16.213.38>.
Call-ID: 1-12775@172.16.213.21.
CSeq: 1 INVITE.
Max-Forwards: 69.
Subject: Performance Test.
Content-Type: multipart/mixed;boundary=uniqueBoundary.
Content-Length:   788.
Contact: <sip:btpsh-58470879-6c61-1@172.16.213.38>.
.
--uniqueBoundary.
Content-Type: application/sdp.
.
v=0.
o=user1 53655765 2353687637 IN IP4 172.16.213.38.
s=-.
c=IN IP4 172.16.213.38.
t=0 0.
m=audio 40236 RTP/AVP 8.
a=rtpmap:8 PCMA/8000.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-11,16.
a=sendrecv.
a=rtcp:40237.
a=ice-ufrag:QNCzXhUr.
a=ice-pwd:Ci90BRpdZH51Hx5BaPgGMrGCeh.
a=candidate:P1djl8LFNb5kexbG 1 UDP 2130706431 172.16.213.38 40236 typ host.
a=candidate:P1djl8LFNb5kexbG 2 UDP 2130706430 172.16.213.38 40237 typ host.
.
--uniqueBoundary.
Content-Type: application/gtd.
Content-Disposition: signal;handling=optional.
.
IAM,.
CGN,04,y,1,y,4,1143617400.
CIC,0000000573.
CPC,09.
CPN,02,y,1,52381660.
FCI,n,n,n,n,y,n,n,u.
GCI,f7140cc78a611601838a002128d7e512.
NOC,0,n,1,n.
PRN,q761*,AR*,oper2,1993.
TMR,02.
.
--uniqueBoundary--.
................
#
U 2016/12/06 15:52:13.879441 172.16.213.31:5060 -> 172.16.213.38:5060
SIP/2.0 180 Ringing.
Via: SIP/2.0/UDP 172.16.213.38;branch=z9hG4bKabaa.840cc83114975a34a37b7af020d37b65.1.
From: 1111111111 <sip:111111111@172.16.213.38>;tag=1.
To: 2222222222 <sip:2222222222@172.16.213.38>;tag=2.
Call-ID: 1-12775@172.16.213.21.
CSeq: 1 INVITE.
Contact: <sip:172.16.213.31:5060;transport=UDP>.
Content-Type: application/sdp.
Content-Length:   137.
.
v=0.
o=user1 53655765 2353687637 IN IP4 172.16.213.31.
s=-.
c=IN IP4 172.16.213.31.
t=0 0.
m=audio 6000 RTP/AVP 0.
a=rtpmap:0 PCMU/8000.
................
#
U 2016/12/06 15:52:13.936565 172.16.213.38:5060 -> 172.16.213.21:5060
SIP/2.0 180 Ringing.
From: sipp <sip:sipp@172.16.213.21:5060>;tag=1.
To: sut <sip:5555555555@172.16.213.38:5060>;tag=2.
Call-ID: 1-12775@172.16.213.21.
CSeq: 1 INVITE.
Content-Type: application/sdp.
Content-Length:   316.
Via: SIP/2.0/UDP 172.16.213.21:5060;branch=z9hG4bK-12775-1-0.
Contact: <sip:atpsh-58470879-6c61-2@172.16.213.38>.
.
v=0.
o=user1 53655765 2353687637 IN IP4 172.16.213.38.
s=-.
c=IN IP4 172.16.213.38.
t=0 0.
m=audio 40248 RTP/AVP 0.
a=rtpmap:0 PCMU/8000.
a=sendrecv.
a=rtcp:40249.
a=candidate:P1djl8LFNb5kexbG 1 UDP 2130706431 172.16.213.38 40248 typ host.
a=candidate:P1djl8LFNb5kexbG 2 UDP 2130706430 172.16.213.38 40249 typ host.
................
#
U 2016/12/06 15:52:20.882165 172.16.213.31:5060 -> 172.16.213.38:5060
SIP/2.0 200 OK.
Via: SIP/2.0/UDP 172.16.213.38;branch=z9hG4bKabaa.840cc83114975a34a37b7af020d37b65.1.
From: 1111111111 <sip:111111111@172.16.213.38>;tag=1.
To: 2222222222 <sip:2222222222@172.16.213.38>;tag=2.
Call-ID: 1-12775@172.16.213.21.
CSeq: 1 INVITE.
Contact: <sip:172.16.213.31:5060;transport=UDP>.
Content-Type: application/sdp.
Content-Length:   213.
.
v=0.
o=user1 53655765 2353687637 IN IP4 172.16.213.31.
s=-.
c=IN IP4 172.16.213.31.
t=0 0.
m=audio 6000 RTP/AVP 0.
a=rtpmap:0 PCMU/8000.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-15.
a=ptime:20.
a=sendrecv.
................
#
U 2016/12/06 15:52:21.173798 172.16.213.38:5060 -> 172.16.213.21:5060
SIP/2.0 200 OK.
From: sipp <sip:sipp@172.16.213.21:5060>;tag=1.
To: sut <sip:5555555555@172.16.213.38:5060>;tag=2.
Call-ID: 1-12775@172.16.213.21.
CSeq: 1 INVITE.
Content-Type: application/sdp.
Content-Length:   380.
Via: SIP/2.0/UDP 172.16.213.21:5060;branch=z9hG4bK-12775-1-0.
Contact: <sip:atpsh-58470879-6c61-2@172.16.213.38>.
.
v=0.
o=user1 53655765 2353687637 IN IP4 172.16.213.38.
s=-.
c=IN IP4 172.16.213.38.
t=0 0.
m=audio 40248 RTP/AVP 0.
a=rtpmap:0 PCMU/8000.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-15.
a=ptime:20.
a=sendrecv.
a=rtcp:40249.
a=candidate:P1djl8LFNb5kexbG 1 UDP 2130706431 172.16.213.38 40248 typ host.
a=candidate:P1djl8LFNb5kexbG 2 UDP 2130706430 172.16.213.38 40249 typ host.
................
#
U 2016/12/06 15:52:21.174390 172.16.213.21:5060 -> 172.16.213.38:5060
ACK sip:atpsh-58470879-6c61-2@172.16.213.38 SIP/2.0.
Via: SIP/2.0/UDP 172.16.213.21:5060;branch=z9hG4bK-12775-1-4.
From: sipp <sip:sipp@172.16.213.21:5060>;tag=1.
To: sut <sip:5555555555@172.16.213.38:5060>;tag=2.
Call-ID: 1-12775@172.16.213.21.
CSeq: 1 ACK.
Contact: sip:sipp@172.16.213.21:5060.
Max-Forwards: 70.
Subject: Performance Test.
Content-Length: 0.
.
................
#
U 2016/12/06 15:52:21.248172 172.16.213.38:5060 -> 172.16.213.31:5060
ACK sip:172.16.213.31:5060;transport=UDP SIP/2.0.
Via: SIP/2.0/UDP 172.16.213.38;branch=z9hG4bKabaa.98116b5795d4c30f52156187a72059c8.0.
From: sipp <sip:111111111@172.16.213.38>;tag=1.
To: sut <sip:2222222222@172.16.213.38>;tag=2.
Call-ID: 1-12775@172.16.213.21.
CSeq: 1 ACK.
Max-Forwards: 69.
Subject: Performance Test.
Content-Length: 0.
Contact: <sip:btpsh-58470879-6c61-1@172.16.213.38>.
.
................
#
U 2016/12/06 15:52:51.178826 172.16.213.21:5060 -> 172.16.213.38:5060
BYE sip:atpsh-58470879-6c61-2@172.16.213.38 SIP/2.0.
Via: SIP/2.0/UDP 172.16.213.21:5060;branch=z9hG4bK-12775-1-7.
From: sipp <sip:sipp@172.16.213.21:5060>;tag=1.
To: sut <sip:5555555555@172.16.213.38:5060>;tag=2.
Call-ID: 1-12775@172.16.213.21.
CSeq: 2 BYE.
Contact: sip:sipp@172.16.213.21:5060.
Max-Forwards: 70.
Subject: Performance Test.
Content-Length: 0.
.
................
#
U 2016/12/06 15:52:51.468639 172.16.213.38:5060 -> 172.16.213.31:5060
BYE sip:172.16.213.31:5060;transport=UDP SIP/2.0.
Via: SIP/2.0/UDP 172.16.213.38;branch=z9hG4bK7baa.3cb44935b506e759e3418501b0688b08.0.
From: sipp <sip:111111111@172.16.213.38>;tag=1.
To: sut <sip:2222222222@172.16.213.38>;tag=2.
Call-ID: 1-12775@172.16.213.21.
CSeq: 2 BYE.
Max-Forwards: 69.
Subject: Performance Test.
Content-Length: 0.
Contact: <sip:btpsh-58470879-6c61-1@172.16.213.38>.
.
................
#
U 2016/12/06 15:52:51.469153 172.16.213.31:5060 -> 172.16.213.38:5060
SIP/2.0 200 OK.
Via: SIP/2.0/UDP 172.16.213.38;branch=z9hG4bK7baa.3cb44935b506e759e3418501b0688b08.0.
From: sipp <sip:111111111@172.16.213.38>;tag=1.
To: sut <sip:2222222222@172.16.213.38>;tag=2.
Call-ID: 1-12775@172.16.213.21.
CSeq: 2 BYE.
Contact: <sip:172.16.213.31:5060;transport=UDP>.
Content-Length: 0.
.
................
#
U 2016/12/06 15:52:51.519423 172.16.213.38:5060 -> 172.16.213.21:5060
SIP/2.0 200 OK.
From: sipp <sip:sipp@172.16.213.21:5060>;tag=1.
To: sut <sip:5555555555@172.16.213.38:5060>;tag=2.
Call-ID: 1-12775@172.16.213.21.
CSeq: 2 BYE.
Content-Length: 0.
Via: SIP/2.0/UDP 172.16.213.21:5060;branch=z9hG4bK-12775-1-7.
Contact: <sip:atpsh-58470879-6c61-2@172.16.213.38>.
.
................
exit
13 received, 0 dropped

Sorry for my english. Thanks in advance!

Diego.






_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com