Asterisk 13.12
Twilio Elastic SIP (secure)
I have setup an IVR and it works flawlessly when testing with a SIP phone connected to the Asterisk server. We are testing through the Twilio’s Elastic SIP (secure) service now and have a single weird issue before cloning to production:
If a call is up for more than two minutes, when the context includes hangup(), the call sends a BYE, throws an error, but never hangs up. If the call is less than two minutes, the call ends just fine.
[nm-goodbye]
exten => s,1,Playback(IVR/nm_goodbye)
exten => s,n,Hangup()
“sanitized” SIP message:
– Executing [s@nm-goodbye:2] Hangup(“SIP/twilio4-00000001”, “”) in new stack
== Spawn extension (nm-goodbye, s, 2) exited non-zero on 'SIP/twilio4-00000001’
Scheduling destruction of SIP dialog ‘72f540723a2258851d6653be8dc37501@0.0.0.0’ in 6400 ms (Method: ACK)
Reliably Transmitting (NAT) to [Twilio]:48335:
BYE sip:+[MyCell]@[NAT’dIPaddress]:5060;transport=udp SIP/2.0
Via: SIP/2.0/TLS [PubIP]:5061;branch=z9hG4bK00262e4c;rport
Route: sip:Twilio:5061;transport=tls;r2=on;lr;ftag=53351529_6772d868_9aa52420-650e-4be7-8a57-5337cb1ee3c2,sip:Twilio:5060;r2=on;lr;ftag=53351529_6772d868_9aa52420-650e-4be7-8a57-5337cb1ee3c2
Max-Forwards: 70
From: sip:+[IVR]@pbx.statement.services;user=phone;tag=as57f38389
To: sip:+[MyCell]@asterisk-server.pstn.twilio.com;isup-oli=62;tag=53351529_6772d868_9aa52420-650e-4be7-8a57-5337cb1ee3c2
Call-ID: 72f540723a2258851d6653be8dc37501@0.0.0.0
CSeq: 102 BYE
User-Agent: Asterisk PBX 13.12.0
X-Asterisk-HangupCause: Normal Clearing
X-Asterisk-HangupCauseCode: 16
Content-Length: 0
Error message received on console after two minutes:
[Oct 31 16:10:57] ERROR[6045][C-00000001]: chan_sip.c:4263 __sip_reliable_xmit: Serious Network Trouble; __sip_xmit returns error for pkt data
I have confirmed that firewall ports UDP/TCP 5060/5061 and UDP 10000-20000 are open.
I have debugged RTP, and it never breaks during the call.
The sip.conf trunk configuration is taken straight out of the Asterisk config document at https://www.twilio.com/docs/api/sip-trunking/sample-configuration#asterisk
twilio-trunk
type=peer
context=from-twilio ;Which dialplan to use for incoming calls
dtmfmode=rfc2833
canreinvite=no
insecure=port,invite
transport=tls
qualify=yes
encryption=yes
media_encryption=sdes
twilio0
host=asterisk-server.pstn.twilio.com
twilio1
host=54.172.60.2
twilio2
host=54.172.60.0
twilio3
host=54.172.60.1
twilio4
host=54.172.60.3