[macro-stdexten]
; Standard extension macro (with call forwarding)
; ${ARG1} - Extension(we could have used ${MACRO_EXTEN} here as well
; ${ARG2} - Device(s) to ring
;
exten => s,1,DBget(temp=CFIM/${ARG1}) ; Get CFIM key, if not existing, goto 102
exten => s,2,Dial(SIP/${temp}@${ASTGW}) ; Unconditional forward
exten => s,3,Dial(SIP/${ARG2}@${PROXY},30) ; 20 sec timeout
exten => s,4,DBget(temp=CFBS/${ARG1}) ; Get CFBS key, if not existing, goto 105
exten => s,5,Dial(SIP/${temp}@${ASTGW}) ; Forward on busy or unavailable
; No CFIM key
exten => s,102,Goto(s,3)
; No CFBS key - voicemail?
exten => s,105,agi,checkvm.php
exten => s,106,Hangup