Synopsis:
Existence Test: Returns 1 if exists, 0 otherwise
Description:
EXISTS(<data>)
This checks the existance of a string. Consider the following:
Var1=test
Var2=
EXISTS(${Var1}) = 1
EXISTS(${Var2}) = 0
If you’re dynamically creating variables and need to check for their existance this function comes in really handy.
Notes
- *CLI> show function EXISTS
Return value
0 or 1
Example
exten => s,1,GotoIf($[${EXISTS(${Var})}]?2:4)
exten => s,2,NoOp(Variable Var (${Var}) exists!)
exten => s,3,Goto(5)
exten => s,4,NoOp(Variable Var does NOT exist!)
exten => s,5,Hangup
See also
1830 views strong.