PJSIP Outgoing call problem

Hello everyone, I have configured my secondary server with IAX2. When I make a call, it works well and I can make outgoing calls from SERVER1 while SERVER2 handles the call.

However, the problem is that after a while, SERVER2 disconnects from the trunk (I believe) and I get the error that all circuits are busy. But often, as soon as I restart the Asterisk server, everything works again. I really can’t understand why; it seems everything is configured correctly since I can make calls, but after a while, it’s as if the trunk disconnects. I am attaching the logs for your reference.

https://pastebin.freepbx.org/view/4896406a




Make a PCAP or run SNGREP to see which side is failing or rejecting A or B…

The Server 2 fails when trying to connect to the Vodafone SIP Trunk for calls. It always disconnects. If I restart the server, it connects successfully, works for 30 minutes to 1 hour, and then disconnects again and won’t reconnect.

Someone can help me?

“disconnect” is not a useful description. Does the server stop responding to OPTIONS? Reject or fail to respond to re-registration attempts? Reject or fail to respond to outgoing INVITEs?

Have you tried more aggressive keep-alives, e.g. Expiration 120, Qualify Frequency 60?

When a failure occurs, any errors in the Asterisk log before a call is attempted? If not, what errors are logged for a failing call?

Any relevant settings in your router/firewall (SIP ALG, timeouts, etc.)?

How to I said before you have to run TCPDUMP or SNGREP to capture and find which side disconnect first. Then you will dig in Asterisk Logs. How to @Stewart1 told you might be Network issue or Router Sip ALG or One side wont sending OPTIONS..
Sorry we can’t guess your issue without more details and evidence,

Yes, I tried with 120 of expiration and 60 of qualify, but the problem persists. I had attached the logs on Pastebin, but it seems they have expired. I don’t have the firewall configured, so it’s all without a firewall (no iptables rules, no ufw, no VM firewall).

This is what I see on sngrep when the call is rejected (when it says ‘all circuits are temporarily busy’).

Additionally, from what I understand, Vodafone VOIP allows ONLY 1 concurrent connection to the trunk; if 2 PJSIP instances were to connect simultaneously, neither would work. However, I have only configured one PJSIP SIP Trunk on FreePBX, so I don’t think that’s the issue.

Can we see your Outbound Routes settings screenshot…
403 coming from Sip Trunk side that means something not right or not liked…

What do you think I should try? I contacted Vodafone support, but it’s practically useless. They suggested changing the modem, which I agreed to, and I’m waiting for the new one to arrive. However, from what I understand, it’s not the Vodafone modem that handles the calls but rather Vodafone’s servers.

voip1.fixed.vodafone.it
ims.vodafone.it

Try without + at Route CID and select Emergency too.

Is that same Server ?

No, this is local server because Vodafone Trunk accept only local connections

I saw somewhere this Sip Trunk still use G729 codec :slight_smile:
So, Go to Sip Trunk settings and select default Codect to be G729 and same change you can apply from Asterisk settings tab. ( Settings → Asterisk SIP Settings → Codecs → g729 )
Sip Trunk → PjSip Settings → Codecs Tab → Select G729 )


I don’t know if adding the G729 codec or removing the + in Route CID and also selecting Emergency makes the problem less persistent. I can make calls more often, although it still disconnects after 5-10 minutes. However, at least it can reconnect to the trunk 1-2 minutes after disconnecting. Maybe we are close to a solution.

You have to dig more deeply if call(s) disconnecting after 5-10 min that could be your network and Firewall issue (Sip ALG or etc…) You have to make full PCAP and capture Begin-to-End then you can see why your call is disconnecting. Maybe your PBX or Sip Trunk is not Responding for OPTIONS?

It seems to me that I read somewhere about this ‘OPTIONS’ thing, but I’m not very knowledgeable about it, sorry. What does it mean? How can I check and possibly resolve it?