Extensions.conf checking values with AND operator in GotoIf

Hello Asterisk world,

Can I do something like this in GotoIf statement

same => n,GotoIf($[${user} > 0 and ${user} != ' '] ?user,1:notuser,1)

I want to check if the user value is not empty and not 0

Is my syntax correct about the logic?

Does Asterisk extensions.conf has AND operator?

The AND operator is “£”.

Although I get a bit confused about the use of quotes, but I think you need double quotes on both sides of the “=” operator.

The > will misparse if ${user} is empty, so I would suggest prefixing it by “0”.

Also I have been having issues with quote

same => n,Set(ARRAY(__user_id, __name, __country,__region,__city)=${USER_INFO(${password},${code})})

but if I do an empty value if I try to access the value in another context . Shouldn’t __variable be accessible in all context?


same => NoOp( Value of region is ${region})

I get the response to be Value of region is

This omit the ${region} variable

_ affects channels, not contexts. __ will cause it to be copied whenever the current channel causes the creation of a new channel, in particular, the outgoing channel, of, for instance Dial.

Nothing specifically makes anything visible in all contexts, but Set(GLOBAL(name)) make name visible to all channels unless they have a local variable called name. I don’t know if you can combine ARRAY and GLOBAL.

When I remove it from the Array declare them individually it works but when I tried accessing variables using the Array with ( __ ) in another context. It does not

Can func_odbc.conf do update.

prefix = BALANCE
dsn = project
writesql = UPDATE customers SET balance=’${ARG1}’ WHERE custid = ‘${ARG2}’

This query is not working. I think the problem is the argument ${ARG1} but I do not know how to fix it

I am passing 2 values in the dialplan BALANCE_STATUS(2,150) but it is not working.