Match a number and strip digits

In this example we need to match a called number beginning with 00, but we also need to strip the leading digits. Assuming that FreeSWITCH receives the number 00123456789 and we need to strip the leading 00 digits, then we can use the following extension:

<extension name="Test3.1"> 
  <condition field="destination_number"  
    expression="^00(d+)$"> 
    <action application="bridge"  
      data="sofia/profilename/[email protected]"/> 
  </condition> 
</extension> 

On the other hand, if you anticipate receiving non-digits, or you want to match on more than just digits, use .+ instead of d+, because d+ matches numeric digits only, whereas a .+ will match all characters from the current position to the end of the string:

<extension name="Test3.2"> 
  <condition field="destination_number" expression="^00(.+)$"> 
    <action application="bridge"  
      data="sofia/profilename/[email protected]"/> 
  </condition> 
</extension> 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.76.89