Outgoing calls using trunk mentions 'All circuits are busy now'

My internal calls are working but external external calls not working and mentions ‘All circuits are busy now’, in asterisk cli prompt I can see res_pjsip_header_funcs.c:670 remove_header: No headers had been previously added to this session., kindly guide how to fix as in GUI no such option was there

The call is getting connected to the SIP server in private network .To mention I am able to connect to the SIP provider using SIP client

pjsip logger o/p below
<— Transmitting SIP response (334 bytes) to UDP:x.x.x.x:x —>
SIP/2.0 100 Trying
Via: SIP/2.0/UDP x.x.x.x:x;rport=x;received=x.x.x.x;branch=x
Call-ID: x
From: sip:[email protected];tag=x
To: sip:[email protected]
CSeq: x INVITE
Server: FPBX-16.0.40.8(19.8.1)
Content-Length: 0

[Jun 16 17:48:12] ERROR[4328]: res_pjsip_header_funcs.c:670 remove_header: No headers had been previously added to this session.
<— Transmitting SIP response (583 bytes) to UDP:x.x.x.x:x —>
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP x.x.x.x:x;rport=x;received=x.x.x.x;branch=x
Call-ID: x
From: sip:[email protected];tag=x
To: sip:[email protected];tag=x
CSeq: x INVITE
Server: FPBX-16.0.40.8(19.8.1)
Contact: sip:x:x
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
P-Asserted-Identity: “CID:x” sip:[email protected]
Content-Length: 0

<— Transmitting SIP request (1040 bytes) to UDP:x.x.x.x:5060 —>
INVITE sip:x SIP/2.0
Via: SIP/2.0/UDP x.x.x.x:5060;rport;branch=x
From: sip:[email protected];tag=x
To: sip:[email protected]
Contact: sip:[email protected]:5060
Call-ID: x
CSeq: x INVITE
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub, histinfo
Session-Expires: 1800
Min-SE: 90
Route: sip:[email protected]:5060
Max-Forwards: 70
User-Agent: FPBX-16.0.40.8(19.8.1)
Content-Type: application/sdp
Content-Length: 339

v=0
o=- x x IN IP4 x.x.x.x
s=Asterisk
c=IN IP4 x.x.x.x
t=0 0
m=audio x RTP/AVP 0 8 3 111 9 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:111 G726-32/8000
a=rtpmap:9 G722/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

<— Received SIP response (385 bytes) from UDP:x.x.x.x:5060 —>
SIP/2.0 100 Trying
Call-ID: x
Via: SIP/2.0/UDP x.x.x.x:5060;received=x.x.x.x;branch=x;rport=x
To: sip:[email protected]
From: sip:[email protected]:5060;tag=x
CSeq: x INVITE
Date: Sun, 16 Jun 2024 12:18:12 GMT
Content-Length: 0

<— Received SIP response (508 bytes) from UDP:x.x.x.x:5060 —>
SIP/2.0 407 Proxy Authentication Required
Call-ID: x
Via: SIP/2.0/UDP x.x.x.x:5060;received=x.x.x.x;branch=x;rport=x
To: sip:[email protected];tag=x
From: sip:[email protected]:5060;tag=x
CSeq: x INVITE
Date: Sun, 16 Jun 2024 12:18:12 GMT
Warning: 399 mpa15.org “IP association no match, user not registered”
Content-Length: 0

<— Transmitting SIP request (442 bytes) to UDP:x.x.x.x:5060 —>
ACK sip:x SIP/2.0
Via: SIP/2.0/UDP x.x.x.x:5060;rport;branch=x
From: sip:[email protected];tag=x
To: sip:[email protected];tag=x
Call-ID: x
CSeq: x ACK
Route: sip:[email protected]:5060
Max-Forwards: 70
User-Agent: FPBX-16.0.40.8(19.8.1)
Content-Length: 0

[Jun 16 17:48:12] WARNING[4328]: res_pjsip_outbound_authenticator_digest.c:507 digest_create_request_with_auth: Endpoint: ‘TRUNK01’: No auth objects matching realm(s) ‘’ from challenge found.
<— Transmitting SIP response (896 bytes) to UDP:x.x.x.x:x —>
SIP/2.0 183 Session Progress
Via: SIP/2.0/UDP x.x.x.x:x;rport=x;received=x.x.x.x;branch=x
Call-ID: x
From: sip:[email protected];tag=x
To: sip:[email protected];tag=x
CSeq: x INVITE
Server: FPBX-16.0.40.8(19.8.1)
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Contact: sip:x:x
P-Asserted-Identity: “CID:x” sip:[email protected]
Content-Type: application/sdp
Content-Length: 270

v=0
o=- x x IN IP4 x.x.x.x
s=Asterisk
c=IN IP4 x.x.x.x
t=0 0
m=audio x RTP/AVP 0 8 3 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

