Custom Destination and extensions_custom.conf content doesn't work

We have an inbound route setup when calling ext. 8000-8009 on an IP phone PBX will go to the custom destination “playpromptonce” and trigger the content [playpromptonce] under extensions_custom.conf file.

exten => _800x,1,Set(__DIRECTION=INBOUND)
exten => _800x,n,Gosub(sub-record-check,s,1(in,${EXTEN},dontcare))
exten => _800x,n,Set(CHANNEL(tonezone)=us)
exten => _800x,n,Set(__FROM_DID=${EXTEN})
exten => _800x,n,Set(returnhere=1)
exten => _800x,n,Gosub(app-blacklist-check,s,1())
exten => _800x,n(did),Set(CDR(did)=${FROM_DID})
exten => _800x,n,GotoIf(${LEN(${BLDEST})}?${BLDEST})
exten => _800x,n(callerid),ExecIf($[ "${CALLERID(name)}" = "" ] ?Set(CALLERID(name)=${CALLERID(num)}))
exten => _800x,n,Set(__MOHCLASS=)
exten => _800x,n,Set(__REVERSAL_REJECT=FALSE)
exten => _800x,n,GotoIf($["${REVERSAL_REJECT}"!="TRUE"]?post-reverse-charge)
exten => _800x,n,GotoIf($["${CHANNEL(reversecharge)}"="1"]?macro-hangupcall)
exten => _800x,n(post-reverse-charge),Noop()
exten => _800x,n,Set(__CALLINGNAMEPRES_SV=${CALLERID(name-pres)})
exten => _800x,n,Set(__CALLINGNUMPRES_SV=${CALLERID(num-pres)})
exten => _800x,n,Set(CALLERID(name-pres)=allowed_not_screened)
exten => _800x,n,Set(CALLERID(num-pres)=allowed_not_screened)
exten => _800x,n(did-cid-hook),Noop(CallerID Entry Point)
exten => _800x,n(dest-ext),Goto(playpromptonce,s,1)
[playpromptonce]
exten => s,1,Answer
exten => s,2,Set(PROMPTID=${FROM_DID})
exten => s,3,Playback(custom/${PROMPTID})
exten => s,4,Wait(1)
exten => s,5,Hangup

However when we try to call the extensions such as 8001 on the ip phone, it seems like it will try to call as a normal call and show busy cos the extension doesn’t exist. The ip phone is working fine calling other existing extensions in the PBX. Below are the logs from the Asterisk, anyone have idea why the extension goes to “macro-dialout-trunk/macro-outbound-callerid” instead, and does not go to the custom “Goto(playpromptonce,s,1)” destination at all? Thanks a lot.

