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)


  1. Interested in advertising?


    We can offer you up to $60 for a link on one of your site’s internal pages. We are working on a project to increase our page rank and site visibility. We just need to turn words that are already in the article into links for us. Let us know if you are interested. We can pay you within 48 hours of the link being up.

    We basically require space for small text based ads that will not use that much space of your site. We assure you the relevance of the ads to your website and its content. Moreover, we will also help you in generating income from your website by placing the advertisements of our 7-8 clients. We can help you grow your revenue via placement of relevant advertisements on your site.
    Additionally, if you needed sponsored content, we are ready to offer you that as well. The payment is done via PayPal.

    So, what are you waiting for? Let us develop business and grow together!

    Best Regards,


    Derek Miller
    Inventory Manager