Pjsip trunk always "all circuits are busy now"

This is a new FreePBX server. I have a chan_sip trunk working but wanted to try pjsip. The trunk is registering with my provider, voip.ms, but, when I try to place any outgoing call, I always get an “all circuits are busy now” message.

I know this topic has been covered by I cannot find anything that seems to match.

I’d appreciate any debugging suggestions.

I’m not a VoIP.ms customer, but found
https://wiki.voip.ms/article/FreePBX_/_PBX_in_a_Flash#General_Settings

Based on that, for pjsip, confirm that you have:
From User: (same value as you have for Username)
Authentication: Outbound
Send RPID/PAI: Send Remote-Party-ID header
Trust RPID/PAI: Yes

If you still have trouble, at the Asterisk command prompt, type
pjsip set logger on
and attempt an outgoing call. Report whether INVITE requests are going out and what replies, if any are being received.

1 Like

The settings in that link are for a chan_sip trunk and I have that working.

I made the changes you suggested, set logger on and still get the “alll circuits are busy” message. Here’s what I get:

<--- Transmitting SIP response (447 bytes) to UDP:96.9.90.28:7617 --->
SIP/2.0 487 Request Terminated
Via: SIP/2.0/UDP 96.9.90.28:7617;rport=7617;received=96.9.90.28;branch=z9hG4bK.bLHjfngy4
Call-ID: kC1YTOALn8
From: <sip:[email protected]>;tag=BaXtn3QHA
To: <sip:[email protected]>;tag=f8715603-2492-4654-8df8-be5f375ba936
CSeq: 21 INVITE
Server: FPBX-14.0.11(13.22.0)
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Content-Length:  0


    -- Executing [h@from-internal:1] Macro("PJSIP/601-0000006f", "hangupcall") in new stack
    -- Executing [s@macro-hangupcall:1] GotoIf("PJSIP/601-0000006f", "1?theend") in new stack
    -- Goto (macro-hangupcall,s,3)
    -- Executing [s@macro-hangupcall:3] ExecIf("PJSIP/601-0000006f", "0?Set(CDR(recordingfile)=)") in new stack
    -- Executing [s@macro-hangupcall:4] NoOp("PJSIP/601-0000006f", " montior file= ") in new stack
    -- Executing [s@macro-hangupcall:5] GotoIf("PJSIP/601-0000006f", "1?skipagi") in new stack
    -- Goto (macro-hangupcall,s,7)
    -- Executing [s@macro-hangupcall:7] Hangup("PJSIP/601-0000006f", "") in new stack
  == Spawn extension (macro-hangupcall, s, 7) exited non-zero on 'PJSIP/601-0000006f' in macro 'hangupcall'
  == Spawn extension (from-internal, h, 1) exited non-zero on 'PJSIP/601-0000006f'
<--- Transmitting SIP response (447 bytes) to UDP:96.9.90.28:7617 --->
SIP/2.0 487 Request Terminated<--- Transmitting SIP response (447 bytes) to UDP:96.9.90.28:7617 --->
SIP/2.0 487 Request Terminated
Via: SIP/2.0/UDP 96.9.90.28:7617;rport=7617;received=96.9.90.28;branch=z9hG4bK.bLHjfngy4
Call-ID: kC1YTOALn8
From: <sip:[email protected]>;tag=BaXtn3QHA
To: <sip:[email protected]>;tag=f8715603-2492-4654-8df8-be5f375ba936
CSeq: 21 INVITE
Server: FPBX-14.0.11(13.22.0)
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Content-Length:  0


    -- Executing [h@from-internal:1] Macro("PJSIP/601-0000006f", "hangupcall") in new stack
    -- Executing [s@macro-hangupcall:1] GotoIf("PJSIP/601-0000006f", "1?theend") in new stack
    -- Goto (macro-hangupcall,s,3)
    -- Executing [s@macro-hangupcall:3] ExecIf("PJSIP/601-0000006f", "0?Set(CDR(recordingfile)=)") in new stack
    -- Executing [s@macro-hangupcall:4] NoOp("PJSIP/601-0000006f", " montior file= ") in new stack
    -- Executing [s@macro-hangupcall:5] GotoIf("PJSIP/601-0000006f", "1?skipagi") in new stack
    -- Goto (macro-hangupcall,s,7)
    -- Executing [s@macro-hangupcall:7] Hangup("PJSIP/601-0000006f", "") in new stack
  == Spawn extension (macro-hangupcall, s, 7) exited non-zero on 'PJSIP/601-0000006f' in macro 'hangupcall'
  == Spawn extension (from-internal, h, 1) exited non-zero on 'PJSIP/601-0000006f'
