[Freeswitch-users] xml dialplan - regurlar expression question / Sanity Check!

Brian Foster bdfoster at endigotech.com
Wed Jan 9 23:53:36 MSK 2013


We have two different regex's/dialplans to handle this issue. One that matches 10 digits and one that matches 11. I think freeswitch example configs cover this. 

Sent from my iPhone

On Jan 9, 2013, at 3:36 PM, Steven Ayre <steveayre at gmail.com> wrote:

> They're dialing 10 digits including the 1.
> 
> '1' plus 10 digits can't match, it's not long enough,
> 
> So the regex instead ignores the optional '1' and tries to match just
> \d{10}, which does match since that allows the first digit to be a 1.
> 
> If you want to handle '1' plus 9 digits differently, then your regex
> will need tweaking.
> 
> 
> 
> 
> 
> On 9 January 2013 19:48, Sean Devoy <sdevoy at bizfocused.com> wrote:
>> HI,
>> 
>> 
>> 
>> I really hope this question is not as dumb as some of my recent questions
>> (Anybody else wiped out you O/S lately?)!
>> 
>> 
>> 
>> Anyway,  I have an xml dial plan:
>> 
>>  <extension name="ten_or eleven_digiti_dial" >
>> 
>>    <condition field="destination_number" expression="^1?(\d{10})$">
>> 
>>      <action application="set" data="ringback=${us-ring}"/>
>> 
>>      <action application="set"
>> data="effective_caller_id_number=${outbound_caller_id_number}"/>
>> 
>>      <action application="set" data="ani=${outbound_caller_id_number}"/>
>> 
>>      <action application="set"
>> data="effective_caller_id_name=${outbound_caller_id_name}"/>
>> 
>>      <action application="set" data="hangup_after_bridge=true"/>
>> 
>>      <action application="bridge"
>> data="sofia/gateway/vitelity-inbound/1$1"/>
>> 
>>    </condition>
>> 
>>  </extension>
>> 
>> 
>> 
>> I thought that would accept either 10 or 11 digit numbers starting with 1
>> and bridge to the gateway always using 1 plus the 10 digits.
>> 
>> 
>> 
>> In fact in my log I can see:
>> 
>> Dialplan: sofia/external/220 at fs_bfis.bizfocused.com Regex (PASS) [ten_or
>> eleven_digiti_dial] destination_number(14104207777) =~ /^1?(\d{10})$/
>> break=on-false
>> 
>> Dialplan: sofia/external/220 at fs_bfis.bizfocused.com Action
>> set(ringback=${us-ring})
>> 
>> Dialplan: sofia/external/220 at fs_bfis.bizfocused.com Action
>> set(effective_caller_id_number=${outbound_caller_id_number})
>> 
>> Dialplan: sofia/external/220 at fs_bfis.bizfocused.com Action
>> set(ani=${outbound_caller_id_number})
>> 
>> Dialplan: sofia/external/220 at fs_bfis.bizfocused.com Action
>> set(effective_caller_id_name=${outbound_caller_id_name})
>> 
>> Dialplan: sofia/external/220 at fs_bfis.bizfocused.com Action
>> set(hangup_after_bridge=true)
>> 
>> Dialplan: sofia/external/220 at fs_bfis.bizfocused.com Action
>> bridge(sofia/gateway/vitelity-inbound/14104207777)
>> 
>> 
>> 
>> BUT
>> 
>> It does not work for my customer :
>> 
>> Dialplan: sofia/external/101 at fs_alst.bizfocused.com Regex (PASS)
>> [ten_or_eleven_digiti_dial] destination_number(1800336940) =~ /^1?(\d{10})$/
>> break=on-false
>> 
>> Dialplan: sofia/external/101 at fs_alst.bizfocused.com Action
>> set(ringback=${us-ring})
>> 
>> Dialplan: sofia/external/101 at fs_alst.bizfocused.com Action
>> set(effective_caller_id_number=${outbound_caller_id_number})
>> 
>> Dialplan: sofia/external/101 at fs_alst.bizfocused.com Action
>> set(ani=${outbound_caller_id_number})
>> 
>> Dialplan: sofia/external/101 at fs_alst.bizfocused.com Action
>> set(effective_caller_id_name=${outbound_caller_id_name})
>> 
>> Dialplan: sofia/external/220 at fs_bfis.bizfocused.com Action
>> set(hangup_after_bridge=true)
>> 
>> Dialplan: sofia/external/101 at fs_alst.bizfocused.com Action
>> bridge(sofia/gateway/vitelity-inbound/11800336940)  NOTE THE EXTRA LEADING 1
>> 
>> 
>> 
>> So, what am I missing?
>> 
>> 
>> 
>> Thanks,
>> 
>> Sean
>> 
>> 
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>> 
>> 
>> 
>> 
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.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://wiki.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



Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list