[asterisk-users] Play different voice-mail messages based on certain conditions

Warren Selby wcselby at selbytech.com
Mon Mar 21 20:37:52 CDT 2011


On Mon, Mar 21, 2011 at 8:05 PM, Harel Cohen <harel at easycall.gi> 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 at 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 at 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 at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20110321/108873b5/attachment.htm>


More information about the asterisk-users mailing list