[general]
static=yes
writeprotect=no
clearglobalvars=no
[globals]
CONSOLE=Console/dsp ; Console interface for demo
TRUNK=DAHDI/G2 ; Trunk interface
TRUNKMSD=1 ; MSD digits to strip (usually 1 or 0)
[dundi-e164-canonical]
[dundi-e164-customers]
[dundi-e164-via-pstn]
[dundi-e164-local]
include => dundi-e164-canonical
include => dundi-e164-customers
include => dundi-e164-via-pstn
[dundi-e164-switch]
switch => DUNDi/e164
[dundi-e164-lookup]
include => dundi-e164-local
include => dundi-e164-switch
[dundi-e164]
exten => s,1,Goto(${ARG1},1)
include => dundi-e164-lookup
[iax2-trunk]
exten => _555XXXX,1,Dial(IAX2/username:secret@example.com/${EXTEN}@some-dialplan-context)
[iaxprovider]
[trunkint]
exten => _9011.,1,Gosub(dundi-e164,s,1(${EXTEN:4}))
exten => _9011.,n,Dial(${GLOBAL(TRUNK)}/${FILTER(0-9,${EXTEN:${GLOBAL(TRUNKMSD)}})})
[trunkld]
exten => _91NXXNXXXXXX,1,Gosub(dundi-e164,s,1(${EXTEN:1}))
exten => _91NXXNXXXXXX,n,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
[trunklocal]
exten => _9NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
[trunktollfree]
exten => _91800NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
exten => _91888NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
exten => _91877NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
exten => _91866NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
[international]
ignorepat => 9
include => longdistance
include => trunkint
[longdistance]
ignorepat => 9
include => local
include => trunkld
[local]
ignorepat => 9
include => default
include => trunklocal
include => iax2-trunk
include => trunktollfree
include => iaxprovider
[outbound-freenum]
exten => _X*X!,1,Goto(outbound-freenum2,${EXTEN},1)
exten => _XX*X!,1,Goto(outbound-freenum2,${EXTEN},1)
exten => _XXX*X!,1,Goto(outbound-freenum2,${EXTEN},1)
exten => _XXXX*X!,1,Goto(outbound-freenum2,${EXTEN},1)
exten => _XXXXX*X!,1,Goto(outbound-freenum2,${EXTEN},1)
exten => _XXXXXX*X!,1,Goto(outbound-freenum2,${EXTEN},1)
[outbound-freenum2]
exten => _X!,1,Verbose(2,Performing ISN lookup for ${EXTEN})
same => n,Set(SUFFIX=${CUT(EXTEN,*,2-)}) ; make sure the suffix is all digits as well
same => n,GotoIf($["${FILTER(0-9,${SUFFIX})}" != "${SUFFIX}"]?fn-CONGESTION,1)
; filter out bad characters per the README-SERIOUSLY.best-practices.txt document
same => n,Set(TIMEOUT(absolute)=10800)
same => n,Set(isnresult=${ENUMLOOKUP(${EXTEN},sip,,1,freenum.org)}) ; perform our lookup with freenum.org
same => n,GotoIf($["${isnresult}" != ""]?from)
same => n,Set(DIALSTATUS=CONGESTION)
same => n,Goto(fn-CONGESTION,1)
same => n(from),Set(__SIPFROMUSER=${CALLERID(num)})
same => n,GotoIf($["${GLOBAL(FREENUMDOMAIN)}" = ""]?dial) ; check if we set the FREENUMDOMAIN global variable in [global]
same => n,Set(__SIPFROMDOMAIN=${GLOBAL(FREENUMDOMAIN)}) ; if we did set it, then we'll use it for our outbound dialing domain
same => n(dial),Dial(SIP/${isnresult},40)
same => n,Goto(fn-${DIALSTATUS},1)
exten => fn-BUSY,1,Busy()
exten => _f[n]-.,1,NoOp(ISN: ${DIALSTATUS})
same => n,Congestion()
[trunkdial]
exten => s,1,StackPop()
same => n,Dial(${ARG1})
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s-NOANSWER,1,Hangup()
exten => s-BUSY,1,PlayTones(busy)
same => n,Wait(60)
same => n,Hangup()
exten => s-CHANUNAVAIL,1,PlayTones(congestion)
same => n,Wait(60)
same => n,Hangup()
exten => s-CONGESTION,1,PlayTones(congestion)
same => n,Wait(60)
same => n,Hangup()
exten => _s-.,1,NoOp(${DIALSTATUS})
same => n,Hangup()
[stdexten]
exten => _X.,50000(stdexten),NoOp(Start stdexten)
same => n,Set(LOCAL(ext)=${EXTEN})
same => n,Set(LOCAL(dev)=${ARG1})
same => n,Set(LOCAL(cntx)=${ARG2})
same => n,Set(LOCAL(mbx)=${ext}${IF($[!${ISNULL(${cntx})}]?@${cntx})})
same => n,Dial(${dev},20) ; Ring the interface, 20 seconds maximum
same => n,Goto(stdexten-${DIALSTATUS},1) ; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
exten => stdexten-NOANSWER,1,VoiceMail(${mbx},u) ; If unavailable, send to voicemail w/ unavail announce
same => n,Return() ; If they press #, return to start
exten => stdexten-BUSY,1,VoiceMail(${mbx},b) ; If busy, send to voicemail w/ busy announce
same => n,Return() ; If they press #, return to start
exten => _stde[x]te[n]-.,1,Goto(stdexten-NOANSWER,1) ; Treat anything else as no answer
exten => a,1,VoiceMailMain(${mbx}) ; If they press *, send the user into VoicemailMain
exten => a,n,Return()
[stdPrivacyexten]
exten => _X.,60000(stdPrivacyexten),NoOp(Start stdPrivacyexten)
same => n,Set(LOCAL(ext)=${ARG1})
same => n,Set(LOCAL(dev)=${ARG2})
same => n,Set(LOCAL(dontcntx)=${ARG3})
same => n,Set(LOCAL(tortcntx)=${ARG4})
same => n,Set(LOCAL(cntx)=${ARG5})
exten => _X.,n,Set(LOCAL(mbx)="${ext}"$["${cntx}" ? "@${cntx}" :: ""])
same => n,Dial(${dev},20,p) ; Ring the interface, 20 seconds maximum, call screening
; option (or use P for databased call _X.screening)
same => n,Goto(stdexten-${DIALSTATUS},1) ; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
exten => stdexten-NOANSWER,1,VoiceMail(${mbx},u) ; If unavailable, send to voicemail w/ unavail announce
same => n,NoOp(Finish stdPrivacyexten NOANSWER)
same => n,Return() ; If they press #, return to start
exten => stdexten-BUSY,1,VoiceMail(${mbx},b) ; If busy, send to voicemail w/ busy announce
same => n,NoOp(Finish stdPrivacyexten BUSY)
same => n,Return() ; If they press #, return to start
exten => stdexten-DONTCALL,1,Goto(${dontcntx},s,1) ; Callee chose to send this call to a polite "Don't call again" script.
exten => stdexten-TORTURE,1,Goto(${tortcntx},s,1) ; Callee chose to send this call to a telemarketer torture script.
exten => _stde[x]te[n]-.,1,Goto(stdexten-NOANSWER,1) ; Treat anything else as no answer
exten => a,1,VoiceMailMain(${mbx}) ; If they press *, send the user into VoicemailMain
same => n,Return()
[sub-page]
exten => s,1,ChanIsAvail(${ARG1},s) ; s is for ANY call
same => n,GotoIf($["${AVAILSTATUS}" = "1"]?autoanswer:fail)
same => n(autoanswer),Set(_ALERT_INFO="RA") ; This is for the PolyComs
same => n,SIPAddHeader(Call-Info: Answer-After=0) ; This is for the Grandstream, Snoms, and Others
same => n,NoOp() ; Add others here and Post on the Wiki!!!!
same => n,Dial(${ARG1})
same => n(fail),Hangup()
[demo]
include => stdexten
exten => s,1,Wait(1) ; Wait a second, just for fun
same => n,Answer() ; Answer the line
same => n,Set(TIMEOUT(digit)=5) ; Set Digit Timeout to 5 seconds
same => n,Set(TIMEOUT(response)=10) ; Set Response Timeout to 10 seconds
same => n(restart),BackGround(demo-congrats) ; Play a congratulatory message
same => n(instruct),BackGround(demo-instruct) ; Play some instructions
same => n,WaitExten() ; Wait for an extension to be dialed.
exten => 2,1,BackGround(demo-moreinfo) ; Give some more information.
exten => 2,n,Goto(s,instruct)
exten => 3,1,Set(CHANNEL(language)=fr) ; Set language to french
same => n,Goto(s,restart) ; Start with the congratulations
exten => 1000,1,Goto(default,s,1)
exten => 1234,1,Playback(transfer,skip) ; "Please hold while..."
; (but skip if channel is not up)
same => n,Gosub(${EXTEN},stdexten(${GLOBAL(CONSOLE)}))
same => n,Goto(default,s,1) ; exited Voicemail
exten => 1235,1,VoiceMail(1234,u) ; Right to voicemail
exten => 1236,1,Dial(Console/dsp) ; Ring forever
same => n,VoiceMail(1234,b) ; Unless busy
exten => #,1,Playback(demo-thanks) ; "Thanks for trying the demo"
same => n,Hangup() ; Hang them up.
exten => t,1,Goto(#,1) ; If they take too long, give up
exten => i,1,Playback(invalid) ; "That's not valid, try again"
exten => 600,1,Playback(demo-echotest) ; Let them know what's going on
same => n,Echo() ; Do the echo test
same => n,Playback(demo-echodone) ; Let them know it's over
same => n,Goto(s,6) ; Start over
exten => 76245,1,Gosub(page,s,1(SIP/Grandstream1))
exten => _7XXX,1,Gosub(page,s,1(SIP/${EXTEN}))
exten => 7999,1,Set(TIMEOUT(absolute)=60)
same => n,Page(Local/Grandstream1@page&Local/Xlite1@page&Local/1234@page/n,d)
exten => 8500,1,VoiceMailMain()
same => n,Goto(s,6)
[page]
exten => _X.,1,Gosub(sub-page,s,1(SIP/${EXTEN}))
same => n,Hangup()
[public]
include => demo
[default]
; Extensión para unirse a la conferencia
exten => 7,1,Answer()
same => n,ConfBridge(7,pc1,pu1) ; Asocia la conferencia "7" con los perfiles definidos en confbridge.conf
same => n,Hangup()
; Extensión para grabar el audio "bienvenido"
exten => 600,1,Answer()
same => n,Playback(vm-intro) ; Mensaje opcional: "Empiece a grabar después del tono"
same => n,Record(/var/lib/asterisk/sounds/bienvenido.gsm) ; Graba el archivo "bienvenido.gsm"
same => n,Playback(vm-saved) ; Mensaje: "Su grabación ha sido guardada"
same => n,Hangup()
; Extensión para grabar el audio "invalido"
exten => 601,1,Answer()
same => n,Playback(vm-intro) ; Mensaje opcional: "Empiece a grabar después del tono"
same => n,Record(/var/lib/asterisk/sounds/invalido.gsm) ; Graba el archivo "invalido.gsm"
same => n,Playback(vm-saved) ; Mensaje: "Su grabación ha sido guardada"
same => n,Hangup()
; Extensión para grabar el audio "prueba"
exten => 602,1,Answer()
same => n,Playback(vm-intro) ; Mensaje: "Empiece a grabar después del tono"
same => n,Record(/var/lib/asterisk/sounds/prueba.gsm) ; Graba el archivo "prueba.gsm"
same => n,Playback(vm-saved) ; Mensaje: "Su grabación ha sido guardada"
same => n,Hangup()
; Extensión para iniciar el menú interactivo
exten => 505,1,Answer()
same => n,Goto(menu,inicio,1)
exten => 1001,1,Dial(PJSIP/1001)
exten => 1001,n,Hangup()
exten => 1002,1,Dial(PJSIP/1002)
exten => 1002,n,Hangup()
exten => 1003,1,Dial(PJSIP/1003)
exten => 1003,n,Hangup()
[menu]
; Inicio del menú interactivo
exten => inicio,1,Background(prueba) ; Reproduce el audio "Bienvenido a comunicaciones avanzadas"
same => n,WaitExten(15) ; Espera 15 segundos para que el usuario pulse una opción
; Opción 1 - Llama a asistencia técnica
exten => 1,1,Playback(bienvenido) ; Reproduce el mensaje "Gracias, lo estamos comunicando"
same => n,Dial(SIP/500,10) ; Llama a la extensión SIP 500
same => n,Hangup()
; Opción 2 - Reproduce un mensaje
exten => 2,1,Playback(hello-world) ; Reproduce el mensaje "Hello world"
same => n,Hangup()
; Manejo de entradas inválidas
exten => i,1,Playback(invalido) ; Reproduce el mensaje "Opción incorrecta"
same => n,Goto(menu,inicio,1) ; Regresa al inicio del menú
; Tiempo de espera (15 segundos sin entrada)
exten => t,1,Playback(goodbye) ; Reproduce el mensaje de despedida
same => n,Hangup()
include => demo
[time]
exten => _X.,30000(time),NoOp(Time: ${EXTEN} ${timezone})
same => n,Wait(0.25)
same => n,Answer()
; the amount of delay is set for English; you may need to adjust this time
; for other languages if there's no pause before the synchronizing beep.
same => n,Set(FUTURETIME=$[${EPOCH} + 12])
same => n,SayUnixTime(${FUTURETIME},Zulu,HNS)
same => n,SayPhonetic(z)
; use the timezone associated with the extension (sip only), or system-wide
; default if one hasn't been set.
same => n,SayUnixTime(${FUTURETIME},${timezone},HNS)
same => n,Playback(spy-local)
same => n,WaitUntil(${FUTURETIME})
same => n,Playback(beep)
same => n,Return()
[ani]
exten => _X.,40000(ani),NoOp(ANI: ${EXTEN})
same => n,Wait(0.25)
same => n,Answer()
same => n,Playback(vm-from)
same => n,SayDigits(${CALLERID(ani)})
same => n,Wait(1.25)
same => n,SayDigits(${CALLERID(ani)}) ; playback again in case of missed digit
same => n,Return()
asterist.conf
[directories](!)
astcachedir => /tmp
astetcdir => /etc/asterisk
astmoddir => /usr/lib/asterisk/modules
astvarlibdir => /var/lib/asterisk
astdbdir => /var/lib/asterisk
astkeydir => /var/lib/asterisk
astdatadir => /var/lib/asterisk
astagidir => /var/lib/asterisk/agi-bin
astspooldir => /var/spool/asterisk
astrundir => /var/run/asterisk
astlogdir => /var/log/asterisk
astsbindir => /usr/sbin
[options]