Call to DID from CallBack module

Hi everyone
I have a problem for which I can’t find a solution using standard FreePBX modules:

from one of the trunks i get a call where
DID: XXXXXXXXXXX (there are an infinite number of such phones)
CID: XXXX (there are about 150 of these phones)

I need to make it so that after receiving a call, the asterisk first calls XXXX (CID) and after the subscriber picks up the phone, the system should call XXXXXXXXXXX (DID)
partially for this functionality, the callback module suits me

but I can’t find a solution to make a call to phone XXXXXXXXXXX (DID)

What solutions are there in asterisk for this task?

i created a Custom Destinations

[callback-test]
exten => _XXXXXXXXXXX,1,Dial(PJSIP/${EXTEN}@pro,60,tr)

It works if I set it in the Inbound Route

but it doesn’t work if i use it in callback

Connected to Asterisk 16.27.0 currently running on pbx (pid = 2418)
– Executing [89038513478@from-pstn:1] Set(“PJSIP/3195-00000008”, “__DIRECTION=INBOUND”) in new stack
– Executing [89038513478@from-pstn:2] Gosub(“PJSIP/3195-00000008”, “sub-record-check,s,1(in,89038513478,dontcare)”) in new stack
– Executing [s@sub-record-check:1] GotoIf(“PJSIP/3195-00000008”, “0?initialized”) in new stack
– Executing [s@sub-record-check:2] Set(“PJSIP/3195-00000008”, “__REC_STATUS=INITIALIZED”) in new stack
– Executing [s@sub-record-check:3] Set(“PJSIP/3195-00000008”, “NOW=1660046298”) in new stack
– Executing [s@sub-record-check:4] Set(“PJSIP/3195-00000008”, “__DAY=09”) in new stack
– Executing [s@sub-record-check:5] Set(“PJSIP/3195-00000008”, “__MONTH=08”) in new stack
– Executing [s@sub-record-check:6] Set(“PJSIP/3195-00000008”, “__YEAR=2022”) in new stack
– Executing [s@sub-record-check:7] Set(“PJSIP/3195-00000008”, “__TIMESTR=20220809-145818”) in new stack
– Executing [s@sub-record-check:8] Set(“PJSIP/3195-00000008”, “__FROMEXTEN=unknown”) in new stack
– Executing [s@sub-record-check:9] Set(“PJSIP/3195-00000008”, “__MON_FMT=wav”) in new stack
– Executing [s@sub-record-check:10] NoOp(“PJSIP/3195-00000008”, “Recordings initialized”) in new stack
– Executing [s@sub-record-check:11] ExecIf(“PJSIP/3195-00000008”, “0?Set(ARG3=dontcare)”) in new stack
– Executing [s@sub-record-check:12] Set(“PJSIP/3195-00000008”, “REC_POLICY_MODE_SAVE=”) in new stack
– Executing [s@sub-record-check:13] ExecIf(“PJSIP/3195-00000008”, “0?Set(REC_STATUS=NO)”) in new stack
– Executing [s@sub-record-check:14] GotoIf(“PJSIP/3195-00000008”, “2?checkaction”) in new stack
– Goto (sub-record-check,s,17)
– Executing [s@sub-record-check:17] GotoIf(“PJSIP/3195-00000008”, “1?sub-record-check,in,1”) in new stack
– Goto (sub-record-check,in,1)
– Executing [in@sub-record-check:1] NoOp(“PJSIP/3195-00000008”, “Inbound Recording Check to 89038513478”) in new stack
– Executing [in@sub-record-check:2] Set(“PJSIP/3195-00000008”, “FROMEXTEN=unknown”) in new stack
– Executing [in@sub-record-check:3] ExecIf(“PJSIP/3195-00000008”, “4?Set(FROMEXTEN=3195)”) in new stack
– Executing [in@sub-record-check:4] Gosub(“PJSIP/3195-00000008”, “recordcheck,1(dontcare,in,89038513478)”) in new stack
– Executing [recordcheck@sub-record-check:1] NoOp(“PJSIP/3195-00000008”, “Starting recording check against dontcare”) in new stack
– Executing [recordcheck@sub-record-check:2] Goto(“PJSIP/3195-00000008”, “dontcare”) in new stack
– Goto (sub-record-check,recordcheck,3)
– Executing [recordcheck@sub-record-check:3] Return(“PJSIP/3195-00000008”, “”) in new stack
– Executing [in@sub-record-check:5] Return(“PJSIP/3195-00000008”, “”) in new stack
– Executing [89038513478@from-pstn:3] Set(“PJSIP/3195-00000008”, “CHANNEL(tonezone)=us”) in new stack
– Executing [89038513478@from-pstn:4] Set(“PJSIP/3195-00000008”, “__FROM_DID=89038513478”) in new stack
– Executing [89038513478@from-pstn:5] Set(“PJSIP/3195-00000008”, “returnhere=1”) in new stack
– Executing [89038513478@from-pstn:6] Gosub(“PJSIP/3195-00000008”, “app-blacklist-check,s,1()”) in new stack
– Executing [s@app-blacklist-check:1] GotoIf(“PJSIP/3195-00000008”, “0?blacklisted”) in new stack
– Executing [s@app-blacklist-check:2] Set(“PJSIP/3195-00000008”, “CALLED_BLACKLIST=1”) in new stack
– Executing [s@app-blacklist-check:3] Return(“PJSIP/3195-00000008”, “”) in new stack
– Executing [89038513478@from-pstn:7] Set(“PJSIP/3195-00000008”, “CDR(did)=89038513478”) in new stack
– Executing [89038513478@from-pstn:8] GotoIf(“PJSIP/3195-00000008”, “0?”) in new stack
– Executing [89038513478@from-pstn:9] ExecIf(“PJSIP/3195-00000008”, “1 ?Set(CALLERID(name)=3195)”) in new stack
– Executing [89038513478@from-pstn:10] Set(“PJSIP/3195-00000008”, “__MOHCLASS=”) in new stack
– Executing [89038513478@from-pstn:11] Set(“PJSIP/3195-00000008”, “__REVERSAL_REJECT=FALSE”) in new stack
– Executing [89038513478@from-pstn:12] GotoIf(“PJSIP/3195-00000008”, “1?post-reverse-charge”) in new stack
– Goto (from-pstn,89038513478,14)
– Executing [89038513478@from-pstn:14] NoOp(“PJSIP/3195-00000008”, “”) in new stack
– Executing [89038513478@from-pstn:15] Set(“PJSIP/3195-00000008”, “__CALLINGNAMEPRES_SV=allowed_not_screened”) in new stack
– Executing [89038513478@from-pstn:16] Set(“PJSIP/3195-00000008”, “__CALLINGNUMPRES_SV=allowed_not_screened”) in new stack
– Executing [89038513478@from-pstn:17] Set(“PJSIP/3195-00000008”, “CALLERID(name-pres)=allowed_not_screened”) in new stack
– Executing [89038513478@from-pstn:18] Set(“PJSIP/3195-00000008”, “CALLERID(num-pres)=allowed_not_screened”) in new stack
– Executing [89038513478@from-pstn:19] NoOp(“PJSIP/3195-00000008”, “CallerID Entry Point”) in new stack
– Executing [89038513478@from-pstn:20] Goto(“PJSIP/3195-00000008”, “callback,1,1”) in new stack
– Goto (callback,1,1)
– Executing [1@callback:1] Set(“PJSIP/3195-00000008”, “CALL=3195”) in new stack
– Executing [1@callback:2] Set(“PJSIP/3195-00000008”, “DESTINATION=callback-test.1.1”) in new stack
– Executing [1@callback:3] Set(“PJSIP/3195-00000008”, “SLEEP=0”) in new stack
– Executing [1@callback:4] Set(“PJSIP/3195-00000008”, “TIMEOUT=15000”) in new stack
– Executing [1@callback:5] Set(“PJSIP/3195-00000008”, “CALLERID=Callback”) in new stack
– Executing [1@callback:6] System(“PJSIP/3195-00000008”, “/var/lib/asterisk/bin/callback 3195 callback-test.1.1 0 15000 Q2FsbGJhY2s= &”) in new stack
– Executing [1@callback:7] Hangup(“PJSIP/3195-00000008”, “”) in new stack
== Spawn extension (callback, 1, 7) exited non-zero on ‘PJSIP/3195-00000008’

[callback-test]
include => callback-custom
exten => _XXXXXXXXXXX,1,Set(CALL=${CALLERID(number)})
exten => _XXXXXXXXXXX,n,Set(DESTINATION=from-internal.${EXTEN}.1)
exten => _XXXXXXXXXXX,n,Set(SLEEP=0)
exten => _XXXXXXXXXXX,n,Set(TIMEOUT=15000)
exten => _XXXXXXXXXXX,n,Set(CALLERID=${CALLERID(number)})
exten => _XXXXXXXXXXX,n,System(/var/lib/asterisk/bin/callback ${CALL} ${DESTINATION} ${SLEEP} ${TIMEOUT} ${BASE64_ENCODE(${CALLERID})} &)
exten => _XXXXXXXXXXX,n,Hangup

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