FreeSWITCH string interpreter functions
There are couple of constructs we can use to enhance the expressive power of FreeSWITCH configuration. They are borrowed from programming languages, and are particularly handy when, for the sake of efficiency, we don't want to use a scripting language like Lua or Perl.
cond, C-like "expr ? truevalue : falsevalue"
The "cond" construct will be substituted by its truevalue if expr is evaluated to true, or by its falsevalue in the other case.
The general format of the cond function is (note the spaces around question mark and around colon):
${cond(<expr> ? <truevalue> : <falsevalue>)}
Let's see an example extension using "cond" construct:
<extension name="COND"> <condition field="destination_number" expression="^2914$"> <action application="log" data="ERR ${cond(${username} == 1011 ? YESSSS : NOOOOT)}"/> </condition> </extension>
Calling 2914 from a phone registered as user 1011 will...