[Asterisk-Users] "Context Picker" for interception and redirection

Jason Lixfeld jason+lists.asterisk at lixfeld.ca
Wed Dec 14 18:07:10 MST 2005


Got it working.. wow..  didn't think it would be this easy:

[test]
; Test SIP user's context
include => contextpicker

[contextpicker]
exten => _9NXXNXXXXXX,1,Set(LOCALEXT=${EXTEN:1})
exten => _9NXXNXXXXXX,2,GoTo(local-outbound-test,localout,1)
exten => _9NXXNXXXXXX,102,NoOp(seq 102 check)
exten => _91NXXNXXXXXX,1,Set(LDEXT=${EXTEN:1})
exten => _91NXXNXXXXXX,2,GoTo(cheapldprovider-outbound-test,ldout,1)
exten => _91NXXNXXXXXX,102,NoOp(seq 102 check)
exten => _8.,1,Set(INOCEXT={$EXTEN:1})
exten => _8.,2,GoTo(inoc-dba,s,1)
exten => _8.,102,NoOp(seq 102 check)

[local-outbound-test]
exten => localout,1,Dial(${LOCALIAXOUT}/${LOCALEXT},,r)
exten => localout,2,Playback(last-error-was)
exten => localout,3,SayDigits(${CAUSECODE})
exten => localout,4,Playback(tt-somethingwrong)
exten => localout,5,Hangup
exten => localout,102,NoOp(seq 102 check)

[cheapldprovider-outbound-test]
exten => ldout,1,Dial(${LDIAXOUT}/${LDEXT},,r)
exten => ldout,2,Playback(last-error-was)
exten => ldout,3,SayDigits(${CAUSECODE})
exten => ldout,4,Playback(tt-somethingwrong)
exten => ldout,5,Hangup
exten => ldout,102,NoOp(seq 102 check)


On 14-Dec-05, at 5:56 PM, Jason Lixfeld wrote:

> Going try my best to explain this and hopefully it will make sense:
>
> We're trying to come up with something that we can only refer to as  
> a "context picker".  The idea is that if someone dials 98625551212,  
> the "context picker" will direct the call to the proper context  
> based on the dialing prefix, in this case "9".  The context picker  
> would then re-write the extension and then Goto the proper context  
> based on the prefix.  The context would need to miraculously read a  
> variable set by the context picker to match the dialed number  
> pattern and execute the proper Dial.  The thing I can't seem to  
> figure out is how to get the context to read this variable set by  
> the context picker as a dialstring.  For example (not syntactically  
> correct, I know):
>
> [contextpicker]
> exten => _9NXXNXXXXXX,1,SetVar(L-EXT=${EXTEN:1})
> exten => _9NXXNXXXXXX,2,GoTo(localoutbound,${L-EXT})
> exten => _91NXXNXXXXXX,1,SetVar(LD-EXT=${EXTEN:1})
> exten => _91NXXNXXXXXX,2,GoTo(ldoutbound,${LD-EXT})
> exten => _8.,1,SetVar(INOC-EXT=${EXTEN:1})
> exten => _8.,2,GoTo(inoc-dba,${INOC-EXT})
>
>
> [localoutbound]
> exten => ${L-EXT},1,Dial(SIP/localdump)
>
> [ldoutbound]
> exten => ${L-EXT},1,Dial(SIP/lddump)
>
> [inoc-dba]
> exten => ${INOC-EXT},1,Dial(SIP/inocdump)
>
> Does this make sense?  Is there a better way to achieve this?
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> Asterisk-Users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>




More information about the asterisk-users mailing list