Re: [asterisk-users] Changing contexts "on the fly"
Hi, Many thanks all for the useful tips - I've gone with a (simple!) mySQL table with a flag in it, indicating the day/night mode, adding the following into the dialplan: [external] ; other stuff in here, excluded for clarity ; Include the SJS phone line controls include => sjs_ctrl [sjs_ctrl] ; Determine if we're in or out of the office, and divert accordingly ; Note - callerID is set because it doesn't get it from the line :( exten => s,1,NoOp(-- ${CALLERID(number)} calling on ZAP channel) exten => s,2,Set(CALLERID(number)=unknown) exten => s,3,Set(CALLERID(name)=SJS Line 1) exten => s,4,MYSQL(Connect connid db_server login_id super_secret_password db_name) exten => s,5,MYSQL(Query resultid ${connid} SELECT\ currentStatus\ FROM\ myStatus) exten => s,6,MYSQL(Fetch fetchid ${resultid} MyStatus) exten => s,7,MYSQL(Clear ${resultid}) exten => s,8,MYSQL(Disconnect ${connid}) exten => s,9,GotoIf($[${MyStatus} = y]?10:12) exten => s,10,GoTo(sjs,s,1) exten => s,12,Goto(sjs-ooh,s,1) [sjs] exten => s,1,NoOp(-- ${CALLERID(number)} calling on ZAP channel) exten => s,n,Set(CALLERID(number)=unknown) exten => s,n,Set(CALLERID(name)=SJS Line 1) exten => s,n,Dial(SIP/5100,30) exten => s,n,Answer() exten => s,n,Wait(0.75) exten => s,n,Voicemail(5100,u) exten => s,n,Hangup() [sjs-ooh] exten => s,1,Answer() exten => s,n,Wait(0.75) exten => s,n,Playback(thank-you-for-calling [etc - lots more soundfiles here]) exten => s,n,Voicemail(5100,s) exten => s,n,Hangup() Then, in the internal extensions config, I've added the following: ; Switch SJS day/night modes ;Daytime (star star D) exten => **3,1,NoCdr() exten => **3,n,Answer() exten => **3,n,MYSQL(Connect connid db_server login_id super_secret_password db_name) exten => **3,n,MYSQL(Query resultid ${connid} UPDATE\ myStatus\ SET\ currentStatus\ = \ \'n\') exten => **3,n,MYSQL(Clear ${resultid}) exten => **3,n,MYSQL(Disconnect ${connid}) exten => **3,n,Playback(daytime) exten => **3,n,Hangup() ;Nighttime (star star N) exten => **6,1,NoCDR() exten => **6,n,Answer() exten => **6,n,MYSQL(Connect connid db_server login_id super_secret_password db_name) exten => **6,n,MYSQL(Query resultid ${connid} UPDATE\ myStatus\ SET\ currentStatus\ = \ \'n\') exten => **6,n,MYSQL(Clear ${resultid}) exten => **6,n,MYSQL(Disconnect ${connid}) exten => **6,n,Playback(nighttime) exten => **6,n,Hangup() So I can switch between day & night modes with **D or **N (3 or 6 respectively) :) Dead simple stuff so far, I may get more whizzy with it later on... At some point, I'll probably switch over to a fully "realtime" config, so I can DIY my own user interface. Cheers! Ade. No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.488 / Virus Database: 269.13.35/1040 - Release Date: 30/09/2007 21:01 ___ 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
Re: [asterisk-users] Changing contexts "on the fly"
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 smime.p7s Description: S/MIME Cryptographic Signature ___ 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
Re: [asterisk-users] Changing contexts "on the fly"
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 > ___ 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
Re: [asterisk-users] Changing contexts "on the fly"
On 9/28/07, Tzafrir Cohen <[EMAIL PROTECTED]> 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... ___ 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
Re: [asterisk-users] Changing contexts "on the fly"
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... Read the relevant data from a global varaible or from the database in the dialplan. You can set db entries and/or global variables in various ways. 4) Use a condional dialplan. e.g GotoIfTime or other uses of GotoIf . In fact, GotoIfTime seems to be the exact "switch flipper" you need. -- Tzafrir Cohen icq#16849755 jabber:[EMAIL PROTECTED] +972-50-7952406 mailto:[EMAIL PROTECTED] http://www.xorcom.com iax:[EMAIL PROTECTED]/tzafrir ___ 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
[asterisk-users] Changing contexts "on the fly"
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