[Asterisk-Users] Calls forwarding to numbers only in user's context
Bartosz Piec
sip at piec.info
Wed Mar 8 05:11:13 MST 2006
Hello,
I'm trying to do call forwarding based on this:
http://www.voip-info.org/wiki/view/Asterisk+call+forwarding
In the extensions.conf file I have several context defined (local,
longdistance, mobile, international and so on). Each user can be
associated with different context (so can make only i.e. local calls).
How to set calls forwarding only to numbers that are available in user's
context (so if he has only locals calls he cannot set calls forwarding
for mobile phones)?
I'm using this for forwarding:
[forwarding] ; available for all users
; Unconditional Call Forward
exten => _*21*X.,1,DBput(CFIM/${CALLERIDNUM}=${EXTEN:4})
exten => _*21*X.,2,Background(auth-thankyou)
exten => _*21*X.,3,Hangup
exten => #21#,1,DBdel(CFIM/${CALLERIDNUM})
exten => #21#,2,Background(auth-thankyou)
exten => #21#,3,Hangup
; Call Forward on Busy or Unavailable
exten => _*61*X.,1,DBput(CFBS/${CALLERIDNUM}=${EXTEN:4})
exten => _*61*X.,2,Background(auth-thankyou)
exten => _*61*X.,3,Hangup
exten => #61#,1,DBdel(CFBS/${CALLERIDNUM})
exten => #61#,2,Background(auth-thankyou)
exten => #61#,3,Hangup
[macro-call-forwarding]
exten => s,1,Set(temp=${DB(CFIM/${ARG1})})
exten => s,n,GotoIf(${temp}?cfim:nocfim)
exten => s,n(cfim),Dial(SIP/${temp}@ruter) ; Unconditional forward
exten => s,n(nocfim),NoOp
exten => s,n,Dial(SIP/${ARG1},20,tTwW)
exten => s,n,Set(temp=${DB(CFBS/${ARG1})})
exten => s,n,GotoIf(${temp}?cfbs:nocfbs)
exten => s,n(cfbs),Dial(SIP/${temp}@ruter) ; Forward on busy or unavailable
exten => s,n(nocfbs),Goto(s-${DIALSTATUS},1) ;
NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER
...
[incoming]
;
; Incoming calls.
;
exten => XXXXXYY,1,Macro(call-forwarding,YY)
--
Best regards,
Bartosz Piec
More information about the asterisk-users
mailing list