[Freeswitch-users] Dialplan: Outbound route: destination_number: regex question

Vallimamod Abdullah vma at vallimamod.org
Mon Jul 3 11:44:22 UTC 2017


Hi,

IMHO, instead of trying to find a single complicated regex working in all cases, a more readable way is to use condition regex="any" to stack all your possible matching regexes and let freeswitch try them one by one:

<condition regex="any">
  <regex field="destination_number" expression="^(\+6422\d{7})$"/>
  <regex field="destination_number" expression="^(022\d{7})$"/>
  <regex field="destination_number" expression="^(\d{7})$"/>
  <action ...>
</condition>

Hope this helps.

Best Regards,
-- 
Vallimamod Abdullah
SIP Solutions
vma at sipsolutions.fr
.


> On 3 Jul 2017, at 05:24, Nate <nathan.port at gmail.com> wrote:
> 
> Hi Roy, many thanks for responding.
> 
> I am simply trying to finishing configuring the server to make/receive calls from the PSTN.
> 
> My reference to the regex is from trying to configure an outbound route.
> 
> Can anyone offer any advice on a regex that will work for me to reach any of the following phone numbers:
> 
> International: +64 22 333 4444
> non-local: 022 333 4444
> local: 333 4444
> 
> From the number assigned to my account? +64 9 xxx yyyy
> 
> Many many thanks!
> 
> Nate.
> 
> On Sat, Jul 1, 2017 at 9:17 AM, <royj at yandex.ru> wrote:
> Not quite clear. What are you trying to achieve?
>  
> 30.06.2017, 11:11, "Nate" <nathan.port at gmail.com>:
>> Good day/evening everyone,
>>  
>> Apologies for not being able to figure this out on my own. I've been searching and trying for several days to get inbound/outbound working but have yet to see success.
>>  
>> At this stage I need help determining a proper regex expression for handling New Zealand phone numbers.
>>  
>> For instance, there are three different ways of expressing numbers here in NZ:
>>  
>> International: +64 22 333 4444
>> non-local: 022 333 4444
>> local: 333 4444
>>  
>> A couple questions related to the SIP proxy:
>>  
>> If the SIP proxy is located in Hong Kong, but the phone number is a New Zealand number, does the location of the proxy have any impact on the number of characters in the string for inbound/outbound calls?
>>  
>> Again, apologies for the rudimentary nature of these questions, but having nearly exhausted all other options (docs, searches, IRC), I am now spending a large amount of time guessing and trial and error without any progress.
>>  
>> Many thanks for any feedback at all.
>>  
>> Nate
>> ,
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>> 
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://confluence.freeswitch.org
>> http://www.cluecon.com
>> 
>> 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
>> 
> 
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
> 
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.freeswitch.org
> http://www.cluecon.com
> 
> 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
> 
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
> 
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.freeswitch.org
> http://www.cluecon.com
> 
> 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