Queue variables

I put ‘setqueuevar = yes’ however I can not access the values ​​defined in the varibles such queuecall in dialplan … can anything help me. My final goal is to register them in the database.

What’s your dialplan look like? Have you set the name of the queue first before accessing the values? For instance here is a sample dialplan:

exten => 101,1,NoOp()
  same => n,Set(${QUEUE_VARIABLES(queue)}=)
  same => n,Verbose(0,strat = ${QUEUESTRATEGY})
  same => n,Verbose(0,calls = ${QUEUECALLS})
  same => n,Hangup()

Using the above I was able to put a call into the queue named “queue” and call was equal to 1. The correct strategy was also output.

my extensions look like that

[crm_incoming_call]
exten => 1111,1,NoOp(Appel entrant crm teste)
same => n, Set(CHANNEL(language)=fr)
same => n, Playback(Bienvenue)
same => n,Read(Digits,Choixlangue)
same => n,NoOp({Digits}) same => n,GoSub(disponible,s,1) same => n,Answer() same => n,Queue(crm_strategy,,,,60) same => n,Set(QUEUE_VARIABLES(crm_strategy)) same =>n,NoOp({QUEUECALLS})
same => n,Playback(Merci)
same => n,Playback(Aurevoir)
same => n,Hangup

I want to have the values ​​before and after a call is received.
I am new to asterisk. I develop a solution that integrates asterisk.

Looks like you are missing some brackets. Try changing:

to:

same => n,Set(${QUEUE_VARIABLES(crm_strategy)}=)

And see what happens.

That might work, for the wrong reason.

QUEUE_VARIABLES cannot be used in an L-Value context , only in an R-Value one (L and R named after the side of an assignment on which they normally appear. Using ${} will create an R-Value, but that R-Value will then be used in an L-Value context, so you will end up trying to set ${1} or ${0} to an empty string, depending on whether the queue exists.

When accessing to variable values we use ${} and when setting variable value we just put the name only, so why this exception here ?

I’m not really sure why the function was originally setup this way, but it only has a read handler and no write handler. So that variable is unable to be “set”.

But if we can set variables using this function why this line using with this SET here and also setting the value to null;

Ya using “Set” here is confusing. Probably the best way to do it is something like the following instead:

same => n,Noop(${QUEUE_VARIABLES(queue)})
1 Like

Thanks @kharwell these are the things, that re not officially documented anywhere

No problem, and you’re right an example is not easily found. I went ahead, and updated the “building queues” wiki with the simple example discussed here:

https://wiki.asterisk.org/wiki/display/AST/Building+Queues#BuildingQueues-QueueVariables

1 Like

Great man, good to know that Asterisk’s gods, are still here to help the mortals :smile: :smile:

Ha! I am but a mere mortal myself who just happens to have access to the wiki and had 5 minutes of extra time (although don’t tell my manager that last part) :smile:

1 Like

The function is weird because you normally only use it for its side effects. The direct result of using it is either 0 or 1. If you use it in set, with ${}. the result is the equivalent of set(1=) or set(0=). I’m not sure if Asterisk will allow variables with those name to be set.

If you use it in set without ${}, it does nothing, because, as has been said, there is no write handler for the function.

I try but it’s like after hangup the rest of the instructions are not executed at all.

[crm_incoming_call]
exten => 2121,1,NoOp(Appel entrant crm teste)
same => n, Set(CHANNEL(language)=fr)
same => n, Playback(Bienvenue)
same => n,Read(Digits,Choixlangue)
same => n,NoOp(${Digits})

same => n,GoSub(disponible,s,1)
same => n,Answer()
same => n,Set(${QUEUE_VARIABLES(crm_strategy)}=)

same => n,Queue(crm_strategy,[t],120)
same => n,NoOp(la veleurs holdtime est de = ${QUEUEHOLDTIME}) ;; :disappointed_relieved:is never be executed
same => n,Hangup

Is there a configuration to do to inform it directly in my database as for the CDR?

Use the h extension, or possibly the newer hangup handlers.

Merci! it work.
so,
I just realized that QUEUEHOLDTIME is to inform if and only if the call was to pick up.
Is that QEHOLDTIME also has the same behavior, otherwise how could I display it?