
[general]


[globals]


[local-incoming]
include=services
include=local-lines
include=line-outgoing
include=local-hangup

[default]
include=services
include=local-lines


[line-incoming]
exten => _XXXXXXX,1,macro(dialuser,SIP/${EXTEN},${EXTEN})

[line-outgoing]
exten => _X.,1,macro(dialuser,Zap/g1/${EXTEN},${EXTEN})
;exten => _6.,1,macro(dialuser,Zap/g1/${EXTEN},${EXTEN})
;exten => s,1,Dial(Zap/g1)

[services]
;ECHO extension - start with answer
;exten => 600,1,answer
;Wait for channel
;exten => 600,2,wait(2)
;Play a beep
;exten => 600,3,playback(beep)
;Repeat everything
;exten => 600,4,echo()


[local-lines]
;exten => _[1-9]XXXXXX,1,macro(dialuser,SIP/${EXTEN:4},@{EXTEN:4})

;exten => _XXXXXXX,1,macro(dialuser,SIP/${EXTEN},${EXTEN})

; Let it go directly into the trunk line-outgoing context

exten => h,1,noop(PM: Hangup received in local-lines)
exten => h,n,hangup

[local-hangup]
exten => _!,1,answer
exten => _!,n,wait(2)
exten => _!,n,playback(pbx-invalid)
exten => _!,n,hangup

;-----------------------------------------------------------------



[macro-dialuser]
;exten => s,1,SetVar(_ALERT_INFO=<http://127.0.0.1/Bellcore-dr2>)
exten => s,1,dial(${ARG1},38,r)
exten => s,n,noop(PM: Dial ended !!)
exten => s,n,noop(${DIALSTATUS})
exten => s,n,Goto(s-${DIALSTATUS},1)

exten => s-NOANSWER,1,answer
exten => s-NOANSWER,n,wait(2)
exten => s-NOANSWER,n,SayDigits(${ARG2})
exten => s-NOANSWER,n,playback(vm-isunavail)
exten => s-NOANSWER,n,VoiceMail(u${MACRO_EXTEN})
exten => s-NOANSWER,n,hangup

exten => s-BUSY,1,answer
exten => s-BUSY,n,wait(2)
exten => s-BUSY,n,SayDigits(${ARG2})
exten => s-BUSY,n,playback(vm-isonphone)
exten => s-BUSY,n,noop(PM-Busy)
exten => s-BUSY,n,VoiceMail(b${MACRO_EXTEN})
exten => s-BUSY,n,congestion
exten => s-BUSY,n,hangup

exten => s-CHANUNAVAIL,1,answer
exten => s-CHANUNAVAIL,n,wait(2)
exten => s-CHANUNAVAIL,n,playback(pbx-invalid)
exten => s-CHANUNAVAIL,n,hangup

exten => _s-.,1,answer
exten => _s-.,n,wait(2)
exten => _s-.,n,SayDigits(${ARG2})
exten => _s-.,n,playback(vm-isunavail)
exten => _s-.,n,hangup

exten => h,1,noop(PM: Hangup in macro !!)

