[asterisk-dev] Including port number on SDP Contact

Robert Moskowitz rgm at htt-consult.com
Sun Jan 13 16:09:33 CST 2008


I have discovered a challenge with Asterisk running with a public IP 
address and thus not needing NAT, when working with a service that of 
course knows there has to be a NAT there....

I come here to the developer's list, as this requires some inside 
understanding of SIP/SDPs.

I am running Asterisk 1.4.17, connecting to Broadvoice.  If the firewall 
has the 'common' SIP ALG inbound calls work.  Without an ALG (firewall 
only doing allow/deny filtering), inbound calls are voice-less.

What it comes down to it seems is in the REGISTER from Asterisk to 
Broadvoice.  All the following were determined with tcpdump and 
displayed with WireShark.

A sample of Asterisk's REGISTER is:

No.     Time        Source                Destination           Protocol 
Info
     36 11.838243   208.83.67.138         147.135.12.221        SIP      
Request: REGISTER sip:sip.broadvoice.com

Frame 36 (708 bytes on wire, 708 bytes captured)
Ethernet II, Src: Ibm_67:93:d1 (00:20:35:67:93:d1), Dst: 
RealtekS_03:52:57 (00:e0:4c:03:52:57)
Internet Protocol, Src: 208.83.67.138 (208.83.67.138), Dst: 
147.135.12.221 (147.135.12.221)
User Datagram Protocol, Src Port: sip (5060), Dst Port: sip (5060)
Session Initiation Protocol
    Request-Line: REGISTER sip:sip.broadvoice.com SIP/2.0
    Message Header
        Via: SIP/2.0/UDP 208.83.67.138:5060;branch=z9hG4bK739d251f;rport
        From: <sip:2482910713 at sip.broadvoice.com>;tag=as778df22e
        To: <sip:2482910713 at sip.broadvoice.com>
        Call-ID: 586a59922b3306280ad020de5e9ef376 at 127.0.0.1
        CSeq: 103 REGISTER
        User-Agent: Asterisk PBX
        Max-Forwards: 70
        Authorization: Digest username="2482910713", realm="BroadWorks", 
algorithm=MD5, uri="sip:sip.broadvoice.com", 
nonce="BroadWorks_______________", response="________________________", 
opaque="", qop=auth, cnonce="________", nc=000
        Expires: 120
        Contact: <sip:2482910713 at 208.83.67.138>
        Event: registration
        Content-Length: 0


I took out the auth nonces. For privacy.  I figured that my IP addresses 
are too easy to discover anyway...

The SIP ALG modifies the Contact so I see:

No.     Time        Source                Destination           Protocol 
Info
     23 0.618634    208.83.67.138         147.135.12.221        SIP      
Request: REGISTER sip:sip.broadvoice.com

Frame 23 (713 bytes on wire, 713 bytes captured)
Ethernet II, Src: Cisco-Li_33:1a:30 (00:13:10:33:1a:30), Dst: 
Flowpoin_10:15:32 (00:20:6f:10:15:32)
Internet Protocol, Src: 208.83.67.138 (208.83.67.138), Dst: 
147.135.12.221 (147.135.12.221)
User Datagram Protocol, Src Port: sip (5060), Dst Port: sip (5060)
Session Initiation Protocol
    Request-Line: REGISTER sip:sip.broadvoice.com SIP/2.0
    Message Header
        Via: SIP/2.0/UDP 208.83.67.138:5060;branch=z9hG4bK5b656687;rport
        From: <sip:2482910713 at sip.broadvoice.com>;tag=as6c8e627c
        To: <sip:2482910713 at sip.broadvoice.com>
        Call-ID: 6376f2313ed0083a7101b6d4346df97b at 127.0.0.1
        CSeq: 103 REGISTER
        User-Agent: Asterisk PBX
        Max-Forwards: 70
        Authorization: Digest username="2482910713", realm="BroadWorks", 
algorithm=MD5, uri="sip:sip.broadvoice.com", 
nonce="BroadWorks_________________________", 
response="_______________________________", opaque="", qop=auth, 
cnonce="___________", nc=000
        Expires: 120
        Contact: <sip:2482910713 at 208.83.67.138:5060>
        Event: registration
        Content-Length: 0



It seems the critical success factor is the SDP value of "Contact: 
<sip:2482910713 at 208.83.67.138:5060>" rather than "Contact: 
<sip:2482910713 at 208.83.67.138>"

However, I cannot generate this form directly from Asterisk.  I have 
tried specifying NAT=yes both without and with:

exterip=208.83.67.138
localnet=208.83.67.136/255.255.255.248

Is there a way to get Asterisk to include the port number on the 
Register (and other fields, btw)?  My humble debugging efforts have been 
fruitless and I am much better ready tcpdumps than code...

thank you.





More information about the asterisk-dev mailing list