Open JoseGoncalves opened 1 month ago
Hi @JoseGoncalves ,
Can you make the dialplan change on your systemV17 system and let us know its working with PJSIP or not?
Change details
[macro-dialout-enum]
exten => s,n,Set(TRYDIAL=${REPLACE(TRYDIAL,/,:)}) ; for replace / with :
exten => s,n,Dial(PJSIP/${FROMEXTEN}/${TRYDIAL},${TRUNK_RING_TIMER},${DIAL_TRUNK_OPTIONS}) ; modified to match pjsip syntax
To make this change on your system, just copy the below dialplan in to extensions_override_freepbx.conf file.
[macro-dialout-enum]
include => macro-dialout-enum-custom
exten => s,1,GosubIf($[$["${ARG3}" != ""] & $["${DB(AMPUSER/${AMPUSER}/pinless)}" != "NOPASSWD"]]?sub-pincheck,s,1())
exten => s,n,GotoIf($["x${OUTDISABLE_${DIAL_TRUNK}}" = "xon"]?disabletrunk,1)
exten => s,n,Set(DIAL_TRUNK_OPTIONS=${IF($["${DB_EXISTS(TRUNK/${DIAL_TRUNK}/dialopts)}" = "1"]?${DB_RESULT}:${TRUNK_OPTIONS})})
exten => s,n,Set(OUTBOUND_GROUP=OUT_${ARG1})
exten => s,n,GotoIf($["${OUTMAXCHANS_${ARG1}}foo" = "foo"]?nomax)
exten => s,n,GotoIf($[ ${GROUP_COUNT(OUT_${ARG1})} >= ${OUTMAXCHANS_${ARG1}} ]?nochans)
exten => s,n(nomax),Set(DIAL_NUMBER=${ARG2})
exten => s,n,Set(DIAL_TRUNK=${ARG1})
exten => s,n,GotoIf($["${INTRACOMPANYROUTE}" = "YES"]?skipoutcid)
exten => s,n,Set(DIAL_TRUNK_OPTIONS=${DIAL_OPTIONS})
exten => s,n,Gosub(macro-outbound-callerid,s,1(${DIAL_TRUNK}))
exten => s,n(skipoutcid),GosubIf($["${PREFIX_TRUNK_${DIAL_TRUNK}}" != ""]?sub-flp-${DIAL_TRUNK},s,1())
exten => s,n,AGI(agi://127.0.0.1/enumlookup.agi)
exten => s,n,ExecIf($["${DB(AMPUSER/${AMPUSER}/cidname)}" != ""]?Set(CONNECTEDLINE(num,i)=${DIAL_NUMBER}))
exten => s,n,ExecIf($["${DB(AMPUSER/${AMPUSER}/cidname)}" != ""]?Set(CONNECTEDLINE(name,i)=CID:${CALLERID(number)}))
exten => s,n(dialloop),GotoIf($["foo${DIALARR}"="foo"]?s-${DIALSTATUS},1)
exten => s,n,ExecIf($["${MOHCLASS}"!="default" & "${MOHCLASS}"!="" & "${FORCE_CONFIRM}"="" ]?Set(DIAL_TRUNK_OPTIONS=M(setmusic^${MOHCLASS})${DIAL_TRUNK_OPTIONS}))
exten => s,n,ExecIf($["${FORCE_CONFIRM}"!="" ]?Set(DIAL_TRUNK_OPTIONS=M(confirm)${DIAL_TRUNK_OPTIONS}))
exten => s,n,Set(TRYDIAL=${CUT(DIALARR,%,1)})
exten => s,n,Set(DIALARR=${CUT(DIALARR,%,2-)})
exten => s,n,Set(TRYDIAL=${REPLACE(TRYDIAL,/,:)})
exten => s,n,Dial(PJSIP/${FROMEXTEN}/${TRYDIAL},${TRUNK_RING_TIMER},${DIAL_TRUNK_OPTIONS})
exten => s,n,GotoIf($[ $[ "${DIALSTATUS}" = "CHANUNAVAIL" ] | $[ "${DIALSTATUS}" = "CONGESTION" ] ]?dialloop)
exten => s,n,GotoIf($["${ARG4}" = "on"]?continue,1:s-${DIALSTATUS},1)
exten => s,n(nochans),Noop(max channels used up)
Run dialplan reload in asterisk cli and then test the calls with ENUM trunk.
Hi @ramarajan222
It does not work, but now it gives me a different error:
[2024-10-18 08:13:38] VERBOSE[1434042][C-000002bf] res_agi.c: <IAX2/5474-10153>AGI Rx << VERBOSE "Setting DIALARR to sip/21841XXXX@voip.utl.pt%" 3
[2024-10-18 08:13:38] VERBOSE[1434042][C-000002bf] res_agi.c: agi://127.0.0.1/enumlookup.agi: Setting DIALARR to sip/21841XXXX@voip.utl.pt%
[2024-10-18 08:13:38] VERBOSE[1434042][C-000002bf] res_agi.c: <IAX2/5474-10153>AGI Tx >> 200 result=1
[2024-10-18 08:13:38] VERBOSE[1434042][C-000002bf] res_agi.c: <IAX2/5474-10153>AGI Rx << SET VARIABLE DIALARR "sip/21841XXXX@voip.utl.pt%"
[2024-10-18 08:13:38] VERBOSE[1434042][C-000002bf] res_agi.c: <IAX2/5474-10153>AGI Tx >> 200 result=1
[2024-10-18 08:13:38] VERBOSE[1434042][C-000002bf] res_agi.c: <IAX2/5474-10153>AGI Script agi://127.0.0.1/enumlookup.agi completed, returning 0
[2024-10-18 08:13:38] VERBOSE[1434042][C-000002bf] res_agi.c: <IAX2/5474-10153>AGI Tx >> HANGUP
[2024-10-18 08:13:38] VERBOSE[1434042][C-000002bf] pbx.c: Executing [s@macro-dialout-enum:14] ExecIf("IAX2/5474-10153", "1?Set(CONNECTEDLINE(num,i)=35121841XXXX)") in new stack
[2024-10-18 08:13:38] VERBOSE[1434042][C-000002bf] pbx.c: Executing [s@macro-dialout-enum:15] ExecIf("IAX2/5474-10153", "1?Set(CONNECTEDLINE(name,i)=CID:495474)") in new stack
[2024-10-18 08:13:38] VERBOSE[1434042][C-000002bf] pbx.c: Executing [s@macro-dialout-enum:16] GotoIf("IAX2/5474-10153", "0?s-,1") in new stack
[2024-10-18 08:13:38] VERBOSE[1434042][C-000002bf] pbx.c: Executing [s@macro-dialout-enum:17] ExecIf("IAX2/5474-10153", "0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^default))") in new stack
[2024-10-18 08:13:38] VERBOSE[1434042][C-000002bf] pbx.c: Executing [s@macro-dialout-enum:18] ExecIf("IAX2/5474-10153", "0?Set(DIAL_TRUNK_OPTIONS=M(confirm))") in new stack
[2024-10-18 08:13:38] VERBOSE[1434042][C-000002bf] pbx.c: Executing [s@macro-dialout-enum:19] Set("IAX2/5474-10153", "TRYDIAL=sip/21841XXXX@voip.utl.pt") in new stack
[2024-10-18 08:13:38] VERBOSE[1434042][C-000002bf] pbx.c: Executing [s@macro-dialout-enum:20] Set("IAX2/5474-10153", "DIALARR=") in new stack
[2024-10-18 08:13:38] VERBOSE[1434042][C-000002bf] pbx.c: Executing [s@macro-dialout-enum:21] Set("IAX2/5474-10153", "TRYDIAL=sip:21841XXXX@voip.utl.pt") in new stack
[2024-10-18 08:13:38] VERBOSE[1434042][C-000002bf] pbx.c: Executing [s@macro-dialout-enum:22] Dial("IAX2/5474-10153", "PJSIP/5474/sip:21841XXXX@voip.utl.pt,300,") in new stack
[2024-10-18 08:13:38] ERROR[1169639] chan_pjsip.c: Unable to create PJSIP channel - endpoint '5474' was not found
[2024-10-18 08:13:38] NOTICE[1434042][C-000002bf] app_dial.c: Unable to create channel of type 'PJSIP' (cause 3 - No route to destination)
[2024-10-18 08:13:38] VERBOSE[1434042][C-000002bf] app_dial.c: Everyone is busy/congested at this time (1:0/0/1)
HI @JoseGoncalves Is it possible for you to test the call from the PJSIP extension?
Not now... I'm not on my office, and remotely I can only use IAX2 to make calls... later on the day I will try it when I reach my office.
Hi @ramarajan222. It works from a PJSIP extension. Here is the relevant log:
[2024-10-18 13:22:53] VERBOSE[1466917][C-00000326] res_agi.c: agi://127.0.0.1/enumlookup.agi: Setting DIALARR to sip/21841XXXX@voip.utl.pt%
[2024-10-18 13:22:53] VERBOSE[1466917][C-00000326] res_agi.c: <PJSIP/2474-00000648>AGI Tx >> 200 result=1
[2024-10-18 13:22:53] VERBOSE[1466917][C-00000326] res_agi.c: <PJSIP/2474-00000648>AGI Rx << SET VARIABLE DIALARR "sip/21841XXXX@voip.utl.pt%"
[2024-10-18 13:22:53] VERBOSE[1466917][C-00000326] res_agi.c: <PJSIP/2474-00000648>AGI Tx >> 200 result=1
[2024-10-18 13:22:53] VERBOSE[1466917][C-00000326] res_agi.c: <PJSIP/2474-00000648>AGI Script agi://127.0.0.1/enumlookup.agi completed, returning 0
[2024-10-18 13:22:53] VERBOSE[1466917][C-00000326] res_agi.c: <PJSIP/2474-00000648>AGI Tx >> HANGUP
[2024-10-18 13:22:54] VERBOSE[1466917][C-00000326] pbx.c: Executing [s@macro-dialout-enum:14] ExecIf("PJSIP/2474-00000648", "1?Set(CONNECTEDLINE(num,i)=35121841XXXX)") in new stack
[2024-10-18 13:22:54] VERBOSE[1466917][C-00000326] pbx.c: Executing [s@macro-dialout-enum:15] ExecIf("PJSIP/2474-00000648", "1?Set(CONNECTEDLINE(name,i)=CID:492474)") in new stack
[2024-10-18 13:22:54] VERBOSE[1466917][C-00000326] pbx.c: Executing [s@macro-dialout-enum:16] GotoIf("PJSIP/2474-00000648", "0?s-,1") in new stack
[2024-10-18 13:22:54] VERBOSE[1466917][C-00000326] pbx.c: Executing [s@macro-dialout-enum:17] ExecIf("PJSIP/2474-00000648", "0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^default))") in new stack
[2024-10-18 13:22:54] VERBOSE[1466917][C-00000326] pbx.c: Executing [s@macro-dialout-enum:18] ExecIf("PJSIP/2474-00000648", "0?Set(DIAL_TRUNK_OPTIONS=M(confirm))") in new stack
[2024-10-18 13:22:54] VERBOSE[1466917][C-00000326] pbx.c: Executing [s@macro-dialout-enum:19] Set("PJSIP/2474-00000648", "TRYDIAL=sip/21841XXXX@voip.utl.pt") in new stack
[2024-10-18 13:22:54] VERBOSE[1466917][C-00000326] pbx.c: Executing [s@macro-dialout-enum:20] Set("PJSIP/2474-00000648", "DIALARR=") in new stack
[2024-10-18 13:22:54] VERBOSE[1466917][C-00000326] pbx.c: Executing [s@macro-dialout-enum:21] Set("PJSIP/2474-00000648", "TRYDIAL=sip:21841XXXX@voip.utl.pt") in new stack
[2024-10-18 13:22:54] VERBOSE[1466917][C-00000326] pbx.c: Executing [s@macro-dialout-enum:22] Dial("PJSIP/2474-00000648", "PJSIP/2474/sip:21841XXXX@voip.utl.pt,300,") in new stack
[2024-10-18 13:22:54] VERBOSE[1466917][C-00000326] app_dial.c: Called PJSIP/2474/sip:21841XXXX@voip.utl.pt
[2024-10-18 13:22:54] VERBOSE[1044872] netsock2.c: Using SIP RTP Audio TOS bits 184
[2024-10-18 13:22:54] VERBOSE[1044872] netsock2.c: Using SIP RTP Audio CoS mark 5
[2024-10-18 13:22:54] VERBOSE[1466917][C-00000326] app_dial.c: PJSIP/2474-00000649 is ringing
So, the only issue remaining is when I make a call from an IAX2 extension.
Thank you for the update @JoseGoncalves, Need to modify the dial command to fix it with IAX2 extension.
FreePBX Version
FreePBX 17
Issue Description
I had a FreePBX 15 system were I used an ENUM trunk to connect to a remote institute. After migrated that system to FreePBX 17 with Asterisk 20 and
chan_sip
disabled, I was unable to communicate with that trunk! Looking at Asterisk logs I see this when I try to make a call on that trunk:Only after enabling
chan_sip
I was able to restore the calls with it. So it seems ENUM trunks need to be updated to supportchan_pjsip
, or else, they are useless with Asterisk 21 or 22, werechan_sip
is unavailable.Operating Environment
Debian 12 Asterisk 20.9.3
Relevant log output