Calls hangup after exactly 32 seconds

asterisk
pjsip
Tags: #<Tag:0x00007f7028b0e1c8> #<Tag:0x00007f7028b0dea8>

(Tragik) #1

Hello,

I am having some issues with a FreePBX system dropping calls consistently at 32 seconds. I’m running FreePBX 15.0.17.17 with Asterisk 16.11.1.

I’ve seen a lot of other posts with similar issues as mine and it usually comes out to be a NAT issue, but I can’t figure out where my issue is. I am forwarding UDP port 5060 (pjsip not chan_sip) and RTP ports 10000-20000 to the internal IP of the PBX and have firewall rules block it if the IP address isn’t coming from the Twilio IPs I am using for my trunk. If i go to asterisk SIP settings and detect network settings it fills in the external IP with the correct IP. I have all of my internal networks added under asterisk SIP Settings as well. Here are logs for a call that dropped: https://pastebin.com/uM5955cd


(Edwin) #2

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)


(Communication Technologies) #3

Hang-up cause 16, which is a normal hang-up. You are correct in assuming it is likely an network issue. You could do a wireshark and turn on SIP Debug from the Asterisk CLI to collect additional detail.

Unlikely, but you can try going to Settings > Asterisk SIP Settings > Under Nat Settings click on “Detect Network Settings”, Apply and try again.

Not sure if you have already read here, but maybe some clues.
https://community.freepbx.org/t/outbound-call-drops-after-30-seconds/49199/2?u=comtech


(D Rajan) #4

I hope you are allowing RTP ports 10000-20000 for all IP addresses and not limiting it to the Twilio IPs. You may allow UDP Port 5060 only for Twilio however allow RTP from anywhere.


#5

At the Asterisk command prompt, type
pjsip set logger on
make a new failing call and paste a new log (which will now include a SIP trace).


(Tragik) #6

UDP 5060 is only allowed in from the Twilio IPs. I originally had UDP 10000-20000 only forwarding to the PBX but just set it to allow all RTP traffic anywhere on the network. No security issues in doing this? No effect on fixing my issue however.


(Tragik) #7

Which logging mode should I be using? Debug or Verbose or another? I have a lot of endpoints so the log is filling up very quick (hundreds of lines) with logs we probably don’t need.

Some more information WAN connection is with Google Fiber and I’m using a Sophos firewall with SIP ALG disabled, UDP timeout has been set to 180 as well.

Devices on the network masquerade to a WAN alias IP that is a different IP address than the one Google communicates with the firewall on. Would that be an issue? I tried setting the PBX to masquerade to the same WAN IP that Google uses but that didn’t seem to do anything either.


#8

Just the SIP trace is all we need. At the Asterisk command prompt, type
pjsip set logger on
call in from your mobile, paste the Asterisk log (or the console output).

We need to see starting from the INVITE sent by Twilio through the 200 OK sent by Asterisk and the subsequent ACK (if present). If there is a lot of noise in between from endpoints registering, etc., that’s easy to ignore and not an issue.


(Tragik) #9

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)


(Tragik) #10

Here is a pastebin with the log: https://pastebin.com/x30hBap5

Editing to add a wireshark capture from the Endpoint, as well as from the Twilio Trunk end.

Endpoint:
image

Twilio Trunk:
image

I can see that the endpoint receives an ACK from the PBX but I don’t see one through the trunk anywhere.

Outbound calls work 100% fine by the way, no dropping whatsoever.


#11

Line 20026:
Contact: <sip:104.145.12.182:5060>
is incorrect. 104.145.12.182 is the default external IP address in the FreePBX Distro (it belongs to Sangoma).

In Asterisk SIP Settings, set External Address to 216.21.164.200 (I’m guessing that’s correct based on where Twilio sent the call), Submit, Apply Config, then you must restart (not just reload) Asterisk. Test. If you still have trouble, please post a new paste.


(Tragik) #12

Ahah. Restarted Asterisk and everything is working fine now. I’ve just been reloading this entire time. Uptime was 13 weeks so it likely didn’t pull any of the NAT settings correctly when I set them up initially not too long ago.

Thanks so much for your help!


(Ricardo) #13

It looks strange, device receive an invite it process and afterward request a registration to FreePBX.

Is device registered? or it loose registration when receive calls?

That’s probably the reason call are released with “exited non-zero on “ “HANGUP CAUSE: 16”

As it seems FreePBX is on another network, have verified, routing, latency etc.?


(Nobby6) #14

Bit late but Ive found the causes are usually one of these

https://helpdesk.ausics.net/kb/faq.php?id=33