login | register
Sun 07 of Sep, 2008 [23:53 UTC]

voip-info.org

Asterisk func exists

Created by: murf,Last modification on Tue 08 of Apr, 2008 [17:57 UTC] by JustRumours

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


10021 views strong.


Comments