DISA, contexts, and timeouts

I don’t see the disa section or my eyes gone bad? take a look :

[globals]
FMDEVSTATE = TRUE
DNDDEVSTATE = TRUE
INTERCOMCODE = nointercom
CALLFILENAME = ""
DIAL_OPTIONS = r
TRUNK_OPTIONS =
DIAL_OUT = 9
FAX =
FAX_RX = system
FAX_RX_EMAIL = [email protected]
FAX_RX_FROM = [email protected]
INCOMING = group-all
NULL = ""
OPERATOR =
OPERATOR_XTN =
PARKNOTIFY = SIP/200
RECORDEXTEN = ""
RINGTIMER = 15
DIRECTORY = both
AFTER_INCOMING =
IN_OVERRIDE = forcereghours
REGTIME = 7:55-17:05
REGDAYS = mon-fri
DIRECTORY_OPTS = e
DIALOUTIDS = 1
OUT_1 = DAHDI/g0
VM_PREFIX = *
VM_OPTS =
VM_GAIN =
VM_DDTYPE = u
TIMEFORMAT = kM
TONEZONE = us
ALLOW_SIP_ANON = no
VMX_CONTEXT = from-internal
VMX_PRI = 1
VMX_TIMEDEST_CONTEXT =
VMX_TIMEDEST_EXT = dovm
VMX_TIMEDEST_PRI = 1
VMX_LOOPDEST_CONTEXT =
VMX_LOOPDEST_EXT = dovm
VMX_LOOPDEST_PRI = 1
VMX_OPTS_TIMEOUT =
VMX_OPTS_LOOP =
VMX_OPTS_DOVM =
VMX_TIMEOUT = 2
VMX_REPEAT = 1
VMX_LOOPS = 1
TRANSFER_CONTEXT = from-internal-xfer
MIXMON_FORMAT = wav
MIXMON_DIR =
MIXMON_POST =
RECORDING_STATE = ENABLED
OUT_2 = SIP/callcentric
OUTPREFIX_2 =
OUTMAXCHANS_2 =
OUTCID_2 =
OUTKEEPCID_2 = off
OUTFAIL_2 =
OUTDISABLE_2 = off
ASTETCDIR = /etc/asterisk
ASTMODDIR = /usr/lib/asterisk/modules
ASTVARLIBDIR = /var/lib/asterisk
ASTAGIDIR = /var/lib/asterisk/agi-bin
ASTSPOOLDIR = /var/spool/asterisk
ASTRUNDIR = /var/run/asterisk
ASTLOGDIR = /var/log/asterisk
CWINUSEBUSY = true
AMPMGRUSER = admin
AMPMGRPASS = amp111
ASTVERSION = 1.6.0.10
ASTCHANDAHDI = 1
PREFIX_TRUNK_2 = 547
#include globals_custom.conf

;end of [globals]

[app-fmf-toggle]
include => app-fmf-toggle-custom
exten => *21,1,Goto(app-fmf-toggle,s,start)
exten => s,1(start),Answer
exten => s,n,Wait(1)
exten => s,n,Macro(user-callerid,)
exten => s,n,GotoIf($["${DB(AMPUSER/${AMPUSER}/followme/ddial)}" = “EXTENSION”]?activate)
exten => s,n,GotoIf($["${DB(AMPUSER/${AMPUSER}/followme/ddial)}" = “DIRECT”]?deactivate:end)
exten => s,n(deactivate),Set(DB(AMPUSER/${AMPUSER}/followme/ddial)=EXTENSION)
exten => s,n,Set(STATE=NOT_INUSE)
exten => s,n,Gosub(app-fmf-toggle,sstate,1)
exten => s,n,Playback(followme&de-activated)
exten => s,n(end),Macro(hangupcall,)
exten => s,n(activate),Set(DB(AMPUSER/${AMPUSER}/followme/ddial)=DIRECT)
exten => s,n,Set(STATE=INUSE)
exten => s,n,Gosub(app-fmf-toggle,sstate,1)
exten => s,n,Playback(followme&activated)
exten => s,n,Macro(hangupcall,)
exten => sstate,1,Set(DEVICES=${DB(AMPUSER/${AMPUSER}/device)})
exten => sstate,n,GotoIf($["${DEVICES}" = “” ]?return)
exten => sstate,n,Set(LOOPCNT=${FIELDQTY(DEVICES,&)})
exten => sstate,n,Set(ITER=1)
exten => sstate,n(begin),Set(DEVICE_STATE(Custom:FOLLOWME${CUT(DEVICES,&,${ITER})})=${STATE})
exten => sstate,n,Set(ITER=$[${ITER} + 1])
exten => sstate,n,GotoIf($[${ITER} <= ${LOOPCNT}]?begin)
exten => sstate,n(return),Return()

; end of [app-fmf-toggle]

[ext-findmefollow]
include => ext-findmefollow-custom
exten => *211000,1,Goto(app-fmf-toggle,*21,1)
exten => *211000,hint,Custom:FOLLOWME1000
exten => *212000,1,Goto(app-fmf-toggle,*21,1)
exten => *212000,hint,Custom:FOLLOWME2000

; end of [ext-findmefollow]

[ext-queues]
include => ext-queues-custom
exten => 800,1,Macro(user-callerid,)
exten => 800,n,Answer
exten => 800,n,Set(__BLKVM_OVERRIDE=BLKVM/${EXTEN}/${CHANNEL})
exten => 800,n,Set(__BLKVM_BASE=${EXTEN})
exten => 800,n,Set(DB(${BLKVM_OVERRIDE})=TRUE)
exten => 800,n,ExecIf($["${REGEX("(M[(]auto-blkvm[)])" ${DIAL_OPTIONS})}" != “1”]?Set(_DIAL_OPTIONS=${DIAL_OPTIONS}M(auto-blkvm)))
exten => 800,n,Set(__NODEST=${EXTEN})
exten => 800,n,GotoIf($[“foo${RGPREFIX}” = “foo”]?REPCID)
exten => 800,n,GotoIf($["${RGPREFIX}" != “${CALLERID(name):0:${LEN(${RGPREFIX})}}”]?REPCID)
exten => 800,n,Noop(Current RGPREFIX is ${RGPREFIX}…stripping from Caller ID)
exten => 800,n,Set(CALLERID(name)=${CALLERID(name):${LEN(${RGPREFIX})}})
exten => 800,n,Set(_RGPREFIX=)
exten => 800,n(REPCID),Noop(CALLERID(name) is ${CALLERID(name)})
exten => 800,n,Set(_RGPREFIX=Support)
exten => 800,n,Set(CALLERID(name)=${RGPREFIX}${CALLERID(name)})
exten => 800,n,Set(MONITOR_FILENAME=/var/spool/asterisk/monitor/q${EXTEN}-${STRFTIME(${EPOCH},%Y%m%d-%H%M%S)}-${UNIQUEID})
exten => 800,n,Queue(800,t,30)
exten => 800,n,dbDel(${BLKVM_OVERRIDE})
exten => 800,n,Set(__NODEST=)
exten => 800,n,Goto(from-did-direct,1000,1)
exten => 800*,1,Macro(agent-add,800,)
exten => 800**,1,Macro(agent-del,800,800)

; end of [ext-queues]

[app-dnd-off]
include => app-dnd-off-custom
exten => *79,1,Answer
exten => *79,n,Wait(1)
exten => *79,n,Macro(user-callerid,)
exten => *79,n,dbDel(DND/${AMPUSER})
exten => *79,n,Set(STATE=NOT_INUSE)
exten => *79,n,Gosub(app-dnd-off,sstate,1)
exten => *79,n,Playback(do-not-disturb&de-activated)
exten => *79,n,Macro(hangupcall,)
exten => sstate,1,Set(DEVICE_STATE(Custom:DND${AMPUSER})=${STATE})
exten => sstate,n,Set(DEVICES=${DB(AMPUSER/${AMPUSER}/device)})
exten => sstate,n,GotoIf($["${DEVICES}" = “” ]?return)
exten => sstate,n,Set(LOOPCNT=${FIELDQTY(DEVICES,&)})
exten => sstate,n,Set(ITER=1)
exten => sstate,n(begin),Set(DEVICE_STATE(Custom:DEVDND${CUT(DEVICES,&,${ITER})})=${STATE})
exten => sstate,n,Set(ITER=$[${ITER} + 1])
exten => sstate,n,GotoIf($[${ITER} <= ${LOOPCNT}]?begin)
exten => sstate,n(return),Return()

; end of [app-dnd-off]

[app-dnd-on]
include => app-dnd-on-custom
exten => *78,1,Answer
exten => *78,n,Wait(1)
exten => *78,n,Macro(user-callerid,)
exten => *78,n,Set(DB(DND/${AMPUSER})=YES)
exten => *78,n,Set(STATE=BUSY)
exten => *78,n,Gosub(app-dnd-on,sstate,1)
exten => *78,n,Playback(do-not-disturb&activated)
exten => *78,n,Macro(hangupcall,)
exten => sstate,1,Set(DEVICE_STATE(Custom:DND${AMPUSER})=${STATE})
exten => sstate,n,Set(DEVICES=${DB(AMPUSER/${AMPUSER}/device)})
exten => sstate,n,GotoIf($["${DEVICES}" = “” ]?return)
exten => sstate,n,Set(LOOPCNT=${FIELDQTY(DEVICES,&)})
exten => sstate,n,Set(ITER=1)
exten => sstate,n(begin),Set(DEVICE_STATE(Custom:DEVDND${CUT(DEVICES,&,${ITER})})=${STATE})
exten => sstate,n,Set(ITER=$[${ITER} + 1])
exten => sstate,n,GotoIf($[${ITER} <= ${LOOPCNT}]?begin)
exten => sstate,n(return),Return()

; end of [app-dnd-on]

[app-dnd-toggle]
include => app-dnd-toggle-custom
exten => *76,1,Answer
exten => *76,n,Wait(1)
exten => *76,n,Macro(user-callerid,)
exten => *76,n,GotoIf($["${DB(DND/${AMPUSER})}" = “”]?activate:deactivate)
exten => *76,n(activate),Set(DB(DND/${AMPUSER})=YES)
exten => *76,n,Set(STATE=BUSY)
exten => *76,n,Gosub(app-dnd-toggle,sstate,1)
exten => *76,n,Playback(do-not-disturb&activated)
exten => *76,n,Macro(hangupcall,)
exten => *76,n(deactivate),dbDel(DND/${AMPUSER})
exten => *76,n,Set(STATE=NOT_INUSE)
exten => *76,n,Gosub(app-dnd-toggle,sstate,1)
exten => *76,n,Playback(do-not-disturb&de-activated)
exten => *76,n,Macro(hangupcall,)
exten => sstate,1,Set(DEVICE_STATE(Custom:DND${AMPUSER})=${STATE})
exten => sstate,n,Set(DEVICES=${DB(AMPUSER/${AMPUSER}/device)})
exten => sstate,n,GotoIf($["${DEVICES}" = “” ]?return)
exten => sstate,n,Set(LOOPCNT=${FIELDQTY(DEVICES,&)})
exten => sstate,n,Set(ITER=1)
exten => sstate,n(begin),Set(DEVICE_STATE(Custom:DEVDND${CUT(DEVICES,&,${ITER})})=${STATE})
exten => sstate,n,Set(ITER=$[${ITER} + 1])
exten => sstate,n,GotoIf($[${ITER} <= ${LOOPCNT}]?begin)
exten => sstate,n(return),Return()

; end of [app-dnd-toggle]

[ext-dnd-hints]
include => ext-dnd-hints-custom
exten => *761000,1,Goto(app-dnd-toggle,*76,1)
exten => *761000,hint,Custom:DEVDND1000
exten => *762000,1,Goto(app-dnd-toggle,*76,1)
exten => *762000,hint,Custom:DEVDND2000

; end of [ext-dnd-hints]

[app-calltrace]
include => app-calltrace-custom
exten => *69,1,Goto(app-calltrace-perform,s,1)

; end of [app-calltrace]

[app-calltrace-perform]
include => app-calltrace-perform-custom
exten => s,1,Answer
exten => s,n,Wait(1)
exten => s,n,Macro(user-callerid,)
exten => s,n,Playback(info-about-last-call&telephone-number)
exten => s,n,Set(lastcaller=${DB(CALLTRACE/${AMPUSER})})
exten => s,n,GotoIf($[ $[ “${lastcaller}” = “” ] | $[ “${lastcaller}” = “unknown” ] ]?noinfo)
exten => s,n,SayDigits(${lastcaller})
exten => s,n,Set(TIMEOUT(digit)=3)
exten => s,n,Set(TIMEOUT(response)=7)
exten => s,n,Background(to-call-this-number&press-1)
exten => s,n,Goto(fin)
exten => s,n(noinfo),Playback(from-unknown-caller)
exten => s,n,Macro(hangupcall,)
exten => s,n(fin),Noop(Waiting for input)
exten => s,n,WaitExten(60,)
exten => s,n,Playback(sorry-youre-having-problems&goodbye)
exten => 1,1,Goto(from-internal,${lastcaller},1)
exten => i,1,Playback(vm-goodbye)
exten => i,n,Macro(hangupcall,)
exten => t,1,Playback(vm-goodbye)
exten => t,n,Macro(hangupcall,)

; end of [app-calltrace-perform]

[app-directory]
include => app-directory-custom
exten => #,1,Answer
exten => #,n,Wait(1)
exten => #,n,AGI(directory,${DIR-CONTEXT},from-did-direct,${DIRECTORY:0:1}${DIRECTORY_OPTS})
exten => #,n,Playback(vm-goodbye)
exten => #,n,Hangup
exten => i,1,Playback(privacy-incorrect)

; end of [app-directory]

[app-echo-test]
include => app-echo-test-custom
exten => *43,1,Answer
exten => *43,n,Wait(1)
exten => *43,n,Playback(demo-echotest)
exten => *43,n,Echo()
exten => *43,n,Playback(demo-echodone)
exten => *43,n,Hangup

; end of [app-echo-test]

