Thursday, November 24, 2011

A simple IVR and Queue example where customer listens to marketing materials and also can leave voice message by '*'

A customer asks for an automated greeting system where callers listen to marketing messages before being picked up by agents.  They can also press '*' anytime to quit waiting in the queue and leave voice message.

1.    In the dial plan, we use the option 'Hn' in the Queue command.  The 'H' allows caller to hangup a ringing call by whatever defined as the disconnect sequence in features.conf.  Note that we also need 'n' such that the retry cycle is skipped and the Queue command exits.


exten => 12345,1,noop
; answer before playing the sound files
exten => 12345,n,answer
exten => 12345,n,wait(1)
exten => 12345,n,Set(TIMEOUT(digit)=2)
exten => 12345,n,Set(TIMEOUT(response)=10)
exten => 12345,n,Background(custom-ivr/custom-welcome)
;exten => 12345,n,Set(TIMEOUT(digit)=5)
; use H to let caller hangup a ringing call to agent by disconnect key seq in features.conf
; use n such that caller skips the retry cycle and exits the queue command
; otherwise, caller still stays in the queue redialing to agent
exten => 12345,n,Queue(custom-queue,Hn,,,300)
; customer leaves voice message by keying '*' or upon wait timeout of 300s
exten => 12345,n,VoiceMail(custom-vm@custom-ivr)

; we still need this extension to handle '*' pressed during the welcome greeting
exten => *,1,noop(i quit waiting)
exten => *,n,VoiceMail(custom-vm@custom-ivr)

To verify the current disconnect sequence, we can use 'feature show' in the CLI.

2.    The marketing messages are specified as a MOH class 'custom-ivr' in the queue definition.  


strategy = ringall
musicclass = custom-ivr
ringinuse = no
wrapuptime = 30
joinempty = yes

3.    Then we can put the marketing messages in a directory /var/lib/asterisk/moh/custom-ivr.  These sound files are preferably formatted to minimize transcoding. 



We can use 'core show translation' in CLI to show how costly Asterisk performs the transcoding.

4.    Alternatively, the queue 'context=' also allows caller to quit by keying a defined extension.  For example, with below configurations, caller can also quit the queue by '*'.


context = custom-ivr


; no need for Hn
exten => 12345,n,Queue(custom-queue,,,,300)

exten => *,1,noop(i quit waiting)