Asterisk func exists

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


37242 views strong.

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


37242 views strong.

Created by: murf, Last modification: Tue 08 of Apr, 2008 (17:57 UTC) by JustRumours
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+