Misc. Dialplan Tools regex

From FreeSWITCH Wiki
Revision as of 13:00, 20 May 2010 by Diego.viola (Talk | contribs)

Jump to: navigation, search



Execute Regular Expression

NOTE: Technically this is not a dialplan application but rather an API. API's are normally done at the CLI, however using the ${my_api(my_args)} syntax with the set application allows for the use of many API's inside the dialplan itself.


regex value expression results*

(results is optional, without this argument the regex returns true or false)

You can test your dialplan on the FS console like this.

regex 61555555555|^61([0-9]{9})$|0%1 

This would return 0555555555.

regex 61555555555|^61([0-9]{9})$

This would return true.


  • value = string to run regex against
  • expression = the actual regular expression
  • results = result handling string ( optional. without the regex returns true / false )

In your results string, you can not use $0 $1 $2 $3 as you normally would, as they would contain the results of your "condition" expression.

So inline Regex's use %0 %1 %2 %3 as their format.


Modify an Australian E164 caller_id to 0NSN format.

<action application="set" data="effective_caller_id_number=${regex(${caller_id_number}|^61([0-9]{9})$|0%1)}"/>

See Also