I am using JSIP (JAIN-SIP) version 1.2 (implementation build 2384). I am trying to send the following SIP message (I removed actual IP addresses in the post):
INVITE sip:bob@miniims.net SIP/2.0
Via: SIP/2.0/UDP xxx.yyy.zzz.www:5065;branch=z9hG4bKbranch1
Route: <sip:xxx.yyy.zzz.www>,<sip:xxx.yyy.zzz.www:5062>
Max-Forwards: 70
From: "Alice" <sip:alice@miniims.net>;tag=rawclientv1.0
To: "Bob" <sip:bob@miniims.net>
Call-ID: f2927406a96b0b3d3ef8213aa338d1c4@xxx.yyy.zzz.www
CSeq: 1 INVITE
Contact: "alice" <sip:alice@xxx.yyy.zzz.www:5065>
P-Preferred-Identity: <sip:alice@miniims.net>
Content-Length: 141
v=0
o=alice 2890844526 2890844526 IN IP4 xxx.yyy.zzz.www
s=
c=IN IP4 xxx.yyy.zzz.www
t=0 0
m=audio 12346 RTP/AVP 0 8 96
a=rtpmap:96 L16/8000
When I print it after parsing, it is correct. However, when I send it, the request URI is put to the end of the list of Route headers, and the first Route header is moved into SIP URI. No RFC or 3GPP standard prescribes such behavior. WireShark already captures the wrong message:
INVITE sip:xxx.yyy.zzz.www SIP/2.0
Via: SIP/2.0/UDP xxx.yyy.zzz.www:5065;branch=z9hG4bKbranch1
Route: <sip:xxx.yyy.zzz.www:5062>,<sip:bob@miniims.net>
Max-Forwards: 70
From: "Alice" <sip:alice@miniims.net>;tag=rawclientv1.0
To: "Bob" <sip:bob@miniims.net>
Call-ID: f2927406a96b0b3d3ef8213aa338d1c4@xxx.yyy.zzz.www
CSeq: 1 INVITE
Contact: "alice" <sip:alice@xxx.yyy.zzz.www:5065>
P-Preferred-Identity: <sip:alice@miniims.net>
Content-Length: 141
v=0
o=alice 2890844526 2890844526 IN IP4 xxx.yyy.zzz.www
s=
c=IN IP4 xxx.yyy.zzz.www
t=0 0
m=audio 12346 RTP/AVP 0 8 96
a=rtpmap:96 L16/8000
Is it normal behavior in JSIP? Or a bug? Is there a way to prevent it, i.e. a workaround? Thanks in advance!
Use lr; parameter in the Route Header.