Executing [s@macro-user-callerid:30] GotoIf("PJSIP/1010-00000022", "1?continue") in new stack
    -- Goto (macro-user-callerid,s,49)
    -- Executing [s@macro-user-callerid:49] Set("PJSIP/1010-00000022", "CALLERID(number)=1010") in new stack
    -- Executing [s@macro-user-callerid:50] Set("PJSIP/1010-00000022", "CALLERID(name)=Ten Ten") in new stack
    -- Executing [s@macro-user-callerid:51] GotoIf("PJSIP/1010-00000022", "0?cnum") in new stack
    -- Executing [s@macro-user-callerid:52] Set("PJSIP/1010-00000022", "CDR(cnam)=Ten Ten") in new stack
    -- Executing [s@macro-user-callerid:53] Set("PJSIP/1010-00000022", "CDR(cnum)=1010") in new stack
    -- Executing [s@macro-user-callerid:54] Set("PJSIP/1010-00000022", "CHANNEL(language)=en") in new stack
    -- Executing [8001@from-internal:2] Gosub("PJSIP/1010-00000022", "sub-record-check,s,1(out,8001,dontcare)") in new stack
    -- Executing [s@sub-record-check:1] GotoIf("PJSIP/1010-00000022", "0?initialized") in new stack
    -- Executing [s@sub-record-check:2] Set("PJSIP/1010-00000022", "__REC_STATUS=INITIALIZED") in new stack
    -- Executing [s@sub-record-check:3] Set("PJSIP/1010-00000022", "NOW=1723738760") in new stack
    -- Executing [s@sub-record-check:4] Set("PJSIP/1010-00000022", "__DAY=15") in new stack
    -- Executing [s@sub-record-check:5] Set("PJSIP/1010-00000022", "__MONTH=08") in new stack
    -- Executing [s@sub-record-check:6] Set("PJSIP/1010-00000022", "__YEAR=2024") in new stack
    -- Executing [s@sub-record-check:7] Set("PJSIP/1010-00000022", "__TIMESTR=20240815-121920") in new stack
    -- Executing [s@sub-record-check:8] Set("PJSIP/1010-00000022", "__FROMEXTEN=1010") in new stack
    -- Executing [s@sub-record-check:9] Set("PJSIP/1010-00000022", "__MON_FMT=wav") in new stack
    -- Executing [s@sub-record-check:10] NoOp("PJSIP/1010-00000022", "Recordings initialized") in new stack
    -- Executing [s@sub-record-check:11] ExecIf("PJSIP/1010-00000022", "0?Set(ARG3=dontcare)") in new stack
    -- Executing [s@sub-record-check:12] Set("PJSIP/1010-00000022", "REC_POLICY_MODE_SAVE=") in new stack
    -- Executing [s@sub-record-check:13] ExecIf("PJSIP/1010-00000022", "0?Set(REC_STATUS=NO)") in new stack
    -- Executing [s@sub-record-check:14] GotoIf("PJSIP/1010-00000022", "3?checkaction") in new stack
    -- Goto (sub-record-check,s,17)
    -- Executing [s@sub-record-check:17] GotoIf("PJSIP/1010-00000022", "1?sub-record-check,out,1") in new stack
    -- Goto (sub-record-check,out,1)
    -- Executing [out@sub-record-check:1] NoOp("PJSIP/1010-00000022", "Outbound Recording Check from 1010 to 8001") in new stack
    -- Executing [out@sub-record-check:2] Set("PJSIP/1010-00000022", "RECMODE=dontcare") in new stack
    -- Executing [out@sub-record-check:3] ExecIf("PJSIP/1010-00000022", "1?Goto(routewins)") in new stack
    -- Goto (sub-record-check,out,7)
    -- Executing [out@sub-record-check:7] Gosub("PJSIP/1010-00000022", "recordcheck,1(dontcare,out,8001)") in new stack
    -- Executing [recordcheck@sub-record-check:1] NoOp("PJSIP/1010-00000022", "Starting recording check against dontcare") in new stack
    -- Executing [recordcheck@sub-record-check:2] Goto("PJSIP/1010-00000022", "dontcare") in new stack
    -- Goto (sub-record-check,recordcheck,3)
    -- Executing [recordcheck@sub-record-check:3] Return("PJSIP/1010-00000022", "") in new stack
    -- Executing [out@sub-record-check:8] Return("PJSIP/1010-00000022", "") in new stack
    -- Executing [8001@from-internal:3] ExecIf("PJSIP/1010-00000022", "0 ?Set(CDR(accountcode)=)") in new stack
    -- Executing [8001@from-internal:4] Set("PJSIP/1010-00000022", "_ROUTEID=1") in new stack
    -- Executing [8001@from-internal:5] Set("PJSIP/1010-00000022", "_ROUTENAME=AllOutbound") in new stack
    -- Executing [8001@from-internal:6] Set("PJSIP/1010-00000022", "MOHCLASS=default") in new stack
    -- Executing [8001@from-internal:7] Set("PJSIP/1010-00000022", "_CALLERIDNAMEINTERNAL=Ten Ten") in new stack
    -- Executing [8001@from-internal:8] Set("PJSIP/1010-00000022", "_CALLERIDNUMINTERNAL=1010") in new stack
    -- Executing [8001@from-internal:9] Set("PJSIP/1010-00000022", "_EMAILNOTIFICATION=FALSE") in new stack
    -- Executing [8001@from-internal:10] Set("PJSIP/1010-00000022", "_NODEST=") in new stack
    -- Executing [8001@from-internal:11] Macro("PJSIP/1010-00000022", "dialout-trunk,1,8001,,off") in new stack
    -- Executing [s@macro-dialout-trunk:1] Set("PJSIP/1010-00000022", "DIAL_TRUNK=1") in new stack
    -- Executing [s@macro-dialout-trunk:2] ExecIf("PJSIP/1010-00000022", "0?Set(DIAL_OPTIONS=Hhtr)") in new stack
    -- Executing [s@macro-dialout-trunk:3] GosubIf("PJSIP/1010-00000022", "0?sub-pincheck,s,1()") in new stack
    -- Executing [s@macro-dialout-trunk:4] ExecIf("PJSIP/1010-00000022", "0?Set(CALLERID(num)=1010)") in new stack
    -- Executing [s@macro-dialout-trunk:5] GotoIf("PJSIP/1010-00000022", "0?disabletrunk,1") in new stack
    -- Executing [s@macro-dialout-trunk:6] Set("PJSIP/1010-00000022", "DIAL_NUMBER=8001") in new stack
    -- Executing [s@macro-dialout-trunk:7] Set("PJSIP/1010-00000022", "DIAL_TRUNK_OPTIONS=HhTtr") in new stack
    -- Executing [s@macro-dialout-trunk:8] Set("PJSIP/1010-00000022", "OUTBOUND_GROUP=OUT_1") in new stack
    -- Executing [s@macro-dialout-trunk:9] Set("PJSIP/1010-00000022", "DIAL_TRUNK_OPTIONS=T") in new stack
    -- Executing [s@macro-dialout-trunk:10] GotoIf("PJSIP/1010-00000022", "1?nomax") in new stack
    -- Goto (macro-dialout-trunk,s,12)