<--- Transmitting SIP response (447 bytes) to UDP:96.9.90.28:7617 --->
SIP/2.0 487 Request Terminated<--- Transmitting SIP response (447 bytes) to UDP:96.9.90.28:7617 --->
SIP/2.0 487 Request Terminated
Via: SIP/2.0/UDP 96.9.90.28:7617;rport=7617;received=96.9.90.28;branch=z9hG4bK.bLHjfngy4
Call-ID: kC1YTOALn8
From: <sip:[email protected]>;tag=BaXtn3QHA
To: <sip:[email protected]>;tag=f8715603-2492-4654-8df8-be5f375ba936
CSeq: 21 INVITE
Server: FPBX-14.0.11(13.22.0)
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Content-Length:  0


    -- Executing [h@from-internal:1] Macro("PJSIP/601-0000006f", "hangupcall") in new stack
    -- Executing [s@macro-hangupcall:1] GotoIf("PJSIP/601-0000006f", "1?theend") in new stack
    -- Goto (macro-hangupcall,s,3)
    -- Executing [s@macro-hangupcall:3] ExecIf("PJSIP/601-0000006f", "0?Set(CDR(recordingfile)=)") in new stack
    -- Executing [s@macro-hangupcall:4] NoOp("PJSIP/601-0000006f", " montior file= ") in new stack
    -- Executing [s@macro-hangupcall:5] GotoIf("PJSIP/601-0000006f", "1?skipagi") in new stack
    -- Goto (macro-hangupcall,s,7)
    -- Executing [s@macro-hangupcall:7] Hangup("PJSIP/601-0000006f", "") in new stack
  == Spawn extension (macro-hangupcall, s, 7) exited non-zero on 'PJSIP/601-0000006f' in macro 'hangupcall'
  == Spawn extension (from-internal, h, 1) exited non-zero on 'PJSIP/601-0000006f'
<--- Transmitting SIP response (447 bytes) to UDP:96.9.90.28:7617 --->
SIP/2.0 487 Request Terminated

The log segment you posted starts after the call failed and is not useful.

In the FreePBX GUI, go to Reports -> Asterisk Logfiles
and search for a line containing “Called PJSIP/” (without the quotes). This should be followed by the relevant INVITEs and responses. The previous 50 lines may also be useful. Instead of posting a long log directly, paste it at pastebin.freepbx.org and post the link here.

I do not find the string “Called PJSIP” in the file (without the quotes). I have issued the pjsip set logger on and then viewed the full logfile. No string “Called PJSIP” in the file after placing a call.

Very strange. Try dialing a pjsip extension (such as your own 601), refresh the log display and see whether Called PJSIP appears. If not, possibly something is wrong with the logging – do the timestamps agree with the current time?

Retry the outgoing call. Does Called appear in the log? If so, perhaps it is routing to a SIP (chan_sip) trunk instead of the pjsip trunk. Or, something could be wrong with the Outbound Route. The call attempt should start with a line containing
Setting global variable 'SIPDOMAIN' to
If you can find that, paste from there to the end.

There was a lot in the log before the end. I hope I captured enough.

https://pastebin.freepbx.org/view/af610abd

Your log shows that the trunk is disabled. This could have been done manually – check that the General tab for the trunk has Disable Trunk set to No. Or, it could be because of registration or qualify failure.
Does Reports -> Asterisk Info -> Registries show the trunk as registered?
Does Reports -> Asterisk Info -> Peers show the endpoint as avail?

I didn’t copy the right section. Try this

https://pastebin.freepbx.org/view/00347f20

Everything is registered okay now.

No, it must have appeared to be unreachable – log line 68 shows it disabled and line 77 shows it coming reachable again.

Possibly, you have a registration conflict – be sure that you don’t have another trunk or device trying to register to the same sub-account.

You could try a test setting Qualify Frequency to 0 (disables qualify), confirm that Registries show registered and Peers shows avail, then try another call.

Yes. I do have another trunk that registers to the same sub-account but it is disabled. Maybe it just becomes unavailable to outbound routes but still registers.

It is 1:45 AM so tomorrow I’ll create a new sub-account and work from there.

Thanks so much. I’ve learned a lot from you.

I couldn’t wait. I set up a new sub-account and pointed the pjsip trunk to that. It works!!!

I’ll do some more testing tomorrow

I think we can close this out. The problem is gone.

This solved the problem

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.