[Home]

Summary:ASTERISK-26954: Queue agi variable not returning
Reporter:Aidar Kamalov (aidar.kamalov@gmail.com)Labels:
Date Opened:2017-04-21 06:34:22Date Closed:2017-04-23 08:39:40
Priority:MajorRegression?
Status:Closed/CompleteComponents:Applications/app_queue
Versions:13.13.1 Frequency of
Occurrence
Related
Issues:
Environment:Debian GNU/Linux 8.7 (jessie) Linux co-ats 3.16.0-4-amd64 #1 SMP Debian 3.16.39-1 (2016-12-30) x86_64 GNU/Linux Attachments:
Description:Hello, not sure it's a bug.

I have queue with agi scipt. When I call to queue and then hangup, I can't get variable set in agi script.
But if agent hangup variable is available in dialplan.

extensions.conf
{noformat}
[test]
exten => _X.,1,Answer()
same => n,Queue(it-support,cF,,,,1.py)
same => n,NoOp(TEST: TICKET_ID ${TEST})
same => n,Hangup
{noformat}
1.py
{noformat}
#!/usr/bin/env python
from asterisk.agi import *
agi = AGI()
agi.set_variable("_TEST", "123456")
{noformat}

If caller hangup:
{noformat}
<SIP/be-00000000>AGI Rx << SET VARIABLE "_TEST" "123456"
-- Executing [9656@test:5] NoOp("SIP/00132-00000002", "TEST: TICKET_ID ") in new stack
{noformat}

If agent hangup:
{noformat}
<SIP/bee-00000007>AGI Rx << SET VARIABLE "_TEST" "123456"
-- Executing [9656@test:5] NoOp("SIP/beeline-00000007", "TEST: TICKET_ID 123456") in new stack
{noformat}
Comments:By: Asterisk Team (asteriskteam) 2017-04-21 06:34:23.560-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

By: Richard Mudgett (rmudgett) 2017-04-21 09:55:52.219-0500

This is not a bug.

# Channel variable inheritance happens *only* when a channel is created by another channel.
# The {{1.py}} AGI script runs on the *caller* channel after the *called* channel answers but before they are bridged.
# The *c* option has the *caller* channel *continue* in dialplan at the next location when the *called* channel hangs up first.
# The *F* option has the *called* channel *start* executing in dialplan at the next location when the *caller* channel hangs up first.

Your {{1.py}} AGI script is setting the channel variable on the *caller* channel *after* the *called* channel is created and answered.  Under these conditions you cannot expect the *called* channel to have that channel variable set on it.

By: Aidar Kamalov (aidar.kamalov@gmail.com) 2017-04-22 03:43:43.292-0500

So there is no way to get varibales if caller hangup first? :(

By: Richard Mudgett (rmudgett) 2017-04-23 08:38:53.056-0500

We appreciate the difficulties you are facing, however this is not a bug report and your request or comments would be better served in a different forum.

The Asterisk community provides support over IRC, mailing lists, and forums as described at http://asterisk.org/community. The Asterisk issue tracker is used specifically to track issues concerning bugs and documentation errors.

Please see the Asterisk Issue Guidelines [1] for instruction on the intended use of the Asterisk issue tracker.

Thanks!

[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines

You need to rethink what you are trying to accomplish.  You need to remember *who* is executing dialplan.  You could set channel variables on the calling channel before he enters the queue that will then be inherited by the agent's channel.