[app-speakextennum]
include => app-speakextennum-custom
exten => *65,1,Answer
exten => *65,n,Wait(1)
exten => *65,n,Macro(user-callerid,)
exten => *65,n,Playback(your)
exten => *65,n,Playback(extension)
exten => *65,n,Playback(number)
exten => *65,n,Playback(is)
exten => *65,n,SayDigits(${AMPUSER})
exten => *65,n,Wait(2)
exten => *65,n,Hangup

; end of [app-speakextennum]

[app-speakingclock]
include => app-speakingclock-custom
exten => *60,1,Answer
exten => *60,n,Wait(1)
exten => *60,n,Set(NumLoops=0)
exten => *60,n(start),Set(FutureTime=$[${EPOCH} + 11])
exten => *60,n,Playback(at-tone-time-exactly)
exten => *60,n,GotoIf($["${TIMEFORMAT}" = “kM”]?hr24format)
exten => *60,n,SayUnixTime(${FutureTime},IM ‘and’ S ‘seconds’ p)
exten => *60,n,Goto(waitloop)
exten => *60,n(hr24format),SayUnixTime(${FutureTime},kM ‘and’ S ‘seconds’)
exten => *60,n(waitloop),Set(TimeLeft=$[${FutureTime} - ${EPOCH}])
exten => *60,n,GotoIf($[${TimeLeft} < 1]?playbeep)
exten => *60,n,Wait(1)
exten => *60,n,Goto(waitloop)
exten => *60,n(playbeep),Playback(beep)
exten => *60,n,Wait(5)
exten => *60,n,Set(NumLoops=$[${NumLoops} + 1])
exten => *60,n,GotoIf($[${NumLoops} < 5]?start)
exten => *60,n,Playback(goodbye)
exten => *60,n,Hangup

; end of [app-speakingclock]

[ext-group]
include => ext-group-custom
exten => 600,1,Macro(user-callerid,)
exten => 600,n,GotoIf($[“foo${BLKVM_OVERRIDE}” = “foo”]?skipdb)
exten => 600,n,GotoIf($["${DB(${BLKVM_OVERRIDE})}" = “TRUE”]?skipov)
exten => 600,n(skipdb),Set(__NODEST=)
exten => 600,n,Set(__BLKVM_OVERRIDE=BLKVM/${EXTEN}/${CHANNEL})
exten => 600,n,Set(__BLKVM_BASE=${EXTEN})
exten => 600,n,Set(DB(${BLKVM_OVERRIDE})=TRUE)
exten => 600,n(skipov),Set(RRNODEST=${NODEST})
exten => 600,n(skipvmblk),Set(__NODEST=${EXTEN})
exten => 600,n,GotoIf($[“foo${RGPREFIX}” = “foo”]?REPCID)
exten => 600,n,GotoIf($["${RGPREFIX}" != “${CALLERID(name):0:${LEN(${RGPREFIX})}}”]?REPCID)
exten => 600,n,Noop(Current RGPREFIX is ${RGPREFIX}…stripping from Caller ID)
exten => 600,n,Set(CALLERID(name)=${CALLERID(name):${LEN(${RGPREFIX})}})
exten => 600,n,Set(_RGPREFIX=)
exten => 600,n(REPCID),Noop(CALLERID(name) is ${CALLERID(name)})
exten => 600,n,Set(_RGPREFIX=Sales)
exten => 600,n,Set(CALLERID(name)=${RGPREFIX}${CALLERID(name)})
exten => 600,n,Set(RecordMethod=Group)
exten => 600,n,Macro(record-enable,1000-2000,${RecordMethod})
exten => 600,n,Set(RingGroupMethod=ringall)
exten => 600,n(DIALGRP),Macro(dial,20,${DIAL_OPTIONS},1000-2000)
exten => 600,n,Set(RingGroupMethod=)
exten => 600,n,GotoIf($[“foo${RRNODEST}” != “foo”]?nodest)
exten => 600,n,Set(__NODEST=)
exten => 600,n,dbDel(${BLKVM_OVERRIDE})
exten => 600,n,Goto(ext-local,vmb1000,1)
exten => 600,n(nodest),Noop(SKIPPING DEST, CALL CAME FROM Q/RG: ${RRNODEST})

; end of [ext-group]

[app-recordings]
include => app-recordings-custom
exten => *77,1,Macro(user-callerid,)
exten => *77,n,Wait(2)
exten => *77,n,Macro(systemrecording,dorecord)
exten => *99,1,Macro(user-callerid,)
exten => *99,n,Wait(2)
exten => *99,n,Macro(systemrecording,docheck)

; end of [app-recordings]

[app-blacklist-check]
include => app-blacklist-check-custom
exten => s,1,GotoIf($["${BLACKLIST()}"=“1”]?blacklisted)
exten => s,n,Return()
exten => s,n(blacklisted),Answer
exten => s,n,Wait(1)
exten => s,n,Zapateller()
exten => s,n,Playback(ss-noservice)
exten => s,n,Hangup

; end of [app-blacklist-check]

[app-blacklist]
include => app-blacklist-custom
exten => *30,1,Goto(app-blacklist-add,s,1)
exten => *32,1,Goto(app-blacklist-last,s,1)
exten => *31,1,Goto(app-blacklist-remove,s,1)

; end of [app-blacklist]

[app-blacklist-add]
include => app-blacklist-add-custom
exten => s,1,Answer
exten => s,n,Wait(1)
exten => s,n,Playback(enter-num-blacklist)
exten => s,n,Set(TIMEOUT(digit)=5)
exten => s,n,Set(TIMEOUT(response)=60)
exten => s,n,Read(blacknr,then-press-pound,)
exten => s,n,SayDigits(${blacknr})
exten => s,n,Playback(if-correct-press&digits/1)
exten => s,n,Noop(Waiting for input)
exten => s,n(end),WaitExten(60,)
exten => s,n,Playback(sorry-youre-having-problems&goodbye)
exten => 1,1,Set(DB(blacklist/${blacknr})=1)
exten => 1,n,Playback(num-was-successfully&added)
exten => 1,n,Wait(1)
exten => 1,n,Hangup

; end of [app-blacklist-add]

[app-blacklist-last]
include => app-blacklist-last-custom
exten => s,1,Answer
exten => s,n,Wait(1)
exten => s,n,Set(lastcaller=${DB(CALLTRACE/${CALLERID(number)})})
exten => s,n,GotoIf($[ $[ “${lastcaller}” = “” ] | $[ “${lastcaller}” = “unknown” ] ]?noinfo)
exten => s,n,Playback(privacy-to-blacklist-last-caller&telephone-number)
exten => s,n,SayDigits(${lastcaller})
exten => s,n,Set(TIMEOUT(digit)=3)
exten => s,n,Set(TIMEOUT(response)=7)
exten => s,n,Playback(if-correct-press&digits/1)
exten => s,n,Goto(end)
exten => s,n(noinfo),Playback(unidentified-no-callback)
exten => s,n,Hangup
exten => s,n,Noop(Waiting for input)
exten => s,n(end),WaitExten(60,)
exten => s,n,Playback(sorry-youre-having-problems&goodbye)
exten => 1,1,Set(DB(blacklist/${lastcaller})=1)
exten => 1,n,Playback(num-was-successfully)
exten => 1,n,Playback(added)
exten => 1,n,Wait(1)
exten => 1,n,Hangup

; end of [app-blacklist-last]

[app-blacklist-remove]
include => app-blacklist-remove-custom
exten => s,1,Answer
exten => s,n,Wait(1)
exten => s,n,Playback(entr-num-rmv-blklist)
exten => s,n,Set(TIMEOUT(digit)=5)
exten => s,n,Set(TIMEOUT(response)=60)
exten => s,n,Read(blacknr,then-press-pound,)
exten => s,n,SayDigits(${blacknr})
exten => s,n,Playback(if-correct-press&digits/1)
exten => s,n,Noop(Waiting for input)
exten => s,n(end),WaitExten(60,)
exten => s,n,Playback(sorry-youre-having-problems&goodbye)
exten => 1,1,dbDel(blacklist/${blacknr})
exten => 1,n,Playback(num-was-successfully&removed)
exten => 1,n,Wait(1)
exten => 1,n,Hangup

; end of [app-blacklist-remove]

[cidlookup]
include => cidlookup-custom
exten => cidlookup_return,1,ExecIf($["${DB(cidname/${CALLERID(num)})}" != “”]?Set(CALLERID(name)=${DB(cidname/${CALLERID(num)})}))
exten => cidlookup_return,n,Return()

; end of [cidlookup]

[macro-autoanswer]
include => macro-autoanswer-custom
exten => s,1,Set(DIAL=${DB(DEVICE/${ARG1}/dial)})
exten => s,n,GotoIf($["${DB(DEVICE/${ARG1}/autoanswer/macro)}" != “” ]?macro)
exten => s,n,Set(phone=${SIPPEER(${CUT(DIAL,/,2)}:useragent)})
exten => s,n,Set(SIPURI=)
exten => s,n,Set(ALERTINFO=Alert-Info: Ring Answer)
exten => s,n,Set(CALLINFO=Call-Info: ;answer-after=0)
exten => s,n,Set(SIPURI=intercom=true)
exten => s,n,Set(DOPTIONS=A(beep))
exten => s,n,Set(DTIME=5)
exten => s,n,Set(ANSWERMACRO=)
exten => s,n,ExecIf($["${phone:0:5}" = “Mitel”]?Set(CALLINFO=Call-Info: sip:broadworks.net;answer-after=0))
exten => s,n,GotoIf($["${ANSWERMACRO}" != “”]?macro2)
exten => s,n,ExecIf($["${ALERTINFO}" != “”]?SipAddHeader(${ALERTINFO}))
exten => s,n,ExecIf($["${CALLINFO}" != “”]?SipAddHeader(${CALLINFO}))
exten => s,n,ExecIf($["${SIPURI}" != “”]?Set(__SIP_URI_OPTIONS=${SIPURI}))
exten => s,n+2(macro),Macro(${DB(DEVICE/${ARG1}/autoanswer/macro)},${ARG1})
exten => s,n+2(macro2),Macro(${ANSWERMACRO},${ARG1})

; end of [macro-autoanswer]

[ext-paging]
include => ext-paging-custom
exten => _PAGE.,1,GotoIf($[ ${AMPUSER} = ${EXTEN:4} ]?skipself)
exten => _PAGE.,n,GotoIf($[ ${FORCE_PAGE} != 1 ]?AVAIL)
exten => _PAGE.,n,Set(AVAILSTATUS=not checked)
exten => _PAGE.,n,Goto(SKIPCHECK)
exten => _PAGE.,n(AVAIL),ChanIsAvail(${DB(DEVICE/${EXTEN:4}/dial)},js)
exten => _PAGE.,n(SKIPCHECK),Noop(Seems to be available (state = ${AVAILSTATUS})
exten => _PAGE.,n,GotoIf($["${DB(DND/${DB(DEVICE/${EXTEN:4}/user)})}" = “YES”]?skipself)
exten => _PAGE.,n,Macro(autoanswer,${EXTEN:4})
exten => _PAGE.,n,Dial(${DIAL},${DTIME},${DOPTIONS})
exten => _PAGE.,n(skipself),Noop(Not paging originator)
exten => _PAGE.,n,Hangup
exten => _PAGE.,AVAIL+101,Noop(Channel ${AVAILCHAN} is not available (state = ${AVAILSTATUS}))

; end of [ext-paging]

[macro-speeddial-lookup]
include => macro-speeddial-lookup-custom
exten => s,1,GotoIf($["${ARG2}"=""]]?lookupsys)
exten => s,n,Set(SPEEDDIALNUMBER=)
exten => s,n(lookupuser),Set(SPEEDDIALNUMBER=${DB(AMPUSER/${ARG2}/speeddials/${ARG1})})
exten => s,n,GotoIf($["${SPEEDDIALNUMBER}"=""]?lookupsys)
exten => s,n,Noop(Found speeddial ${ARG1} for user ${ARG2}: ${SPEEDDIALNUMBER})
exten => s,n,Goto(end)
exten => s,lookupuser+101(lookupsys),Set(SPEEDDIALNUMBER=${DB(sysspeeddials/${ARG1})})
exten => s,n,GotoIf($["${SPEEDDIALNUMBER}"=""]?failed)
exten => s,n,Noop(Found system speeddial ${ARG1}: ${SPEEDDIALNUMBER})
exten => s,n,Goto(end)
exten => s,lookupsys+101(failed),Noop(No system or user speeddial found)
exten => s,n(end),Noop(End of Speeddial-lookup)

; end of [macro-speeddial-lookup]

[app-speeddial]
include => app-speeddial-custom
exten => _*0.,1,Macro(user-callerid,)
exten => _*0.,n,Set(SPEEDDIALLOCATION=${EXTEN:2})
exten => _*0.,n(lookup),Macro(speeddial-lookup,${SPEEDDIALLOCATION},${AMPUSER})
exten => _*0.,n,GotoIf($["${SPEEDDIALNUMBER}"=""]?failed)
exten => _*0.,n,Dial(Local/${SPEEDDIALNUMBER}@from-internal/n,)
exten => _*0.,lookup+101(failed),Playback(speed-dial-empty)
exten => _*0.,n,Congestion()
exten => *75,1,Goto(app-speeddial-set,s,1)

; end of [app-speeddial]

[app-speeddial-set]
include => app-speeddial-set-custom
exten => s,1,Macro(user-callerid,)
exten => s,n(setloc),Read(newlocation,speed-enterlocation,)
exten => s,n(lookup),Macro(speeddial-lookup,${newlocation},${AMPUSER})
exten => s,n(lookup),GotoIf($["${SPEEDDIALNUMBER}"!=""]?conflicts)
exten => s,n(setnum),Read(newnum,speed-enternumber,)
exten => s,n(success),Set(DB(AMPUSER/${AMPUSER}/speeddials/${newlocation})=${newnum})
exten => s,n,Playback(speed-dial)
exten => s,n,SayDigits(${newlocation})
exten => s,n,Playback(is-set-to)
exten => s,n,SayDigits(${newnum})
exten => s,n,Hangup
exten => s,n(conflicts),Playback(speed-dial)
exten => s,n,SayDigits(${newlocation})
exten => s,n,Playback(is-in-use)
exten => s,n,Background(press-1&to-listen-to-it&press-2&to-enter-a-diff&location&press-3&to-change&telephone-number)
exten => s,n,WaitExten(60,)
exten => 1,1,Playback(speed-dial)
exten => 1,n,SayDigits(${newlocation})
exten => 1,n,Playback(is-set-to)
exten => 1,n,SayDigits(${SPEEDDIALNUMBER})
exten => 1,n,Goto(s,conflicts)
exten => 2,1,Goto(s,setloc)
exten => 3,1,Goto(s,setnum)
exten => t,1,Congestion()

