[asterisk-users] Changing contexts "on the fly"
J. Oquendo
sil at infiltrated.net
Fri Sep 28 13:24:48 CDT 2007
Mojo with Horan & Company, LLC wrote:
> *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.
Nice Mojo...
Here is something I have on one machine... Ugly but effective
; Nitemode
exten => 5551,1,System(asterisk -rx "dont include biz-day-aa in biz-aa")
exten => 5551,2,System(asterisk -rx "include biz-nite-aa in biz-aa")
exten => 5551,3,Hangup ;SetVar(__main=1)
; Daymode
exten => 5552,1,System(asterisk -rx "dont include biz-nite-aa in biz-aa")
exten => 5552,2,System(asterisk -rx "include biz-day-aa in biz-aa")
exten => 5552,3,System(asterisk -rx reload);
exten => 5552,4,Hangup ;SetVar(__main=0)
[biz-day-aa]
include => 1600
exten => s,1,Wait(1)
exten => s,2,Ringing
exten => s,3,Dial(SIP/xxx&SIP/xxx|20|r)
etc, etc, etc
[biz-nite-aa]
exten => s,1,Wait(1)
exten => s,2,Answer
exten => s,3,Background(biz/welcome)
exten => s,4,Background(biz/biz-aa)
exten => s,5,Background(silence/5)
exten => s,6,Goto(biz-nite-aa|s|1)
Here is something I did using GotoIfTime. The client has an extension
(6566) so that they can record their own greetings so we wouldn't have
to swap them out for them...
; Martin Luther King's Day
exten => s,3,GotoIfTime(14:00-23:59|*|14|jan?bizclient-aa,6566,1)
;exten => s,4,GotoIfTime(*|*|15|jan?bizclient-aa,6566,1)
exten => s,4,GotoIfTime(*|*|13-15|jul?bizclient-aa,6566,1)
; Memorial Day
exten => s,5,GotoIfTime(14:00-23:59|*|27|may?bizclient-aa,6566,1)
exten => s,6,GotoIfTime(*|*|28|may?bizclient-aa,6566,1)
; Independence Day
exten => s,7,GotoIfTime(12:00-23:59|*|3|jul?bizclient-aa,6566,1)
exten => s,8,GotoIfTime(*|*|4|jul?bizclient-aa,6566,1)
; Labor Day
exten => s,9,GotoIfTime(14:00-23:59|*|2|sep?bizclient-aa,6566,1)
exten => s,10,GotoIfTime(*|*|3|sep?bizclient-aa,6566,1)
; Columbus Day
exten => s,11,GotoIfTime(14:00-23:59|*|7|oct?bizclient-aa,6566,1)
exten => s,12,GotoIfTime(*|*|8|oct?bizclient-aa,6566,1)
; Veterans Day
exten => s,13,GotoIfTime(14:00-23:59|*|11|nov?bizclient-aa,6566,1)
exten => s,14,GotoIfTime(*|*|12|nov?bizclient-aa,6566,1)
; Thanksgiving Day
exten => s,15,GotoIfTime(14:00-23:59|*|21|nov?bizclient-aa,6566,1)
exten => s,16,GotoIfTime(*|*|22|nov?bizclient-aa,6566,1)
--
====================================================
J. Oquendo
"Excusatio non petita, accusatio manifesta"
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xF684C42E
sil . infiltrated @ net http://www.infiltrated.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5157 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20070928/2cbfeabf/attachment.bin
More information about the asterisk-users
mailing list