<— Transmitting SIP response (585 bytes) to UDP:x.x.x.x:x —>
SIP/2.0 503 Service Unavailable
Via: SIP/2.0/UDP x.x.x.x:x;rport=x;received=x.x.x.x;branch=x
Call-ID: x
From: sip:[email protected];tag=x
To: sip:[email protected];tag=x
CSeq: x INVITE
Server: FPBX-16.0.40.8(19.8.1)
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Reason: Q.850;cause=34
P-Asserted-Identity: “CID:x” sip:[email protected]
Content-Length: 0

<— Transmitting SIP response (585 bytes) to UDP:x.x.x.x:x —>
SIP/2.0 503 Service Unavailable
Via: SIP/2.0/UDP x.x.x.x:x;rport=x;received=x.x.x.x;branch=x
Call-ID: x
From: sip:[email protected];tag=x
To: sip:[email protected];tag=x
CSeq: x INVITE
Server: FPBX-16.0.40.8(19.8.1)
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Reason: Q.850;cause=34
P-Asserted-Identity: “CID:x” sip:[email protected]
Content-Length: 0

<— Received SIP request (378 bytes) from UDP:x.x.x.x:x —>
ACK sip:x.x.x.x:5060 SIP/2.0
Via: SIP/2.0/UDP x.x.x.x:x;rport;x;branch=x
From: sip:[email protected];tag=x
To: sip:[email protected];tag=x
Call-ID: x
CSeq: x ACK
Max-Forwards: 70
User-Agent: x
Content-Length: 0

The remove_header message is not an error.

“All circuits busy now” is practically any failure for a call that gets as far as trying to call the destination, so is of no use without detailed logging. Please look at recent threads, for examples of how to debug this.

Typical causes, are:

  • failure confirm connectivity (qualify);
  • authentication failure;
  • unacceptable called number format;
  • unacceptable caller ID;
  • you’ve exceeded your contracted number of simultaneous calls;
  • the provider’s network has too many concurrent calls.

Thanks for your reply, I am additionly getting WARNING[1757]: res_pjsip_outbound_authenticator_digest.c:507 d igest_create_request_with_auth: Endpoint: ‘TRUNK01’: No auth objects matching re alm(s) ‘’ from challenge found. but my sip trunk shows as online when seen in the asterisk info page , what exactly is the realm ? as I was able to connect using the provided details like hostname,user/pass on a SIP client

That message often relates to a misconfigured outbound proxy. Again you are not providing enough information to allow people to do more than guess.

Realm identifies which set of credentials are needed.

To show as online it is sufficient for the provider to respond with a request for authentication, and that message indicates you are getting such requests.

With chan_pjsip, outbound proxies are treated as though they had come directly from a Record-Route header, and, in many cases, they need \;lr appending, to indicate that the request URI is the final one, not the proxy. Often they also need \;hide appending, to suppress the Route header that would normally happen. The backslashes are because ; is special to Asterisk, and are not part of the SIP protocol.

<— Transmitting SIP response (334 bytes) to UDP:x.x.x.x:x —>
SIP/2.0 100 Trying
Via: SIP/2.0/UDP x.x.x.x:x;rport=x;received=x.x.x.x;branch=x
Call-ID: x
From: sip:[email protected];tag=x
To: sip:[email protected]
CSeq: x INVITE
Server: FPBX-16.0.40.8(19.8.1)
Content-Length: 0

[Jun 16 17:48:12] ERROR[4328]: res_pjsip_header_funcs.c:670 remove_header: No headers had been previously added to this session.
<— Transmitting SIP response (583 bytes) to UDP:x.x.x.x:x —>
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP x.x.x.x:x;rport=x;received=x.x.x.x;branch=x
Call-ID: x
From: sip:[email protected];tag=x
To: sip:[email protected];tag=x
CSeq: x INVITE
Server: FPBX-16.0.40.8(19.8.1)
Contact: sip:x:x
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
P-Asserted-Identity: “CID:x” sip:[email protected]
Content-Length: 0

<— Transmitting SIP request (1040 bytes) to UDP:x.x.x.x:5060 —>
INVITE sip:x SIP/2.0
Via: SIP/2.0/UDP x.x.x.x:5060;rport;branch=x
From: sip:[email protected];tag=x
To: sip:[email protected]
Contact: sip:[email protected]:5060
Call-ID: x
CSeq: x INVITE
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub, histinfo
Session-Expires: 1800
Min-SE: 90
Route: sip:[email protected]:5060
Max-Forwards: 70
User-Agent: FPBX-16.0.40.8(19.8.1)
Content-Type: application/sdp
Content-Length: 339

