[Freeswitch-users] Localized Numbering Plans
Jason Garland
jgarland at gmail.com
Fri Oct 19 18:15:38 PDT 2007
I use something like this for my regex since I like E.164 formatted numbers:
US National:
^(\+1|1)?([2-9]\d\d[2-9]\d{6})$
International from US:
^(\+|011)(\d\d\d\d*)$
On 10/19/07, Raymond Chandler <intralanman at gmail.com> wrote:
> After seeing how many people responded to Brian's requests on localized
> say stuff, I figured I'd run this up the flagpole and see who salutes it....
>
> I'd like to see FreeSwitch have localized numbering plans for many
> different areas out of the box. So, I've written a semi-complete version
> of a US numbering plan to spark some discussion on how others think it
> should be done.... and maybe get some examples written for other areas.
> If you notice any syntax errors, etc.... keep in mind this was written
> rather quickly and NOT thoroughly tested.... it's really just a
> (somewhat functional?) draft.
>
> ---- In Existing default_context ----
> <!--
> This will send a user to their localized numbering plan (provided the
> variable (maybe it should be a param?) is in directory.conf)
> -->
> <extension name="Localized_Dialplan">
> <condition field="${numbering_plan}" expression="^[[:alnum:]]+$"/>
> <condition field="destination_number" expression="^([[:alnum:]]+)$">
> <action application="transfer" data="$1 XML
> ${numbering_plan}-Numbering-Plan"/>
> </condition>
> </extension>
>
>
>
> ---- in numberplans/US.conf.xml (needs to be included)----
> <context name="US-Numbering-Plan">
>
> <!--
> If the destination starts with 011, then check enum and route the call
> accordingly
> -->
> <extension name="US_International">
> <condition field="destination_number" expression="^011(\d*)$">
> <action application="set" data="continue_on_fail=true"/>
> <action application="set" data="hangup_after_bridge=true"/>
> <action application="enum" data="1$1"/>
> <action application="bridge" data="${enum_auto_route}"/>
> <action application="bridge" data="sofia/$${domain}/011$1"/>
> </condition>
> </extension>
>
> <!--
> If the destination is a 10 or 11 digit US-Style number, then check
> enum and route accordingly
> -->
> <extension name="US_LD">
> <condition field="destination_number"
> expression="^1?([2-9]\d{2}[2-9]\d{6})$">
> <action application="set" data="continue_on_fail=true"/>
> <action application="set" data="hangup_after_bridge=true"/>
> <action application="enum" data="1$1"/>
> <action application="bridge" data="${enum_auto_route}"/>
> <action application="bridge" data="sofia/$${domain}/1$1"/>
> </condition>
> </extension>
>
> <!--
> Check for the existence of a default area code.... If found and the
> destination was dialed
> as 7 digits prefix a 1 and the default area code to the dialstring,
> then check enum,
> then (you guessed it) route accordingly
> -->
> <extension name="US_Local">
> <condition field="${default_area_code}" expression="\d{3}"
> continue="on-true">
> <anti-action application="say" data="you must dial the area code
> to call this destination"/>
> </condition>
> <condition field="destination_number" expression="^([2-9]\d{6})$">
> <action application="set" data="continue_on_fail=true"/>
> <action application="set" data="hangup_after_bridge=true"/>
> <action application="enum" data="1$1"/>
> <action application="bridge" data="${enum_auto_route}"/>
> <action application="bridge"
> data="sofia/$${domain}/1${default_area_code}$1"/>
> </condition>
> </extension>
>
> <!--
> If the number dialed was
> 411 (Directory Services),
> 611 (Pretty Standard for Provider Customer Service),
> 811 (call before you dig i think?),
> or 911 (Emergency Services) then send directly out the default profile
> -->
> <extension name="FCC_Services">
> <condition field="^([4689]11)$">
> <action application="bridge" data="sofia/$${domain}/$1"/>
> </condition>
> </extension>
> </context>
>
> _______________________________________________
> Freeswitch-users mailing list
> Freeswitch-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
More information about the FreeSWITCH-users
mailing list