-- Executing [s@macro-dialout-trunk:12] GotoIf("PJSIP/1010-00000022", "0?skipoutcid") in new stack
    -- Executing [s@macro-dialout-trunk:13] Macro("PJSIP/1010-00000022", "outbound-callerid,1") in new stack
    -- Executing [s@macro-outbound-callerid:1] NoOp("PJSIP/1010-00000022", "1010") in new stack
    -- Executing [s@macro-outbound-callerid:2] NoOp("PJSIP/1010-00000022", "") in new stack
    -- Executing [s@macro-outbound-callerid:3] NoOp("PJSIP/1010-00000022", "off") in new stack
    -- Executing [s@macro-outbound-callerid:4] ExecIf("PJSIP/1010-00000022", "0?Set(CALLERPRES(name-pres)=)") in new stack
    -- Executing [s@macro-outbound-callerid:5] ExecIf("PJSIP/1010-00000022", "0?Set(CALLERPRES(num-pres)=)") in new stack
    -- Executing [s@macro-outbound-callerid:6] Set("PJSIP/1010-00000022", "HOTDESCKCHAN=1010-00000022") in new stack
    -- Executing [s@macro-outbound-callerid:7] Set("PJSIP/1010-00000022", "HOTDESKEXTEN=1010") in new stack
    -- Executing [s@macro-outbound-callerid:8] Set("PJSIP/1010-00000022", "HOTDESKCALL=0") in new stack
    -- Executing [s@macro-outbound-callerid:9] ExecIf("PJSIP/1010-00000022", "0?Set(HOTDESKCALL=1)") in new stack
    -- Executing [s@macro-outbound-callerid:10] ExecIf("PJSIP/1010-00000022", "0?Set(CALLERID(name)=)") in new stack
    -- Executing [s@macro-outbound-callerid:11] Set("PJSIP/1010-00000022", "ALLOWTHISROUTE=NO") in new stack
    -- Executing [s@macro-outbound-callerid:12] ExecIf("PJSIP/1010-00000022", "0?Set(ALLOWTHISROUTE=YES)") in new stack
    -- Executing [s@macro-outbound-callerid:13] ExecIf("PJSIP/1010-00000022", "0?Hangup()") in new stack
    -- Executing [s@macro-outbound-callerid:14] ExecIf("PJSIP/1010-00000022", "0?Set(REALCALLERIDNUM=1010)") in new stack
    -- Executing [s@macro-outbound-callerid:15] ExecIf("PJSIP/1010-00000022", "0?Set(AMPUSER=1010)") in new stack
    -- Executing [s@macro-outbound-callerid:16] GotoIf("PJSIP/1010-00000022", "1?normcid") in new stack
    -- Goto (macro-outbound-callerid,s,20)
    -- Executing [s@macro-outbound-callerid:20] Set("PJSIP/1010-00000022", "USEROUTCID=") in new stack
    -- Executing [s@macro-outbound-callerid:21] Set("PJSIP/1010-00000022", "EMERGENCYCID=") in new stack
    -- Executing [s@macro-outbound-callerid:22] ExecIf("PJSIP/1010-00000022", "0?Set(EMERGENCYCID=)") in new stack
    -- Executing [s@macro-outbound-callerid:23] Set("PJSIP/1010-00000022", "TRUNKOUTCID=") in new stack
    -- Executing [s@macro-outbound-callerid:24] GotoIf("PJSIP/1010-00000022", "1?trunkcid") in new stack
    -- Goto (macro-outbound-callerid,s,30)