; end of [app-speeddial-set]

[ivr-2]
include => ivr-2-custom
include => from-did-direct-ivr
include => app-directory
exten => #,1,dbDel(${BLKVM_OVERRIDE})
exten => #,n,Set(__NODEST=)
exten => #,n,Goto(app-directory,#,1)
exten => h,1,Hangup
exten => s,1,Set(MSG=custom/would-you-like-to-connect)
exten => s,n,Set(LOOPCOUNT=0)
exten => s,n,Set(__DIR-CONTEXT=default)
exten => s,n,Set(IVR_CONTEXT${CONTEXT}=${IVR_CONTEXT})
exten => s,n,Set(_IVR_CONTEXT=${CONTEXT})
exten => s,n,GotoIf($["${CDR(disposition)}" = “ANSWERED”]?begin)
exten => s,n,Answer
exten => s,n,Wait(1)
exten => s,n(begin),Set(TIMEOUT(digit)=3)
exten => s,n,Set(TIMEOUT(response)=10)
exten => s,n,Set(__IVR_RETVM=)
exten => s,n,ExecIf($["${MSG}" != “”]?Background(${MSG}))
exten => s,n,WaitExten(,)
exten => hang,1,Playback(vm-goodbye)
exten => hang,n,Hangup
exten => 1,1,dbDel(${BLKVM_OVERRIDE})
exten => 1,n,Set(__NODEST=)
exten => 1,n,Goto(ext-group,600,1)
exten => 2,1,dbDel(${BLKVM_OVERRIDE})
exten => 2,n,Set(__NODEST=)
exten => 2,n,Goto(ext-queues,800,1)
exten => 3,1,dbDel(${BLKVM_OVERRIDE})
exten => 3,n,Set(__NODEST=)
exten => 3,n,Goto(app-pbdirectory,pbdirectory,1)
exten => i,1,Playback(invalid)
exten => i,n,Goto(loop,1)
exten => t,1,Goto(loop,1)
exten => loop,1,Set(LOOPCOUNT=$[${LOOPCOUNT} + 1])
exten => loop,n,GotoIf($[${LOOPCOUNT} > 2]?hang,1)
exten => loop,n,Goto(ivr-2,s,begin)
exten => return,1,Set(MSG=custom/would-you-like-to-connect)
exten => return,n,Set(IVR_CONTEXT=${CONTEXT})
exten => return,n,Set(IVR_CONTEXT${CONTEXT}=${IVR_CONTEXT
${CONTEXT}})
exten => return,n,Goto(ivr-2,s,begin)
exten => fax,1,Goto(ext-fax,in_fax,1)

; end of [ivr-2]

[app-callwaiting-cwoff]
include => app-callwaiting-cwoff-custom
exten => *71,1,Answer
exten => *71,n,Wait(1)
exten => *71,n,Macro(user-callerid,)
exten => *71,n,dbDel(CW/${AMPUSER})
exten => *71,n,Playback(call-waiting&de-activated)
exten => *71,n,Macro(hangupcall,)

; end of [app-callwaiting-cwoff]

[app-callwaiting-cwon]
include => app-callwaiting-cwon-custom
exten => *70,1,Answer
exten => *70,n,Wait(1)
exten => *70,n,Macro(user-callerid,)
exten => *70,n,Set(DB(CW/${AMPUSER})=ENABLED)
exten => *70,n,Playback(call-waiting&activated)
exten => *70,n,Macro(hangupcall,)

; end of [app-callwaiting-cwon]

[app-pbdirectory]
include => app-pbdirectory-custom
exten => 411,1,Answer
exten => 411,n,Wait(1)
exten => 411,n,Goto(pbdirectory,1)
exten => pbdirectory,1,Macro(user-callerid,)
exten => pbdirectory,n,AGI(pbdirectory)
exten => pbdirectory,n,GotoIf($["${dialnumber}"=""]?hangup,1)
exten => pbdirectory,n,Noop(Got number to dial: ${dialnumber})
exten => pbdirectory,n,Dial(Local/${dialnumber}@from-internal/n,)
exten => hangup,1,Hangup

; end of [app-pbdirectory]

[app-cf-busy-off]
include => app-cf-busy-off-custom
exten => *91,1,Answer
exten => *91,n,Wait(1)
exten => *91,n,Macro(user-callerid,)
exten => *91,n,dbDel(CFB/${AMPUSER})
exten => *91,n,Playback(call-fwd-on-busy&de-activated)
exten => *91,n,Macro(hangupcall,)
exten => _*91.,1,Answer
exten => _*91.,n,Wait(1)
exten => _*91.,n,Set(fromext=${EXTEN:3})
exten => _*91.,n,dbDel(CFB/${fromext})
exten => _*91.,n,Playback(call-fwd-on-busy&for&extension)
exten => _*91.,n,SayDigits(${fromext})
exten => _*91.,n,Playback(cancelled)
exten => _*91.,n,Macro(hangupcall,)

; end of [app-cf-busy-off]

[app-cf-busy-off-any]
include => app-cf-busy-off-any-custom
exten => *92,1,Answer
exten => *92,n,Wait(1)
exten => *92,n,Playback(please-enter-your&extension)
exten => *92,n,Read(fromext,then-press-pound,)
exten => *92,n,Wait(1)
exten => *92,n,dbDel(CFB/${fromext})
exten => *92,n,Playback(call-fwd-on-busy&for&extension)
exten => *92,n,SayDigits(${fromext})
exten => *92,n,Playback(cancelled)
exten => *92,n,Macro(hangupcall,)

; end of [app-cf-busy-off-any]

[app-cf-busy-on]
include => app-cf-busy-on-custom
exten => *90,1,Answer
exten => *90,n,Wait(1)
exten => *90,n,Macro(user-callerid,)
exten => *90,n,Playback(call-fwd-on-busy)
exten => *90,n,Playback(please-enter-your&extension)
exten => *90,n,Read(fromext,then-press-pound,)
exten => *90,n,Set(fromext=${IF($[“foo${fromext}”=“foo”]?${AMPUSER}:${fromext})})
exten => *90,n,Wait(1)
exten => *90,n(startread),Playback(ent-target-attendant)
exten => *90,n,Read(toext,then-press-pound,)
exten => *90,n,GotoIf($[“foo${toext}”=“foo”]?startread)
exten => *90,n,Wait(1)
exten => *90,n,Set(DB(CFB/${fromext})=${toext})
exten => *90,n,Playback(call-fwd-on-busy&for&extension)
exten => *90,n,SayDigits(${fromext})
exten => *90,n,Playback(is-set-to)
exten => *90,n,SayDigits(${toext})
exten => *90,n,Macro(hangupcall,)
exten => _*90.,1,Answer
exten => _*90.,n,Wait(1)
exten => _*90.,n,Macro(user-callerid,)
exten => _*90.,n,Set(DB(CFB/${AMPUSER})=${EXTEN:3})
exten => _*90.,n,Playback(call-fwd-on-busy&for&extension)
exten => _*90.,n,SayDigits(${AMPUSER})
exten => _*90.,n,Playback(is-set-to)
exten => _*90.,n,SayDigits(${EXTEN:3})
exten => _*90.,n,Macro(hangupcall,)

; end of [app-cf-busy-on]

[app-cf-off]
include => app-cf-off-custom
exten => *73,1,Answer
exten => *73,n,Wait(1)
exten => *73,n,Macro(user-callerid,)
exten => *73,n,dbDel(CF/${AMPUSER})
exten => *73,n,Playback(call-fwd-unconditional&de-activated)
exten => *73,n,Macro(hangupcall,)
exten => _*73.,1,Answer
exten => _*73.,n,Wait(1)
exten => _*73.,n,Set(fromext=${EXTEN:3})
exten => _*73.,n,dbDel(CF/${fromext})
exten => _*73.,n,Playback(call-fwd-unconditional&for&extension)
exten => _*73.,n,SayDigits(${fromext})
exten => _*73.,n,Playback(cancelled)
exten => _*73.,n,Macro(hangupcall,)

; end of [app-cf-off]

[app-cf-off-any]
include => app-cf-off-any-custom
exten => *74,1,Answer
exten => *74,n,Wait(1)
exten => *74,n,Playback(please-enter-your&extension)
exten => *74,n,Read(fromext,then-press-pound,)
exten => *74,n,Wait(1)
exten => *74,n,dbDel(CF/${fromext})
exten => *74,n,Playback(call-fwd-unconditional&for&extension)
exten => *74,n,SayDigits(${fromext})
exten => *74,n,Playback(cancelled)
exten => *74,n,Macro(hangupcall,)

; end of [app-cf-off-any]

[app-cf-on]
include => app-cf-on-custom
exten => *72,1,Answer
exten => *72,n,Wait(1)
exten => *72,n,Macro(user-callerid,)
exten => *72,n,Playback(call-fwd-unconditional)
exten => *72,n,Playback(please-enter-your&extension)
exten => *72,n,Read(fromext,then-press-pound,)
exten => *72,n,Set(fromext=${IF($[“foo${fromext}”=“foo”]?${AMPUSER}:${fromext})})
exten => *72,n,Wait(1)
exten => *72,n(startread),Playback(ent-target-attendant)
exten => *72,n,Read(toext,then-press-pound,)
exten => *72,n,GotoIf($[“foo${toext}”=“foo”]?startread)
exten => *72,n,Wait(1)
exten => *72,n,Set(DB(CF/${fromext})=${toext})
exten => *72,n,Playback(call-fwd-unconditional&for&extension)
exten => *72,n,SayDigits(${fromext})
exten => *72,n,Playback(is-set-to)
exten => *72,n,SayDigits(${toext})
exten => *72,n,Macro(hangupcall,)
exten => _*72.,1,Answer
exten => _*72.,n,Wait(1)
exten => _*72.,n,Macro(user-callerid,)
exten => _*72.,n,Set(DB(CF/${AMPUSER})=${EXTEN:3})
exten => _*72.,n,Playback(call-fwd-unconditional&for&extension)
exten => _*72.,n,SayDigits(${AMPUSER})
exten => _*72.,n,Playback(is-set-to)
exten => _*72.,n,SayDigits(${EXTEN:3})
exten => _*72.,n,Macro(hangupcall,)

; end of [app-cf-on]

[app-cf-unavailable-off]
include => app-cf-unavailable-off-custom
exten => *53,1,Answer
exten => *53,n,Wait(1)
exten => *53,n,Macro(user-callerid,)
exten => *53,n,dbDel(CFU/${AMPUSER})
exten => *53,n,Playback(call-fwd-no-ans&de-activated)
exten => *53,n,Macro(hangupcall,)
exten => _*53.,1,Answer
exten => _*53.,n,Wait(1)
exten => _*53.,n,Set(fromext=${EXTEN:3})
exten => _*53.,n,dbDel(CFU/${fromext})
exten => _*53.,n,Playback(call-fwd-no-ans&for&extension)
exten => _*53.,n,SayDigits(${fromext})
exten => _*53.,n,Playback(cancelled)
exten => _*53.,n,Macro(hangupcall,)

; end of [app-cf-unavailable-off]

[app-cf-unavailable-on]
include => app-cf-unavailable-on-custom
exten => *52,1,Answer
exten => *52,n,Wait(1)
exten => *52,n,Macro(user-callerid,)
exten => *52,n,Playback(call-fwd-no-ans)
exten => *52,n,Playback(please-enter-your&extension)
exten => *52,n,Read(fromext,then-press-pound,)
exten => *52,n,Set(fromext=${IF($[“foo${fromext}”=“foo”]?${AMPUSER}:${fromext})})
exten => *52,n,Wait(1)
exten => *52,n(startread),Playback(ent-target-attendant)
exten => *52,n,Read(toext,then-press-pound,)
exten => *52,n,GotoIf($[“foo${toext}”=“foo”]?startread)
exten => *52,n,Wait(1)
exten => *52,n,Set(DB(CFU/${fromext})=${toext})
exten => *52,n,Playback(call-fwd-no-ans&for&extension)
exten => *52,n,SayDigits(${fromext})
exten => *52,n,Playback(is-set-to)
exten => *52,n,SayDigits(${toext})
exten => *52,n,Macro(hangupcall,)
exten => _*52.,1,Answer
exten => _*52.,n,Wait(1)
exten => _*52.,n,Macro(user-callerid,)
exten => _*52.,n,Set(DB(CFU/${AMPUSER})=${EXTEN:3})
exten => _*52.,n,Playback(call-fwd-no-ans&for&extension)
exten => _*52.,n,SayDigits(${AMPUSER})
exten => _*52.,n,Playback(is-set-to)
exten => _*52.,n,SayDigits(${EXTEN:3})
exten => _*52.,n,Macro(hangupcall,)

; end of [app-cf-unavailable-on]

