Thursday, October 28, 2010

Asterisk func set

 SET assigns a value to a channel variable  ${SET(=[])}
Might be useful to assign the value of a complex expression to a variable, while still using that value to evaluate still another expression.
Returns the value set  Set(one=${SET(two=${SET(three=${SET(four=0)})})})

Sets variables ${one}, ${two}, ${three}, and ${four} to 0.

 GotoIf(${SET(DB(sw/provider)=$[!0${DB(sw/provider)}])}?provider1:provider2)

Alternates between provider1 and provider2 (for load distribution). Please note that for Asterisk versions before 1.4.37 and 1.6.2.13 as well as 1.8.0 you will most probably have to remove the 0 from the line above (due to an extensions.conf parser fault).


No comments:

Post a Comment