Misc. Dialplan Tools regex

From FreeSWITCH Wiki
Revision as of 03:09, 16 June 2009 by Jwehle (Talk | contribs)

Jump to: navigation, search

Contents

Description

Execute Regular Expression

Usage

regex value expression results*

( results is opitional, 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

Parameters

  • 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.

Examples

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

Dialplan