v=0
o=- x x IN IP4 x.x.x.x
s=Asterisk
c=IN IP4 x.x.x.x
t=0 0
m=audio x RTP/AVP 0 8 3 111 9 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:111 G726-32/8000
a=rtpmap:9 G722/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

<— Received SIP response (385 bytes) from UDP:x.x.x.x:5060 —>
SIP/2.0 100 Trying
Call-ID: x
Via: SIP/2.0/UDP x.x.x.x:5060;received=x.x.x.x;branch=x;rport=x
To: sip:[email protected]
From: sip:[email protected]:5060;tag=x
CSeq: x INVITE
Date: Sun, 16 Jun 2024 12:18:12 GMT
Content-Length: 0

<— Received SIP response (508 bytes) from UDP:x.x.x.x:5060 —>
SIP/2.0 407 Proxy Authentication Required
Call-ID: x
Via: SIP/2.0/UDP x.x.x.x:5060;received=x.x.x.x;branch=x;rport=x
To: sip:[email protected];tag=x
From: sip:[email protected]:5060;tag=x
CSeq: x INVITE
Date: Sun, 16 Jun 2024 12:18:12 GMT
Warning: 399 mpa15.org “IP association no match, user not registered”
Content-Length: 0

<— Transmitting SIP request (442 bytes) to UDP:x.x.x.x:5060 —>
ACK sip:x SIP/2.0
Via: SIP/2.0/UDP x.x.x.x:5060;rport;branch=x
From: sip:[email protected];tag=x
To: sip:[email protected];tag=x
Call-ID: x
CSeq: x ACK
Route: sip:[email protected]:5060
Max-Forwards: 70
User-Agent: FPBX-16.0.40.8(19.8.1)
Content-Length: 0

[Jun 16 17:48:12] WARNING[4328]: res_pjsip_outbound_authenticator_digest.c:507 digest_create_request_with_auth: Endpoint: ‘TRUNK01’: No auth objects matching realm(s) ‘’ from challenge found.
<— Transmitting SIP response (896 bytes) to UDP:x.x.x.x:x —>
SIP/2.0 183 Session Progress
Via: SIP/2.0/UDP x.x.x.x:x;rport=x;received=x.x.x.x;branch=x
Call-ID: x
From: sip:[email protected];tag=x
To: sip:[email protected];tag=x
CSeq: x INVITE
Server: FPBX-16.0.40.8(19.8.1)
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Contact: sip:x:x
P-Asserted-Identity: “CID:x” sip:[email protected]
Content-Type: application/sdp
Content-Length: 270

v=0
o=- x x IN IP4 x.x.x.x
s=Asterisk
c=IN IP4 x.x.x.x
t=0 0
m=audio x RTP/AVP 0 8 3 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

<— Transmitting SIP response (585 bytes) to UDP:x.x.x.x:x —>
SIP/2.0 503 Service Unavailable
Via: SIP/2.0/UDP x.x.x.x:x;rport=x;received=x.x.x.x;branch=x
Call-ID: x
From: sip:[email protected];tag=x
To: sip:[email protected];tag=x
CSeq: x INVITE
Server: FPBX-16.0.40.8(19.8.1)
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Reason: Q.850;cause=34
P-Asserted-Identity: “CID:x” sip:[email protected]
Content-Length: 0

<— Transmitting SIP response (585 bytes) to UDP:x.x.x.x:x —>
SIP/2.0 503 Service Unavailable
Via: SIP/2.0/UDP x.x.x.x:x;rport=x;received=x.x.x.x;branch=x
Call-ID: x
From: sip:[email protected];tag=x
To: sip:[email protected];tag=x
CSeq: x INVITE
Server: FPBX-16.0.40.8(19.8.1)
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Reason: Q.850;cause=34
P-Asserted-Identity: “CID:x” sip:[email protected]
Content-Length: 0

Thanks for the reply, here is the pjsip log o/p

<— Received SIP request (378 bytes) from UDP:x.x.x.x:x —>
ACK sip:x.x.x.x:5060 SIP/2.0
Via: SIP/2.0/UDP x.x.x.x:x;rport;x;branch=x
From: sip:[email protected];tag=x
To: sip:[email protected];tag=x
Call-ID: x
CSeq: x ACK
Max-Forwards: 70
User-Agent: x
Content-Length: 0

According to this, you are sending the call back to yourself. That’s probably the result of over-redacting. If you redact it is important to distinguish between different addresses, and between different classes of address (e.g. routable and non-routable).

Simiarly call-IDs and tag distinctions need to be retained. tags should not contain anything sensitive, and I don’t think that pjsip originated call-IDs do, eitehr.

You seem to be unknown to whatever x.x.x.x refers to on the preceding Received SIP response line. I guess one of the x.x.x.x’s isn’t what is registered with them.

