SOLVED Incoming calls hangup after 30 seconds

Server Stats:
Asterisk 1.8.20.1
OS: Centos 5.9
Kernel version: 2.6.18-348.3.1.el5

Network diagram

AT&T —> T1 —> Cisco Router ----> Local Network Switch <----- Asterisk

I have had a working Asterisk server for a few years now, incoming phone service is AT&T PRI on a T1. I have a Digium TE121 card, using Dahdi and everything is fine. Fast forward to a week ago trying to do test and turn up to switch our service to AT&T IP Flexible Reach. All the AT&T hardware is in place and tested (2 - T1 cards, Cisco router, etc.).

I can place a call from my cell phone to a DID test number. It hits Asterisk. I hear my IVR then about 30 seconds into the call, it hangs up.

Snip from CLI with SIP debug on:

[code]Retransmitting #2 (NAT) to XX.XXX.XXX.XX:5060:
SIP/2.0 200 OK
Via: SIP/2.0/UDP XX.XXX.XXX.XX:5060;branch=z9hG4bKhgpr5300d8qg9g89g340.1;received=XX.XXX.XXX.XX;rport=5060
From: “WIRELESS CALLER” sip:XXXXXXXXXX@XX.XXX.XXX.XX:5060;tag=SDfu34001-0439375144239087_c1b01.1.1.1363156247884.0_1088360_2150343
To: sip:XXXXXXXXXX@XXX.XX.XX.XX;tag=as11c0d885
Call-ID: SDfu34001-c2dbea6ac0bde01047e0701646579c8e-cggtr70
CSeq: 2 INVITE
Server: Glastender PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Contact: sip:XXXXXXX@XXX.XX.XX.XX:5060
Content-Type: application/sdp
Content-Length: 235

v=0
o=root 190297827 190297827 IN IP4 XXX.XX.XX.XX
s=Asterisk PBX 1.8.20.1
c=IN IP4 XXX.XX.XX.XX
t=0 0
m=audio 19508 RTP/AVP 0 100
a=rtpmap:0 PCMU/8000
a=rtpmap:100 telephone-event/8000
a=fmtp:100 0-16
a=ptime:20
a=sendrecv

[Mar 28 09:46:39] WARNING[30837]: chan_sip.c:3974 retrans_pkt: Retransmission timeout reached on transmission SDfu34001-c2dbea6ac0bde01047e0701646579c8e-cggtr70 for seqno 2 (Critical Response) – See https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions
Packet timed out after 6400ms with no response
[Mar 28 09:46:39] WARNING[30837]: chan_sip.c:4003 retrans_pkt: Hanging up call SDfu34001-c2dbea6ac0bde01047e0701646579c8e-cggtr70 - no reply to our critical packet (see https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions).
== Spawn extension (day-menu, s, 3) exited non-zero on 'SIP/first_gateway-00000c0e’
Scheduling destruction of SIP dialog ‘SDfu34001-c2dbea6ac0bde01047e0701646579c8e-cggtr70’ in 6400 ms (Method: INVITE)
set_destination: Parsing sip:XX.XXX.XXX.XX:5060;transport=udp for address/port to send to
set_destination: set destination to XX.XXX.XXX.XX:5060
Reliably Transmitting (NAT) to XX.XXX.XXX.XX:5060:
BYE sip:XX.XXX.XXX.XX:5060;transport=udp SIP/2.0
Via: SIP/2.0/UDP XXX.XX.XX.XX:5060;branch=z9hG4bK3a68b925;rport
Max-Forwards: 70
From: sip:XXXXXXXXXX@XXX.XX.XX.XX;tag=as11c0d885
To: “WIRELESS CALLER” sip:XXXXXXXXXX@XX.XXX.XXX.XX:5060;tag=SDfu34001-0439375144239087_c1b01.1.1.1363156247884.0_1088360_2150343
Call-ID: SDfu34001-c2dbea6ac0bde01047e0701646579c8e-cggtr70
CSeq: 102 BYE
User-Agent: Glastender PBX
X-Asterisk-HangupCause: No user responding
X-Asterisk-HangupCauseCode: 18
Content-Length: 0
[/code]

Tshark snip:

