Issue with Remote Extensions

I just finished setting up Asterisk for home usage and am having several issues with externally registered phones. Please see the details of my configuration below:

Working

Internal

Internal to SIP Provider

External to Internal

Not Working

Internal to External (does not ring on either end)

External to SIP Provider (calls ring and connect with no audio)

sip.conf

[general]
register => XXXXXXX:XXXXXXXX@sip-provider.com
registertimeout=20
externip=mydomainname.com
localnet=192.168.11.0/255.255.255.0
context=sipprovider-inbound
allowoverlap=no
bindport=5060
bindaddr=0.0.0.0
srvlookup=no
subscribecontext=from-sip
directmedia=no

[2004]
type=friend
host=dynamic
dtmfmode=rfc2833
nat=yes
username=2004
secret=secret
context=phones
canreinvite=no
#directmedia=no
callerid=“John Doe”

Firewall Configuration

5060 Open to Asterisk RTP Open to match range in rtp.conf

Codecs

I have confirmed that all devices are using G711 ULAW

CLI Output

== Using SIP RTP CoS mark 5
– Executing [2004@phones:1] Dial(“SIP/2000-00000000”, “SIP/2004”) in new stack
== Using SIP RTP CoS mark 5
– Called SIP/2004
[Nov 20 23:18:35] WARNING[18243]: chan_sip.c:4175 retrans_pkt: Retransmission timeout reached on transmission 119d17a8483dfe824f209828115ff597@192.168.11.20:5060 for seqno 102 (Critical Request) – See wiki.asterisk.org/wiki/display/ … nsmissions
Packet timed out after 32000ms with no response
– SIP/2004-00000001 is circuit-busy
[Nov 20 23:18:35] WARNING[18243]: chan_sip.c:4204 retrans_pkt: Hanging up call 119d17a8483dfe824f209828115ff597@192.168.11.20:5060 - no reply to our critical packet (see wiki.asterisk.org/wiki/display/ … nsmissions).
== Everyone is busy/congested at this time (1:0/1/0)
– Auto fallthrough, channel ‘SIP/2000-00000000’ status is ‘CONGESTION’

Does anyone have any idea what may be going wrong? Any help would be greatly appriciated.

Turn on rtp debug " rtp set debug on" and check the IP address where the media stream is sent.
And don’t know what version of Asterisk you are using but try this option to specify your external IP address

externaddr = my-external-ip-addr

Verison: Asterisk 11.7.0~dfsg-1ubuntu1 built by buildd @ lamiak on a x86_64 running Linux on 2013-12-24 06:02:10 UTC

– Registered SIP ‘2004’ at 70.193.1.85:5202

Sent RTP packet to 70.193.1.85:5214 (type 00, seq 038122, ts 041440, len 000160)
Got RTP packet from 4.55.22.70:20270 (type 00, seq 000260, ts 041600, len 000160)
Sent RTP packet to 70.193.1.85:5214 (type 00, seq 038123, ts 041600, len 000160)
Got RTP packet from 4.55.22.70:20270 (type 00, seq 000261, ts 041760, len 000160)
Sent RTP packet to 70.193.1.85:5214 (type 00, seq 038124, ts 041760, len 000160)
… Until call is answered

Sent RTP P2P packet to 70.193.1.85:5214 (type 00, len 000160)
Sent RTP P2P packet to 70.193.1.85:5214 (type 00, len 000160)
Sent RTP P2P packet to 70.193.1.85:5214 (type 00, len 000160)
Sent RTP P2P packet to 70.193.1.85:5214 (type 00, len 000160)
Sent RTP P2P packet to 70.193.1.85:5214 (type 00, len 000160)
…Until call is terminated

70.193.1.85 is the public IP address for the external SIP phone. I am not sure what 4.55.22.70 belongs to.

Other common errors

After failed call is placed to an external SIP phone:

[2014-11-21 22:10:50] WARNING[23340]: chan_sip.c:4175 retrans_pkt: Retransmission timeout reached on transmission 000f9089-5eeb0006-3296a8c1-01430943@192.168.11.30 for seqno 102 (Critical Response) – See wiki.asterisk.org/wiki/display/ … nsmissions

Also, I randomly loss connection to my SIP provider:

[2014-11-21 22:14:19] NOTICE[23340]: chan_sip.c:29427 sip_poke_noanswer: Peer ‘flowroute51923665’ is now UNREACHABLE! Last qualify: 86

[2014-11-21 22:14:29] NOTICE[23340]: chan_sip.c:23522 handle_response_peerpoke: Peer ‘flowroute51923665’ is now Reachable. (88ms / 2000ms)

Both Asterisk and SIP provider are sending 404s in response to “604 Request: OPTIONS”

Should I ditch the prepackaged verison of Asterisk that comes with Ubuntu and compile it from source?

4.55.22.70 is the IP address of you SIP trunk… (flowroute). How ever you can verify this information running a sip show peers

It looks like my SIP provider is 216.115.69.144:

64 bytes from sip-lv1.flowroute.com (216.115.69.144): icmp_seq=2 ttl=52 time=80.3 ms

