FreePBX and SIP trunk: Outbound calls always busy

Hello there,

after trying for a few days to debug the problem for myself, I find myself completely at a loss. I tried to configure a FreePBX installation (based on raspbx, so Asterisk 13.26) to use a SIP trunk (from sipgate de).

Inbound calls work, outbound calling always fails. The log always looks something like this:

[2019-06-13 19:39:55] VERBOSE[24640][C-00000065] app_stack.c: Spawn extension (from-pstn, 08003301000, 1) exited non-zero on ‘PJSIP/sipgate-000000aa’
[2019-06-13 19:39:55] VERBOSE[24640][C-00000065] app_stack.c: PJSIP/sipgate-000000aa Internal Gosub(func-apply-sipheaders,s,1(1)) complete GOSUB_RETVAL=
[2019-06-13 19:39:55] VERBOSE[24640][C-00000065] app_dial.c: Called PJSIP/08003301000@sipgate
[2019-06-13 19:39:55] VERBOSE[24640][C-00000065] app_dial.c: Everyone is busy/congested at this time (1:0/0/1)
[2019-06-13 19:39:55] VERBOSE[24640][C-00000065] pbx.c: Executing [s@macro-dialout-trunk:26] NoOp(“PJSIP/20-000000a9”, “Dial failed for some reason with DIALSTATUS = CHANUNAVAIL and HANGUPCAUSE = 1”) in new stack
[2019-06-13 19:39:55] VERBOSE[24640][C-00000065] pbx.c: Executing [s@macro-dialout-trunk:27] GotoIf(“PJSIP/20-000000a9”, “0?continue,1:s-CHANUNAVAIL,1”) in new stack

(I can provide more lines but those seem the most relevant to me - as a novice Asterisk user)

I - of course - also turned on the pjsip logging on the console:

<--- Transmitting SIP request (1108 bytes) to UDP:217.10.68.150:5060 --->
INVITE sip:sipconnect.sipgate.de SIP/2.0
Via: SIP/2.0/UDP 172.20.0.250:5060;rport;branch=z9hG4bKPj0aded5b3-b217-452c-    9e06-2631d6d9388c
From: <sip:<accountname>@sipconnect.sipgate.de>;tag=1d5d535f-3668-4198-b3e5-54d2a7479da8
To: <sip:[email protected]>
Contact: <sip:<myaccount>@172.20.0.250:5060>
Call-ID: 32747040-e035-47ee-8644-9230169c6b22
CSeq: 15756 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, REFER, MESSAGE
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
P-Asserted-Identity: "me" <sip:<mynumber>@sipconnect.sipgate.de>
Route: <sip:[email protected]:5060>
Max-Forwards: 70
User-Agent: FPBX-14.0.11(13.26.0)
Content-Type: application/sdp
Content-Length:   292

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

<--- Received SIP response (418 bytes) from UDP:217.10.68.150:5060 --->
SIP/2.0 404 Not found (no match)
Via: SIP/2.0/UDP 172.20.0.250:5060;received=<my IP>;rport=65322;branch=z9hG4bKPj0aded5b3-    b217-452c-9e06-2631d6d9388c
From: <sip:<myaccount>@sipconnect.sipgate.de>;tag=1d5d535f-3668-4198-b3e5-54d2a7479da8
To: <sip:[email protected]>;tag=59090977d38d1697fd81fd97f073a25d.0c69
Call-ID: 32747040-e035-47ee-8644-9230169c6b22
CSeq: 15756 INVITE
Content-Length: 0

The phone number is a customer hotline from Deutsche Telekom which definitely is not busy and also reachable. I configured Linphone with the trunk account in parallel just to be sure the trunk account works - and it does. The SIP messages in the Linphone debug window are identical except for two things, as far as I can see (the following call works from Linphone):

INVITE sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 172.20.0.248:5060;branch=z9hG4bK.d2zIAW~GF;rport
From: <sip:<myaccount>@sipconnect.sipgate.de>;tag=VYvy0zFTp
To: sip:[email protected]
CSeq: 21 INVITE
Call-ID: Z-VHVSo9kQ
Max-Forwards: 70
Supported: replaces, outbound
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO, UPDATE
Content-Type: application/sdp
Content-Length: 686
Contact: <sip:<myaccount>@<my IP>:65320;transport=udp>;+sip.instance="    <urn:uuid:98caef36-4e82-4f4c-9c6c-455a506dc76b>"
User-Agent: Linphone/3.12.0 (belle-sip/1.6.3)
Proxy-Authorization:  Digest realm="sipconnect.sipgate.de", nonce="<nonce>", username="<myaccount>",  uri="sip:[email protected]", response="313209faaf9c6b146ad6578561380960"

1.) The Contact header line. I tried playing around with the PJSIP settings to force it to reflect my public IP or sipconnect dot sipgate dot de, as some Google hits suggested. Didn’t change anything.

2.) The Proxy-Authorization header is not present when FreePBX makes the call (at this point, I’m not sure if this is relevant and how to change it).

Any ideas are greatly appreciated! Thank you!

In Asterisk SIP Settings → NAT Settings:
External Address: (your public IPv4 address)
Local Networks: 172.20.0.0 / 24
You must restart (not just reload) Asterisk for these to take effect.

That will appear automatically after you fix the trunk settings enough so sipgate requests authentication .

Here is my guess: (If you still have trouble, post screenshots of your old and new trunk settings, and another SIP trace.)

On the General tab, leave settings as they are (you wouldn’t receive calls if they were wrong).
On the Advanced tab:

Outbound Proxy: (blank)
Contact User: (blank)
From Domain: sipconnect.sipgate.de
From User: (myaccount)
Client URI: (blank)
Server URI: (blank)
Media Address: (blank)
AOR: (blank)
AOR Contact: (blank)
Match (Permit): (blank)
Send RPID/PAI: No

If these settings cause registration to fail, post failing REGISTER request from FreePBX and working one from Linphone.

If you can still register but incoming doesn’t work anymore, post a log of that.

That’s incorrect.

That is correct. That is a huge difference as that header is where they will be looking for the destination user (DID) and in your first one there is none.

So if you configure the provider creds on your softphone and they work fine but you try from your PBX and they fail your PBX is not configured correctly.

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