1002.507728  XXX.XX.XX.XX -> XX.XXX.XXX.XX SIP/SDP Status: 200 OK, with session description
1002.508588  XXX.XX.XX.XX -> XX.XXX.XXX.XX RTP PT=ITU-T G.711 PCMU, SSRC=0x704B955A, Seq=29003, Time=42560
1002.528621  XXX.XX.XX.XX -> XX.XXX.XXX.XX RTP PT=ITU-T G.711 PCMU, SSRC=0x704B955A, Seq=29004, Time=42720
1002.548619  XXX.XX.XX.XX -> XX.XXX.XXX.XX RTP PT=ITU-T G.711 PCMU, SSRC=0x704B955A, Seq=29005, Time=42880
1002.568614  XXX.XX.XX.XX -> XX.XXX.XXX.XX RTP PT=ITU-T G.711 PCMU, SSRC=0x704B955A, Seq=29006, Time=43040
1002.588637  XXX.XX.XX.XX -> XX.XXX.XXX.XX RTP PT=ITU-T G.711 PCMU, SSRC=0x704B955A, Seq=29007, Time=43200
1002.608619  XXX.XX.XX.XX -> XX.XXX.XXX.XX RTP PT=ITU-T G.711 PCMU, SSRC=0x704B955A, Seq=29008, Time=43360
1002.609089  XXX.XX.XX.XX -> XX.XXX.XXX.XX SIP Request: BYE sip:XX.XXX.XXX.XX:5060;transport=udp
1002.679143 XX.XXX.XXX.XX ->  XXX.XX.XX.XX SIP Status: 200 OK
1035.418805  XXX.XX.XX.XX -> XX.XXX.XXX.XX SIP Request: OPTIONS sip:XX.XXX.XXX.XX
1035.463751 XX.XXX.XXX.XX ->  XXX.XX.XX.XX SIP Status: 405 Method Not Allowed

My sip.conf

[general]
context=default
bindport=5060
bindaddr=0.0.0.0
srvlookup=no
;srvlookup=yes
disallow=all
allow=ulaw
allow=gsm
allow=alaw
language=en
trustpid=yes
sendrpid=yes
qualify=yes
callevents=yes
insecure=invite
pedantic=no
useragent=Glastender PBX
videosupport=no
t38pt_udptl=no
t38pt_rtp=no
t38pt_tcp=no


; ******************************************************
; ** Register statements

; ******************************************************
; ** Friends, Users and Peers below this line


; *********** AT&T IP FLEX *****************************
[first_gateway]
context=pbx_trunk_in
type=peer
host=XX.XXX.XXX.XX
qualify=2000

And before you say it’s a problem with NAT, I have tried ALL the various NAT configurations in my sip.conf. I tried nat=yes. I tried adding localnet, directrtpsetup=yes, canreinvite=yes…and the opposite of these. Nothing I do seems to make any difference. I’m at a loss.

You have blanked out the information needed to diagnose this.

nat is for tweaking NAT handling, normally when the remote side is behind a broken NAT system. What you actually need to set for NAT is externip, externaddr, or stunaddr.

I tried externip with no success. NAT shouldn’t be an issue, since the Cisco router is connected directly to my internal network, with no firewall in between it and my Asterisk server. If there is a problem with NAT, it is with the Cisco router from AT&T and I have no control over that.

A new development. I changed the dialplan to route the call directly to my desk phone extension instead of the IVR and my phone rings, I can answer hear voice on both ends, yet after 30 seconds, the call drops.

Here’s the CLI messages with SIP debug on (nothing blanked out).

[Mar 28 11:22:28] WARNING[30837]: chan_sip.c:3974 retrans_pkt: Retransmission timeout reached on transmission SDqv3c301-a5e1a0767342eabc7f04fb9981bd2347-cggtr70 for seqno 2 (Critical Response) -- See https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions Packet timed out after 6400ms with no response [Mar 28 11:22:28] WARNING[30837]: chan_sip.c:4003 retrans_pkt: Hanging up call SDqv3c301-a5e1a0767342eabc7f04fb9981bd2347-cggtr70 - no reply to our critical packet (see https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions). == Spawn extension (pbx_trunk_in, 3417908, 1) exited non-zero on 'SIP/first_gateway-00000d49' Scheduling destruction of SIP dialog 'SDqv3c301-a5e1a0767342eabc7f04fb9981bd2347-cggtr70' in 6400 ms (Method: INVITE) set_destination: Parsing <sip:24.172.190.15:5060;transport=udp> for address/port to send to set_destination: set destination to 24.172.190.15:5060 Reliably Transmitting (NAT) to 24.172.190.15:5060: BYE sip:24.172.190.15:5060;transport=udp SIP/2.0 Via: SIP/2.0/UDP 192.168.43.32:5060;branch=z9hG4bK15ed6c68;rport Max-Forwards: 70 From: <sip:6163427908@192.168.43.32>;tag=as3a0cff77 To: "WIRELESS CALLER" <sip:6162542345@24.172.190.15:5060>;tag=SDqv3c301-48256845454828223_c1b01.1.1.1364191394752.0_296141_584382 Call-ID: SDqv3c301-a5e1a0767342eabc7f04fb9981bd2347-cggtr70 CSeq: 102 BYE User-Agent: Glastender PBX X-Asterisk-HangupCause: No user responding X-Asterisk-HangupCauseCode: 18 Content-Length: 0

