Choking an Extension


During phone contests in large markets, the number of inbound calls can overwhelm the phone system and the VX.  So it becomes necessary sometimes to limit the number of inbound calls that are allowed to hit the phone system.  Sometimes this needs to be done at the provider's side, but here's how it works in the Asterisk.

Information provided here regarding "Asterisk" or "FreePBX" servers refers only to Telos-commissioned FreePBX (Asterisk) servers used with Telos Alliance telephony products. While these are third-party servers and software, we can provide limited pointers and advice (like this article) under regular support.

This file can be used to create custom call contexts such as "choke scripts." It is located at /etc/asterisk/extensions_custom.conf

You add your context to this file, save it, then go to Admin > Custom Destinations in FreePBX to be able to use it as a destination within FreePBX


  • EXT = Extension Number
  • LINES = Number of line positions containing this extension


Here's the format for a normal choke script:

exten => s,1,Set(GROUP()=EXT)
exten => s,2,GotoIf($[${GROUP_COUNT(EXT)} > LINES]?103)
exten => s,3,Dial(SIP/EXT,180)
exten => s,103,Busy

You can also do other things with a context. Here's an example "choke script" that also removes personal info from a contest line for legal compliance reasons by setting CID name and number (all) to a new string:

exten => s,1,Set(CALLERID(all)="WXYZ Listener" <1999>)
exten => s,2,Set(GROUP()=1011)
exten => s,3,GotoIf($[${GROUP_COUNT(1011)} > 10]?103)
exten => s,4,Dial(SIP/1011,180)
exten => s,103,Busy

Don't forget to use PJSIP/EXT instead of SIP/EXT if the extension is using the PJSIP driver. For example: exten => s,4,Dial(PJSIP/1011,180)

Enabling the Script

Once the extensions_custom.conf file is saved with the desired scripting, go to Admin > Custom Destinations in FreePBX to be able to use it as a destination within FreePBX. For the our example context where "1011-WXYZ-choke" is the name of the context, you would enter the following:

Target: 1011-WXYZ-choke,s,1
Description: 1011-WXYZ-choke
Notes: (not required)
Return: No (may not appear in all versions of FreePBX).

Save and Apply Config

Then set the destination within the desired inbound route to Custom Destination > 1011-WXYZ-choke.

Submit and Apply Config.

Let us know how we can help

If you have further questions on this topic or have ideas about improving this document, please contact us.

How did we do?