[app-dialvm]
include => app-dialvm-custom
exten => *98,1,Answer
exten => *98,n(start),Wait(1)
exten => *98,n,Noop(app-dialvm: Asking for mailbox)
exten => *98,n,Read(MAILBOX,vm-login,3,2)
exten => *98,n(check),Noop(app-dialvm: Got Mailbox ${MAILBOX})
exten => *98,n,Macro(get-vmcontext,${MAILBOX})
exten => *98,n,MailBoxExists(${MAILBOX}@${VMCONTEXT})
exten => *98,n,GotoIf($["${VMBOXEXISTSSTATUS}" = “SUCCESS”]?good:bad)
exten => *98,n,Macro(hangupcall,)
exten => *98,n(good),Noop(app-dialvm: Good mailbox ${MAILBOX}@${VMCONTEXT})
exten => *98,n,VoiceMailMain(${MAILBOX}@${VMCONTEXT})
exten => *98,n,GotoIf($["${IVR_RETVM}" = “RETURN” & “${IVR_CONTEXT}” != “”]?playret)
exten => *98,n,Macro(hangupcall,)
exten => *98,n(bad),Noop(app-dialvm: BAD mailbox ${MAILBOX}@${VMCONTEXT})
exten => *98,n,Wait(1)
exten => *98,n,Noop(app-dialvm: Asking for password so people can’t probe for existence of a mailbox)
exten => *98,n,Read(FAKEPW,vm-password,3,2)
exten => *98,n,Noop(app-dialvm: Asking for mailbox again)
exten => *98,n,Read(MAILBOX,vm-incorrect-mailbox,3,2)
exten => *98,n,Goto(check)
exten => *98,n,Macro(hangupcall,)
exten => *98,n(playret),Playback(beep&you-will-be-transfered-menu&silence/1)
exten => *98,n,Goto(${IVR_CONTEXT},return,1)
exten => _*98.,1,Answer
exten => _*98.,n,Wait(1)
exten => _*98.,n,Macro(get-vmcontext,${EXTEN:3})
exten => _*98.,n,VoiceMailMain(${EXTEN:3}@${VMCONTEXT})
exten => _*98.,n,GotoIf($["${IVR_RETVM}" = “RETURN” & “${IVR_CONTEXT}” != “”]?${IVR_CONTEXT},return,1)
exten => _*98.,n,Macro(hangupcall,)

; end of [app-dialvm]

[app-vmmain]
include => app-vmmain-custom
exten => *97,1,Answer
exten => *97,n,Wait(1)
exten => *97,n,Macro(user-callerid,)
exten => *97,n,Macro(get-vmcontext,${AMPUSER})
exten => *97,n(check),MailBoxExists(${AMPUSER}@${VMCONTEXT})
exten => *97,n,GotoIf($["${VMBOXEXISTSSTATUS}" = “SUCCESS”]?mbexist)
exten => *97,n,VoiceMailMain()
exten => *97,n,GotoIf($["${IVR_RETVM}" = “RETURN” & “${IVR_CONTEXT}” != “”]?playret)
exten => *97,n,Macro(hangupcall,)
exten => *97,check+101(mbexist),VoiceMailMain(${AMPUSER}@${VMCONTEXT})
exten => *97,n,GotoIf($["${IVR_RETVM}" = “RETURN” & “${IVR_CONTEXT}” != “”]?playret)
exten => *97,n,Macro(hangupcall,)
exten => *97,n(playret),Playback(beep&you-will-be-transfered-menu&silence/1)
exten => *97,n,Goto(${IVR_CONTEXT},return,1)

; end of [app-vmmain]

[app-userlogonoff]
include => app-userlogonoff-custom
exten => *12,1,Macro(user-logoff,)
exten => *12,n,Hangup
exten => *11,1,Macro(user-logon,)
exten => *11,n,Hangup
exten => _*11.,1,Macro(user-logon,${EXTEN:3},)
exten => _*11.,n,Hangup

; end of [app-userlogonoff]

[app-pickup]
include => app-pickup-custom
exten => _.,1,Noop(Attempt to Pickup ${EXTEN:2} by ${CALLERID(num)})
exten => _
.,n,Pickup(${EXTEN:2})
exten => _.,n,Pickup(${EXTEN:2}@ext-local)
exten => _
.,n,Pickup(${EXTEN:2}@from-internal)
exten => _.,n,Pickup(${EXTEN:2}@from-did-direct)
exten => _
.,n,Pickup(FMPR-${EXTEN:2})
exten => _.,n,Pickup(LC-${EXTEN:2}@from-internal)
exten => _
.,n,Pickup(FMPR-${EXTEN:2}@from-internal)
exten => _.,n,Pickup(FMPR-${EXTEN:2}@from-did-direct)
exten => _
.,n,Hangup
exten => **1000,1,Pickup(1000)
exten => **1000,n,Pickup(1000@ext-local)
exten => **1000,n,Pickup(1000@from-internal)
exten => **1000,n,Pickup(1000@from-did-direct)
exten => **1000,n,Pickup(LC-1000@from-internal)
exten => **1000,n,Pickup(FMPR-1000)
exten => **1000,n,Pickup(FMPR-1000@from-internal)
exten => **1000,n,Pickup(FMPR-1000@from-did-direct)
exten => **1000,n,Pickup(600@from-internal)
exten => **1000,n,Pickup(600@ext-group)
exten => **1000,n,Hangup
exten => **2000,1,Pickup(2000)
exten => **2000,n,Pickup(2000@ext-local)
exten => **2000,n,Pickup(2000@from-internal)
exten => **2000,n,Pickup(2000@from-did-direct)
exten => **2000,n,Pickup(LC-2000@from-internal)
exten => **2000,n,Pickup(FMPR-2000)
exten => **2000,n,Pickup(FMPR-2000@from-internal)
exten => **2000,n,Pickup(FMPR-2000@from-did-direct)
exten => **2000,n,Pickup(600@from-internal)
exten => **2000,n,Pickup(600@ext-group)
exten => **2000,n,Hangup

; end of [app-pickup]

[app-zapbarge]
include => app-zapbarge-custom
exten => 888,1,Macro(user-callerid,)
exten => 888,n,Set(GROUP()=${CALLERID(number)})
exten => 888,n,Answer
exten => 888,n,Wait(1)
exten => 888,n,DAHDIBarge()
exten => 888,n,Hangup

; end of [app-zapbarge]

[app-chanspy]
include => app-chanspy-custom
exten => 555,1,Macro(user-callerid,)
exten => 555,n,Answer
exten => 555,n,Wait(1)
exten => 555,n,ChanSpy()
exten => 555,n,Hangup

; end of [app-chanspy]

[ext-test]
include => ext-test-custom
exten => 7777,1,Goto(from-pstn,${EXTEN},1)
exten => 666,1,Goto(ext-fax,in_fax,1)
exten => h,1,Macro(hangupcall,)

; end of [ext-test]

[ext-did-0001]
include => ext-did-0001-custom
exten => fax,1,Goto(ext-fax,in_fax,1)
exten => s,1,Set(__FROM_DID=${EXTEN})
exten => s,n,Gosub(app-blacklist-check,s,1)
exten => s,n,ExecIf($[ “${CALLERID(name)}” = “” ] ?Set(CALLERID(name)=${CALLERID(num)}))
exten => s,n,Set(__CALLINGPRES_SV=${CALLERPRES()})
exten => s,n,Set(CALLERPRES()=allowed_not_screened)
exten => s,n,Goto(ext-group,600,1)

; end of [ext-did-0001]

[ext-did-0002]
include => ext-did-0002-custom
exten => fax,1,Goto(ext-fax,in_fax,1)
exten => 17772099669,1,Set(__FROM_DID=${EXTEN})
exten => 17772099669,n,Gosub(app-blacklist-check,s,1)
exten => 17772099669,n,ExecIf($[ “${CALLERID(name)}” = “” ] ?Set(CALLERID(name)=${CALLERID(num)}))
exten => 17772099669,n,Set(__CALLINGPRES_SV=${CALLERPRES()})
exten => 17772099669,n,Set(CALLERPRES()=allowed_not_screened)
exten => 17772099669,n,Goto(ivr-2,s,1)

; end of [ext-did-0002]

[ext-did]
include => ext-did-custom
include => ext-did-0001
include => ext-did-0002
exten => fax,1,Goto(ext-fax,in_fax,1)

; end of [ext-did]

[ext-did-catchall]
include => ext-did-catchall-custom
exten => _.,1,Noop(Catch-All DID Match - Found ${EXTEN} - You probably want a DID for this.)
exten => _.,n,Goto(ext-did,s,1)

; end of [ext-did-catchall]

[ext-local]
include => ext-local-custom
exten => 1000,1,Macro(exten-vm,1000,1000)
exten => 1000,n,Goto(vmret,1)
exten => 1000,hint,SIP/1000&Custom:DND1000
exten => ${VM_PREFIX}1000,1,Macro(vm,1000,DIRECTDIAL,${IVR_RETVM})
exten => ${VM_PREFIX}1000,n,Goto(vmret,1)
exten => vmb1000,1,Macro(vm,1000,BUSY,${IVR_RETVM})
exten => vmb1000,n,Goto(vmret,1)
exten => vmu1000,1,Macro(vm,1000,NOANSWER,${IVR_RETVM})
exten => vmu1000,n,Goto(vmret,1)
exten => vms1000,1,Macro(vm,1000,NOMESSAGE,${IVR_RETVM})
exten => vms1000,n,Goto(vmret,1)
exten => 2000,1,Set(__RINGTIMER=10)
exten => 2000,n,Macro(exten-vm,2000,2000)
exten => 2000,n,Goto(vmret,1)
exten => 2000,hint,SIP/2000&Custom:DND2000
exten => ${VM_PREFIX}2000,1,Macro(vm,2000,DIRECTDIAL,${IVR_RETVM})
exten => ${VM_PREFIX}2000,n,Goto(vmret,1)
exten => vmb2000,1,Macro(vm,2000,BUSY,${IVR_RETVM})
exten => vmb2000,n,Goto(vmret,1)
exten => vmu2000,1,Macro(vm,2000,NOANSWER,${IVR_RETVM})
exten => vmu2000,n,Goto(vmret,1)
exten => vms2000,1,Macro(vm,2000,NOMESSAGE,${IVR_RETVM})
exten => vms2000,n,Goto(vmret,1)
exten => vmret,1,GotoIf($["${IVR_RETVM}" = “RETURN” & “${IVR_CONTEXT}” != “”]?playret)
exten => vmret,n,Hangup
exten => vmret,n(playret),Playback(exited-vm-will-be-transfered&silence/1)
exten => vmret,n,Goto(${IVR_CONTEXT},return,1)

; end of [ext-local]

[from-did-direct-ivr]
include => from-did-direct-ivr-custom
exten => 1000,1,ExecIf($["${BLKVM_OVERRIDE}" != “”]?dbDel(${BLKVM_OVERRIDE}))
exten => 1000,n,Set(__NODEST=)
exten => 1000,n,Goto(from-did-direct,1000,1)
exten => ${VM_PREFIX}1000,1,ExecIf($["${BLKVM_OVERRIDE}" != “”]?dbDel(${BLKVM_OVERRIDE}))
exten => ${VM_PREFIX}1000,n,Set(__NODEST=)
exten => ${VM_PREFIX}1000,n,Macro(vm,1000,DIRECTDIAL,${IVR_RETVM})
exten => ${VM_PREFIX}1000,n,GotoIf($["${IVR_RETVM}" = “RETURN” & “${IVR_CONTEXT}” != “”]?ext-local,vmret,playret)
exten => 2000,1,ExecIf($["${BLKVM_OVERRIDE}" != “”]?dbDel(${BLKVM_OVERRIDE}))
exten => 2000,n,Set(__NODEST=)
exten => 2000,n,Goto(from-did-direct,2000,1)
exten => ${VM_PREFIX}2000,1,ExecIf($["${BLKVM_OVERRIDE}" != “”]?dbDel(${BLKVM_OVERRIDE}))
exten => ${VM_PREFIX}2000,n,Set(__NODEST=)
exten => ${VM_PREFIX}2000,n,Macro(vm,2000,DIRECTDIAL,${IVR_RETVM})
exten => ${VM_PREFIX}2000,n,GotoIf($["${IVR_RETVM}" = “RETURN” & “${IVR_CONTEXT}” != “”]?ext-local,vmret,playret)

; end of [from-did-direct-ivr]

[from-trunk-sip-callcentric]
include => from-trunk-sip-callcentric-custom
exten => _.,1,Set(GROUP()=OUT_2)
exten => _.,n,Goto(from-trunk,${EXTEN},1)

; end of [from-trunk-sip-callcentric]

[macro-record-enable]
include => macro-record-enable-custom
exten => s,1,GotoIf($["${BLINDTRANSFER}" = “”]?check)
exten => s,n,ResetCDR(w)
exten => s,n,StopMonitor()
exten => s,n(check),AGI(recordingcheck,${STRFTIME(${EPOCH},%Y%m%d-%H%M%S)},${UNIQUEID})
exten => s,n,MacroExit()
exten => s,1+998(record),MixMonitor(${MIXMON_DIR}${CALLFILENAME}.${MIXMON_FORMAT},${MIXMON_POST})

; end of [macro-record-enable]

[outbound-allroutes]
include => outbound-allroutes-custom
include => outrt-001-to-callcentric
include => outrt-002-9_outside
exten => foo,1,Noop(bar)

; end of [outbound-allroutes]

