Okay it turns out this is making my extensions very complicated…
here is what my extensions.conf file looks like now after setting up my mappings. it works, however, is there any optimized way of doing this?
I’d like to shift all the gv1,gv2,gvcall into a single subroutine irrespective of the extension because it has to be performed no matter what. In fact, if at a later point of time, i decided to add more GV accounts and more GV/Motif -> SIP mappings, I’d like to make that change in one place (and not all over the file).
Also, I send my outgoing toll-free calls to a different carrier (arctele). So I still need the tollfree calling to logic to stay agnostic of the per-google voice account / sip mapping “line” or “channel” switching logic.
sip accounts
101 -> actual softphone (my phone)
102 -> fax machine (may be off but is barely dialling out (my phone)
103 -> used by 2nd gv account (other’s phone)
[code][general]
static=yes
writeprotect=no
clearglobalvars=no
[globals]
CONSOLE=Console/dsp ; Console interface for demo
IAXINFO=guest ; IAXtel username/password
TRUNK=Zap/G2 ; Trunk interface
TRUNKMSD=1 ; MSD digits to strip (usually 1 or 0)
GvChannel=
[home-context]
exten => 101,1,Dial(SIP/101,60)
exten => 102,1,Dial(SIP/102,60)
exten => 103,1,Dial(SIP/103,60)
[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-numeric-outbound]
exten => _1NXXNXXXXXX,1,GotoIf($["${CALLERID(num)}" = “101”]?gv1)
exten => _1NXXNXXXXXX,n,GotoIf($["${CALLERID(num)}" = “103”]?gv2)
exten => _1NXXNXXXXXX,n(gv1),Set(GvChannel=Motif/me)
exten => _1NXXNXXXXXX,n,Goto(gvcall)
exten => _1NXXNXXXXXX,n(gv2),Set(GvChannel=Motif/others)
exten => _1NXXNXXXXXX,n(gvcall),Dial(${GvChannel}/${EXTEN}@voice.google.com,r)
exten => _+1NXXNXXXXXX,1,GotoIf($["${CALLERID(num)}" = “101”]?gv1)
exten => _+1NXXNXXXXXX,n,GotoIf($["${CALLERID(num)}" = “103”]?gv2)
exten => _+1NXXNXXXXXX,n(gv1),Set(GvChannel=Motif/me)
exten => _+1NXXNXXXXXX,n,Goto(gvcall)
exten => _+1NXXNXXXXXX,n(gv2),Set(GvChannel=Motif/others)
exten => _+1NXXNXXXXXX,n(gvcall),Dial(${GvChannel}/${EXTEN}@voice.google.com,r)
[talk-numeric-outbound-india]
exten => _01191NXXXXXXXXX,1,GotoIf($["${CALLERID(num)}" = “101”]?gv1)
exten => _01191NXXXXXXXXX,n,GotoIf($["${CALLERID(num)}" = “103”]?gv2)
exten => _01191NXXXXXXXXX,n(gv1),Set(GvChannel=Motif/me)
exten => _01191NXXXXXXXXX,n,Goto(gvcall)
exten => _01191NXXXXXXXXX,n(gv2),Set(GvChannel=Motif/others)
exten => _01191NXXXXXXXXX,n(gvcall),Dial(${GvChannel}/${EXTEN}@voice.google.com,r)
exten => _+91NXXXXXXXXX,1,GotoIf($["${CALLERID(num)}" = “101”]?gv1)
exten => _+91NXXXXXXXXX,n,GotoIf($["${CALLERID(num)}" = “103”]?gv2)
exten => _+91NXXXXXXXXX,n(gv1),Set(GvChannel=Motif/me)
exten => _+91NXXXXXXXXX,n,Goto(gvcall)
exten => _+91NXXXXXXXXX,n(gv2),Set(GvChannel=Motif/others)
exten => _+91NXXXXXXXXX,n(gvcall),Dial(${GvChannel}/${EXTEN}@voice.google.com,r)
[talk-numeric-outbound-germany]
exten => _01149NXXXXXXXXX,1,GotoIf($["${CALLERID(num)}" = “101”]?gv1)
exten => _01149NXXXXXXXXX,n,GotoIf($["${CALLERID(num)}" = “103”]?gv2)
exten => _01149NXXXXXXXXX,n(gv1),Set(GvChannel=Motif/me)
exten => _01149NXXXXXXXXX,n,Goto(gvcall)
exten => _01149NXXXXXXXXX,n(gv2),Set(GvChannel=Motif/others)
exten => _01149NXXXXXXXXX,n(gvcall),Dial(${GvChannel}/${EXTEN}@voice.google.com,r)
exten => _+49NXXXXXXXXX,1,GotoIf($["${CALLERID(num)}" = “101”]?gv1)
exten => _+49NXXXXXXXXX,n,GotoIf($["${CALLERID(num)}" = “103”]?gv2)
exten => _+49NXXXXXXXXX,n(gv1),Set(GvChannel=Motif/me)
exten => _+49NXXXXXXXXX,n,Goto(gvcall)
exten => _+49NXXXXXXXXX,n(gv2),Set(GvChannel=Motif/others)
exten => _+49NXXXXXXXXX,n(gvcall),Dial(${GvChannel}/${EXTEN}@voice.google.com,r)
[talk-gmail-outbound]
exten => _[a-z].@gmail.com,1,Dial(Motif/me/${EXTEN}@gmail.com,r)
exten => _[A-Z].@gmail.com,1,Dial(Motif/me/${EXTEN}@gmail.com,r)
[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)
[me-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&SIP/102,20,D(:1))
[others-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/103,20,D(:1))
[outbound]
include => home-context
include => tollfree-arctele
include => seven-digit
include => talk-numeric-outbound
include => talk-numeric-outbound-india
include => talk-numeric-outbound-germany
include => talk-gmail-outbound
include => dial-uri
[tollfree-arctele]
exten => _411, 1, Dial(SIP/18882472425@tf.arctele.com:5060)
exten => _1800NXXXXXX,1,Dial(SIP/${EXTEN}@tf.arctele.com:5060)
exten => _1822NXXXXXX,1,Dial(SIP/${EXTEN}@tf.arctele.com:5060)
exten => _1833NXXXXXX,1,Dial(SIP/${EXTEN}@tf.arctele.com:5060)
exten => _1844NXXXXXX,1,Dial(SIP/${EXTEN}@tf.arctele.com:5060)
exten => _1855NXXXXXX,1,Dial(SIP/${EXTEN}@tf.arctele.com:5060)
exten => _1866NXXXXXX,1,Dial(SIP/${EXTEN}@tf.arctele.com:5060)
exten => _1877NXXXXXX,1,Dial(SIP/${EXTEN}@tf.arctele.com:5060)
exten => _1888NXXXXXX,1,Dial(SIP/${EXTEN}@tf.arctele.com:5060)
[/code]
so basically I need to perform a lookup as to where to send the call if the context ever goes beyond [tollfree-arctele].
Any advice?
regards,
cchhat01