Asterisk func set

Synopsis:

SET assigns a value to a channel variable

Description:

${SET(<varname>=[<value>])}

Notes


  • Might be useful to assign the value of a complex expression to a variable, while still using that value to evaluate still another expression.

Return value

Returns the value set

Example2

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).

See also



Synopsis:

SET assigns a value to a channel variable

Description:

${SET(<varname>=[<value>])}

Notes


  • Might be useful to assign the value of a complex expression to a variable, while still using that value to evaluate still another expression.

Return value

Returns the value set

Example2

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).

See also



Created by: murf, Last modification: Thu 28 of Oct, 2010 (21:13 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+