[asterisk-dev] App_queue doesn't sends correct AMI events to EXITWITHTIMEOUT, EXITWITHKEY, SYSCOMPAT, EXITEMPTY
Marcos Setim
m.setim at gmail.com
Wed Nov 24 10:17:47 CST 2010
Hello,
I found an ugly behavior. In fact it is both a code bug and a mistake of
concepts. I'm talking about AMI event from app_queue.c. First let me bring
the concepts from voipinfo:
ABANDON: "The caller abandoned their position in the queue."
EXITEMPTY: "The caller was exited from the queue forcefully because the
queue had no reachable members and it's configured to do that to callers
when there
are no reachable members."
EXITWITHKEY: "The caller elected to use a menu key to exit the queue."
EXITWITHTIMEOUT: "The caller was on hold too long and the timeout expired."
I don't want mean we don't know about it, however it's my argument to bring
to discuss the importance of this fix. In short, the problem is that
app_queue sends the same event to EXITWITHTIMEOUT, EXITWITHKEY, SYSCOMPAT,
EXITEMPTY. When app_queue receives any of them it sends: QueueCallerAbandon.
In other hand, app_queue saves the correct event in queue_log. As follows:
if (qe.expire && (time(NULL) >= qe.expire)) {
record_abandoned(&qe);
reason = QUEUE_TIMEOUT;
res = 0;
ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHTIMEOUT",
"%d", qe.pos);
break;
}
The code above sends a "QueueCallerAbandon" coded in record_abandoned.
I was talking about it with Corydon and he alerted me about the complexity
to implement changes in AMI events because many apps use the events in yours
front-ends.
What I suggest to this case is create a "deprecated" event in the asterisk
1.4 and 1.6 to events: EXITWITHTIMEOUT, EXITWITHKEY, SYSCOMPAT, EXITEMPTY
and sent both the new events and the deprecate event. At 1.8 asterisk this
"deprecated event" will be removed. It's not the handsome solution, but is a
way to start a change. My argument about this change is that attach a new
line "deprecate" at AMI events won't cause problems to implementations that
depends of it and at same time send the new events will let the developers
of both front-ends and asterisk AMI monitoring to adapt our codes before the
asterisk 1.8.
The code below represent a "deprecate" event:
manager_event(EVENT_FLAG_AGENT, "QueueCallerAbandon",
"Queue: %s\r\n"
"Uniqueid: %s\r\n"
"Position: %d\r\n"
"OriginalPosition: %d\r\n"
"HoldTime: %d\r\n"
"Replacedby: QueueCallerExitWithTimeout"
"Deprecated: Yes",
qe->parent->name, qe->chan->uniqueid, qe->pos, qe->opos, (int)(time(NULL) -
qe->start));
To real ABANDON events the lines "Replacedby" and "Deprecated" will not
appear, because it will not removed at future versions.
I posted in pastebin a complete code (asterisk-1.6.2.14) to exemplify my
idea: http://pastebin.com/gaSSnfSW (diff version:
http://pastebin.com/m1zzcF9q)
Bye
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-dev/attachments/20101124/a814997e/attachment.htm
More information about the asterisk-dev
mailing list