; PRI dialing macro
; I want to track who's calling through the PRI. If $ACCOUNTCODE is not set, set it to $ARG2.
; If $ARG2 is empty, default to the string "benshaw". This way the upstream dialplan can
; override the account code, or it can be set explicitly though this macro but no matter what
; it will never be blank.
[macro-pri-dial]
exten => s,1,GotoIf($[$ACCOUNTCODE != ""],s,gotac)
exten => s,n,SetVar(ACCOUNTCODE=${ARG2})
exten => s,n,GotoIf($[{$ARG2} != ""],s,gotac)
exten => s,n,SetVar(ACCOUNTCODE=benshaw)
exten => s,gotac,SetAccount(${ACCOUNTCODE})
exten => s,n,Dial(${BELLTRUNK}/${ARG1})
exten => s,n,Wait(5)
exten => s,n,Congestion
exten => s,dial+101,Busy