Also, I note that they don’t actually include the line with the realm setting, which is a protocol violation: RFC 3261: SIP: Session Initiation Protocol (Proxy-Authenticate is mandatory in 407 responses). It looks like a bodged attempt to disguise the fact that you are unknown to it.

The wording could mean that you need to register dynamically, rather than statically, before making outbound calls, although, strictly speaking, REGISTER is only about telling the provider where to send incoming calls.

I’m not sure if the use of 407 means you’ve really hit a proxy, or whether that is all part of their non-standard way of rejecting unknown users.

Hi, I had the exact issue with my SIP trunk provider (local ISP in UAE)

I don’t familiar with your provider, but maybe try to set this parameters (which helped me) will be the solution

The SIP server is basically operated at our private network and connected using private IP series, I have provided details as the same is getting fed from GUI and extension getting connected to SIP server, issue in the logs, my concern is what other information can be passed on to fix the issue as mentioned earlier. As mentioned I am able to connect to the SIP line using SIP client. Thanks again

Thanks will give a try

After adding the mentioned, you need to see that your pjsip trunk is aveliable (by asterisk command pjsip show endpoints) and also that it registered (by asterisk command pjsip show registrations

As a guess, try setting for your trunk From User to the same value you have in Username and From Domain to the same value you have in SIP Server.

If no luck, please post all the settings in the mobile client and we can give you the equivalent for FreePBX. Please don’t use “x”; use these names to represent values where applicable:
myusername
myaccountnumber
mypassword
myphonenumber
mydisplayname
mye164phonenumber
providerdomainname
provideroutboundproxydomain
provideroutboundproxyaddress
providerportnumber

If there are other parameters required by the provider, choose a suitable name so we understand what it represents.

Hello all I am trying to utilize the trunk, internal call works fine and set dialed number format in outbound routes. When dialed a particular number am getting error ‘No headers had been previously added to this session’, I tried certain fixes on GUI option but it didn’t work.

Here is the PJSIP log output(certain entries renamed in log with representative names) , thanks once again

— Transmitting SIP response (333 bytes) to Client SIP client for [Device Name] (UDP:<redacted_ip>:19876) —>
SIP/2.0 100 Trying
Via: SIP/2.0/UDP Client SIP client for [Device Name] (<redacted_ip>:19876);rport=19876;received=<redacted_ip>;branch=z9hG4bK-113p6779639964609960418r
Call-ID: 110e1091719186854338650k87735rmwp
From: <sip:<redacted_username>@<internal_ip>>;tag=112g7871252155588027224m
To: <sip:<redacted_username>@<internal_ip>>;tag=df61aa0f-2442-46dd-a8d0-1d84516a2308
CSeq: 2425 INVITE
Server: FPBX-16.0.40.8(19.8.1)
Content-Length: 0

[Jun 17 17:53:46] ERROR[16422]: res_pjsip_header_funcs.c:670 remove_header: No headers had been previously added to this session.
— Transmitting SIP request (1108 bytes) to Server (UDP:10.2.8.67:5060) —>
INVITE sip:<redacted_username>@<domain_name> SIP/2.0
Via: SIP/2.0/UDP Client SIP client for [Device Name] (<redacted_ip>:5060);rport;branch=z9hG4bKPje76cbb96-92dd-4e59-91f9-149c8042e058
From: <sip:<redacted_phone_number>@<domain_name>>;tag=7bd9a6d7-f838-4629-9247-57379619b756
To: <sip:<redacted_username>@<domain_name>>
Contact: <sip:<redacted_phone_number>@(<redacted_ip>:5060)>
Call-ID: 70a2d3c8-819a-44db-b3d0-22a9a38aff52
CSeq: 23496 INVITE
Route: sip:Proxy_address;lr
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
P-Asserted-Identity: <sip:<redacted_phone_number>@<domain_name>>
Max-Forwards: 70
User-Agent: FPBX-16.0.40.8(19.8.1)
Content-Type: application/sdp
Content-Length: 341

v=0
o=- 2134215374 2134215374 IN IP4 <redacted_ip>
s=Asterisk
c=IN IP4 <redacted_ip>
t=0 0
m=audio 16146 RTP/AVP 0 8 3 111 9 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:111 G726

This is not an error when using FreePBX. FreePBX simply blindly tries to remove the header without checking if it already exists.

Also, please don’t use angle brackets both literally and to delimit meta names. It’s confusing.

Very strange. I would expect to see the destination phone number after sip: (some providers allow you to call another user on their system by specifying their account number, but it would usually be all numeric).

Please make a test call to a number you don’t have to redact (for example, a local McDonald’s) and post the resulting INVITE.

Also, post the working settings in your mobile app, as requested earlier.

Thanks the issue is fixed of outbound calls currently by tuning traffic in firewall

issue fixed by tuning firewall traffic

Be sure that you have your correct caller ID number in the caller id field. I was having this issue and this finally fixed my problem.

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