From: Warren Selby <[email protected]> Reply-To: Asterisk Users Mailing List - Non-Commercial Discussion <[email protected]> Date: Mon, 21 Mar 2011 20:37:52 -0500 To: Asterisk Users Mailing List - Non-Commercial Discussion <[email protected]> Subject: Re: [asterisk-users] Play different voice-mail messages based on certain conditions
> On Mon, Mar 21, 2011 at 8:05 PM, Harel Cohen <[email protected]> wrote: >> Hello List, >> I have few installations out there based on 1.6.1 or above. >> I¹m trying to play different voice mail messages based on certain criteria¹s. >> For example, I want during office hours to play (in short): ³we are not >> available to take your call, please leave a message², during off-hours and >> weekends I would play: ³we are closed, our opening hours xx:xx-yy:yy, please >> leave a message or send a fax or send an email² and during holidays I would >> play: ³we are closed due to holiday, please leave a message, fax, blab la² >> etc. >> > > What I have done for various clients in your situation is to create > conditional contexts based on either time of day and day of year criteria (see > GotoIfTime()[1]) and then use Playback() to play the correct voicemail > greeting, then call the Voicemail() app with just the s option, which skips > all "vm-intro"'s and any pre-recorded messages. > > Quick, off the top of my head example: > > [default] > exten => _X.,1,Verbose(Incoming call - battlestations!) > exten => _X.,n,Answer() > exten => _X.,n,Dial(SIP/${EXTEN},30) > exten => _X.,n,Verbose(No one answered - going to voicemail) > exten => _X.,n,Goto(no-answer,s,1) > > [no-answer] > ; no one answered, play voicemail based on time of day / day of year > exten => s,1,Verbose(Checking time conditions to play proper voicemail) > exten => s,n,Verbose(First check holidays) > exten => s,n,GotoIfTime(*,*,25,dec?holiday,1) ; Christmas, add your own here > exten => s,n,Verbose(Not a holiday - so checking time of day) > exten => s,n,GotoIfTime(08:00-18:00,mon-fri,*,*?officehours,1) > exten => s,n,Verbose(Time condition check failed - playing after-hours > message) > exten => s,n,Goto(afterhours,1) > > ; holiday voicemail greeting > exten => holiday,1,Verbose(Playing holiday greeting) > exten => holiday,n,Playback(holiday-greeting) > exten => holiday,n,Voicemail(defaultmailbox@default,s) > exten => holiday,n,Hangup() > > ; officehours voicemail greeting > exten => officehours,1,Verbose(Playing officehours greeting) > exten => officehours,n,Playback(officehours-greeting) > exten => officehours,n,Voicemail(defaultmailbox@default,s) > exten => officehours,n,Hangup() > > ; afterhours voicemail greeting > exten => afterhours,1,Verbose(Playing afterhours greeting) > exten => afterhours,n,Playback(afterhours-greeting) > exten => afterhours,n,Voicemail(defaultmailbox@default,s) > exten => afterhours,n,Hangup() > > > [1]: http://www.voip-info.org/wiki/view/Asterisk+cmd+GotoIfTime > > -- > Thanks, > --Warren Selby, dCAP > http://www.selbytech.com I used a slightly different approach below is a snippet of my [day-menu] context that I did for one of my installs. I load up the site's holiday schedule in the Asterisk data base (I do it once per year, and train someone to do it if I cannot), then check for the current date/holiday key if it is =1 then I play out the holiday greetings, otherwise I play out the day or night greeting. The second argument to STRFTIME is the time zone be sure to get that right for your installation. [day-menu] exten => s,1,Answer() exten => s,n,Wait(1.5) ; Wait for callerID spill exten => s,n,Set(DATE=${STRFTIME(${EPOCH},ChST,%C%y%m%d)}) exten => s,n,Verbose(2,---> Current date is ${DATE}) exten => s,n(reinit),Set(COUNTER=0) exten => s,n,GotoIf($["${DB(custom/${DATE}/holiday)}" = "1"]?holiday) exten => s,n,Goto(daycheck) exten => s,n(holiday),Set(MENU=holiday-menu) exten => s,n,Goto(playmenu) exten => s,n(daycheck),GotoIfTime(08:00-16:59,mon-fri,*,*?open) exten => s,n,Set(MENU=night-menu) exten => s,n,Goto(night) exten => s,n(open),Set(MENU=day-menu) exten => s,n(night),NoOp() exten => s,n(top),Wait(0.5) exten => s,n,GotoIf($[${COUNTER}>=10]?wrong) exten => s,n(playmenu),Background(${MENU}) exten => s,n(bypass),WaitExten(10) ; go straight to VM if they time out... exten => s,n,Goto(2,1) exten => s,n(wrong),Playback(something-terribly-wrong) exten => s,n,Playback(goodbye) exten => s,n,Hangup() Hopefully this is enough to get you started. Cassius Smith
-- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