[outrt-001-to-callcentric]
include => outrt-001-to-callcentric-custom
exten => 311,1,Macro(user-callerid,SKIPTTL,)
exten => 311,n,Set(_NODEST=)
exten => 311,n,Macro(record-enable,${AMPUSER},OUT,)
exten => 311,n,Macro(dialout-trunk,2,${EXTEN},)
exten => 311,n,Macro(outisbusy,)
exten => 411,1,Macro(user-callerid,SKIPTTL,)
exten => 411,n,Set(_NODEST=)
exten => 411,n,Macro(record-enable,${AMPUSER},OUT,)
exten => 411,n,Macro(dialout-trunk,2,${EXTEN},)
exten => 411,n,Macro(outisbusy,)
exten => 505,1,Macro(user-callerid,SKIPTTL,)
exten => 505,n,Set(_NODEST=)
exten => 505,n,Macro(record-enable,${AMPUSER},OUT,)
exten => 505,n,Macro(dialout-trunk,2,${EXTEN},)
exten => 505,n,Macro(outisbusy,)
exten => 911,1,Macro(user-callerid,SKIPTTL,)
exten => 911,n,Set(_NODEST=)
exten => 911,n,Macro(record-enable,${AMPUSER},OUT,)
exten => 911,n,Macro(dialout-trunk,2,${EXTEN},)
exten => 911,n,Macro(outisbusy,)
exten => _011.,1,Macro(user-callerid,SKIPTTL,)
exten => _011.,n,Set(_NODEST=)
exten => _011.,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _011.,n,Macro(dialout-trunk,2,${EXTEN},)
exten => _011.,n,Macro(outisbusy,)
exten => _1800NXXXXXX,1,Macro(user-callerid,SKIPTTL,)
exten => _1800NXXXXXX,n,Set(_NODEST=)
exten => _1800NXXXXXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _1800NXXXXXX,n,Macro(dialout-trunk,2,${EXTEN},)
exten => _1800NXXXXXX,n,Macro(outisbusy,)
exten => _1866NXXXXXX,1,Macro(user-callerid,SKIPTTL,)
exten => _1866NXXXXXX,n,Set(_NODEST=)
exten => _1866NXXXXXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _1866NXXXXXX,n,Macro(dialout-trunk,2,${EXTEN},)
exten => _1866NXXXXXX,n,Macro(outisbusy,)
exten => _1877NXXXXXX,1,Macro(user-callerid,SKIPTTL,)
exten => _1877NXXXXXX,n,Set(_NODEST=)
exten => _1877NXXXXXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _1877NXXXXXX,n,Macro(dialout-trunk,2,${EXTEN},)
exten => _1877NXXXXXX,n,Macro(outisbusy,)
exten => _1888NXXXXXX,1,Macro(user-callerid,SKIPTTL,)
exten => _1888NXXXXXX,n,Set(_NODEST=)
exten => _1888NXXXXXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _1888NXXXXXX,n,Macro(dialout-trunk,2,${EXTEN},)
exten => _1888NXXXXXX,n,Macro(outisbusy,)
exten => _1NXXNXXXXXX,1,Macro(user-callerid,SKIPTTL,)
exten => _1NXXNXXXXXX,n,Set(_NODEST=)
exten => _1NXXNXXXXXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _1NXXNXXXXXX,n,Macro(dialout-trunk,2,${EXTEN},)
exten => _1NXXNXXXXXX,n,Macro(outisbusy,)
exten => _NXXNXXXXXX,1,Macro(user-callerid,SKIPTTL,)
exten => _NXXNXXXXXX,n,Set(_NODEST=)
exten => _NXXNXXXXXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _NXXNXXXXXX,n,Macro(dialout-trunk,2,${EXTEN},)
exten => _NXXNXXXXXX,n,Macro(outisbusy,)
exten => _NXXXXXX,1,Macro(user-callerid,SKIPTTL,)
exten => _NXXXXXX,n,Set(_NODEST=)
exten => _NXXXXXX,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _NXXXXXX,n,Macro(dialout-trunk,2,${EXTEN},)
exten => _NXXXXXX,n,Macro(outisbusy,)

; end of [outrt-001-to-callcentric]

[outrt-002-9_outside]
include => outrt-002-9_outside-custom
exten => _9.,1,Macro(user-callerid,SKIPTTL,)
exten => _9.,n,Set(_NODEST=)
exten => _9.,n,Macro(record-enable,${AMPUSER},OUT,)
exten => _9.,n,Macro(dialout-trunk,1,${EXTEN:1},)
exten => _9.,n,Macro(outisbusy,)

; end of [outrt-002-9_outside]

[app-blackhole]
include => app-blackhole-custom
exten => hangup,1,Noop(Blackhole Dest: Hangup)
exten => hangup,n,Hangup
exten => zapateller,1,Noop(Blackhole Dest: Play SIT Tone)
exten => zapateller,n,Answer
exten => zapateller,n,Zapateller()
exten => musiconhold,1,Noop(Blackhole Dest: Put caller on hold forever)
exten => musiconhold,n,Answer
exten => musiconhold,n,MusicOnHold()
exten => congestion,1,Noop(Blackhole Dest: Congestion)
exten => congestion,n,Answer
exten => congestion,n,Playtones(congestion)
exten => congestion,n,Congestion(20)
exten => congestion,n,Hangup
exten => busy,1,Noop(Blackhole Dest: Busy)
exten => busy,n,Answer
exten => busy,n,Playtones(busy)
exten => busy,n,Busy(20)
exten => busy,n,Hangup
exten => ring,1,Noop(Blackhole Dest: Ring)
exten => ring,n,Answer
exten => ring,n,Playtones(ring)
exten => ring,n,Wait(300)
exten => ring,n,Hangup

; end of [app-blackhole]

[bad-number]
include => bad-number-custom
exten => _X.,1,ResetCDR()
exten => _X.,n,NoCDR()
exten => _X.,n,Wait(1)
exten => _X.,n,Playback(silence/1&cannot-complete-as-dialed&check-number-dial-again,noanswer)
exten => _X.,n,Wait(1)
exten => _X.,n,Congestion(20)
exten => _X.,n,Hangup

; end of [bad-number]

[macro-confirm]
include => macro-confirm-custom
exten => s,1,Set(LOOPCOUNT=0)
exten => s,n,Set(__MACRO_RESULT=ABORT)
exten => s,n,Set(MSG1=${IF($[“foo${ARG1}” != “foo”]?${ARG1}:“incoming-call-1-accept-2-decline”)})
exten => s,n(start),Background(${MSG1},m,${CHANNEL(language)},macro-confirm)
exten => s,n,Read(INPUT,1,4)
exten => s,n,GotoIf($[${LEN(${INPUT})} > 0]?${INPUT},1:t,1)
exten => 1,1,GotoIf($["${DB_EXISTS(RG/${ARG3}/${UNIQCHAN})}" = “0”]?toolate,1)
exten => 1,n,dbDel(RG/${ARG3}/${UNIQCHAN})
exten => 1,n,dbDel(${BLKVM_OVERRIDE})
exten => 1,n,Set(__MACRO_RESULT=)
exten => 1,n(exitopt1),MacroExit()
exten => 2,1,Goto(noanswer,1)
exten => 3,1,SayDigits(${CALLCONFIRMCID})
exten => 3,n,GotoIf($["${DB_EXISTS(RG/${ARG3}/${UNIQCHAN})}" = “0”]?toolate,1:s,start)
exten => t,1,GotoIf($["${DB_EXISTS(RG/${ARG3}/${UNIQCHAN})}" = “0”]?toolate,1)
exten => t,n,Set(LOOPCOUNT=$[ ${LOOPCOUNT} + 1 ])
exten => t,n,GotoIf($[ ${LOOPCOUNT} < 5 ]?s,start:noanswer,1)
exten => _X,1,Background(invalid,m,${CHANNEL(language)},macro-confirm)
exten => _X,n,GotoIf($["${DB_EXISTS(RG/${ARG3}/${UNIQCHAN})}" = “0”]?toolate,1)
exten => _X,n,Set(LOOPCOUNT=$[ ${LOOPCOUNT} + 1 ])
exten => _X,n,GotoIf($[ ${LOOPCOUNT} < 5 ]?s,start:noanswer,1)
exten => noanswer,1,Set(__MACRO_RESULT=ABORT)
exten => noanswer,n(exitnoanswer),MacroExit()
exten => toolate,1,Set(MSG2=${IF($[“foo${ARG2}” != “foo”]?${ARG2}:“incoming-call-no-longer-avail”)})
exten => toolate,n,Playback(${MSG2})
exten => toolate,n,Set(__MACRO_RESULT=ABORT)
exten => toolate,n(exittoolate),MacroExit()
exten => h,1,Macro(hangupcall,)

; end of [macro-confirm]

[macro-auto-confirm]
include => macro-auto-confirm-custom
exten => s,1,Set(__MACRO_RESULT=)
exten => s,n,dbDel(${BLKVM_OVERRIDE})
exten => s,n,dbDel(RG/${ARG1}/${UNIQCHAN})

; end of [macro-auto-confirm]

[macro-auto-blkvm]
include => macro-auto-blkvm-custom
exten => s,1,Set(__MACRO_RESULT=)
exten => s,n,dbDel(${BLKVM_OVERRIDE})

; end of [macro-auto-blkvm]

[sub-pincheck]
include => sub-pincheck-custom
exten => s,1,Authenticate(${ARG3},)
exten => s,n,ResetCDR()
exten => s,n,Return()

; end of [sub-pincheck]

[macro-dialout-trunk]
include => macro-dialout-trunk-custom
exten => s,1,Set(DIAL_TRUNK=${ARG1})
exten => s,n,GosubIf($[$["${ARG3}" != “”] & $["${DB(AMPUSER/${AMPUSER}/pinless)}" != “NOPASSWD”]]?sub-pincheck,s,1)
exten => s,n,GotoIf($[“x${OUTDISABLE_${DIAL_TRUNK}}” = “xon”]?disabletrunk,1)
exten => s,n,Set(DIAL_NUMBER=${ARG2})
exten => s,n,Set(DIAL_TRUNK_OPTIONS=${DIAL_OPTIONS})
exten => s,n,Set(OUTBOUND_GROUP=OUT_${DIAL_TRUNK})
exten => s,n,GotoIf($["${OUTMAXCHANS_${DIAL_TRUNK}}foo" = “foo”]?nomax)
exten => s,n,GotoIf($[ ${GROUP_COUNT(OUT_${DIAL_TRUNK})} >= ${OUTMAXCHANS_${DIAL_TRUNK}} ]?chanfull)
exten => s,n(nomax),GotoIf($["${INTRACOMPANYROUTE}" = “YES”]?skipoutcid)
exten => s,n,Set(DIAL_TRUNK_OPTIONS=${TRUNK_OPTIONS})
exten => s,n,Macro(outbound-callerid,${DIAL_TRUNK})
exten => s,n(skipoutcid),ExecIf($["${PREFIX_TRUNK_${DIAL_TRUNK}}" != “”]?AGI(fixlocalprefix))
exten => s,n,Set(OUTNUM=${OUTPREFIX_${DIAL_TRUNK}}${DIAL_NUMBER})
exten => s,n,Set(custom=${CUT(OUT_${DIAL_TRUNK},:,1)})
exten => s,n,ExecIf($[$["${MOHCLASS}" != “default”] & $["${MOHCLASS}" != “”]]?Set(DIAL_TRUNK_OPTIONS=M(setmusic^${MOHCLASS})${DIAL_TRUNK_OPTIONS}))
exten => s,n(gocall),Macro(dialout-trunk-predial-hook,)
exten => s,n,GotoIf($["${PREDIAL_HOOK_RET}" = “BYPASS”]?bypass,1)
exten => s,n,GotoIf($["${custom}" = “AMP”]?customtrunk)
exten => s,n,Dial(${OUT_${DIAL_TRUNK}}/${OUTNUM},300,${DIAL_TRUNK_OPTIONS})
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s,n(customtrunk),Set(pre_num=${CUT(OUT_${DIAL_TRUNK},$,1)})
exten => s,n,Set(the_num=${CUT(OUT_${DIAL_TRUNK},$,2)})
exten => s,n,Set(post_num=${CUT(OUT_${DIAL_TRUNK},$,3)})
exten => s,n,GotoIf($["${the_num}" = “OUTNUM”]?outnum:skipoutnum)
exten => s,n(outnum),Set(the_num=${OUTNUM})
exten => s,n(skipoutnum),Dial(${pre_num:4}${the_num}${post_num},300,${DIAL_TRUNK_OPTIONS})
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s,n(chanfull),Noop(max channels used up)
exten => s-BUSY,1,Noop(Dial failed due to trunk reporting BUSY - giving up)
exten => s-BUSY,n,Playtones(busy)
exten => s-BUSY,n,Busy(20)
exten => s-NOANSWER,1,Noop(Dial failed due to trunk reporting NOANSWER - giving up)
exten => s-NOANSWER,n,Playtones(congestion)
exten => s-NOANSWER,n,Congestion(20)
exten => s-CANCEL,1,Noop(Dial failed due to trunk reporting CANCEL - giving up)
exten => s-CANCEL,n,Playtones(congestion)
exten => s-CANCEL,n,Congestion(20)
exten => s-CHANUNAVAIL,1,GotoIf($[“x${OUTFAIL_${ARG1}}” = “x”]?noreport)
exten => s-CHANUNAVAIL,n,AGI(${OUTFAIL_${ARG1}})
exten => s-CHANUNAVAIL,n(noreport),Noop(TRUNK Dial failed due to ${DIALSTATUS} (hangupcause: ${HANGUPCAUSE}) - failing through to other trunks)
exten => s-.,1,GotoIf($["x${OUTFAIL${ARG1}}" = “x”]?noreport)
exten => s-.,n,AGI(${OUTFAIL${ARG1}})
exten => s-.,n(noreport),Noop(TRUNK Dial failed due to ${DIALSTATUS} - failing through to other trunks)
exten => disabletrunk,1,Noop(TRUNK: ${OUT
${DIAL_TRUNK}} DISABLED - falling through to next trunk)
exten => bypass,1,Noop(TRUNK: ${OUT_${DIAL_TRUNK}} BYPASSING because dialout-trunk-predial-hook)
exten => h,1,Macro(hangupcall,)

; end of [macro-dialout-trunk]

