>I have written a hack -- a AGI script to do various checking, and if
>the destination is "ok" set a database variable
"fwd/1234" for extension
>1234 which contains the destination. It's gross, but it does work.
I have done a hack but users simple call *60bkah & that becomes their
extension
here is the extension logic behind it
I just thought i'd post a small sample that uses the new chan_local
to show one way of doing variable callfwding
This sample extension.conf uses's the ast DB to store a users current
extension,
in a db family of CallFWD
and the unique Key is based on the current channel the user is assigned.
In the globals var section each key is hardcoded EXT1, EXT2 this is used in
the
[incoming] context to associate each voicemenu option with a user/extension.
A macro call is made for each extension which does a simple lookup in the
ast DB
based on the family/key of CallFWD/${EXT?}, this returns the extension the
user is currently
forwarded to. The dial command just use's what ever ext the user has
assigned.
The current extension assigment is configured by the user on their assigned
channel
dialing *60 this pattern is matched in the callfwd context
& will allow the user to store what ever is after the *60 as their current
extension
It is saved to the DB by prepending the new 'local' channel driver &
the
context that is
assigned in the Global var SPEEDIAL.
I guess to be more generic users should be able to select the context they
want the
call fwd to apply to, & the means of determing there current User/Channel
should be more generic
so they don't have to set the CallFwd from there assigned channel, but that
be pretty easy just to
add some more promt when determining what channel to call fwd ...
This new local channel is realy cool works like a function calls in the
extension.conf
vs a goto / gotoif whic does not return to the calling context..
! ROCK on Mark !
[globals]
;outgoing Trunks
TRUNK1=Zap/g1
TRUNK2=IAX/myUserName@SomeIAXBox.com
TRUNK3=SIP/bah@iconnechre.com
;key associating extension/user to a channel via a DBGet
EXT1=1Zap ;see Incoming DBGet Lookup uses this family/key eg. CallFwd/1Zap
EXT2=2Zap ; ect
;
SPEEDIAL=megacontext ;context for call fwds when using extensions
[exts]
exten => 11,1,Dial(Zap/1,20,tTrm) ;dial ext on zap channel 2
exten => 12,1,Dial(Zap/2,20,tTrm) ;dial ext on zap channel 2
exten => 13,1,Dial(Zap/3,20,tTrm) ;dial ext on zap channel 3
;...
[remoteexts]
exten => 1001,1,Dial(IAX/guest@myBuddy.org) ;some iax friend hosts
exten => 1002,1,Dial(${TRUNK1}/12505552323) ;some PSTN
;all other werid exts that need to be used h323, SIP etc
[us]
exten => _91NXXNXXXXXX,1,Dial(${TRUNK2}/${EXTEN:1})
[intl]
exten => _9011.,1,StripMSD,1
exten => _011.,2,Dial({$TRUNK1}/1BYEXTENSION}
[local]
exten => 0,1,Dial(${TRUNK1}/0)
exten => 411,1,Dial(${TRUNK1}/411)
exten => 911,1,Dial,${TRUNK1}/911
exten => _9NXXXXXX,1,Dial(${TRUNK1}/${EXTEN:1})
[megacontext]
;usually just include all contexts that you have when dialing out
include => exts
include => remoteexts
include => local
include => us
include => intl
[callfwd]
exten => _*60.,1,Setvar(CallFwdNo=${EXTEN:3}) ;need to save bcus next vm
will create new ${EXTEN}
;myChannel is a string set to the same value as global var EXT1, EXT2 etc
one for each channel
;needs to be cleaned up if user sit on different tecnology/ or double digit
Zap channels
;
exten => _*60.2,Setvar(MyChannel=${CHANNEL:4:1}${CHANNEL:0:3})
;Note the use of the new channel 'local' this allow a callfwd to follow
same
pattern logic
;as if the number was dialed from an internal ext
exten => _*60.3,DBput(CallFwd/${MyChannel}=local/${CallFwdNo}@${SPEEDIAL})
[incoming]
exten => s,1,Answer
exten => s,2,setmusiconhold,default
exten => s,3,DigitTimeout,5
exten => s,4,responsetimeout,20
exten => s,5,BackGround,officemenu ;/var/lib/asterisk/sounds
exten => 1,1,Macro(stdexten,1,${EXT1})
[macro-stdexten]
;
; Standard extension macro:
; ${ARG1} -
; ${ARG2} -
;
exten => s,1,DBget(DEVICE=CallFwd/${ARG2})
exten => s,2,Dial(${DEVICE},20,tTmr) ;t allow calls to be transfered,
m-music on hold, 20sec
exten => s,3,Voicemail(u${ARG1}) ; If unavailable, send to
voicemail w/ unavail announce
exten => s,102,Voicemail(b${ARG1}) ; If busy, send to voicemail
w/ busy announce