[Resolved] Exit queue with key

Hello

This is what I want to achieve:

  1. Place a user in a queue from within a AGI-script
  2. User can leave the queue by pressing a digit
  3. Get which digit the user pressed from within the AGI-script
  4. Do something in the AGI-script based on which digit that was pressed

This is how I have tried to achieve it:

Specified an extension context for the queue which it should transfer the user to when he/she pressed a digit. In the corresponding extension for the context (e.g. 1 if digit 1 was pressed), I set a variable with the extension, which I should be able to get from within the AGI-script.

My problem is that when the user pressed a key, the queue is leaved, but it first returns the user to the AGI-script (the variable is not yet set) and it will be runned to it’s end. Then the user is transfered to the specified context and the variable will be set.

Is this how it should work? How can I change this behavior, so the queue first runs the context (the variable will be set), and then returns to the AGI-script?

Thanks !

The solutions is the catch the variable EXTEN in the agi-script. It will be set to the corresponding digit that was pressed in the queue, because it holds the extension in the queue callback context that asterisk will forward the user to when the agi-script returns.