[asterisk-dev] [Code Review] 2878: app_queue: Make manager events tolerant of Local channel shenanigans

Matt Jordan reviewboard at asterisk.org
Tue Sep 24 16:49:40 CDT 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2878/
-----------------------------------------------------------

Review request for Asterisk Developers and Mark Michelson.


Bugs: ASTERISK-22507
    https://issues.asterisk.org/jira/browse/ASTERISK-22507


Repository: Asterisk


Description
-------

app_queue does an admirable job of attempting to manage the Lovecraftian nightmare that are Local channel optimizations. Sometimes, however, even it can't defeat the horror.

Consider the following scenario:
 SIP/foo <-> L;1 <-> L;2 <-> SIP/agent

SIP/agent answers, triggering a Local channel optimization. This is fine - app_queue will normally do the following:
 * Listen for the Local optimization events and update our agent accordingly to SIP/agent
 * When we get a hangup, publish the AgentComplete event based on our information (SIP/foo and SIP/agent)

However, as with all things that depend on sanity from something as capricious as Local channels, things can go wrong:
 (1) SIP/agent immediately hangs up upon answering, because "customer service is our #1 priority" doesn't apply on casual Fridays
 (2) Asterisk is either (a) Running under valgrind; (b) Running under gdb; (c) Running on Richard's dev machine/some other ancient piece of equipment that should have been put out of its misery ages ago

In that case, the messages *may* arrive to app_queue in the following order:
 * Hangup SIP/Agent
 * Hangup SIP/foo
 * Optimize L;1/L;2
 * Hangup L;2
 * Hangup L;1

When we receive the hangup of the agent or the caller, we'll attempt to publish the AgentComplete event. However, we now have a problem - we think our agent is L;1. We haven't received the optimization messages - but L;1 is already dead, so any attempts to query it from the Stasis cache result in a big fat NULL.

There are two options here:
 (1) If we can't retrieve channel information, bail
 (2) If we can't retrieve channel information, publish what we know

This patch goes with option #2. We still have a lot of pertinent queue information (interface, queue name, etc.) - and we may as well tell the user what we know. They will still at least get the "AgentComplete" event, which "completes" the known Agent information.


Diffs
-----

  ./branches/12/apps/app_queue.c 399746 

Diff: https://reviewboard.asterisk.org/r/2878/diff/


Testing
-------


Thanks,

Matt Jordan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130924/2a60ef7c/attachment-0001.html>


More information about the asterisk-dev mailing list