You can’t hit Inbound Routes from an extension/endpoint on the PBX.

1 Like

Oh didn’t know that, if I want to dial those 800X extension to go to the custom destination to trigger the scripts, what should I change, or add to make them work on the IP phones as well? Thanks in advance!

You need to add it as a custom context. You can use from-internal-custom to include them or create Misc Destinations that point to your custom context.

Thanks again, is this the right way to do? Sorry this is the first time Im doing this. Under extensions_custom.conf, I have this content [playpromptonce] and I already have a custom custom destination.

[playpromptonce]
exten => s,1,Answer
exten => s,2,Set(PROMPTID=${FROM_DID})
exten => s,3,Playback(custom/${PROMPTID})
exten => s,4,Wait(1)
exten => s,5,Hangup
PBXMEDIASERVER*CLI> dialplan show customdests
[ Context 'customdests' created by 'pbx_config' ]
  'dest-1' =>       1. Noop(Entering Custom Destination ANI-Extract) [extensions_additional.conf:5816]
                    2. Goto(911ANIEXTRACT,s,1)                    [extensions_additional.conf:5817]
  'dest-2' =>       1. Noop(Entering Custom Destination MediaServerPlayPrompt) [extensions_additional.conf:5819]
                    2. Goto(playprompt,s,1)                       [extensions_additional.conf:5820]
  'dest-3' =>       1. Noop(Entering Custom Destination MediaServerRecordPrompt) [extensions_additional.conf:5822]
                    2. Goto(mediaserver,888,1)                    [extensions_additional.conf:5823]
  'dest-4' =>       1. Noop(Entering Custom Destination MediaServerPlayPromptOnce) [extensions_additional.conf:5825]
                    2. Goto(playpromptonce,s,1)                   [extensions_additional.conf:5826]
  'dest-5' =>       1. Noop(Entering Custom Destination LumenvoxIVR) [extensions_additional.conf:5828]
                    2. Goto(LumenvoxIVR,s,1)                      [extensions_additional.conf:5829]
  Include =>        'customdests-custom'                          [pbx_config]

-= 5 extensions (10 priorities) in 1 context. =-

Do I just need to add the following under extensions_custom.conf, and it should work? Or I still need to add additional items such as Misc Application…?

[from-internal-custom]
include => playpromptonce