[Freeswitch-users] Cleanup destination_number with country code

Michael Nielsen mic.niel84 at gmail.com
Tue Sep 8 11:32:50 MSD 2015


I would like to check if the called number contains a country code, if not
then one should be added.
I've got a variable in my user's XML file called country_code containing
+44.

This is my code so far, however, I think the last to conditions overlap:

    <condition field="destination_number" expression="^(\+\d{3,20})$">

      <action application="export" data="dialed_extension=$1"/>

    </condition>

    <condition field="destination_number" expression="^00(\d{3,20})$">

      <action application="export" data="dialed_extension=+$1"/>

    </condition>

    <condition field="destination_number" expression="^(\d{3,20})$">

      <action application="export"
data="dialed_extension=${country_code}$1"/>

    </condition>


I would like to change 00 to +, and if no + is on the number then use
country_code from the user. If it does contain a +, then just use the
dialled number.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20150908/34a1a0c0/attachment-0001.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list