Block dialing to specific extensions in IVR


For this article, client needs that some specific extensions could not be dialed or forward the call to the other destination like the secretary extension first. The secretary would make validation the call then decides to transfer to the boss or not.

Currently this could not be accomplished from the IVR web settings. Alternatively, we have a custom dialplan solution.

Consider the note before you proceed:

  1. You would a good knowledge of Linux operation and basic knowledge of Asterisk dialplan.
  2. Once you use this solution, the change of IVR from web would not take effect anymore. 


See the procedures in the following:

Basic Understanding

  • First you need to know how to enter the SSH interface:

For S-Series, K2 or Cloud PBX:

  • Secondly you need to how the custom configuration rules:

For S-Series and K2 or Cloud PBX:

Solution 1 - Block Direct Dialing to Specific Extensions

Here you have several choices to handle how it blocks. The common applications:

  • Play a prompt 
  • Return to IVR
  • Hangup the call directly

1. Configure IVR, and make sure it is the final configuration. As the note mentioned in front of this article, the change of IVR would not take effect any more.

2. Enter SSH, and copy the IVR dialplan in the /etc/asterisk/extensions.conf

IVR dialplan start with [ivr_XXX], XXX is the IVR number.

3. Create the extensions_support.conf in path /ysdisk/suppoprt/customcfg/

As this file exists already and to prevent permission issue. Enter the commands:

  • cd /ysdisk/support/customcfg/
  • rm extensions_support.conf  (press y to delete the file)
  • touch extensions_support.conf


4. Paste the the dialplan copied from step 2 in the extensions_support.conf 

5. Change the dialplan as required.

5.1 Return to IVR

Basically it means returns to the same IVR. 

Insert the dialplan to make IVR return. So when the caller dials to the extension blocks, the call would be back to IVR.

Note that insert the dialplan upon the "include" lines.

The dialplan sample is: exten = XXX,1,Goto(ivr_YYY,YYY,1). 

XXX is the extension blocks, YYY is the IVR number.

Like: exten = 1002,1,Goto(ivr_6500,6500,1)

5.2 Hangup the call directly

Insert the dialplan to make call hangup. This might be not friendly, so it's recommended to use with other application.

Note that insert the dialplan upon the "include" lines.

The dialplan sample is: exten = XXX,1,hangup(). 

XXX is the extension blocks.

Like: exten = 1002,1,Hangup()

5.3.1 Play a prompt

Upload a prompt firstly through the Custom Prompt menu.

Make sure your audio file is correct, please refer this guide:

5.3.2 Insert the dialplan to play the prompt you uploaded. 

For example you need to prevent extension 1002 from direct dialing in the IVR.

Note that insert the dialplan upon the "include" lines.

For the dialplan for play a prompt is: exten = XXX,1,Playback(record/YYY)

XXX is the extension blocks, YYY is the audio file name.

Then you would the next sequence, generally you could let it return to IVR or hang up directly after the prompt. Like:

exten = 1002,1,Playback(record/YYY)

exten = 1002,2,Goto(ivr_6500,6500,1)


exten = 1002,1,Playback(record/YYY)

exten = 1002,2,Hangup

6. Save and Apply any change on the web or reboot the PBX to let the change take effect.

7. Test

Solution  2 - Forward the Call to Other Destination

Here we set the destination as the other extension number like the secretary's number.

Once the caller dials the extension that blocks, it would forward to the secretary's number automatically.

The steps are almost the same as the Solution 1 except the dialplan.

The dialplan sample is exten = XXX,1,Goto(from-outside,YYY,1).

XXX is the extension number blocks, YYY is the secretary extension number.


Have more questions? Submit a request


Please sign in to leave a comment.