This is what I want to achieve:
- Place a user in a queue from within a AGI-script
- User can leave the queue by pressing a digit
- Get which digit the user pressed from within the AGI-script
- 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?