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

Mojo with Horan & Company, LLC mojo at horanappraisals.com
Fri Sep 28 12:44:53 CDT 2007


Another option to you might just be easier.  Does your PBX ring your 
desk phone for a while and then move on to IVR/auto-attendant?   If it 
already does, do you have a DoNotDisturb button on your phone?  That's 
pretty straightforward.

The way we do the switch thing is as follows:

exten => *6,1,GotoIf($["${DB(night/enabled)}" = "1"]?2:102)
exten => *6,2,Set(oldval=${DB_DELETE(night/enabled)})
exten => *6,3,System(rm /home/pbx/night_mode)
exten => *6,4,Playback(hcllc-nightmode-off)
exten => *6,5,Hangup
exten => *6,102,Set(DB(night/enabled)="1")
exten => *6,103,System(touch /home/pbx/night_mode)
exten => *6,104,Playback(hcllc-nightmode-on)
exten => *6,105,Hangup

Then, in my incoming from PSTN context, I check like this:

...
exten => s,6,GotoIf($["${DB(night/enabled)}" = "1"]?7:107)
exten => s,7,Goto(attendant-closed,s,1)
exten => s,107,Dial(${RECEPTIONIST},15,tw)
exten => s,108,Dial(${RECEPTIONIST_AND_MOJO},10,tw)
exten => s,109,Goto(attendant-open,s,1)

*6 is for *N, for people to remember (N)ight mode.  In my *6 extension, 
I create a mutex in a sense, the file called 'night_mode' in /home/pbx 
-- this lets me determine if night mode is enabled via external systems, 
like those written in PHP for a webpage or something else for a shell 
script, maybe as a cron schedule that rings your desk to remind you that 
night mode is still on...  It is not needed for my incoming context; 
that context uses the astdb.

Mojo





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...
>
>
> What's the panel's opinion on the best way to do this?
>
>
> For info:
> 	Asterisk 1.4.5 running on Ubuntu 7.04
> 	Digium-compatible AX100P card providing connection to POTS line
> (this is the one that needs controlling)
> 	2 SIP extensions (Grandstream GXP2000)
> 	Numerous SIPGATE lines (these are configured as I like them already)
>
>
> Much appreciated in advance.
> 	
> Cheers,
> Ade.
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition. 
> Version: 7.5.488 / Virus Database: 269.13.33/1034 - Release Date: 27/09/2007
> 17:00
>  
>
>
>
> _______________________________________________
>
> Sign up now for AstriCon 2007!  September 25-28th.  http://www.astricon.net/ 
>
> --Bandwidth and Colocation Provided by http://www.api-digital.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