$if
If-statement.
If the flag is true, return val1 otherwise return val2.
Syntax:
$if( flag, val1, val2 )
Parameters:
flag– Must indicates “true” or “false”
val1 – value 1
val2 – value 2
Returns:
val1 – if the flag is true
val2 – if the flag is false
Version Since:
2.4
Where the function can be used:
- Preliminary rules
- Regular rules
Example:
$if($registered,"sip:user@host", "sip:voicemail@host") = (.+)
If the user in Request-URI is registered, it returns “sip:user@host”, otherwise it returns “sip:voicemail@host”.