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().
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.
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 Server: Cisco-SIPGateway/IOS-12.x.. 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. 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.
Stop manipulating the Contact header and you will see that loose routing will work fine.
regards klaus
and resend 183 to
Term.
U X.X.X.X:5060 -> Y.Y.Y.Y:60767 SIP/2.0 183 Session Progress Via: 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 Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRAC K, UPDATE, REFER, SUBSCRIBE, NOTIFY, INFO, REGISTER Require: 100rel RSeq: 3722 Record-Route: sip:X.X.X.X;lr=on;ftag=00179A52BC45_T1011336699 Contact: sip:74951000000@X.X.X.X:5060;nat=yes
Term try to send PRACK to GW. It sets RURI to value getted from Contact: header of 183 reply. It adds Route: getted from Term's route set (comes from 183) also. So PRACK getted by OpenSER:
U Y.Y.Y.Y:60767 -> X.X.X.X:5060 PRACK sip:74951000000@X.X.X.X:5060;nat=yes SIP/2.0 Via: SIP/2.0/UDP 192.168.100.77:5060; branch=z9hG4bK_00179A52BC45_T16F15B76 From: "Vit-Horosho" sip:vit-horosho@X.X.X.X; tag=00179A52BC45_T1011336699 To: sip:74951000000@X.X.X.X:5060;tag=54E1EED8-D8E Call-ID: CALL_ID4_00179A52BC45_T397365265@192.168.100.77 RAck: 3722 397703138 INVITE CSeq: 397703139 PRACK Contact: sip:vit-horosho@192.168.100.77:5060 Route: sip:X.X.X.X;lr=on;ftag=00179A52BC45_T1011336699
And I have misunderstood at this point. I use following logic in my openser.cfg:
route {
...
record_route(); if ( loose_route() ) { append_hf("P-hint: rr-enforced\r\n"); # we don't call route(1) here -- we need to process all requests later }
# main request process logic followed ... }
and I found the following in my debug:
0(41063) after_strict: Next hop: 'sip:X.X.X.X;lr=on;ftag=00179A52BC45_T1011336699' is loose router 0(41063) parse_headers: flags=ffffffffffffffff 0(41063) rewrite_uri: Rewriting Request-URI with 'sip:X.X.X.X;lr=on;ftag=00179A52BC45_T1011336699' 0(41063) after_strict: The last route URI: 'sip:X.X.X.X;lr=on;ftag=00179A52BC45_T1011336699' 0(41063) parse_headers: flags=ffffffffffffffff
As I founded in RFC-3261 section 16.12:
"1. The proxy will inspect the Request-URI. If it indicates a resource owned by this proxy, the proxy will replace it with the results of running a location service. Otherwise, the proxy will not change the Request-URI.
- The proxy will inspect the URI in the topmost Route header
field value. If it indicates this proxy, the proxy removes it from the Route header field (this route node has been reached)."
So my question:
why loose_route() don't treat PRACK RURI sip:74951000000@X.X.X.X:5060;nat=yes as resource owned by this proxy and rewrite it with Route: header URI sip:X.X.X.X;lr=on;ftag=00179A52BC45_T1011336699 ?