Klaus Darilion wrote:
Victor Gamov wrote:
Hi gentlemen!
Sorry for my perseverance but I'll try to ask my question one more time.
I have following SIP-network configuration
Term=192.168.100.77 <-> NAT=Y.Y.Y.Y <-> OpenSER=X.X.X.X <-> GW=Z.Z.Z.Z
Term uses X.X.X.X as registrar and outbound proxy. It registered on OpenSER as "vit-horosho@X.X.X.X". GW is gateway connected to POTS.
Then I make call from Term to POTS number 74951000000.
'ngrep SIP port 5060' output from OpenSER machine followed (I strip some unimportant info from requests. My comments before requests)
Initial request from Term comes to OpenSER:
U Y.Y.Y.Y:60767 -> X.X.X.X:5060 INVITE sip:74951000000@X.X.X.X:5060 SIP/2.0 Via: SIP/2.0/UDP 192.168.100.77:5060;branch=z9hG4bK_00179A52BC45_T63F7A22E Session-Expires: 1800 From: "Vit-Horosho" sip:vit-horosho@X.X.X.X; tag=00179A52BC45_T1011336699 To: sip:74951000000@X.X.X.X:5060 Call-ID: CALL_ID4_00179A52BC45_T397365265@192.168.100.77 CSeq: 397703138 INVITE Contact: sip:vit-horosho@192.168.100.77:5060
OK. OpenSER send prov. reply to Term:
U X.X.X.X:5060 -> Y.Y.Y.Y:60767 SIP/2.0 100 Giving a try Via: SIP/2.0/UDP 192.168.100.77:5060;branch=z9hG4bK_00179A52BC45_T63F7A22E; rport=60767;received=Y.Y.Y.Y From: "Vit-Horosho" sip:vit-horosho@X.X.X.X; tag=00179A52BC45_T1011336699 To: sip:74951000000@X.X.X.X:5060 Call-ID: CALL_ID4_00179A52BC45_T397365265@192.168.100.77 CSeq: 397703138 INVITE Content-Length: 0
Then I make my own transformations on Contact: header
Why are you replacing the Contact with the IP address of the proxy? There is no need to do that. If you want NAT traversal use fix_nated_contact().
fix_nated_contact() does not work correctly (I try it some times ago for 1.1.0). In this scenario it changes Term IP=192.168.100.77 with NAT IP=Y.Y.Y.Y and NAT port=60767. So when request sending to Term then Proxy rewrite RURI to termuser@192.168.100.77:60767 and send it to Y.Y.Y.Y:60767 NAT send UDP-packet to Term 192.168.100.77 port 5060 (it's known because NAT logic) and Term will reply "No such transaction" or "No such user" (sorry I don't remember it now) because Term really don't know anything about RURI termuser@192.168.100.77:60767
And I use my own transformation for some reasons else.
and OpenSER resend
request to GW. OpenSER adds Record-Route: header into request also.
U X.X.X.X:5060 -> Z.Z.Z.Z:5060 INVITE sip:74951000000@Z.Z.Z.Z;user=phone SIP/2.0 Record-Route: <sip:X.X.X.X;lr=on; ftag=00179A52BC45_T1011336699> Via: SIP/2.0/UDP X.X.X.X;branch=z9hG4bK7a3.0ae7d67.0 Via: SIP/2.0/UDP 192.168.100.77:5060;rport=60767;received= Y.Y.Y.Y;branch=z9hG4bK_00179A52BC45_T63F7A22E Session-Expires: 1800 From: "Vit-Horosho" <sip:vit-horosho@80.23 7.15.3>; tag=00179A52BC45_T1011336699 To: sip:74951000000@X.X.X.X:5060 Call-ID: CALL_ID4_00179A52BC45_T397365265@ 192.168.100.77 CSeq: 397703138 INVITE Contact: sip:vit-horosho@X.X.X.X;nat=yes
OK. GW send prov. reply to OpenSER
U Z.Z.Z.Z:5060 -> X.X.X.X:5060 SIP/2.0 100 Trying Via: SIP/2.0/UDP X.X.X.X;branch=z9hG4bK7a3.0ae7d67.0,SIP/2.0/UDP 192.168.100.77:5060;rport=60767 ;received=Y.Y.Y.Y;branch=z9hG4bK_00179A52BC45_T63F7A22E From: "Vit-Horosho" sip:vit-horosho@X.X.X.X; tag=00179A52BC45_T1011336699 To: sip:74951000000@X.X.X.X:5060;tag=54E1EED8-D8E Date: Thu, 19 Apr 2007 18:37:57 GMT Call-ID: CALL_ID4_00179A52BC45_T397365265@192.168.100.77 CSeq: 397703138 INVITE
OK. OpenSER resend prov. reply to Term
Why does openser resend the 100? I have never seen this before.
sorry for confusing -- it may be local generated 100.
U X.X.X.X:5060 -> Y.Y.Y.Y:60767 SIP/2.0 100 Giving a try Via: SIP/2.0/UDP 192.168.100.77:5060;branch=z9hG4bK_00179A52BC45_T63F7A22E; rport=60767;received=Y.Y.Y.Y From: "Vit-Horosho" sip:vit-horosho@X.X.X.X; tag=00179A52BC45_T1011336699 To: sip:74951000000@X.X.X.X:5060 Call-ID: CALL_ID4_00179A52BC45_T397365265@192.168.100.77 CSeq: 397703138 INVITE
GW send 183 to OpenSER. Record-Route: header present in this reply.
U Z.Z.Z.Z:5060 -> X.X.X.X:5060 SIP/2.0 183 Session Progress Via: SIP/2.0/UDP X.X.X.X;branch=z9hG4bK7a3.0ae7d67.0,SIP/2.0/UDP 192.168.100.77:5060;rport=60767;received=Y.Y.Y.Y; branch=z9hG4bK_00179A52BC45_T63F7A22E From: "Vit-Horosho" sip:vit-horosho@X.X.X.X; tag=00179A52BC45_T1011336699 To: sip:74951000000@X.X.X.X:5060;tag=54E1EED8-D8E Date: Thu, 19 Apr 2007 18:37:58 GMT Call-ID: CALL_ID4_00179A52BC45_T397365265@192.168.100.77 CSeq: 397703138 INVITE RSeq: 3722 Contact: sip:74951000000@Z.Z.Z.Z:5060 Record-Route: sip:X.X.X.X;lr=on;ftag=00179A52BC45_T1011336699
OpenSER make my own transformation on Contact: header
This is the root of your problem. By rewriting the Contact header with the IP address of the proxy you are not standard conform.
Hm. Which part of standard is breakup by this rewriting?
Thus, the loose routing of in-dialog messages can not work anymore, as the Contact must be the address of the client, not the proxy.
where is differences between Proxy and Terminal using one IP (but may be different UDP ports) and Contact: header rewrited by smart proxy which know what it will be done when found RURI with values equal this Contact?
Which logic used by loose_route() to treat RURI as local RURI? In this scenario why PRACK RURI sip:74951000000@X.X.X.X:5060;nat=yes don't treat as resource owned by this proxy?
Stop manipulating the Contact header and you will see that loose routing will work fine.
:-) I stop loose_route() and everything works fine for our SIP-network. If something come wrong -- I'll try to find new solutions for new problems.
Now I want to understand logic only.
I have only one idea -- call loose_route() after all my own transformations and check what it will be do. But if loose_route() uses original (not rewrited) requests so nothing to changes.
Sorry to trouble you