[Asterisk-Users] Setting a "Forward" to an external number on
yourphone
C F
shmaltz at gmail.com
Tue Feb 15 11:20:58 MST 2005
Why not use dbput and dbget?
On Tue, 15 Feb 2005 11:16:32 -0500, Jim Van Meggelen <jim at vanmeggelen.ca> wrote:
> asterisk-users-bounces at lists.digium.com wrote:
> > Hi!
> >
> > Maybe I have just been looking on the wrong pages but there is a
> > question that is very important for me. I already studied some
> > Demo-Dialplans and made some basic experiences with Asterisk.
> > But what I
> > need to find out is how I can handle this.
> >
> > I am leaving my office and I want to tell asterisk to forward
> > calls now
> > to my mobile phone by just hitting a key (on my IP-Phone) or
> > by using a
> > special key-sequence.
> >
> > How can this be handled because I need to change the dialplan
> > based on
> > some information coming from a device attached to a channel.
> > When back in my office I hit the key again and the calls are
> > now routed
> > to my IP-Phone (or ISDN-Phone on zap-channel) again.
> >
> > With IP-Phones I can imagine just unregistering the phone and
> > having a
> > dialplan with a fallback-option or something like that. But what if I
> > want to tell asterisk to forward calls from now on to a
> > number I want to
> > manually add just for today (hitting a key, entering the new target
> > number and that's it). where can I find some information on
> > how to make
> > this feature available.
>
> There's probably a whole lot of ways this could be achieved. It's kind
> of a cookbook type thing: more than one recipe.
>
> What I've been working on is a way to change where "zero-out" or main
> menu timeouts. I want to be able to do this while on the road or in the
> office, so I built it into the dial plan.
>
> All the authentication issues aside, I need to set a variable that
> defines where I want calls to go. Additionally, I want the state of this
> variable to survive a restart.
>
> What I've been messing with is using a file-based semaphores to do this.
> Perhaps it's kludgy, but it works. Also, there's no database work
> required: it all happens in the dialplan.
>
> There's a lot more work needed here - I just hacked this together. Works
> pretty well though, it's just not very friendly.
>
> I wouldn't intall this at a customer without some more work, but mostly
> because I'd want it a bit more friendly.
>
> Anyhow, I have not tested this exact one, but it's similar to what I've
> got so far. Enjoy:
>
> [global]
>
> MyCell=18005551212
> Reception = SIP/YourPhone
>
> ; These are your semaphores. Because they are files they will survive a
> restart
> #include /var/lib/asterisk/remote_context
> #include /var/lib/asterisk/remote_exten
>
> [incoming]
> ; somewhere you'll need to put the exten that sends you to [presence]
> ; Make sure this is secure, but you'll probably want to be able to
> ; access it extenally
> exten => 4321,1,Goto(presence,s,1)
>
> [local_sets]
> exten => 1000,1,Macro(exec_set,${EXTEN},${Reception})
>
> [remote_sets]
> exten => 2000,1,Macro(cell_user,${MyCell})
>
> [presence]
> ;just record a basic prompt so you know what's up
> exten => s,1,SayDigits(${ATDT_EXTEN}) ; raw, but it'll tell you where
> it's going
> exten => s,2,Background(prompt_for_choice)
> ;;;;this sets calls to go to one place
> ; first we write the semaphore
> exten => 1,1,System(echo ATDT_CONTEXT=remote_sets >
> /var/lib/remote_context)
> ;then we set the value of the variable
> exten => 1,2,SetGlobalVar(ATDT_CONTEXT=remote_sets)
> exten => 1,3,System(echo ATDT_EXTEN=2000 > /var/lib/remote_exten)
> exten => 1,4,SetGlobalVar(ATDT_EXTEN=2000)
> exten => 1,5,Goto(presence,s,1)
> ;;;;this sets calls to go to somewhere else
> exten => 2,1,System(echo ATDT_CONTEXT=local_sets >
> /var/lib/remote_context)
> exten => 2,2,SetGlobalVar(ATDT_CONTEXT=local_sets)
> exten => 2,3,System(echo ATDT_EXTEN=1000 > /var/lib/remote_exten)
> exten => 2,4,SetGlobalVar(ATDT_EXTEN=1000)
> exten => 2,5,Goto(presence,s,1)
> ;;;;you can have as many of these as you need
> exten => 3,1,System(echo ATDT_CONTEXT=[some_context] >
> /var/lib/remote_context)
> exten => 3,2,SetGlobalVar(ATDT_CONTEXT=[some_context])
> exten => 3,3,System(echo ATDT_EXTEN=[some_exten] >
> /var/lib/remote_exten)
> exten => 3,4,SetGlobalVar(ATDT_EXTEN=[some_exten])
> exten => 3,5,Goto(presence,s,1)
>
> [cleanup]
> ; hang up the call and whatever else
> exten => s,1,Playback(goodbye)
> exten => s,2,Hangup()
>
> ;;; MACROS ;;;
> [macro-exec_set]
> exten => s,1,Dial(${ARG2},20) ; Ring the interface, 20
> seconds maximum
> exten => s,2,Goto(s-${DIALSTATUS},1) ; Jump based on status
> (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
> exten => s-NOANSWER,1,Voicemail(u${ARG1}) ; If unavailable, send
> to voicemail w/ unavail announce
> exten => s-NOANSWER,2,Goto(default,s,1) ; If they press #,
> return to start
> exten => s-BUSY,1,Voicemail(b${ARG1}) ; If busy, send to
> voicemail w/ busy announce
> exten => s-BUSY,2,Goto(default,s,1) ; If they press #,
> return to start
> exten => _s-.,1,Goto(s-NOANSWER,1) ; Treat anything else as
> no answer
> exten => a,1,VoicemailMain(${ARG1}) ; If they press *, send
> the user into VoicemailMain
>
> [macro-cell_user]
> ; This will only work if your external line supports link transfer
> exten => s,1,Playback(transfer)
> exten => s,2,Flash()
> exten => s,3,SendDTMF(${ARG1})
> exten => s,4,Hangup()
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.300 / Virus Database: 265.8.8 - Release Date: 14/02/2005
>
> _______________________________________________
> Asterisk-Users mailing list
> Asterisk-Users at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-users
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users
>
More information about the asterisk-users
mailing list