[macro-dialout-dundi]
include => macro-dialout-dundi-custom
exten => s,1,Set(DIAL_TRUNK=${ARG1})
exten => s,n,GosubIf($[$["${ARG3}" != “”] & $["${DB(AMPUSER/${AMPUSER}/pinless)}" != “NOPASSWD”]]?sub-pincheck,s,1)
exten => s,n,GotoIf($[“x${OUTDISABLE_${DIAL_TRUNK}}” = “xon”]?disabletrunk,1)
exten => s,n,Set(DIAL_NUMBER=${ARG2})
exten => s,n,Set(DIAL_TRUNK_OPTIONS=${DIAL_OPTIONS})
exten => s,n,Set(OUTBOUND_GROUP=OUT_${DIAL_TRUNK})
exten => s,n,GotoIf($["${OUTMAXCHANS_${DIAL_TRUNK}}foo" = “foo”]?nomax)
exten => s,n,GotoIf($[ ${GROUP_COUNT(OUT_${DIAL_TRUNK})} >= ${OUTMAXCHANS_${DIAL_TRUNK}} ]?chanfull)
exten => s,n(nomax),GotoIf($["${INTRACOMPANYROUTE}" = “YES”]?skipoutcid)
exten => s,n,Set(DIAL_TRUNK_OPTIONS=${TRUNK_OPTIONS})
exten => s,n,Macro(outbound-callerid,${DIAL_TRUNK})
exten => s,n(skipoutcid),ExecIf($["${PREFIX_TRUNK_${DIAL_TRUNK}}" != “”]?AGI(fixlocalprefix))
exten => s,n,Set(OUTNUM=${OUTPREFIX_${DIAL_TRUNK}}${DIAL_NUMBER})
exten => s,n,ExecIf($[$["${MOHCLASS}" != “default”] & $["${MOHCLASS}" != “”]]?Set(DIAL_TRUNK_OPTIONS=M(setmusic^${MOHCLASS})${DIAL_TRUNK_OPTIONS}))
exten => s,n(gocall),Macro(dialout-dundi-predial-hook,)
exten => s,n,GotoIf($["${PREDIAL_HOOK_RET}" = “BYPASS”]?bypass,1)
exten => s,n,GotoIf($["${custom}" = “AMP”]?customtrunk)
exten => s,n,Macro(dundi-${DIAL_TRUNK},${OUTNUM})
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s,n(chanfull),Noop(max channels used up)
exten => s-BUSY,1,Noop(Dial failed due to trunk reporting BUSY - giving up)
exten => s-BUSY,n,Playtones(busy)
exten => s-BUSY,n,Busy(20)
exten => s-NOANSWER,1,Noop(Dial failed due to trunk reporting NOANSWER - giving up)
exten => s-NOANSWER,n,Playtones(congestion)
exten => s-NOANSWER,n,Congestion(20)
exten => s-CANCEL,1,Noop(Dial failed due to trunk reporting CANCEL - giving up)
exten => s-CANCEL,n,Playtones(congestion)
exten => s-CANCEL,n,Congestion(20)
exten => s-.,1,GotoIf($["x${OUTFAIL${ARG1}}" = “x”]?noreport)
exten => s-.,n,AGI(${OUTFAIL${ARG1}})
exten => s-.,n(noreport),Noop(TRUNK Dial failed due to ${DIALSTATUS} - failing through to other trunks)
exten => disabletrunk,1,Noop(TRUNK: ${OUT
${DIAL_TRUNK}} DISABLED - falling through to next trunk)
exten => bypass,1,Noop(TRUNK: ${OUT_${DIAL_TRUNK}} BYPASSING because dialout-dundi-predial-hook)
exten => h,1,Macro(hangupcall,)

; end of [macro-dialout-dundi]

[macro-user-callerid]
include => macro-user-callerid-custom
exten => s,1,Set(AMPUSER=${IF($[“foo${AMPUSER}” = “foo”]?${CALLERID(number)}:${AMPUSER})})
exten => s,n,GotoIf($["${CHANNEL:0:5}" = “Local”]?report)
exten => s,n,ExecIf($["${REALCALLERIDNUM:1:2}" = “”]?Set(REALCALLERIDNUM=${CALLERID(number)}))
exten => s,n,Set(AMPUSER=${DB(DEVICE/${REALCALLERIDNUM}/user)})
exten => s,n,Set(AMPUSERCIDNAME=${DB(AMPUSER/${AMPUSER}/cidname)})
exten => s,n,GotoIf($[“x${AMPUSERCIDNAME:1:2}” = “x”]?report)
exten => s,n,Set(AMPUSERCID=${IF($["${DB_EXISTS(AMPUSER/${AMPUSER}/cidnum)}" = “1”]?${DB_RESULT}:${AMPUSER})})
exten => s,n,Set(CALLERID(all)="${AMPUSERCIDNAME}" <${AMPUSERCID}>)
exten => s,n,Set(REALCALLERIDNUM=${DB(DEVICE/${REALCALLERIDNUM}/user)})
exten => s,n,ExecIf($["${DB(AMPUSER/${AMPUSER}/language)}" != “”]?Set(CHANNEL(language)=${DB(AMPUSER/${AMPUSER}/language)}))
exten => s,n(report),GotoIf($[ “${ARG1}” = “SKIPTTL” ]?continue)
exten => s,n(report2),Set(__TTL=${IF($[“foo${TTL}” = “foo”]?64:$[ ${TTL} - 1 ])})
exten => s,n,GotoIf($[ ${TTL} > 0 ]?continue)
exten => s,n,Wait(${RINGTIMER})
exten => s,n,Answer
exten => s,n,Wait(2)
exten => s,n,Playback(im-sorry&an-error-has-occured&with&call-forwarding)
exten => s,n,Macro(hangupcall,)
exten => s,n,Congestion(20)
exten => s,n(continue),Noop(Using CallerID ${CALLERID(all)})
exten => h,1,Macro(hangupcall,)

; end of [macro-user-callerid]

[macro-dialout-enum]
include => macro-dialout-enum-custom
exten => s,1,GosubIf($[$["${ARG3}" != “”] & $["${DB(AMPUSER/${AMPUSER}/pinless)}" != “NOPASSWD”]]?sub-pincheck,s,1)
exten => s,n,Macro(outbound-callerid,${ARG1})
exten => s,n,Set(OUTBOUND_GROUP=OUT_${ARG1})
exten => s,n,GotoIf($["${OUTMAXCHANS_${ARG1}}foo" = “foo”]?nomax)
exten => s,n,GotoIf($[ ${GROUP_COUNT(OUT_${ARG1})} >= ${OUTMAXCHANS_${ARG1}} ]?nochans)
exten => s,n(nomax),Set(DIAL_NUMBER=${ARG2})
exten => s,n,Set(DIAL_TRUNK=${ARG1})
exten => s,n,ExecIf($["${PREFIX_TRUNK_${DIAL_TRUNK}}" != “”]?AGI(fixlocalprefix))
exten => s,n,AGI(enumlookup.agi)
exten => s,n(dialloop),GotoIf($[“foo${DIALARR}”=“foo”]?end)
exten => s,n,Set(TRYDIAL=${CUT(DIALARR,%,1)})
exten => s,n,Set(DIALARR=${CUT(DIALARR,%,2-)})
exten => s,n,Dial(${TRYDIAL},)
exten => s,n,Noop(Dial exited in macro-enum-dialout with ${DIALSTATUS})
exten => s,n,GotoIf($[ $[ “${DIALSTATUS}” = “CHANUNAVAIL” ] | $[ “${DIALSTATUS}” = “CONGESTION” ] ]?dialloop)
exten => s,n(dialfailed),Goto(s-${DIALSTATUS},1)
exten => s,n(nochans),Noop(max channels used up)
exten => s,n(end),Noop(Exiting macro-dialout-enum)
exten => s-BUSY,1,Noop(Trunk is reporting BUSY)
exten => s-BUSY,n,Busy(20)
exten => _s-.,1,Noop(Dial failed due to ${DIALSTATUS})

; end of [macro-dialout-enum]

[macro-outbound-callerid]
include => macro-outbound-callerid-custom
exten => s,1,ExecIf($["${CALLINGPRES_SV}" != “”]?Set(CALLERPRES()=${CALLINGPRES_SV}))
exten => s,n,ExecIf($["${REALCALLERIDNUM:1:2}" = “”]?Set(REALCALLERIDNUM=${CALLERID(number)}))
exten => s,n(start),GotoIf($[ $["${REALCALLERIDNUM}" = “”] | $["${KEEPCID}" != “TRUE”] | $["${OUTKEEPCID_${ARG1}}" = “on”] ]?normcid)
exten => s,n,Set(USEROUTCID=${REALCALLERIDNUM})
exten => s,n,GotoIf($[“foo${DB(AMPUSER/${REALCALLERIDNUM}/device)}” = “foo”]?bypass)
exten => s,n(normcid),Set(USEROUTCID=${DB(AMPUSER/${REALCALLERIDNUM}/outboundcid)})
exten => s,n(bypass),Set(EMERGENCYCID=${DB(DEVICE/${REALCALLERIDNUM}/emergency_cid)})
exten => s,n,Set(TRUNKOUTCID=${OUTCID_${ARG1}})
exten => s,n,GotoIf($[ $["${EMERGENCYROUTE:1:2}" = “”] | $["${EMERGENCYCID:1:2}" = “”] ]?trunkcid)
exten => s,n,Set(CALLERID(all)=${EMERGENCYCID})
exten => s,n(exit),MacroExit()
exten => s,n(trunkcid),ExecIf($["${TRUNKOUTCID:1:2}" != “”]?Set(CALLERID(all)=${TRUNKOUTCID}))
exten => s,n(usercid),ExecIf($["${USEROUTCID:1:2}" != “”]?Set(CALLERID(all)=${USEROUTCID}))
exten => s,n(hidecid),ExecIf($["${CALLERID(name)}"=“hidden”]?Set(CALLERPRES()=prohib_passed_screen))

; end of [macro-outbound-callerid]

[macro-agent-add]
include => macro-agent-add-custom
exten => s,1,Wait(1)
exten => s,n,Macro(user-callerid,SKIPTTL)
exten => s,n(a3),Read(CALLBACKNUM,agent-login,)
exten => s,n,GotoIf($["${CALLBACKNUM}" != “”]?a7)
exten => s,n(a5),Set(CALLBACKNUM=${AMPUSER})
exten => s,n,ExecIf($["${CALLBACKNUM}" = “”]?Set(CALLBACKNUM=${CALLERID(number)}))
exten => s,n,GotoIf($["${CALLBACKNUM}" = “”]?a3)
exten => s,n(a7),GotoIf($["${CALLBACKNUM}" = “${ARG1}”]?invalid)
exten => s,n,ExecIf($["${QREGEX}" != “”]?GotoIf($["${REGEX("${QREGEX}" ${CALLBACKNUM})}" = “0”]?invalid))
exten => s,n,ExecIf($["${ARG2}" != “”]?Authenticate(${ARG2}))
exten => s,n(a9),AddQueueMember(${ARG1},Local/${CALLBACKNUM}@from-internal/n)
exten => s,n,UserEvent(Agentlogin,Agent: ${CALLBACKNUM})
exten => s,n,Wait(1)
exten => s,n,Playback(agent-loginok&with&extension)
exten => s,n,SayDigits(${CALLBACKNUM})
exten => s,n,Hangup
exten => s,n,MacroExit()
exten => s,n(invalid),Playback(pbx-invalid)
exten => s,n,Goto(a3)

; end of [macro-agent-add]

[macro-agent-del]
include => macro-agent-del-custom
exten => s,1,Wait(1)
exten => s,n,Macro(user-callerid,SKIPTTL)
exten => s,n(a3),Read(CALLBACKNUM,agent-logoff,)
exten => s,n,GotoIf($["${CALLBACKNUM}" = “”]?a5:a7)
exten => s,n(a5),Set(CALLBACKNUM=${AMPUSER})
exten => s,n,ExecIf($["${CALLBACKNUM}" = “”]?Set(CALLBACKNUM=${CALLERID(number)}))
exten => s,n,GotoIf($["${CALLBACKNUM}" = “”]?a3)
exten => s,n(a7),RemoveQueueMember(${ARG1},Local/${CALLBACKNUM}@from-internal/n)
exten => s,n,UserEvent(RefreshQueue)
exten => s,n,Wait(1)
exten => s,n,Playback(agent-loggedoff)
exten => s,n,Hangup

; end of [macro-agent-del]

