Friday, September 28, 2007

Re: [asterisk-users] Changing contexts "on the fly"

On 9/28/07, Tzafrir Cohen <tzafrir.cohen@xorcom.com> wrote:
On Fri, Sep 28, 2007 at 05:28:21PM +0100, Ade Vickers wrote:
> Hi folks,
>
> I've been playing around with an Asterisk server in my office for a few
> weeks now, and I've got it pretty much nailed down the way I want it, which
> is nice.
>
> One of the features I'm using is the ability to switch different contexts in
> & out of the dialplan on a schedule. So, for example, I've got the
> "official" tel number ringing my desk phone between 9.00-17.30 mon-fri; and
> out of those hours any caller gets a recorded message + sent to voicemail.
>
> However, I'm quite often working later than 17.30, and would quite like to
> be able to easily "flick a switch" which tells Asterisk that, actually, I'm
> here in the office, and I'd quite like to receive calls. Currently, I have
> to alter dialplans.conf, comment out a couple of lines & uncomment another;
> save & then re-load the dialplan.
>
> I'm guessing I've got 3 options open to me:
>
> 1) Convert from using the various .conf files, to using a "realtime" config,
> then write a small front-end to the DB so I can access the settings from a
> simple switch on my Windows desktop
> 2) Write some kind of script which I can execute on the Asterisk box which
> makes the same changes I'm currently making manually
> 3) Some other option I've not thought of...

4) Use a condional dialplan. e.g GotoIfTime or other uses of GotoIf .

Now, add a flag that allows your calls to be routed as either:
1. Default - route according to the schedule
2. Open - give me the calls, to heck with the time
3. Closed - leave me alone. Yes, I know what time it is, but I don't care.

Put this before the GotoIfTime stuff, and it can override however you'd like.

We did this, but added a few fancy things, like ClosedForHurricane mode. It allows us to record a message as to which dates patients have been rescheduled to, says the time of the last update, and a few other goodies.

Have fun with it. You can do just about anything you can dream of. Except solve the halting problem. Ah well...


No comments: