[asterisk-commits] mmichelson: branch group/manager2 r103797 - /team/group/manager2/apps/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Feb 18 16:47:23 CST 2008
Author: mmichelson
Date: Mon Feb 18 16:47:23 2008
New Revision: 103797
URL: http://svn.digium.com/view/asterisk?view=rev&rev=103797
Log:
Converted some more manager_event calls to ast_event use in app_queue. This is just a checkin
of sorts. It's fun to call a queue in this branch now because the screen just fills up with
debug "manager" messages.
Modified:
team/group/manager2/apps/app_queue.c
Modified: team/group/manager2/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/group/manager2/apps/app_queue.c?view=diff&rev=103797&r1=103796&r2=103797
==============================================================================
--- team/group/manager2/apps/app_queue.c (original)
+++ team/group/manager2/apps/app_queue.c Mon Feb 18 16:47:23 2008
@@ -1646,6 +1646,7 @@
{
struct call_queue *q;
struct queue_ent *cur, *prev = NULL;
+ struct ast_event *event = NULL;
int res = -1;
int pos = 0;
int inserted = 0;
@@ -1694,13 +1695,27 @@
ast_copy_string(qe->context, q->context, sizeof(qe->context));
q->count++;
res = 0;
+
+ event = ast_event_new(AST_EVENT_INFO,
+ AST_EVENT_IE_INFO_QUEUE_SOURCE_CHANNEL, AST_EVENT_IE_PLTYPE_STR, qe->chan->name,
+ AST_EVENT_IE_INFO_QUEUE_CALLERIDNUM, AST_EVENT_IE_PLTYPE_STR, qe->chan->cid.cid_num,
+ AST_EVENT_IE_INFO_QUEUE_CALLERIDNAME, AST_EVENT_IE_PLTYPE_STR, qe->chan->cid.cid_name,
+ AST_EVENT_IE_INFO_QUEUE_NAME, AST_EVENT_IE_PLTYPE_STR, q->name,
+ AST_EVENT_IE_INFO_QUEUE_POSITION, AST_EVENT_IE_PLTYPE_UINT, qe->pos,
+ AST_EVENT_IE_INFO_QUEUE_COUNT, AST_EVENT_IE_PLTYPE_UINT, q->count,
+ AST_EVENT_IE_INFO_QUEUE_SOURCE_UNIQUEID, AST_EVENT_IE_PLTYPE_STR, qe->chan->uniqueid,
+ AST_EVENT_IE_END);
+
+ ast_event_queue(event);
+#if 0
manager_event(EVENT_FLAG_CALL, "Join",
"Channel: %s\r\nCallerID: %s\r\nCallerIDName: %s\r\nQueue: %s\r\nPosition: %d\r\nCount: %d\r\nUniqueid: %s\r\n",
qe->chan->name,
S_OR(qe->chan->cid.cid_num, "unknown"), /* XXX somewhere else it is <unknown> */
S_OR(qe->chan->cid.cid_name, "unknown"),
q->name, qe->pos, q->count, qe->chan->uniqueid );
- ast_debug(1, "Queue '%s' Join, Channel '%s', Position '%d'\n", q->name, qe->chan->name, qe->pos );
+#endif
+ ast_debug(1, "Queue '%s' Join, Channel '%s', Position '%d'\n", q->name, qe->chan->name, qe->pos );
}
ao2_unlock(q);
ao2_unlock(queues);
@@ -1892,6 +1907,7 @@
struct call_queue *q;
struct queue_ent *cur, *prev = NULL;
struct penalty_rule *pr_iter;
+ struct ast_event *event = NULL;
int pos = 0;
if (!(q = qe->parent))
@@ -1904,10 +1920,20 @@
if (cur == qe) {
q->count--;
+ event = ast_event_new(AST_EVENT_INFO,
+ AST_EVENT_IE_INFO_QUEUE_SOURCE_CHANNEL, AST_EVENT_IE_PLTYPE_STR, qe->chan->name,
+ AST_EVENT_IE_INFO_QUEUE_NAME, AST_EVENT_IE_PLTYPE_STR, q->name,
+ AST_EVENT_IE_INFO_QUEUE_COUNT, AST_EVENT_IE_PLTYPE_UINT, q->count,
+ AST_EVENT_IE_INFO_QUEUE_SOURCE_UNIQUEID, AST_EVENT_IE_PLTYPE_STR, qe->chan->uniqueid,
+ AST_EVENT_IE_END);
+
+ ast_event_queue(event);
+#if 0
/* Take us out of the queue */
manager_event(EVENT_FLAG_CALL, "Leave",
"Channel: %s\r\nQueue: %s\r\nCount: %d\r\nUniqueid: %s\r\n",
qe->chan->name, q->name, q->count, qe->chan->uniqueid);
+#endif
ast_debug(1, "Queue '%s' Leave, Channel '%s'\n", q->name, qe->chan->name );
/* Take us out of the queue */
if (prev)
@@ -1962,6 +1988,7 @@
{
struct member *cur;
struct ao2_iterator mem_iter;
+ struct ast_event *event = NULL;
/* Since a reload could have taken place, we have to traverse the list to
be sure it's still valid */
@@ -1975,6 +2002,20 @@
cur->status = status;
if (!q->maskmemberstatus) {
+ event = ast_event_new(AST_EVENT_INFO,
+ AST_EVENT_IE_INFO_QUEUE_NAME, AST_EVENT_IE_PLTYPE_STR, q->name,
+ AST_EVENT_IE_INFO_QUEUE_INTERFACE, AST_EVENT_IE_PLTYPE_STR, cur->interface,
+ AST_EVENT_IE_INFO_QUEUE_MEMBER_NAME, AST_EVENT_IE_PLTYPE_STR, cur->membername,
+ AST_EVENT_IE_INFO_QUEUE_MEMBERSHIP, AST_EVENT_IE_PLTYPE_STR, cur->dynamic ? "dynamic" : cur->realtime ? "realtime" : "static",
+ AST_EVENT_IE_INFO_QUEUE_PENALTY, AST_EVENT_IE_PLTYPE_UINT, cur->penalty,
+ AST_EVENT_IE_INFO_QUEUE_CALLS, AST_EVENT_IE_PLTYPE_UINT, cur->calls,
+ AST_EVENT_IE_INFO_QUEUE_LASTCALL, AST_EVENT_IE_PLTYPE_UINT, cur->lastcall,
+ AST_EVENT_IE_INFO_QUEUE_STATUS, AST_EVENT_IE_PLTYPE_STR, devstate2str(cur->status),
+ AST_EVENT_IE_INFO_QUEUE_PAUSED, AST_EVENT_IE_PLTYPE_UINT, cur->paused,
+ AST_EVENT_IE_END);
+
+ ast_event_queue(event);
+#if 0
manager_event(EVENT_FLAG_AGENT, "QueueMemberStatus",
"Queue: %s\r\n"
"Location: %s\r\n"
@@ -1987,6 +2028,7 @@
"Paused: %d\r\n",
q->name, cur->interface, cur->membername, cur->dynamic ? "dynamic" : cur->realtime ? "realtime": "static",
cur->penalty, cur->calls, (int)cur->lastcall, cur->status, cur->paused);
+#endif
}
ao2_ref(cur, -1);
}
@@ -2201,7 +2243,26 @@
(*busies)++;
return 0;
} else if (qe->parent->eventwhencalled) {
- char vars[2048];
+ /*char vars[2048];*/
+ struct ast_event *event = NULL;
+
+ event = ast_event_new(AST_EVENT_INFO,
+ AST_EVENT_IE_INFO_QUEUE_NAME, AST_EVENT_IE_PLTYPE_STR, qe->parent->name,
+ AST_EVENT_IE_INFO_QUEUE_INTERFACE, AST_EVENT_IE_PLTYPE_STR, tmp->interface,
+ AST_EVENT_IE_INFO_QUEUE_MEMBER_NAME, AST_EVENT_IE_PLTYPE_STR, tmp->member->membername,
+ AST_EVENT_IE_INFO_QUEUE_SOURCE_CHANNEL, AST_EVENT_IE_PLTYPE_STR, qe->chan->name,
+ AST_EVENT_IE_INFO_QUEUE_DESTINATION_CHANNEL, AST_EVENT_IE_PLTYPE_STR, tmp->chan->name,
+ AST_EVENT_IE_INFO_QUEUE_CALLERIDNUM, AST_EVENT_IE_PLTYPE_STR, S_OR(tmp->chan->cid.cid_num, "unknown"),
+ AST_EVENT_IE_INFO_QUEUE_CALLERIDNAME, AST_EVENT_IE_PLTYPE_STR, S_OR(tmp->chan->cid.cid_name, "unknown"),
+ AST_EVENT_IE_INFO_QUEUE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, qe->chan->context,
+ AST_EVENT_IE_INFO_QUEUE_EXTENSION, AST_EVENT_IE_PLTYPE_STR, qe->chan->exten,
+ AST_EVENT_IE_INFO_QUEUE_PRIORITY, AST_EVENT_IE_PLTYPE_UINT, qe->chan->priority,
+ AST_EVENT_IE_INFO_QUEUE_SOURCE_UNIQUEID, AST_EVENT_IE_PLTYPE_STR, qe->chan->uniqueid,
+ AST_EVENT_IE_END);
+ /*Add channelvars stuff later*/
+
+ ast_event_queue(event);
+#if 0
manager_event(EVENT_FLAG_AGENT, "AgentCalled",
"Queue: %s\r\n"
@@ -2221,6 +2282,7 @@
tmp->chan->cid.cid_name ? tmp->chan->cid.cid_name : "unknown",
qe->chan->context, qe->chan->exten, qe->chan->priority, qe->chan->uniqueid,
qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
+#endif
ast_verb(3, "Called %s\n", tmp->interface);
}
More information about the asterisk-commits
mailing list