VoIP, Linux, Security & much more fun
If you need any help regarding these subjects do not hesitate about sending me a text

When you run a commercial PBX, especially for business, it is very common they have more than one DID for more than one city. One of the first requests you will get is to let your customer use their local phone number when calling to a specific area.

To do this, I wrote this dialplan.

<condition field="destination_number" expression="^\+?1?(\d{3})(\d{7})$" >
<action application="set" data="area_code=$1" inline="true" />
<action application="push" data="myvar,12345678901,12225678902,13335678903" inline="true"/>
<action application="set" data="my_dids=${myvar}" inline="true" />
</condition>

<condition field="${my_dids}" expression="(1${area_code}\d{7})" >
<action application="set" data="effective_caller_id_number=$1" inline="true" />
<action application="set" data="effective_caller_id_name=$1" inline="true" />
<anti-action application="set" data="effective_caller_id_name=${outbound_caller_id_name}" inline="true" />
<anti-action application="set" data="effective_caller_id_number=${outbound_caller_id_number} inline="true" />
</condition>

There are some limitations:

  • This is designed only for North American numbers,
  • Local areas where there is more than one prefix, this won't work properly
  • Geographic areas where one prefix may be considered long or local for any other factor, this won't work.
blog comments powered by Disqus
If you need more help than the free one provided here...