[macro-systemrecording]
include => macro-systemrecording-custom
exten => s,1,Set(RECFILE=${IF($["${ARG2}" = “”]?/tmp/${AMPUSER}-ivrrecording:${ARG2})})
exten => s,n,ExecIf($["${ARG3}" != “”]?Authenticate(${ARG3}))
exten => s,n,Goto(${ARG1},1)
exten => dorecord,1,System(rm ${ASTVARLIBDIR}/sounds/${RECFILE}.)
exten => dorecord,n,Record(${RECFILE}:wav)
exten => dorecord,n,Wait(1)
exten => dorecord,n,Goto(confmenu,1)
exten => docheck,1,Playback(beep)
exten => docheck,n(dc_start),Background(${RECFILE},m,${CHANNEL(language)},macro-systemrecording)
exten => docheck,n,Wait(1)
exten => docheck,n,Goto(confmenu,1)
exten => confmenu,1,Background(to-listen-to-it&press-1&to-rerecord-it&press-star&astcc-followed-by-pound,m,${CHANNEL(language)},macro-systemrecording)
exten => confmenu,n,Read(RECRESULT,1,4)
exten => confmenu,n,GotoIf($[“x${RECRESULT}”="x
"]?dorecord,1)
exten => confmenu,n,GotoIf($[“x${RECRESULT}”=“x1”]?docheck,2)
exten => confmenu,n,Goto(1)
exten => 1,1,Goto(docheck,dc_start)
exten => *,1,Goto(dorecord,1)
exten => t,1,Playback(goodbye)
exten => t,n,Hangup
exten => i,1,Playback(pm-invalid-option)
exten => i,n,Goto(confmenu,1)
exten => h,1,Hangup

; end of [macro-systemrecording]

[from-zaptel]
include => from-zaptel-custom
exten => _X.,1,Set(DID=${EXTEN})
exten => _X.,n,Goto(s,1)
exten => s,1,Noop(Entering from-zaptel with DID == ${DID})
exten => s,n,Ringing()
exten => s,n,Set(DID=${IF($["${DID}"= “”]?s:${DID})})
exten => s,n,Noop(DID is now ${DID})
exten => s,n,GotoIf($["${CHANNEL:0:5}"=“DAHDI”]?zapok:notzap)
exten => s,n(notzap),Goto(from-pstn,${DID},1)
exten => s,n,Macro(Hangupcall,dummy)
exten => s,n(zapok),Noop(Is a Zaptel Channel)
exten => s,n,Set(CHAN=${CHANNEL:6})
exten => s,n,Set(CHAN=${CUT(CHAN,-,1)})
exten => s,n,Macro(from-zaptel-${CHAN},${DID},1)
exten => s,n,Noop(Returned from Macro from-zaptel-${CHAN})
exten => s,n,Goto(from-pstn,${DID},1)
exten => fax,1,Goto(ext-fax,in_fax,1)

; end of [from-zaptel]

[vm-callme]
include => vm-callme-custom
exten => s,1,Answer
exten => s,n,Wait(1)
exten => s,n(repeat),Background(${MSG}&silence/2&vm-repeat&vm-starmain)
exten => s,n,WaitExten(15,)
exten => 5,1,Goto(s,repeat)
exten => #,1,Playback(vm-goodbye)
exten => #,n,Hangup
exten => *,1,Macro(get-vmcontext,${MBOX})
exten => *,n,VoiceMailMain(${MBOX}@${VMCONTEXT},s)
exten => i,1,Playback(pm-invalid-option)
exten => i,n,Goto(s,repeat)
exten => t,1,Playback(vm-goodbye)
exten => t,n,Hangup
exten => h,1,Hangup

; end of [vm-callme]

[macro-vm]
include => macro-vm-custom
exten => s,1,Macro(user-callerid,SKIPTTL)
exten => s,n,Set(VMGAIN=${IF($[“foo${VM_GAIN}”!=“foo”]?“g(${VM_GAIN})”:"")})
exten => s,n,GotoIf($[“foo${DB(${BLKVM_OVERRIDE})}” != “fooTRUE”]?vmx,1)
exten => s,n,Noop(CAME FROM: ${NODEST} - Blocking VM cause of key: ${DB(BLKVM_OVERRIDE)})
exten => s,n,Hangup
exten => vmx,1,GotoIf($["${ARG2}"=“NOMESSAGE”]?s-${ARG2},1)
exten => vmx,n,Set(MODE=${IF($["${ARG2}"=“BUSY”]?busy:unavail)})
exten => vmx,n,GotoIf($["${ARG2}" != “DIRECTDIAL”]?notdirect)
exten => vmx,n,Set(MODE=${IF($["${REGEX("[b]" ${VM_DDTYPE})}" = “1”]?busy:${MODE})})
exten => vmx,n(notdirect),Noop(Checking if ext ${ARG1} is enabled: ${DB(AMPUSER/${ARG1}/vmx/${MODE}/state)})
exten => vmx,n,GotoIf($["${DB(AMPUSER/${ARG1}/vmx/${MODE}/state)}" != “enabled”]?s-${ARG2},1)
exten => vmx,n,Macro(get-vmcontext,${ARG1})
exten => vmx,n,AGI(checksound.agi,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/temp)
exten => vmx,n,GotoIf($["${SYSTEMSTATUS}" = “SUCCESS”]?tmpgreet)
exten => vmx,n,AGI(checksound.agi,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/${MODE})
exten => vmx,n,GotoIf($["${SYSTEMSTATUS}" != “SUCCESS”]?nofile)
exten => vmx,n,Set(LOOPCOUNT=0)
exten => vmx,n,GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/repeat)}" = “0”]?vmxtime)
exten => vmx,n,Set(VMX_REPEAT=${DB_RESULT})
exten => vmx,n(vmxtime),GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/timeout)}" = “0”]?vmxloops)
exten => vmx,n,Set(VMX_TIMEOUT=${DB_RESULT})
exten => vmx,n(vmxloops),GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/loops)}" = “0”]?vmxanswer)
exten => vmx,n,Set(VMX_LOOPS=${DB_RESULT})
exten => vmx,n(vmxanswer),Answer
exten => vmx,n(loopstart),Read(ACTION,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/${MODE},1,skip,${VMX_REPEAT},${VMX_TIMEOUT})
exten => vmx,n,GotoIf($["${EXISTS(${ACTION})}" = “1”]?checkopt)
exten => vmx,n(noopt),Noop(Timeout: going to timeout dest)
exten => vmx,n,Set(VMX_OPTS=${VMX_OPTS_TIMEOUT})
exten => vmx,n,GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/vmxopts/timeout)}" = “0”]?chktime)
exten => vmx,n,Set(VMX_OPTS=${DB_RESULT})
exten => vmx,n(chktime),GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/timedest/ext)}" = “0”]?dotime)
exten => vmx,n,Set(VMX_TIMEDEST_EXT=${DB_RESULT})
exten => vmx,n,GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/timedest/context)}" = “0”]?timepri)
exten => vmx,n,Set(VMX_TIMEDEST_CONTEXT=${DB_RESULT})
exten => vmx,n(timepri),GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/timedest/pri)}" = “0”]?dotime)
exten => vmx,n,Set(VMX_TIMEDEST_PRI=${DB_RESULT})
exten => vmx,n(dotime),Goto(${VMX_TIMEDEST_CONTEXT},${VMX_TIMEDEST_EXT},${VMX_TIMEDEST_PRI})
exten => vmx,n(checkopt),GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/${ACTION}/ext)}" = “1”]?doopt)
exten => vmx,n,GotoIf($["${ACTION}" = “0”]?o,1)
exten => vmx,n,GotoIf($["${ACTION}" = “"]?adef,1)
exten => vmx,n,Set(LOOPCOUNT=$[${LOOPCOUNT} + 1])
exten => vmx,n,GotoIf($[${LOOPCOUNT} > ${VMX_LOOPS}]?toomany)
exten => vmx,n,Playback(pm-invalid-option&please-try-again)
exten => vmx,n,Goto(loopstart)
exten => vmx,n(toomany),Noop(Too Many invalid entries, got to invalid dest)
exten => vmx,n,Set(VMX_OPTS=${VMX_OPTS_LOOPS})
exten => vmx,n,GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/vmxopts/loops)}" = “0”]?chkloop)
exten => vmx,n,Set(VMX_OPTS=${DB_RESULT})
exten => vmx,n(chkloop),GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/loopdest/ext)}" = “0”]?doloop)
exten => vmx,n,Set(VMX_LOOPDEST_EXT=${DB_RESULT})
exten => vmx,n,GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/loopdest/context)}" = “0”]?looppri)
exten => vmx,n,Set(VMX_LOOPDEST_CONTEXT=${DB_RESULT})
exten => vmx,n(looppri),GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/loopdest/pri)}" = “0”]?doloop)
exten => vmx,n,Set(VMX_LOOPDEST_PRI=${DB_RESULT})
exten => vmx,n(doloop),Goto(${VMX_LOOPDEST_CONTEXT},${VMX_LOOPDEST_EXT},${VMX_LOOPDEST_PRI})
exten => vmx,n(doopt),Noop(Got a valid option: ${DB_RESULT})
exten => vmx,n,Set(VMX_EXT=${DB_RESULT})
exten => vmx,n,GotoIf($["${VMX_EXT}" != “dovm”]?getdest)
exten => vmx,n(vmxopts),Set(VMX_OPTS=${VMX_OPTS_DOVM})
exten => vmx,n,GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/vmxopts/dovm)}" = “0”]?vmxdovm)
exten => vmx,n(vmxopts),Set(VMX_OPTS=${DB_RESULT})
exten => vmx,n(vmxdovm),Goto(dovm,1)
exten => vmx,n(getdest),GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/${ACTION}/context)}" = “0”]?vmxpri)
exten => vmx,n,Set(VMX_CONTEXT=${DB_RESULT})
exten => vmx,n(vmxpri),GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/${ACTION}/pri)}" = “0”]?vmxgoto)
exten => vmx,n,Set(VMX_PRI=${DB_RESULT})
exten => vmx,n(vmxgoto),Goto(${VMX_CONTEXT},${VMX_EXT},${VMX_PRI})
exten => vmx,n(nofile),Noop(File for mode: ${MODE} does not exist, SYSTEMSTATUS: ${SYSTEMSTATUS}, going to normal voicemail)
exten => vmx,n,Goto(s-${ARG2},1)
exten => vmx,n(tmpgreet),Noop(Temporary Greeting Detected, going to normal voicemail)
exten => vmx,n,Goto(s-${ARG2},1)
exten => dovm,1,Noop(VMX Timeout - go to voicemail)
exten => dovm,n,VoiceMail(${ARG1}@${VMCONTEXT},${VMX_OPTS}${VMGAIN})
exten => dovm,n,Goto(exit-${VMSTATUS},1)
exten => s-BUSY,1,Noop(BUSY voicemail)
exten => s-BUSY,n,Macro(get-vmcontext,${ARG1})
exten => s-BUSY,n,VoiceMail(${ARG1}@${VMCONTEXT},${VM_OPTS}b${VMGAIN})
exten => s-BUSY,n,Goto(exit-${VMSTATUS},1)
exten => s-NOMESSAGE,1,Noop(NOMESSAGE (beeb only) voicemail)
exten => s-NOMESSAGE,n,Macro(get-vmcontext,${ARG1})
exten => s-NOMESSAGE,n,VoiceMail(${ARG1}@${VMCONTEXT},s${VM_OPTS}${VMGAIN})
exten => s-NOMESSAGE,n,Goto(exit-${VMSTATUS},1)
exten => s-DIRECTDIAL,1,Noop(DIRECTDIAL voicemail)
exten => s-DIRECTDIAL,n,Macro(get-vmcontext,${ARG1})
exten => s-DIRECTDIAL,n,VoiceMail(${ARG1}@${VMCONTEXT},${VM_OPTS}${VM_DDTYPE}${VMGAIN})
exten => s-DIRECTDIAL,n,Goto(exit-${VMSTATUS},1)
exten => _s-.,1,Macro(get-vmcontext,${ARG1})
exten => _s-.,n,VoiceMail(${ARG1}@${VMCONTEXT},${VM_OPTS}u${VMGAIN})
exten => _s-.,n,Goto(exit-${VMSTATUS},1)
exten => o,1,Background(one-moment-please)
exten => o,n,GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/0/ext)}" = “0”]?doopdef)
exten => o,n,Set(VMX_OPDEST_EXT=${DB_RESULT})
exten => o,n,GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/0/context)}" = “1”]?opcontext)
exten => o,n,Set(DB_RESULT=${VMX_CONTEXT})
exten => o,n(opcontext),Set(VMX_OPDEST_CONTEXT=${DB_RESULT})
exten => o,n,GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/0/pri)}" = “1”]?oppri)
exten => o,n,Set(DB_RESULT=${VMX_PRI})
exten => o,n(oppri),Set(VMX_OPDEST_PRI=${DB_RESULT})
exten => o,n,Goto(${VMX_OPDEST_CONTEXT},${VMX_OPDEST_EXT},${VMX_OPDEST_PRI})
exten => o,n(doopdef),GotoIf($[“x${OPERATOR_XTN}”=“x”]?nooper:from-internal,${OPERATOR_XTN},1)
exten => o,n(nooper),GotoIf($[“x${FROM_DID}”=“x”]?nodid)
exten => o,n,Dial(Local/${FROM_DID}@from-pstn,)
exten => o,n,Macro(hangup,)
exten => o,n(nodid),Dial(Local/s@from-pstn,)
exten => o,n,Macro(hangup,)
exten => a,1,Macro(get-vmcontext,${ARG1})
exten => a,n,GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/
/ext)}” = “0”]?adef,1)
exten => a,n,Set(VMX_ADEST_EXT=${DB_RESULT})
exten => a,n,GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}//context)}" = “1”]?acontext)
exten => a,n,Set(DB_RESULT=${VMX_CONTEXT})
exten => a,n(acontext),Set(VMX_ADEST_CONTEXT=${DB_RESULT})
exten => a,n,GotoIf($["${DB_EXISTS(AMPUSER/${ARG1}/vmx/${MODE}/
/pri)}" = “1”]?apri)
exten => a,n,Set(DB_RESULT=${VMX_PRI})
exten => a,n(apri),Set(VMX_ADEST_PRI=${DB_RESULT})
exten => a,n,Goto(${VMX_ADEST_CONTEXT},${VMX_ADEST_EXT},${VMX_ADEST_PRI})
exten => adef,1,VoiceMailMain(${ARG1}@${VMCONTEXT})
exten => adef,n,GotoIf($["${ARG3}" = “RETURN”]?exit-RETURN,1)
exten => adef,n,Hangup
exten => exit-FAILED,1,Playback(im-sorry&an-error-has-occured)
exten => exit-FAILED,n,GotoIf($["${ARG3}" = “RETURN”]?exit-RETURN,1)
exten => exit-FAILED,n,Hangup
exten => exit-SUCCESS,1,GotoIf($["${ARG3}" = “RETURN”]?exit-RETURN,1)
exten => exit-SUCCESS,n,Playback(goodbye)
exten => exit-SUCCESS,n,Hangup
exten => exit-USEREXIT,1,GotoIf($["${ARG3}" = “RETURN”]?exit-RETURN,1)
exten => exit-USEREXIT,n,Playback(goodbye)
exten => exit-USEREXIT,n,Hangup
exten => exit-RETURN,1,Noop(Returning From Voicemail because macro)
exten => t,1,Hangup

; end of [macro-vm]

[from-internal-additional]
include => from-internal-additional-custom
include => app-fmf-toggle
include => ext-findmefollow
include => fmgrps
include => ext-queues
include => app-dnd-off
include => app-dnd-on
include => app-dnd-toggle
include => ext-dnd-hints
include => vmblast-grp
include => app-calltrace
include => app-directory
include => app-echo-test
include => app-speakextennum
include => app-speakingclock
include => app-languages
include => ext-group
include => grps
include => app-recordings
include => app-blacklist
include => ext-meetme
include => ext-paging
include => app-speeddial
include => app-callwaiting-cwoff
include => app-callwaiting-cwon
include => app-pbdirectory
include => app-cf-busy-off
include => app-cf-busy-off-any
include => app-cf-busy-on
include => app-cf-off
include => app-cf-off-any
include => app-cf-on
include => app-cf-unavailable-off
include => app-cf-unavailable-on
include => app-dialvm
include => app-vmmain
include => app-userlogonoff
include => app-pickup
include => app-zapbarge
include => app-chanspy
include => ext-test
include => ext-local
include => outbound-allroutes
exten => h,1,Hangup

; end of [from-internal-additional]

Weird. What version of FreePBX are you using? (I’m on 2.5.2.2.)

Have you actually created any DISA’s? If not, that code might not be added to the dialplan. If so, what #/route do you use to invoke the DISA?

Weird. What version of FreePBX are you using? (I’m on 2.5.2.2.)

Have you actually created any DISA’s? If not, that code might not be added to the dialplan. If so, what #/route do you use to invoke the DISA?

Weird. What version of FreePBX are you using? (I’m on 2.5.2.2.)

