[general]
static=yes
writeprotect=no
clearglobalvars=no

[globals]
CONSOLE=Console/dsp				; Console interface for demo
;CONSOLE=DAHDI/1
;CONSOLE=Phone/phone0
IAXINFO=guest					; IAXtel username/password
;IAXINFO=myuser:mypass
TRUNK=Zap/G2					; Trunk interface
TRUNKMSD=1					; MSD digits to strip (usually 1 or 0)
;TRUNK=IAX2/user:pass@provider

;FREENUMDOMAIN=mydomain.com                     ; domain to send on outbound
                                                ; freenum calls (uses outbound-freenum
                                                ; context)

[default]
exten => s,1,Set(CALLERID(name)=${DB(cidname/${CALLERID(num)})})
exten => s,n,Dial(SIP/101,10)
exten => s,n, Hangup
exten => 101, 1, Dial(SIP/101, 10)
exten => 102, 1, Dial(SIP/102, 10)

[incoming-motif]
exten => s,1,NoOp()
 same => n,Set(crazygooglecid=${CALLERID(name)})
 same => n,Set(stripcrazysuffix=${CUT(crazygooglecid,@,1)})
 same => n,Set(CALLERID(num)=${stripcrazysuffix})
 same => n,Set(CALLERID(name)=${stripcrazysuffix})
 same => n,Dial(SIP/101,20,D(:1))
 
[outbound]
include => seven-digit
include => local-devices
include => tollfree
include => talk-gmail-outbound
include => talk-numeric-outbound
include => talk-numeric-outbound-india
include => talk-numeric-outbound-germany
include => dial-uri


[local-devices]
exten => _1, 1, Dial(SIP/101,10)
exten => 101, 1, Dial(SIP/101,10)
exten => _2, 1, Dial(SIP/102,10)
exten => 102, 1, Dial(SIP/102,10)

[tollfree]
exten => _411, 1, Dial(SIP/18882472425@tollfree.alcazarnetworks.com:5060)
exten => _1800NXXXXXX,1,Dial(SIP/${EXTEN}@tollfree.alcazarnetworks.com:5060)
exten => _1822NXXXXXX,1,Dial(SIP/${EXTEN}@tollfree.alcazarnetworks.com:5060) 
exten => _1833NXXXXXX,1,Dial(SIP/${EXTEN}@tollfree.alcazarnetworks.com:5060) 
exten => _1844NXXXXXX,1,Dial(SIP/${EXTEN}@tollfree.alcazarnetworks.com:5060) 
exten => _1855NXXXXXX,1,Dial(SIP/${EXTEN}@tollfree.alcazarnetworks.com:5060) 
exten => _1866NXXXXXX,1,Dial(SIP/${EXTEN}@tollfree.alcazarnetworks.com:5060) 
exten => _1877NXXXXXX,1,Dial(SIP/${EXTEN}@tollfree.alcazarnetworks.com:5060) 
exten => _1888NXXXXXX,1,Dial(SIP/${EXTEN}@tollfree.alcazarnetworks.com:5060) 
;exten => _411, 1, Dial(SIP/18882472425@tf.callwithus.com:5060)
;exten => _1800NXXXXXX,1,Dial(SIP/${EXTEN}@tf.callwithus.com:5060)
;exten => _1822NXXXXXX,1,Dial(SIP/${EXTEN}@tf.callwithus.com:5060) 
;exten => _1833NXXXXXX,1,Dial(SIP/${EXTEN}@tf.callwithus.com:5060) 
;exten => _1844NXXXXXX,1,Dial(SIP/${EXTEN}@tf.callwithus.com:5060) 
;exten => _1855NXXXXXX,1,Dial(SIP/${EXTEN}@tf.callwithus.com:5060) 
;exten => _1866NXXXXXX,1,Dial(SIP/${EXTEN}@tf.callwithus.com:5060) 
;exten => _1877NXXXXXX,1,Dial(SIP/${EXTEN}@tf.callwithus.com:5060) 
;exten => _1888NXXXXXX,1,Dial(SIP/${EXTEN}@tf.callwithus.com:5060) 

[seven-digit]
exten => _NXXXXXX,1,Set(CALLERID(dnid)=1347${CALLERID(dnid)})
exten => _NXXXXXX,n,Goto(1347${EXTEN},1)
exten => _NXXNXXXXXX,1,Set(CALLERID(dnid)=1${CALLERID(dnid)})
exten => _NXXNXXXXXX,n,Goto(1${EXTEN},1)

[talk-gmail-outbound]
exten => _[a-z].@gmail.com,1,Dial(Motif/google/${EXTEN}@gmail.com,,r)
exten => _[A-Z].@gmail.com,1,Dial(Motif/google/${EXTEN}@gmail.com,,r)

[talk-numeric-outbound]
exten => _1NXXNXXXXXX,1,Dial(Motif/google/${EXTEN}@voice.google.com,,r)
exten => _+1NXXNXXXXXX,1,Dial(Motif/google/${EXTEN}@voice.google.com,,r)

[talk-numeric-outbound-india]
exten => _01191NXXXXXXXXX,1,Dial(Motif/google/${EXTEN}@voice.google.com,,r)
exten => _+91NXXXXXXXXX,1,Dial(Motif/google/${EXTEN}@voice.google.com,,r)

[talk-numeric-outbound-germany]
exten => _01149NXXXXXXXXX,1,Dial(Motif/google/${EXTEN}@voice.google.com,,r)
exten => _+49NXXXXXXXXX,1,Dial(Motif/google/${EXTEN}@voice.google.com,,r)

;[gv-agi-outbound]
;exten => _1NXXNXXXXXX,1,AGI(google-voice-dialout.agi)
;exten => _+1NXXNXXXXXX,1,AGI(google-voice-dialout.agi)

[dial-uri] 
exten => _[a-z].,1,Dial(SIP/${EXTEN}@${SIPDOMAIN},120,tr)
exten => _[A-Z].,1,Dial(SIP/${EXTEN}@${SIPDOMAIN},120,tr)
exten => _X.,1,Dial(SIP/${EXTEN}@${SIPDOMAIN},120,tr)