The original call was dropping because of the three way handshake is not completing. The initiator of the call should send ACK when it receives the 200 OK.

It sounds as though it is receiving the 200 OK, but is possibly sending the ACK to the wrong address. Seeing what was under the XXX’s would allow one to get an idea to which address Asterisk was telling it to send.

I’m no longer clear whether you are in a NAT situation, but I suspect you are. If the NAT is being done by a router that is out of your control, you need to either find out what address it is using, or use a STUN server to find this dynamically. Such an arrangement would be hostile to the running of any server.

[quote=“david55”]The original call was dropping because of the three way handshake is not completing. The initiator of the call should send ACK when it receives the 200 OK.

It sounds as though it is receiving the 200 OK, but is possibly sending the ACK to the wrong address. Seeing what was under the XXX’s would allow one to get an idea to which address Asterisk was telling it to send.

I’m no longer clear whether you are in a NAT situation, but I suspect you are. If the NAT is being done by a router that is out of your control, you need to either find out what address it is using, or use a STUN server to find this dynamically. Such an arrangement would be hostile to the running of any server.[/quote]

Thanks for the info.
I think the problem lies in the AT&T equipment. The call is coming from their network to a T1 card, then to this Cisco router they provided us, then right to our network switch. The documentation they provide claims this router has NAT to protect my network and my Asterisk box, since my Asterisk box doesn’t run a firewall because our current incoming service is a PRI to a TE121 card, and the Asterisk box sits behind our corporate firewall.

I will post another trace when I get a moment without the XXX’s But I can tell you from looking at it, that all the addresses are correct. So I’m not sure why the AT&T router is not responding.

Thanks again.

Okay, more info.
An interesting development, if I remove access to the internet to my Asterisk server, it kills the audio on my incoming call through the AT&T IP Flex. Also, if I route port 5060 from my outside internet, into my network, my incoming call reaches the server. So for some reason, the Cisco router from AT&T is getting mixed up and is sending call information out of my internet connection. I would have to assume that routing is an issue here, since setting NAT in the sip.conf at least allows an internal call into the server.

Another update!
Well, it WAS a routing issue! I set the default gateway of the Asterisk box to the IP address of the Cisco router and now I can call in and out, with no NAT settings in my sip.conf. My only issue now is, I have no voice on outgoing calls, but there is MOH. Yet, I have voice on incoming calls! So I have to figure that out.

IT WORKS!!!

I got everything working! First, here is the sip.conf. Make sure canreinvite and directrtpsetup both equal NO. This will save you a ton of pain later on! Also, make sure to set the default gateway on your Asterisk box to the IP address (internal address) of the router that AT&T supplied you. This is especially important if you have internet on your network from some other source.


[general]
context=default
bindport=5060
bindaddr=0.0.0.0
disallow=all
allow=g729
allow=ulaw
allow=alaw
allow=gsm
language=en
srvlookup=no
canreinvite=no
directrtpsetup=no
trustpid=yes
sendrpid=yes
qualify=yes
callevents=yes
insecure=invite
pedantic=no
useragent=Glastender PBX
videosupport=no
t38pt_udptl=no
t38pt_rtp=no
t38pt_tcp=no


; ******************************************************
; ** Friends, Users and Peers below this line


; *********** AT&T IP FLEX *****************************
[first_gateway]
context=pbx_trunk_in
type=peer
host=12.194.XXX.15
qualify=2000

[second_gateway]
context=pbx_trunk_in
type=peer
host=12.194.XXX.15
qualify=2000

ETC....