[macro-dialout-trunk-predial-hook]
exten => s,1,noop(Entering user defined context macro-dialout-trunk-predial-hook in extensions_custom.conf)
; exten => s,n,DumpChan ; uncomment for debug
; check if this is an emergency call, and if so bypass all customization. Emerg calls must use an outbound route with the
; Emergency option toggled
exten => s,n,ExecIf($["${EMERGENCYROUTE}"="YES"]?MacroExit)
; check if outbound channel started as an incoming call
; if call is from an inbound route don't change CID
; exten => s,n,ExecIf($["${FROM_DID}"!=""]?MacroExit) ; FreePBX < 12+
exten => s,n,ExecIf($["${DIRECTION}"="INBOUND"]?MacroExit) ; FreePBX 12+
; set random cid
exten => s,n,Gosub(outbound-random-cid,s,1)
; log outgoing CID and continue
exten => s,n,Noop(Call proceeding with Outbound CID: ${CALLERID(number)})
exten => s,n,MacroExit
; end context [macro-dialout-trunk-predial-hook]