Hello everyone,
I’m facing a persistent issue with my FreePBX installation and I’m hoping someone can help. I’m trying to configure an outbound PJSIP trunk to Twilio.
The Situation:
- My WebRTC client (SIP.js) connects perfectly to Asterisk via WSS on port 57003.
- My extension 101 authenticates successfully (I can see “Result: SUCCESS” in the logs).
- The call from my extension correctly enters my custom dialplan context.
The Problem:
When the dialplan executes the Dial()
command, it fails every time with the same error, which I can see in the Asterisk CLI (asterisk -rvvv
):
Connected to Asterisk 18.20.2 currently running on freepbx (pid = 29455)
== WebSocket connection from ‘82.85.110.51:62633’ for protocol ‘sip’ accepted using version ‘13’
== Using SIP RTP Audio TOS bits 184
== Using SIP RTP Audio TOS bits 184 in TCLASS field.
== Using SIP RTP Audio CoS mark 5
== DTLS ECDH initialized (automatic), faster PFS enabled
[2025-06-19 12:12:57] ERROR[3070]: res_pjsip.c:993 ast_sip_create_dialog_uac: Endpoint ‘Trunk_CRM_Italia’: Could not create dialog to invalid URI ‘Trunk_CRM_Italia’. Is endpoint registered and reachable?
[2025-06-19 12:12:57] ERROR[3070]: chan_pjsip.c:2698 request: Failed to create outgoing session to endpoint ‘Trunk_CRM_Italia’
[2025-06-19 12:12:57] NOTICE[9872][C-0000000a]: app_dial.c:2719 dial_exec_full: Unable to create channel of type ‘PJSIP’ (cause 3 - No route to destination)
== Everyone is busy/congested at this time (1:0/0/1)
== Spawn extension (from-webrtc, 3317482208, 3) exited non-zero on ‘PJSIP/101-00000009’
[2025-06-19 12:22:58] ERROR[9468]: res_http_websocket.c:567 ws_safe_read: Error reading from web socket: No route to host
[2025-06-19 12:22:58] ERROR[29491]: iostream.c:552 ast_iostream_close: SSL_shutdown() failed: error:00000005:lib(0):func(0):DH lib, Underlying BIO error: Bad file descriptor
== WebSocket connection from ‘82.85.110.51:59160’ forcefully closed due to fatal write error
freepbx*CLI>
– Executing [3317482208@from-webrtc:1] NoOp(“PJSIP/101-…”)
– Executing [3317482208@from-webrtc:2] Dial(“PJSIP/101-…”, “PJSIP/3317482208@Trunk_CRM_Italia,60”)
ERROR[…]: res_pjsip.c: Endpoint ‘Trunk_CRM_Italia’: Could not create dialog to invalid URI ‘Trunk_CRM_Italia’. Is endpoint registered and reachable?
NOTICE[…]: app_dial.c: Unable to create channel of type ‘PJSIP’ (cause 3 - No route to destination)
What We’ve Tried (and didn’t work):
- Creating the Trunk (
Trunk_CRM_Italia
) via the FreePBX GUI and carefully setting all parameters in the General and Advanced tabs (includingSIP Server
,Server URI
, andFrom Domain
). The setting seems to be ignored after an “Apply Config”. - Manually creating the trunk configuration in all possible custom files (
pjsip_custom.conf
,pjsip.endpoint_custom.conf
, etc.). The configuration seems to be ignored by Asterisk. - Forcing the WSS transport settings directly into the FreePBX database via
fwconsole mysql
. This did not solve the trunk issue. - Reinstalling core modules (
core
,sipsettings
) usingfwconsole
. This fixed afwconsole reload
hang, but the trunk problem persists.
It seems like my FreePBX installation is not correctly generating or loading the PJSIP configuration for this specific trunk endpoint, even though the Asterisk service is running fine.
Does anyone have any idea what could cause FreePBX to ignore the Server URI
/ AOR
for a specific PJSIP endpoint? Is there a known bug or another file I should be checking?
My versions are:
- FreePBX: 16.0.40.13
- Asterisk: 18.20.2
Thank you for any help!