[asterisk-commits] mmichelson: branch group/manager2 r110342 - in /team/group/manager2: apps/ in...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Mar 20 17:11:48 CDT 2008
Author: mmichelson
Date: Thu Mar 20 17:11:48 2008
New Revision: 110342
URL: http://svn.digium.com/view/asterisk?view=rev&rev=110342
Log:
Getting rid of manager2.h, at least for now...everything in there
should have been in the main event code to begin with. I moved all the
IE definitions event_defs.h and moved the info_map which maps event
IEs to their payload type and name to event.c. I created accessor functions
to get an IE's payload type or its name.
I also changed some of the queue-specific IE names since they're not
really queue-specific at all. Now they have a more generic name since they
will most likely be used in many other modules too.
Removed:
team/group/manager2/include/asterisk/manager2.h
Modified:
team/group/manager2/apps/app_queue.c
team/group/manager2/include/asterisk/event.h
team/group/manager2/include/asterisk/event_defs.h
team/group/manager2/main/event.c
team/group/manager2/res/res_manager2.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=110342&r1=110341&r2=110342
==============================================================================
--- team/group/manager2/apps/app_queue.c (original)
+++ team/group/manager2/apps/app_queue.c Thu Mar 20 17:11:48 2008
@@ -92,7 +92,6 @@
#include "asterisk/astobj2.h"
#include "asterisk/strings.h"
#include "asterisk/global_datastores.h"
-#include "asterisk/manager2.h"
/*!
* \par Please read before modifying this file.
* There are three locks which are regularly used
@@ -708,15 +707,15 @@
}
event = ast_event_new(AST_EVENT_QUEUE_MEMBER_STATUS,
- 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_QUEUE_NAME, AST_EVENT_IE_PLTYPE_STR, q->name,
+ AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, cur->interface,
+ AST_EVENT_IE_QUEUE_MEMBERNAME, AST_EVENT_IE_PLTYPE_STR, cur->membername,
+ AST_EVENT_IE_QUEUE_MEMBERSHIP, AST_EVENT_IE_PLTYPE_STR, cur->dynamic ? "dynamic " : cur->realtime ? "realtime" : "static",
+ AST_EVENT_IE_QUEUE_PENALTY, AST_EVENT_IE_PLTYPE_UINT, cur->penalty,
+ AST_EVENT_IE_QUEUE_CALLS, AST_EVENT_IE_PLTYPE_UINT, cur->calls,
+ AST_EVENT_IE_QUEUE_LASTCALL, AST_EVENT_IE_PLTYPE_UINT, cur->lastcall,
+ AST_EVENT_IE_STATE, AST_EVENT_IE_PLTYPE_STR, devstate2str(cur->status),
+ AST_EVENT_IE_QUEUE_PAUSED, AST_EVENT_IE_PLTYPE_UINT, cur->paused,
AST_EVENT_IE_END);
ast_event_queue(event);
@@ -1738,13 +1737,13 @@
res = 0;
event = ast_event_new(AST_EVENT_QUEUE_JOIN,
- 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_SOURCE_CHANNEL, AST_EVENT_IE_PLTYPE_STR, qe->chan->name,
+ AST_EVENT_IE_CALLERIDNUM, AST_EVENT_IE_PLTYPE_STR, qe->chan->cid.cid_num,
+ AST_EVENT_IE_CALLERIDNAME, AST_EVENT_IE_PLTYPE_STR, qe->chan->cid.cid_name,
+ AST_EVENT_IE_QUEUE_NAME, AST_EVENT_IE_PLTYPE_STR, q->name,
+ AST_EVENT_IE_QUEUE_POSITION, AST_EVENT_IE_PLTYPE_UINT, qe->pos,
+ AST_EVENT_IE_QUEUE_COUNT, AST_EVENT_IE_PLTYPE_UINT, q->count,
+ AST_EVENT_IE_SOURCE_UNIQUEID, AST_EVENT_IE_PLTYPE_STR, qe->chan->uniqueid,
AST_EVENT_IE_END);
ast_event_queue(event);
@@ -1959,10 +1958,10 @@
q->count--;
event = ast_event_new(AST_EVENT_QUEUE_LEAVE,
- 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_SOURCE_CHANNEL, AST_EVENT_IE_PLTYPE_STR, qe->chan->name,
+ AST_EVENT_IE_QUEUE_NAME, AST_EVENT_IE_PLTYPE_STR, q->name,
+ AST_EVENT_IE_QUEUE_COUNT, AST_EVENT_IE_PLTYPE_UINT, q->count,
+ AST_EVENT_IE_SOURCE_UNIQUEID, AST_EVENT_IE_PLTYPE_STR, qe->chan->uniqueid,
AST_EVENT_IE_END);
ast_event_queue(event);
@@ -2066,9 +2065,9 @@
}
/*temporarily comment this out since we're not using it but may need it for later */
/*! \brief convert "\n" to "\nVariable: " ready for manager to use */
-static void vars2manager(struct ast_channel *chan struct ast_event *event)
-{
- struct ast_str *buf = ast_str_alloca(len + 1);
+static void vars2manager(struct ast_channel *chan, struct ast_event *event)
+{
+ struct ast_str *buf = ast_str_alloca(2048);
if (pbx_builtin_serialize_variables(chan, &buf)) {
char *var;
@@ -2204,17 +2203,17 @@
struct ast_event *event = NULL;
event = ast_event_new(AST_EVENT_QUEUE_MEMBER_CALLED,
- 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_QUEUE_NAME, AST_EVENT_IE_PLTYPE_STR, qe->parent->name,
+ AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, tmp->interface,
+ AST_EVENT_IE_QUEUE_MEMBERNAME, AST_EVENT_IE_PLTYPE_STR, tmp->member->membername,
+ AST_EVENT_IE_SOURCE_CHANNEL, AST_EVENT_IE_PLTYPE_STR, qe->chan->name,
+ AST_EVENT_IE_DESTINATION_CHANNEL, AST_EVENT_IE_PLTYPE_STR, tmp->chan->name,
+ AST_EVENT_IE_CALLERIDNUM, AST_EVENT_IE_PLTYPE_STR, S_OR(tmp->chan->cid.cid_num, "unknown"),
+ AST_EVENT_IE_CALLERIDNAME, AST_EVENT_IE_PLTYPE_STR, S_OR(tmp->chan->cid.cid_name, "unknown"),
+ AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, qe->chan->context,
+ AST_EVENT_IE_EXTENSION, AST_EVENT_IE_PLTYPE_STR, qe->chan->exten,
+ AST_EVENT_IE_PRIORITY, AST_EVENT_IE_PLTYPE_UINT, qe->chan->priority,
+ AST_EVENT_IE_SOURCE_UNIQUEID, AST_EVENT_IE_PLTYPE_STR, qe->chan->uniqueid,
AST_EVENT_IE_END);
if (qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES) {
@@ -2392,11 +2391,11 @@
set_queue_variables(qe);
event = ast_event_new(AST_EVENT_QUEUE_CALLER_ABANDON,
- AST_EVENT_IE_INFO_QUEUE_NAME, AST_EVENT_IE_PLTYPE_STR, qe->parent->name,
- AST_EVENT_IE_INFO_QUEUE_SOURCE_UNIQUEID, AST_EVENT_IE_PLTYPE_STR, qe->chan->uniqueid,
- AST_EVENT_IE_INFO_QUEUE_POSITION, AST_EVENT_IE_PLTYPE_UINT, qe->pos,
- AST_EVENT_IE_INFO_QUEUE_ORIGINAL_POSITION, AST_EVENT_IE_PLTYPE_UINT, qe->opos,
- AST_EVENT_IE_INFO_QUEUE_HOLDTIME, AST_EVENT_IE_PLTYPE_UINT, (time(NULL) - qe->start),
+ AST_EVENT_IE_QUEUE_NAME, AST_EVENT_IE_PLTYPE_STR, qe->parent->name,
+ AST_EVENT_IE_SOURCE_UNIQUEID, AST_EVENT_IE_PLTYPE_STR, qe->chan->uniqueid,
+ AST_EVENT_IE_QUEUE_POSITION, AST_EVENT_IE_PLTYPE_UINT, qe->pos,
+ AST_EVENT_IE_QUEUE_ORIGINAL_POSITION, AST_EVENT_IE_PLTYPE_UINT, qe->opos,
+ AST_EVENT_IE_QUEUE_HOLDTIME, AST_EVENT_IE_PLTYPE_UINT, (time(NULL) - qe->start),
AST_EVENT_IE_END);
ast_event_queue(event);
@@ -2995,14 +2994,14 @@
}
event = ast_event_new(AST_EVENT_QUEUE_MEMBER_COMPLETE,
- AST_EVENT_IE_INFO_QUEUE_NAME, AST_EVENT_IE_PLTYPE_STR, queuename,
- AST_EVENT_IE_INFO_QUEUE_SOURCE_UNIQUEID, AST_EVENT_IE_PLTYPE_STR, qe->chan->uniqueid,
- AST_EVENT_IE_INFO_QUEUE_DESTINATION_CHANNEL, AST_EVENT_IE_PLTYPE_STR, peer->name,
- AST_EVENT_IE_INFO_QUEUE_INTERFACE, AST_EVENT_IE_PLTYPE_STR, member->interface,
- AST_EVENT_IE_INFO_QUEUE_MEMBER_NAME, AST_EVENT_IE_PLTYPE_STR, member->membername,
- AST_EVENT_IE_INFO_QUEUE_HOLDTIME, AST_EVENT_IE_PLTYPE_UINT, callstart - qe->start,
- AST_EVENT_IE_INFO_QUEUE_TALKTIME, AST_EVENT_IE_PLTYPE_UINT, time(NULL) - callstart,
- AST_EVENT_IE_INFO_QUEUE_REASON, AST_EVENT_IE_PLTYPE_STR, reason,
+ AST_EVENT_IE_QUEUE_NAME, AST_EVENT_IE_PLTYPE_STR, queuename,
+ AST_EVENT_IE_SOURCE_UNIQUEID, AST_EVENT_IE_PLTYPE_STR, qe->chan->uniqueid,
+ AST_EVENT_IE_DESTINATION_CHANNEL, AST_EVENT_IE_PLTYPE_STR, peer->name,
+ AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, member->interface,
+ AST_EVENT_IE_QUEUE_MEMBERNAME, AST_EVENT_IE_PLTYPE_STR, member->membername,
+ AST_EVENT_IE_QUEUE_HOLDTIME, AST_EVENT_IE_PLTYPE_UINT, callstart - qe->start,
+ AST_EVENT_IE_QUEUE_TALKTIME, AST_EVENT_IE_PLTYPE_UINT, time(NULL) - callstart,
+ AST_EVENT_IE_QUEUE_REASON, AST_EVENT_IE_PLTYPE_STR, reason,
AST_EVENT_IE_END);
if (qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES) {
@@ -3341,11 +3340,11 @@
record_abandoned(qe);
if (qe->parent->eventwhencalled) {
event = ast_event_new(AST_EVENT_QUEUE_MEMBER_DUMP,
- AST_EVENT_IE_INFO_QUEUE_NAME, AST_EVENT_IE_PLTYPE_STR, queuename,
- AST_EVENT_IE_INFO_QUEUE_SOURCE_UNIQUEID, AST_EVENT_IE_PLTYPE_STR, qe->chan->uniqueid,
- AST_EVENT_IE_INFO_QUEUE_DESTINATION_CHANNEL, AST_EVENT_IE_PLTYPE_STR, peer->name,
- AST_EVENT_IE_INFO_QUEUE_INTERFACE, AST_EVENT_IE_PLTYPE_STR, member->interface,
- AST_EVENT_IE_INFO_QUEUE_MEMBER_NAME, AST_EVENT_IE_PLTYPE_STR, member->membername,
+ AST_EVENT_IE_QUEUE_NAME, AST_EVENT_IE_PLTYPE_STR, queuename,
+ AST_EVENT_IE_SOURCE_UNIQUEID, AST_EVENT_IE_PLTYPE_STR, qe->chan->uniqueid,
+ AST_EVENT_IE_DESTINATION_CHANNEL, AST_EVENT_IE_PLTYPE_STR, peer->name,
+ AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, member->interface,
+ AST_EVENT_IE_QUEUE_MEMBERNAME, AST_EVENT_IE_PLTYPE_STR, member->membername,
AST_EVENT_IE_END);
if (qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES) {
@@ -3629,14 +3628,14 @@
ast_copy_string(qe->chan->cdr->dstchannel, member->membername, sizeof(qe->chan->cdr->dstchannel));
if (qe->parent->eventwhencalled) {
event = ast_event_new(AST_EVENT_QUEUE_MEMBER_CONNECT,
- AST_EVENT_IE_INFO_QUEUE_NAME, AST_EVENT_IE_PLTYPE_STR, queuename,
- AST_EVENT_IE_INFO_QUEUE_SOURCE_UNIQUEID, AST_EVENT_IE_PLTYPE_STR, qe->chan->uniqueid,
- AST_EVENT_IE_INFO_QUEUE_DESTINATION_CHANNEL, AST_EVENT_IE_PLTYPE_STR, peer->name,
- AST_EVENT_IE_INFO_QUEUE_INTERFACE, AST_EVENT_IE_PLTYPE_STR, member->interface,
- AST_EVENT_IE_INFO_QUEUE_MEMBER_NAME, AST_EVENT_IE_PLTYPE_STR, member->membername,
- AST_EVENT_IE_INFO_QUEUE_HOLDTIME, AST_EVENT_IE_PLTYPE_UINT, time(NULL) - qe->start,
- AST_EVENT_IE_INFO_QUEUE_DESTINATION_UNIQUEID, AST_EVENT_IE_PLTYPE_STR, peer->uniqueid,
- AST_EVENT_IE_INFO_QUEUE_RINGTIME, AST_EVENT_IE_PLTYPE_UINT, orig - to > 0 ? (orig - to) / 1000 : 0,
+ AST_EVENT_IE_QUEUE_NAME, AST_EVENT_IE_PLTYPE_STR, queuename,
+ AST_EVENT_IE_SOURCE_UNIQUEID, AST_EVENT_IE_PLTYPE_STR, qe->chan->uniqueid,
+ AST_EVENT_IE_DESTINATION_CHANNEL, AST_EVENT_IE_PLTYPE_STR, peer->name,
+ AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, member->interface,
+ AST_EVENT_IE_QUEUE_MEMBERNAME, AST_EVENT_IE_PLTYPE_STR, member->membername,
+ AST_EVENT_IE_QUEUE_HOLDTIME, AST_EVENT_IE_PLTYPE_UINT, time(NULL) - qe->start,
+ AST_EVENT_IE_DESTINATION_UNIQUEID, AST_EVENT_IE_PLTYPE_STR, peer->uniqueid,
+ AST_EVENT_IE_QUEUE_RINGTIME, AST_EVENT_IE_PLTYPE_UINT, orig - to > 0 ? (orig - to) / 1000 : 0,
AST_EVENT_IE_END);
if (qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES) {
@@ -3780,9 +3779,9 @@
}
q->membercount--;
event = ast_event_new(AST_EVENT_QUEUE_MEMBER_REMOVED,
- AST_EVENT_IE_INFO_QUEUE_NAME, AST_EVENT_IE_PLTYPE_STR, q->name,
- AST_EVENT_IE_INFO_QUEUE_INTERFACE, AST_EVENT_IE_PLTYPE_STR, mem->interface,
- AST_EVENT_IE_INFO_QUEUE_MEMBER_NAME, AST_EVENT_IE_PLTYPE_STR, mem->membername,
+ AST_EVENT_IE_QUEUE_NAME, AST_EVENT_IE_PLTYPE_STR, q->name,
+ AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, mem->interface,
+ AST_EVENT_IE_QUEUE_MEMBERNAME, AST_EVENT_IE_PLTYPE_STR, mem->membername,
AST_EVENT_IE_END);
ast_event_queue(event);
@@ -3834,11 +3833,11 @@
q->membercount++;
/*I'm leaving out some of the original manager event stuff because it's just stupid.*/
event = ast_event_new(AST_EVENT_QUEUE_MEMBER_ADDED,
- AST_EVENT_IE_INFO_QUEUE_NAME, AST_EVENT_IE_PLTYPE_STR, q->name,
- AST_EVENT_IE_INFO_QUEUE_INTERFACE, AST_EVENT_IE_PLTYPE_STR, new_member->interface,
- AST_EVENT_IE_INFO_QUEUE_MEMBER_NAME, AST_EVENT_IE_PLTYPE_STR, new_member->membername,
- AST_EVENT_IE_INFO_QUEUE_MEMBERSHIP, AST_EVENT_IE_PLTYPE_STR, "dynamic",
- AST_EVENT_IE_INFO_QUEUE_PENALTY, AST_EVENT_IE_PLTYPE_UINT, new_member->penalty,
+ AST_EVENT_IE_QUEUE_NAME, AST_EVENT_IE_PLTYPE_STR, q->name,
+ AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, new_member->interface,
+ AST_EVENT_IE_QUEUE_MEMBERNAME, AST_EVENT_IE_PLTYPE_STR, new_member->membername,
+ AST_EVENT_IE_QUEUE_MEMBERSHIP, AST_EVENT_IE_PLTYPE_STR, "dynamic",
+ AST_EVENT_IE_QUEUE_PENALTY, AST_EVENT_IE_PLTYPE_UINT, new_member->penalty,
AST_EVENT_IE_END);
ast_event_queue(event);
@@ -3896,20 +3895,20 @@
if (!ast_strlen_zero(reason)) {
event = ast_event_new(AST_EVENT_QUEUE_MEMBER_PAUSED,
- AST_EVENT_IE_INFO_QUEUE_NAME, AST_EVENT_IE_PLTYPE_STR, q->name,
- AST_EVENT_IE_INFO_QUEUE_INTERFACE, AST_EVENT_IE_PLTYPE_STR, mem->interface,
- AST_EVENT_IE_INFO_QUEUE_MEMBER_NAME, AST_EVENT_IE_PLTYPE_STR, mem->membername,
- AST_EVENT_IE_INFO_QUEUE_PAUSED, AST_EVENT_IE_PLTYPE_UINT, paused,
- AST_EVENT_IE_INFO_QUEUE_REASON, AST_EVENT_IE_PLTYPE_STR, reason,
+ AST_EVENT_IE_QUEUE_NAME, AST_EVENT_IE_PLTYPE_STR, q->name,
+ AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, mem->interface,
+ AST_EVENT_IE_QUEUE_MEMBERNAME, AST_EVENT_IE_PLTYPE_STR, mem->membername,
+ AST_EVENT_IE_QUEUE_PAUSED, AST_EVENT_IE_PLTYPE_UINT, paused,
+ AST_EVENT_IE_QUEUE_REASON, AST_EVENT_IE_PLTYPE_STR, reason,
AST_EVENT_IE_END);
ast_event_queue(event);
} else {
event = ast_event_new(AST_EVENT_QUEUE_MEMBER_PAUSED,
- AST_EVENT_IE_INFO_QUEUE_NAME, AST_EVENT_IE_PLTYPE_STR, q->name,
- AST_EVENT_IE_INFO_QUEUE_INTERFACE, AST_EVENT_IE_PLTYPE_STR, mem->interface,
- AST_EVENT_IE_INFO_QUEUE_MEMBER_NAME, AST_EVENT_IE_PLTYPE_STR, mem->membername,
- AST_EVENT_IE_INFO_QUEUE_PAUSED, AST_EVENT_IE_PLTYPE_UINT, paused,
+ AST_EVENT_IE_QUEUE_NAME, AST_EVENT_IE_PLTYPE_STR, q->name,
+ AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, mem->interface,
+ AST_EVENT_IE_QUEUE_MEMBERNAME, AST_EVENT_IE_PLTYPE_STR, mem->membername,
+ AST_EVENT_IE_QUEUE_PAUSED, AST_EVENT_IE_PLTYPE_UINT, paused,
AST_EVENT_IE_END);
ast_event_queue(event);
@@ -3949,9 +3948,9 @@
ast_queue_log(q->name, "NONE", interface, "PENALTY", "%d", penalty);
event = ast_event_new(AST_EVENT_QUEUE_MEMBER_PENALTY,
- AST_EVENT_IE_INFO_QUEUE_NAME, AST_EVENT_IE_PLTYPE_STR, q->name,
- AST_EVENT_IE_INFO_QUEUE_INTERFACE, AST_EVENT_IE_PLTYPE_STR, mem->interface,
- AST_EVENT_IE_INFO_QUEUE_PENALTY, AST_EVENT_IE_PLTYPE_UINT, penalty,
+ AST_EVENT_IE_QUEUE_NAME, AST_EVENT_IE_PLTYPE_STR, q->name,
+ AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, mem->interface,
+ AST_EVENT_IE_QUEUE_PENALTY, AST_EVENT_IE_PLTYPE_UINT, penalty,
AST_EVENT_IE_END);
ast_event_queue(event);
Modified: team/group/manager2/include/asterisk/event.h
URL: http://svn.digium.com/view/asterisk/team/group/manager2/include/asterisk/event.h?view=diff&rev=110342&r1=110341&r2=110342
==============================================================================
--- team/group/manager2/include/asterisk/event.h (original)
+++ team/group/manager2/include/asterisk/event.h Thu Mar 20 17:11:48 2008
@@ -63,6 +63,25 @@
#include "asterisk/event_defs.h"
+/*!
+ * \brief accessor function to get an ast_event_ie_type's payload type
+ *
+ * \param ie the ast_event_ie_type to be looked up
+ *
+ * \return The ast_event_ie_pltype which corresponds to ie is returned
+ */
+enum ast_event_ie_pltype ast_event_ie_get_pltype(enum ast_event_ie_type ie);
+
+/*!
+ * \brief accessor function to get an ast_event_ie_type's name
+ *
+ * \param ie the ast_event_ie_type to be looked up
+ *
+ * \return The name which corresponds to ie is returned
+ */
+
+const char *ast_event_ie_get_name(enum ast_event_ie_type ie);
+
/*!
* \brief Subscriber event callback type
*
Modified: team/group/manager2/include/asterisk/event_defs.h
URL: http://svn.digium.com/view/asterisk/team/group/manager2/include/asterisk/event_defs.h?view=diff&rev=110342&r1=110341&r2=110342
==============================================================================
--- team/group/manager2/include/asterisk/event_defs.h (original)
+++ team/group/manager2/include/asterisk/event_defs.h Thu Mar 20 17:11:48 2008
@@ -123,6 +123,52 @@
* Payload type: str
*/
AST_EVENT_IE_CONTEXT = 0x09,
+ /*! Queue's name, string */
+ AST_EVENT_IE_QUEUE_NAME = 0x0A,
+ /*! Member name, string */
+ AST_EVENT_IE_QUEUE_MEMBERNAME = 0x0B,
+ /*! Member penalty, int */
+ AST_EVENT_IE_QUEUE_PENALTY = 0x0C,
+ /*! Number of calls taken, int */
+ AST_EVENT_IE_QUEUE_CALLS = 0x0D,
+ /*! Time of last call, int */
+ AST_EVENT_IE_QUEUE_LASTCALL = 0x0E,
+ /*! Paused status, int */
+ AST_EVENT_IE_QUEUE_PAUSED = 0x0F,
+ /*! Queue caller's channel name, string */
+ AST_EVENT_IE_SOURCE_CHANNEL = 0x10,
+ /*! Queue caller's callerid number, string */
+ AST_EVENT_IE_CALLERIDNUM = 0x11,
+ /*! Queue caller's callerid name, string */
+ AST_EVENT_IE_CALLERIDNAME = 0x12,
+ /*! Queue caller's position, int */
+ AST_EVENT_IE_QUEUE_POSITION = 0x13,
+ /*! Number of callers in queue, int */
+ AST_EVENT_IE_QUEUE_COUNT = 0x14,
+ /*! Uniqueid of queue caller's channel, string */
+ AST_EVENT_IE_SOURCE_UNIQUEID = 0x15,
+ /*! Membership of queue member, string */
+ AST_EVENT_IE_QUEUE_MEMBERSHIP = 0x16, /* static, dynamic, or realtime */
+ /*! Member channel name, string */
+ AST_EVENT_IE_DESTINATION_CHANNEL = 0x17,
+ /*! Queue extension, string */
+ AST_EVENT_IE_EXTENSION = 0x18,
+ /*! Queue dialplan priority, int */
+ AST_EVENT_IE_PRIORITY = 0x19,
+ /*! Original position of queue caller, int */
+ AST_EVENT_IE_QUEUE_ORIGINAL_POSITION = 0x1A,
+ /*! Queue's holdtime, int */
+ AST_EVENT_IE_QUEUE_HOLDTIME = 0x1B,
+ /*! Amount of time spent talking to queue member, int */
+ AST_EVENT_IE_QUEUE_TALKTIME = 0x1C,
+ /*! Reason the call ended, int */
+ AST_EVENT_IE_QUEUE_REASON = 0x1D,
+ /*! Amount of time queue call rang, int */
+ AST_EVENT_IE_QUEUE_RINGTIME = 0x1E,
+ /*! Member channel's uniqueid, string */
+ AST_EVENT_IE_DESTINATION_UNIQUEID = 0x1F,
+ /*! Channel variable */
+ AST_EVENT_IE_CHANVAR = 0x20,
};
/*!
* \brief Payload types for event information elements
@@ -136,6 +182,7 @@
AST_EVENT_IE_PLTYPE_STR,
};
+
/*!
* \brief Results for checking for subscribers
*
Modified: team/group/manager2/main/event.c
URL: http://svn.digium.com/view/asterisk/team/group/manager2/main/event.c?view=diff&rev=110342&r1=110341&r2=110342
==============================================================================
--- team/group/manager2/main/event.c (original)
+++ team/group/manager2/main/event.c Thu Mar 20 17:11:48 2008
@@ -118,6 +118,55 @@
* needs to know this state, it can get the last known state from the cache. */
static AST_RWLIST_HEAD(ast_event_ref_list, ast_event_ref) ast_event_cache[AST_EVENT_TOTAL];
+struct ast_event_ie_map {
+ enum ast_event_ie_pltype pltype;
+ const char * name; /*!< The name is used for debugging and manager purposes currently */
+} info_map[] = { /*NOTE: it is INSANELY IMPORTANT that these are in the same order as the above enum. My GOD I CANNOT STRESS THIS ENOUGH!!! */
+ {AST_EVENT_IE_PLTYPE_STR, "RUBBERDUCK"}, /*!< Placeholder for nonexistent IE 0 */
+ {AST_EVENT_IE_PLTYPE_UINT, "NewMessages"}, /*!< AST_EVENT_IE_NEWMSGS 1 */
+ {AST_EVENT_IE_PLTYPE_UINT, "OldMessages"}, /*!< AST_EVENT_IE_OLDMSGS 2 */
+ {AST_EVENT_IE_PLTYPE_STR, "Mailbox"}, /*!< AST_EVENT_IE_MAILBOX 3 */
+ {AST_EVENT_IE_PLTYPE_UINT, "EventUniqueID"}, /*!< AST_EVENT_IE_UNIQUEIED 4 */
+ {AST_EVENT_IE_PLTYPE_UINT, "EventType"}, /*!< AST_EVENT_IE_EVENTTYPE 5 */
+ {AST_EVENT_IE_PLTYPE_UINT, "Exists"}, /*!< AST_EVENT_IE_EXISTS 6 */
+ {AST_EVENT_IE_PLTYPE_STR, "Device"}, /*!< AST_EVENT_IE_DEVICE 7 */
+ {AST_EVENT_IE_PLTYPE_UINT, "State"}, /*!< AST_EVENT_IE_STATE 8 */
+ {AST_EVENT_IE_PLTYPE_STR, "Context"}, /*!< AST_EVENT_IE_CONTEXT 9 */
+ {AST_EVENT_IE_PLTYPE_STR, "QueueName"}, /*!< AST_EVENT_IE_QUEUE_NAME 10 */
+ {AST_EVENT_IE_PLTYPE_STR, "MemberName"}, /*!< AST_EVENT_IE_QUEUE_MEMBERNAME 11 */
+ {AST_EVENT_IE_PLTYPE_UINT, "Penalty"}, /*!< AST_EVENT_IE_QUEUE_PENALTY 12 */
+ {AST_EVENT_IE_PLTYPE_UINT, "Calls"}, /*!< AST_EVENT_IE_QUEUE_CALLS 13 */
+ {AST_EVENT_IE_PLTYPE_UINT, "LastCall"}, /*!< AST_EVENT_IE_QUEUE_LASTCALL 14 */
+ {AST_EVENT_IE_PLTYPE_UINT, "Paused"}, /*!< AST_EVENT_IE_QUEUE_PAUSED 15 */
+ {AST_EVENT_IE_PLTYPE_STR, "SourceChannel"}, /*!< AST_EVENT_IE SOURCE_CHANNEL 16 */
+ {AST_EVENT_IE_PLTYPE_STR, "CallerIDNumber"}, /*!< AST_EVENT_IE_CALLERIDNUMBER 17 */
+ {AST_EVENT_IE_PLTYPE_STR, "CallerIDName"}, /*!< AST_EVENT_IE_CALLERIDNAME 18 */
+ {AST_EVENT_IE_PLTYPE_UINT, "Position"}, /*!< AST_EVENT_IE_QUEUE_POSITION 19 */
+ {AST_EVENT_IE_PLTYPE_UINT, "Count"}, /*!< AST_EVENT_IE_QUEUE_COUNT 20 */
+ {AST_EVENT_IE_PLTYPE_STR, "SourceUniqueID"}, /*!< AST_EVENT_IE_SOURCE_UNIQUEID 21 */
+ {AST_EVENT_IE_PLTYPE_STR, "Membership"}, /*!< AST_EVENT_IE_QUEUE_MEMBERSHIP 22 */
+ {AST_EVENT_IE_PLTYPE_STR, "DestinationChannel"}, /*!< AST_EVENT_IE_DESTINATION_CHANNEL 23 */
+ {AST_EVENT_IE_PLTYPE_STR, "Extension"}, /*!< AST_EVENT_IE_EXTENSION 24 */
+ {AST_EVENT_IE_PLTYPE_UINT, "Priority"}, /*!< AST_EVENT_IE_PRIORITY 25 */
+ {AST_EVENT_IE_PLTYPE_UINT, "OriginalPosition"}, /*!< AST_EVENT_IE_QUEUE_ORIGINAL_POSITION 26 */
+ {AST_EVENT_IE_PLTYPE_UINT, "HoldTime"}, /*!< AST_EVENT_IE_QUEUE_HOLDTIME 27 */
+ {AST_EVENT_IE_PLTYPE_UINT, "TalkTime"}, /*!< AST_EVENT_IE_QUEUE_TALKTIME 28 */
+ {AST_EVENT_IE_PLTYPE_STR, "Reason"}, /*!< AST_EVENT_IE_QUEUE_REASON 29 */
+ {AST_EVENT_IE_PLTYPE_UINT, "RingTime"}, /*!< AST_EVENT_IE_QUEUE_RINGTIME 30 */
+ {AST_EVENT_IE_PLTYPE_STR, "DestinationUniqueID"}, /*!< AST_EVENT_IE_DESTINATION_UNIQUEID 31 */
+ {AST_EVENT_IE_PLTYPE_STR, "Variable"}, /*!< AST_EVENT_IE_CHANVAR 32 */
+};
+
+enum ast_event_ie_pltype ast_event_ie_get_pltype(enum ast_event_ie_type ie)
+{
+ return info_map[ie].pltype;
+}
+
+const char * ast_event_ie_get_name(enum ast_event_ie_type ie)
+{
+ return info_map[ie].name;
+}
+
static void ast_event_ie_val_destroy(struct ast_event_ie_val *ie_val)
{
if (ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_STR)
Modified: team/group/manager2/res/res_manager2.c
URL: http://svn.digium.com/view/asterisk/team/group/manager2/res/res_manager2.c?view=diff&rev=110342&r1=110341&r2=110342
==============================================================================
--- team/group/manager2/res/res_manager2.c (original)
+++ team/group/manager2/res/res_manager2.c Thu Mar 20 17:11:48 2008
@@ -1,7 +1,6 @@
#include "asterisk.h"
#include "asterisk/module.h"
#include "asterisk/event.h"
-#include "asterisk/manager2.h"
#include "asterisk/utils.h"
#include "asterisk/linkedlists.h"
@@ -95,16 +94,14 @@
if (!event)
continue;
- ast_log(LOG_DEBUG, "NEW EVENT: %s\n", queue_map[ast_event_get_type(event->event) - QUEUE_EVENT_BEGIN].name);
-
for (ast_event_iterator_init(&iter, event->event); !res; res = ast_event_iterator_next(&iter)) {
enum ast_event_ie_type ie_type = ast_event_iterator_get_ie_type(&iter);
if (ie_type == AST_EVENT_IE_END)
break;
- if (info_map[ie_type].pltype == AST_EVENT_IE_PLTYPE_STR)
- ast_log(LOG_DEBUG, "%s: %s\r\n", info_map[ie_type].name, ast_event_iterator_get_ie_str(&iter));
- else if (info_map[ie_type].pltype == AST_EVENT_IE_PLTYPE_UINT)
- ast_log(LOG_DEBUG, "%s: %u\r\n", info_map[ie_type].name, ast_event_iterator_get_ie_uint(&iter));
+ if (ast_event_ie_get_pltype(ie_type) == AST_EVENT_IE_PLTYPE_STR)
+ ast_log(LOG_DEBUG, "%s: %s\r\n", ast_event_ie_get_name(ie_type), ast_event_iterator_get_ie_str(&iter));
+ else if (ast_event_ie_get_pltype(ie_type) == AST_EVENT_IE_PLTYPE_UINT)
+ ast_log(LOG_DEBUG, "%s: %u\r\n", ast_event_ie_get_name(ie_type), ast_event_iterator_get_ie_uint(&iter));
}
ast_event_destroy(event->event);
ast_free(event);
More information about the asterisk-commits
mailing list