Upgrade 3CX to v18 and get it hosted free!

Timing Music on Hold

Author image

Description

Asterisk’s Music On Hold (moh) is a great feature to enhance the ergonomy of an auto attendant (IVR).

Nevertheless, it lacks provision to play music for a limited given length of time.

As a result, one cannot trivially rely on basic moh features for providing the incoming call with a few seconds of music before connecting to the auto-attendant.

A solution

What if we could dial a fake number for a given length of time, say 10 seconds, and tell Dial() to play moh (option m in third argument) during this time, something like :


Dial(${FakeNumber},10,m)

This idea makes the basis of our solution.

  • Step 1 : Define a moh timer.

First, define a section in the Asterisk’s dialplan (file extensions.conf) to mimic a timer, something that takes one argument (the extension) to set the number of seconds the timer should run before going off :


[moh_timer]
exten => _X!,1,Wait(${EXTEN})
  • Step 2 : Call this timer by dialing it through a local channel (reentrant call to the Dialplan)

Dial(local/10@moh_timer,10,m)    ;  play 10 seconds of moh !
  • Step 3 : Use an Asterisk’s macro to provide the user with a friendly interface

[macro-moh]
exten => s,1,Dial(local/${ARG1}@moh_timer,${ARG1},m)
  • Step 4 : Plug the whole thing to the general diaplan

[incoming]
exten => s,1,Answer()
exten => s,n,Macro(moh,5)     ; Please give the incoming call 5 seconds of music on hold! Thanks :-)
exten => s,n,Goto(ivr,s,1)

[ivr]
...

Author

Franck PORCHER,Ph.D.

Date

Fri 17 of Oct, 2008 (10:25 UTC)

Related Posts:

Get 3CX - Absolutely Free!
Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.