Thursday 18 December 2014

Asterisk Out of Office Recording Extension

12:34 Posted by Jurgens Krause No comments
My clients sometimes need to put temporary messages on their phone lines. For example during the Christmas holidays or if everyone is away for a company retreat.

This is a simple edit to your dialplan, so it should not be too difficult.


On the incoming dialplan, add the following

;Check if a greeting is enabled, if so go to "playback" in the current context
same => n,GotoIf(${DB_EXISTS(greeting/enabled)}?playback)

;If greeting is not enabled, skip to "noplayback"
same => n,goto(noplayback)

;Play the recorded message then hang up
same => n(playback),Playback(temp-message)
same => n,HangUp()

;If message is not enabled, proceed with the rest of your incoming dialplan
same => n(noplayback),NoOp(Playback is not active)

Now, create the following context and make sure it is included in your outgoing context.



[greeting]
;When the user dials 999 start the process to record the temporary message
exten => 999,1,NoOp(Start Recording Message)

;Issue a voice instruction to the user, make sure to upload the voice files from the extended voice pack for asterisk
same => n(record),Playback(after-the-tone&say-temp-msg-prs-pound)
;same => n,Playback(beep)

;Record the message, and play it back to the user for approval
same => n,Record(temp-message.gsm)
same => n,Playback(playback&temp-message)

;Ask the user to approve the message by hanging up, or press zero to re-record
same => n,Background(if-this-is-not-correct&press-0&otherwise&hangup)
same => n,Wait(10)
same => n,hangup

;If the user presses zero, return to "record"
exten => 0,1,goto(greeting,999,record)

;When the user dials *999 toggle the message playback and prompt the user, make sure to upload the appropriate promtps
exten => *999,1,NoOp(Toggle Greeting)
same => n,GotoIf(${DB_EXISTS(greeting/enabled)}?DisableGreeting)
same => n,Set(DB(greeting/enabled)=TRUE)
same => n,Playback(vm-tempgreetactive)
same => n,HangUp()
same => n(DisableGreeting),DBdel(greeting/enabled)
same => n,Playback(vm-tempremoved)
same => n,HangUp()


0 comments:

Post a Comment