July 2017
Intermediate to advanced
434 pages
12h 59m
English
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 output:

Comparison operators ...
Read now
Unlock full access