flowroute51923665/5192366 216.115.69.144 N 5060 OK (88 ms)

The link that appear on your CLI Output has a very useful information like :

Why does this happen?

A NAT device in the signalling path. A misconfigured NAT device is in the signalling path and stops SIP messages.
A firewall that blocks messages or reroutes them wrongly in an attempt to assist in a too clever way.
A SIP middlebox (SBC) that rewrites contact: headers so that we can't reach the other side with our reply or the ACK.
A badly configured SIP proxy that forgets to add record-route headers to make sure that signalling works.
Packet loss. IP and UDP are unreliable transports. If you loose too many packets the retransmits doesn't help and communication is impossible. If this happens with signaling, media would be unusable anyway.

Turn on SIP debug ( sip set debug on ), try to understand the signalling that happens and see if you’re missing the reply to the INVITE or if the ACK gets lost. When you know what happens, you’ve taken the first step to track down the problem. See the list above and investigate your network.

Here is my understanding of how to register a SIP client outside of the network:

[ul]Inside the general context of the sip.conf file define “localnet” and “externip” so that Asterisk can understand the local network topology and how to route traffic to clients that are located outside of it.
Define individual SIP clients. If a client is outside of the local network options “nat=yes” and canreinvite=no" should be added.
Open SIP signaling ports and RTP ports on the firewall.[/ul]

At this point I feel like I have 2 options:

[ul]Start from scrach and compile the latest Asterisk 13 release
Replace Firewall (SonicWall TZ150)[/ul]

Here are some commonly occuring snippets from ( sip set debug on ):

<— SIP read from UDP:216.115.69.144:5060 —>
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 192.168.11.20:5060;branch=z9hG4bK5b4da298;rport=24005
From: “8289910152” sip:8289910152@192.168.11.20;tag=as05a60139
To: sip:sip-lv1.flowroute.com;tag=20e1698a3241cbcc6677a39fcb65a0aa.7cce
Call-ID: 155e3c8f1b97f3d6131f15e25c7a8ced@192.168.11.20:5060
CSeq: 102 OPTIONS
Content-Length: 0

<— SIP read from UDP:216.115.69.144:5060 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.11.20:5060;branch=z9hG4bK1b49ec54
From: sip:51923665@sip-lv1.flowroute.com;tag=as2cb808b8
To: sip:51923665@sip-lv1.flowroute.com;tag=aa681f9fdf30149b00040f579a1d99c4.588a
Call-ID: 7472bb757beb17684ec896f62a41b9c7@127.0.1.1
CSeq: 208 REGISTER
Contact: sip:s@192.168.11.20:5060;q=1;expires=120;received="sip:192.168.11.20:5060"
Content-Length: 0

<— Transmitting (no NAT) to 216.115.69.144:5060 —>
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 216.115.69.144;branch=z9hG4bKb1d5.bc4677acf2626848d927d0bea9b6b69d.0;received=216.115.69.144
Via: SIP/2.0/UDP 216.115.69.131:5060;branch=0
From: sip:ping@invalid;tag=6138a862
To: sip:192.168.11.20:5060;tag=as77bb5555
Call-ID: 95f5da82-c5b80444-5922111@216.115.69.131
CSeq: 1 OPTIONS
Server: Asterisk PBX 11.7.0~dfsg-1ubuntu1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Accept: application/sdp
Content-Length: 0

<— Transmitting (NAT) to 216.115.69.144:5060 —>
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 216.115.69.144;branch=z9hG4bKe558.cb103b9d21724f5ccfa5756154b5eb03.0;received=216.115.69.144;rport=5060
Via: SIP/2.0/UDP 70.167.153.136:5060;branch=0
From: sip:ping@invalid;tag=0d31d3bc
To: sip:192.168.11.20:5060;tag=as1367bcf2
Call-ID: 0c26e475-636408bb-9f7b9b8@70.167.153.136
CSeq: 1 OPTIONS
Server: Asterisk PBX 11.7.0~dfsg-1ubuntu1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Accept: application/sdp
Content-Length: 0

<— Transmitting (NAT) to 192.168.12.22:59900 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.12.22:59900;branch=z9hG4bK-d8754z-9288a3df44019dec-1—d8754z-;received=192.168.12.22;rport=59900
From: sip:2004@192.168.11.20:5060;transport=UDP;tag=93319956
To: sip:2004@192.168.11.20:5060;transport=UDP;tag=as41cc8705
Call-ID: MDgxYWUyMTFlNTgxODE2YjZkZTViOTAwYTUwYTcyOTg.
CSeq: 12 REGISTER
Server: Asterisk PBX 11.7.0~dfsg-1ubuntu1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Expires: 60
Contact: sip:2004@192.168.12.22:59900;rinstance=cf4c4fc49213fd6f;transport=UDP;expires=60
Date: Sat, 22 Nov 2014 18:56:15 GMT
Content-Length: 0

nat=yes is deprecated, use nat=force_rport,comedia instead, canreinvite= was renamed to directmedia= in Asterisk 1.6.2 to more accurately describe what this setting does. See also the closely related setting

The trace contains two half registers - there is no request shown. Both those registrations are from devices inside the NAT boundary.