Wednesday, February 22, 2017

An example of creating "out of office" function in the Asterisk (Elastix)

In this example, we create a function "out of office" in /etc/asterisk/extensions_custom.conf  for followme calls

Example:
Users phones: 10XXX

Then users can use this function from phones:
*11 - enable
*12 - disable


1. We have to record WAV files (PCM Encoded, 16 Bits, at 8000Hz) and add to Asterisk:
Sorry, subscriber out office
Hello, you set autoreply
Hello, you disable autoreply

2. Add to /etc/asterisk/extensions_custom.conf enable and disable blocks

[from-internal-custom]

;out of office enable
exten => *11,1,Answer
exten => *11,n,Wait(1)
exten => *11,n,Noop(${CALLERID(num)})
exten => *11,n,Set(DB(AMPUSER/${CALLERID(num)}/followme/announ_custom1)=1)
exten => *11,n,Playback(custom/Hi_you_enable_auto_reply_for_forwarding_call)
exten => *11,n,Hangup

;out of office disable
exten => *12,1,Answer
exten => *12,n,Wait(1)
exten => *12,n,Noop(${CALLERID(num)})
exten => *12,n,Set(DB(AMPUSER/${CALLERID(num)}/followme/announ_custom1)=0)
exten => *12,n,Playback(custom/Hi_you_disable_auto_reply_for_forwarding_call)
exten => *12,n,Hangup

3. Add to /etc/asterisk/extensions_custom.conf check blocks in Followme
[ext-findmefollow-custom]

;forward call, check out of office
exten => _FMPR-10XXX,1,Noop("CUSTOM-FOLLOWME")
exten => _FMPR-10XXX,n,GotoIf($["${DB(AMPUSER/${EXTEN:5}/followme/announ_custom1)}" != "1"]?NOANNOUN)
exten => _FMPR-10XXX,n,Answer
exten => _FMPR-10XXX,n,Wait(1)
exten => _FMPR-10XXX,n,Playback(custom/Hi_subscriber_you_are_calling_is_out_of_office)
exten => _FMPR-10XXX,n,Goto(ext-findmefollow,${EXTEN:5},DIALGRP)
exten => _FMPR-10XXX,n(NOANNOUN),Noop("NO ANNOUNCMENT")
exten => _FMPR-10XXX,n,Macro(dial-one,${RT},${DIAL_OPTIONS},${EXTEN:5})

No comments:

Post a Comment