I’m also using FreePBX framework version 13.0.195.26 (which is up to date like yours), and am using the context “[ext-did-custom]” in the “/etc/asterisk/extensions_custom.conf” file for this purpose.
Thus, for a given trunk setup where I have defined for an exemplary SIP provider its user name to be “1036819” and a ring group definition called “600”, I have the following line entries in the “/etc/asterisk/extensions_custom.conf” file:
[ext-did-custom]
exten => 1036819,1,NoOp(CALLERID(num)=${CALLERID(num)})
exten => 1036819,n,NoOp(CALLERID(name)=${CALLERID(name)})
exten => 1036819,n,NoOp(EXTEN=${EXTEN})
exten => 1036819,n,NoOp(CHANNEL=${CHANNEL})
exten => 1036819,n,ExecIf($[$["${CALLERID(num):1:8}" = "nonymous"] | $["${CALLERID(num):1:6}" = "nknown"]] ?Set(CALLERID(num)=900000000))
exten => 1036819,n,Set(CALLERID(num)=${FILTER(0-9,${CALLERID(num)})})
exten => 1036819,n,ExecIf($["${CALLERID(num):0:2}" != "00" & "${CALLERID(num):0:1}" = "0" ] ?Set(CALLERID(num)=0044${CALLERID(num):1:12}))
exten => 1036819,n,ExecIf($["${CALLERID(num):0:4}" = "0044"] ?Set(CALLERID(num)=0${CALLERID(num):4:12}))
exten => 1036819,n,Set(__DIRECTION=INBOUND)
exten => 1036819,n,Gosub(sub-record-check,s,1(in,${EXTEN},dontcare))
exten => 1036819,n,Gosub(app-blacklist-check,s,1())
exten => 1036819,n,Set(__FROM_DID=${EXTEN})
exten => 1036819,n,Set(CDR(did)=${FROM_DID})
exten => 1036819,n,ExecIf($[ "${CALLERID(name)}" = "" ] ?Set(CALLERID(name)=${CALLERID(num)}))
exten => 1036819,n,Set(__MOHCLASS=)
exten => 1036819,n,Set(__REVERSAL_REJECT=FALSE)
exten => 1036819,n,GotoIf($["${REVERSAL_REJECT}"!="TRUE"]?post-reverse-charge)
exten => 1036819,n,GotoIf($["${CHANNEL(reversecharge)}"="1"]?macro-hangupcall)
exten => 1036819,n(post-reverse-charge),Noop()
exten => 1036819,n,Macro(privacy-mgr,3,10)
exten => 1036819,n(did-cid-hook),Noop(CallerID Entry Point)
exten => 1036819,n(dest-ext),Goto(from-did-direct,230,1)
In my case above:
-
I’m using the “NoOp” statements for debug purposes;
-
for any incoming calls with “unknown” or “anonymous” caller IDs*, I’m translating them to a specific number (so that I can manipulate them further in another context);
-
the next lines simply add and strip the international prefix (here the international dialling code for the UK) - I have a reason for this as some SIP providers do not provide the standard national codes;
-
and above last lines, I have copied them 1:1 from the “[ext-did-0001]” context in file “extensions_additional.conf”, where you find the default context definition for the bespoken “600” ring group.
Hope above concept sounds simple enough to carry on with your work in a similar direction.