Have you actually created any DISA’s? If not, that code might not be added to the dialplan. If so, what #/route do you use to invoke the DISA?

Weird. What version of FreePBX are you using? (I’m on 2.5.2.2.)

Have you actually created any DISA’s? If not, that code might not be added to the dialplan. If so, what #/route do you use to invoke the DISA?

My system is :

trixbox CE current release is 2.8.0

However, when i look at the extensions_additional.conf it say: this file as it is auto-generated by FreePBX. I guess trixbox and freepbx share the same codes or at least most of the codes.

As far as if I actually created DISA, the answer no but I just added one.

and did the reload. it didn’t seems to make a difference yet . When I dial either an extension or dial out I have to wait for about 10 or more second before the call is placed . If I add a # at the end of the number, the call is placed immediately.

Thanks in advance for all your help.

My system is :

trixbox CE current release is 2.8.0

However, when i look at the extensions_additional.conf it say: this file as it is auto-generated by FreePBX. I guess trixbox and freepbx share the same codes or at least most of the codes.

As far as if I actually created DISA, the answer no but I just added one.

and did the reload. it didn’t seems to make a difference yet . When I dial either an extension or dial out I have to wait for about 10 or more second before the call is placed . If I add a # at the end of the number, the call is placed immediately.

Thanks in advance for all your help.

[disa]
include => disa-custom
exten => 1,1,Set(_DISA=“disa,1,newcall”)
exten => 1,n(newcall),Set(_DISACONTEXT=from-internal)
exten => 1,n,Set(_KEEPCID=TRUE)
exten => 1,n,Set(TIMEOUT(digit)=5)
exten => 1,n,Set(TIMEOUT(response)=10)
exten => 1,n,DISA(no-password,from-internal)
exten => 1,n(end),Hangup

; end of [disa]

[disa-dial]
include => disa-dial-custom
exten => _[0-9a-zA-Z*#].,1,Noop(called ${EXTEN} in ${DISACONTEXT} by ${DISA})
exten => _[0-9a-zA-Z*#].,n,Dial(Local/${EXTEN}@${DISACONTEXT},300,${HANGUP})
exten => _[0-9a-zA-Z*#].,n,Gosub(s-${DIALSTATUS},1)
exten => _[0-9a-zA-Z*#].,n,Goto(${DISA})
exten => s-ANSWER,1,Return()
exten => s-CANCEL,1,Return()
exten => s-BUSY,1,Playtones(busy)
exten => s-BUSY,n,Wait(3)
exten => s-BUSY,n,Return()
exten => _s-.,1,Noop(DISA Dial failed due to ${DIALSTATUS} - returning to dial tone)
exten => _s-.,n,Playtones(congestion)
exten => _s-.,n,Wait(3)
exten => _s-.,n,StopPlaytones
exten => _s-.,n,Return()

; end of [disa-dial]

Your dialplan looks okay disa-wise. The [disa] is using the from-internal context instead of the bad disa-dial context.

If things aren’t dialing right away, there must be some other ambiguity in your dialplan (two possible ways to dial that have the same common start).

You indicated that other devices (“from a standard phone”) do dial immediately, but not your disa. What type of devices are these? If they’re SIP, they don’t use the dialplan to decide when to dial, the use their own internal dial pattern setting.

Zap channels do determine when to dial using the dial plan (as do iaxy’s). Zap, iaxy’s, and DISA’s all receive the dial digits one at a time. SIP, and other devices usually collect the # themselves, and send it off to asterisk as a chunk to dial righ taway…

(Sorry for the multiple posts earlier… freepbx.org wasn’t responding for me, although I guess it was getting the post…)

sorry about that, I guess I should have giving more background about the system which would help.

The system is trixbox 2.8 running on centos. It has one sip trunk and two extensions. One extension (1000) is used with linksys 2102 and the second extension (2000) is pointing to Cisco 7960 ip phone.

if you dial any number internal or external the call is not dialed immediately unless you ended with a #. That even goes for dialing from extension 1000 to 2000.

The second major problem is : if you dial a cell phone number not a pots you will not hear the ring back . The only way you can tell is when the called party answer the call.

We are trying to workout all these issues before going live with it for our business.

As a software developer I think much has been left out of the documentation for this project which makes adaption difficult for lots of small business who otherwise would benefit from it. My goal would be to document our experience step by step and share it. I thinks the system is nice it just needs a little more documentations.

Thanks again

You have ambiguity in your dial plan.

From a quick look at your conf, the internal extensions are in the 600’s, standard stuff.

However, there’s an outbound route which contains the pattern “NXXXXXX”. (Typical dial of an outoging 7 digit number.)

If you start diaing 612, for example, the system doesn’t know if you’re done, if you want extension 612, or if you’re going to keep dialing 612-1234. (There’s also an NXXNXXNXXXX for long distance in the plan, so you might be dialing 612-123-5678.)

With that ambiguity, it waits for a timeout (or #), which is the right thing to do.

Watch your outbound routes very closely. Also 1000-2000 are bad extensions to use, if you want to allow dialing without a 9 to outside (i.e. 1-902-555-1212).

Ambiguity is bad. You need to put some thought into dialplan design.

I don’t like having to dial 9 to get out, so what I did was the following:

Used 600-699 for extensions. There are no local exchanges around here in the 600 range (well, one, so we avoid that 6xx extensions).

In the outbound route, we use FreePBX’s feature of looking up local exchange lists and putting them in the outbound routes. That way it’s not just NXX that matches, but actual 842XXXX, 849XXXX, etc., etc., which don’t conflict with the 6xx extensions.

If I dial 6xx, there’s no NXXNXXX rule to also match, so it knows to dial right away. If I dial 8421234, it knows that’s an outbound trunk to use for that one, and dials the instant I hit that last 4.

The other option is only having 9NXXNXXX, 91NXXNXXX, and 91NXXNXXNXXXX (or the like) for outbound routes. That doesn’t conflict with any internal extensions (assuming none start with 9), so it will always only match the outbound route. And any dialing to 6xx will only match your extensions, and dial immediately.

If you disabled those outbound routes, you’ll find your internal extensions dial and answer immediately (including through DISA). Remove those NXXNXXX’s (which can match your 6XX extensions, causing delays/ambiguity) and you’ll find things peppier. But overall, you need to figure out the right dialplan for you.

If there are a lot of 6xx exchanges in your area you might dial, and you want to be able to still do 7 digit dialing, you’d best find another range of extensions to use internally that don’t conflict with any common exchanges in your area

Same with area codes. If you were near Vancouver, or called Vancouver a lot (area code 602), and wanted 10 digit dialing (no 1 required), and had a NXXNXXNXXXX pattern to allow it, then you’d best not have a 602 internal extension, or you’ve got the same problem with delays.

If there’s no 6xx exchanges in your local calling area, and any long distance people will dial will require a 1, then you can avoid the ambiguity by removing the NXXNXXXX and NXXNXXNXXXX stuff (leaving the 1NXXNXXXX and 1NXXNXXNXXXX stuff which doesn’t conflict with your 600 exchanges). Then get FreePBX to look up and add patterns for your local calling exchanges. Works great, I love that feature.

I don’t offhand know of any tools to help spot dialplan ambiguities; you really need to just plan things out, be careful, and if you hit an unexpected delay, try to hunt down why, starting with any pattern that has wildcards (_NX stuff).

(Some of the verbose and debugging logs will talk about ast_match and ast_matchmore which give some hints, but that’s kinda low-level.)

I agree the documentation might be considered lacking, but possibly not if you put Asterisk/FreePBX in the right context. I don’t see it as an end-user system, but a tool for integrators.

Things such as dialplan design are addressed in a lot of Asterisk documentation (including the standard asterisk book). FreePBX is an incredible tool for managing, simplifying, and adding a lot of common functionality without a lot of coding. But it still requires some knowledge of how Asterisk works to set up properly, IMHO.

Asterisk is an infinitely configurable and extensible system; with that comes some learning and complexity. Other systems like 3CX or whatever, are easier to set up and use, but you could never tailor them nor extend them like you can Asterisk.

I do think dialplan ambiguity gets less attention both from integrators and even the developers as it should (hence this whole thread). It’s always been a peeve of mine. It really is the difference between a seemingly sluggish system, and an immediately responsive one that feels fast and impressive…

On the “not hearing ringing when calling” issue, I had the same issue:

It’s call progress ringing you want.

Under general settings, Asterisk Outbound dial command options. Add ‘r’ to the string. FreePBX explicitly recommends against this for outbound trunks.

I guess the ring tone being played could confuse the outbound trunk and mess up the call; I’ve never had a problem with that happening, and the lack of a ring is way too disconcerting for me. The one disadvantage is that you can some times get a “ring, ring, ring, busy-tone” if the line is actually busy. No big deal to me.

http://www.voip-info.org/wiki/view/Asterisk+cmd+Dial

"r: Generate a ringing tone for the calling party, passing no audio from the called channel(s) until one answers. Without this option, Asterisk will generate ring tones automatically where it is appropriate to do so; however, “r” will force Asterisk to generate ring tones, even if it is not appropriate. For example, if you used this option to force ringing but the line was busy the user would hear “RING RIBEEP BEEP BEEP” (thank you tzanger), which is potentially confusing and/or unprofessional. However, the option is necessary in a couple of places. For example, when you’re dialing multiple channels, call progress information is not consistantly passed back. "

(I might need this because I do a lot of calling/forwarding through multiple channels, so as they indicate, I might not be getting call progress back reliably.)

Sorry, I guess I was wrong; it doesn’t potentially confuse the outbound trunk; the outbound trunk doesn’t hear the ringing, just the calling user.

It’s just the ring/ring/busy thing that might confuse people. So it’s not a big threat if your users are aware of it (even then, the busy tone pretty much tells the user it was busy, despite the earlier ringing…)

There is the odd time calling out I don’t hear the other party say “hello”; perhaps this options is delaying the connecting of the trunk slightly leading to this. Dunno.

Alex -

First, you should come to the trixbox site for support on the trixbox version of FreePBX.

Your delay in dialing between extensions is due to a lack of a dial plan on the devices themselves.

Thank you,

You say the issue has to due with having a dialing plan on the devices themselves!

Well how would you load a dialing plan into X-lite softphone or cisco 7960 for example.

Thanks

Alex

Yeah, I started this particular thread on DISA, where asterisk gets the digits one at a time, and decides when to dial based upon dial plan matching (and ambiguity in the dial plan causes delays). The same is true for Zap channels and iAXY devices, and important for responsiveness on those types of devies.

For SIP and others, when the phone sends off the request is typically based upon the phone’s dial plan. For Linksys phones (which I use), this is an advanced admin configuration item (“dial plan”). It’s a different (simpler) syntax than asterisk dialplans (and in general, they should sync up to specify the same ways of dialing). On Linksys phones you can set this in the web gui (or via tftp, http provisioning, etc.)

There is no automated way to “upload” an asterisk dial plan to a phone. They’re different beasts, that should generally match up. (The asterisk dial plan is a complex beast that describes how dial patterns are matched and routed. On the phone, it’s just a list of patterns that describe when the dialing is done and the SIP invite should commence. The phone doesn’t start talking to the asterisk PBX to initiate the call until the dial plan is matched, or a timeout occurs.)

How the phone dial plans are set up would vary phone to phone. The syntax seems generally consistent, with some variations.

Most softphones don’t use dial plans; you type in the number to dial and press enter (or click dial), which tells the phone to dial at that point. It’s mainly phones that are trying to “feel” like traditional touch tone phones that need a dial plan to decide when to dial, since hitting enter, pressing #, etc, is not what users expect.

http://www.netphonedirectory.com/pap2_dialplan.htm

This gives a good overview of on-device dial plans for Linksys/Cisco/Sipura devices.

Note the same issues I mentioned above apply. If you have a 6xxS0 in your phone dial plan (if the phone sees 6 and two digits, it will immediately dial), and you want to also be able to dial a local 613 exchange directly (for example), 613-1234, then you have ambiguity in the plan, and delays and/or other confusion ensue.

(Requiring a 9 to dial out really does simplify things when it comes to dial plans on both the phones and asterisk. I personally don’t like it, so I take measures on both the phones and asterisk to carefully craft things to avoid conflicts.)

http://en.wikipedia.org/wiki/VoIP_Dial_Plan

Certainly there are dial plans on any conceivable end point.

On x-lite it’s SIP Account Settings - Dialing Options

On the Cisco 7960 it’s loaded with dialplan.xml file from the confiuration server.

First I would like to say thanks to everyone who responded. I do agree that the system is not intended for an end userlike me.

However, few years back I wanted to set up a Linux server and I had similar experience. Lots of information available on how to do it. However, there was no simple way for the end user or a small business to take advantage of all that information. So I started a company to do just that. Seven years later an end user who have no knowledge of linux can get his own server up and running if few minutes. Now I work for www.ezbluesoftware.com

As I take this journey with the trixbox I feel the same way. Most of the hard work has been done by those developers who paved the way. What I feel left is to have someone develop a “wizard”, a script or a templet(s) for the end user to use.

I know there are may integrators out there that would be happy to sell you a pre configured system or help you set up one. That is good. I like options. The more options the better. I also like to make things easy;-)

So I am going to start over with a trixbox taking everyone’s feedback and see how I would do as an end user. I will be posting more questions and would welcome your answers. Once that done I would like to post my experience.

I may have one of my php developers write a script or a wizard for it.

Thanks,

Alex

First, I highly suggest you post your questions at trixbox.org This is the FreePBX web site. trixbox uses a “forked” or modified version of FreePBX. You can form your own opinion on the fork, however it is completely unfair to discuss the trixbox distribution (or any other) in the FreePBX forum unless you are going to install Asterisk and FreePBX from scratch. trixbox pulls the modules from their repositories so patches and updates have to clear the Fonality folks first.

I am one of the community moderators at trixbox.org and again if you want to comment or ask for support on trixbox that is the place to do it.

[quoteWhat I feel left is to have someone develop a “wizard”, a script or a templet(s) for the end user to use.[/quote]

What more do you want the distribution to do? With so many hardware devices to support I can’t imagine a more automated install.