[asterisk-users] On SIP INVITE answering to IP:port found in Contact: header.

Markus universe at truemetal.org
Tue Apr 16 20:02:42 CDT 2013


Joshua, Matthew,

Am 17.04.2013 02:01, schrieb Matthew J. Roth:
> Joshua Colp wrote:
>>
>> If you set nat=no for that specific peer it should work as you need.
>> 'rport' is forced on these days which works for most situations, except
>> with some platforms and Cisco phones. >_>
>
> Joshua,
>
> That sounds much easier than what I came up with, so I'd recommend to Markus
> that he try your suggestion first.

bingo, that fixed it! Now everything's working fine, and my config looks 
like this:

host=1.1.1.1
type=peer
insecure=port
nat=no

Thanks a lot!

Although I have to say I don't understand what is going on exactly. :) 
As can be seen below, and as Joshua suggested, nat=no removed the 
"rport" in the Via: header. I'm just wondering how Asterisk now knows to 
which port to send the replies to? Is it simply using 5060 because 
that's the RFC default for SIP? And because there is no port specified 
in the Via: header? Would the nat=no switch also fix it in a scenario 
where the remote side was sending from port 36252 but wanted the replies 
on port 5061 instead of 5060?


> If you have a moment, please take a look at my response and let me know if my
> understanding of the Contact and Via headers was correct.  If it was, is the
> 'nat=no' solution just a way to workaround the provider's RFC-noncompliant
> platform?

I would be interested in that, too.

Matthew, to provide you with feedback, here are the SIP headers before 
and after nat=no:

Without nat=no:

IP 1.1.1.1.36252 > 2.2.2.2.5060: UDP, length 845
INVITE sip:1234 at 2.2.2.2 SIP/2.0
Via:SIP/2.0/UDP 
1.1.1.1;branch=z9hG4bKBroadWorks.2plg2e-2.2.2.2V5060-0-164693126-1529565735-1366128986378-
From:<sip:9999 at 1.1.1.1;user=phone>;tag=1529565735-1366128986378-
To:"My wife"<sip:1234 at 2.2.2.2:5060>
Call-ID:BW161626378160413-1212022685 at 1.1.1.1
CSeq:164693126 INVITE
Contact:<sip:1.1.1.1:5060>
Supported:100rel
Allow:ACK,BYE,CANCEL,INFO,INVITE,OPTIONS,PRACK,REFER,NOTIFY,UPDATE
Accept:application/media_control+xml,application/sdp,multipart/mixed
Max-Forwards:40
Content-Type:application/sdp
Content-Length:206

[ ... SDP removed ... ]

IP 2.2.2.2.5060 > 1.1.1.1.36252: UDP, length 602
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 
1.1.1.1;branch=z9hG4bKBroadWorks.2plg2e-2.2.2.2V5060-0-164693126-1529565735-1366128986378-;received=1.1.1.1;rport=36252
From: <sip:9999 at 1.1.1.1;user=phone>;tag=1529565735-1366128986378-
To: "My wife"<sip:1234 at 2.2.2.2:5060>
Call-ID: BW161626378160413-1212022685 at 1.1.1.1
CSeq: 164693126 INVITE
Server: Asterisk PBX 10.7.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, 
INFO, PUBLISH
Supported: replaces, timer
Contact: <sip:1234 at 2.2.2.2:5060>
Content-Length: 0

And with nat=no:

The same, except for the reply:

IP 2.2.2.2.5060 > 1.1.1.1.5060: UDP, length 588
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 
1.1.1.1;branch=z9hG4bKBroadWorks.2plg2e-2.2.2.2V5060-0-179354203-809967599-1366158308532-;received=1.1.1.1

That means the "rport" part is gone.

Regards
Markus




More information about the asterisk-users mailing list