[svn-commits] qwell: branch qwell/queue_events r390335 - /team/qwell/queue_events/apps/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Fri May 31 14:53:55 CDT 2013
Author: qwell
Date: Fri May 31 14:53:52 2013
New Revision: 390335
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=390335
Log:
Genericize callbacks.
Modified:
team/qwell/queue_events/apps/app_queue.c
Modified: team/qwell/queue_events/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/queue_events/apps/app_queue.c?view=diff&rev=390335&r1=390334&r2=390335
==============================================================================
--- team/qwell/queue_events/apps/app_queue.c (original)
+++ team/qwell/queue_events/apps/app_queue.c Fri May 31 14:53:52 2013
@@ -1852,8 +1852,11 @@
STASIS_MESSAGE_TYPE_DEFN(queue_agent_dump_type);
STASIS_MESSAGE_TYPE_DEFN(queue_agent_ringnoanswer_type);
-static void queue_channel_manager_event(const char *type, struct stasis_message *message)
-{
+static void queue_channel_manager_event(void *data,
+ struct stasis_subscription *sub, struct stasis_topic *topic,
+ struct stasis_message *message)
+{
+ const char *type = data;
struct ast_channel_blob *obj = stasis_message_data(message);
RAII_VAR(struct ast_str *, channel_event_string, NULL, ast_free);
RAII_VAR(struct ast_str *, event_string, NULL, ast_free);
@@ -1875,8 +1878,11 @@
ast_str_buffer(event_string));
}
-static void queue_multi_channel_manager_event(const char *type, struct stasis_message *message)
-{
+static void queue_multi_channel_manager_event(void *data,
+ struct stasis_subscription *sub, struct stasis_topic *topic,
+ struct stasis_message *message)
+{
+ const char *type = data;
struct ast_multi_channel_blob *obj = stasis_message_data(message);
struct ast_channel_snapshot *caller;
struct ast_channel_snapshot *agent;
@@ -1908,8 +1914,11 @@
ast_str_buffer(event_string));
}
-static void queue_member_manager_event(const char *type, struct stasis_message *message)
-{
+static void queue_member_manager_event(void *data,
+ struct stasis_subscription *sub, struct stasis_topic *topic,
+ struct stasis_message *message)
+{
+ const char *type = data;
struct ast_json_payload *payload = stasis_message_data(message);
struct ast_json *event = payload->json;
RAII_VAR(struct ast_str *, event_string, NULL, ast_free);
@@ -1998,104 +2007,6 @@
"Status", mem->status,
"Paused", mem->paused,
"Ringinuse", mem->ringinuse);
-}
-
-static void queue_caller_join_cb(void *data,
- struct stasis_subscription *sub, struct stasis_topic *topic,
- struct stasis_message *message)
-{
- queue_channel_manager_event("QueueCallerJoin", message);
-}
-
-static void queue_caller_leave_cb(void *data,
- struct stasis_subscription *sub, struct stasis_topic *topic,
- struct stasis_message *message)
-{
- queue_channel_manager_event("QueueCallerLeave", message);
-}
-
-static void queue_caller_abandon_cb(void *data,
- struct stasis_subscription *sub, struct stasis_topic *topic,
- struct stasis_message *message)
-{
- queue_channel_manager_event("QueueCallerAbandon", message);
-}
-
-static void queue_member_status_cb(void *data,
- struct stasis_subscription *sub, struct stasis_topic *topic,
- struct stasis_message *message)
-{
- queue_member_manager_event("QueueMemberStatus", message);
-}
-
-static void queue_member_added_cb(void *data,
- struct stasis_subscription *sub, struct stasis_topic *topic,
- struct stasis_message *message)
-{
- queue_member_manager_event("QueueMemberAdded", message);
-}
-
-static void queue_member_removed_cb(void *data,
- struct stasis_subscription *sub, struct stasis_topic *topic,
- struct stasis_message *message)
-{
- queue_member_manager_event("QueueMemberRemoved", message);
-}
-
-static void queue_member_pause_cb(void *data,
- struct stasis_subscription *sub, struct stasis_topic *topic,
- struct stasis_message *message)
-{
- queue_member_manager_event("QueueMemberPause", message);
-}
-
-static void queue_member_penalty_cb(void *data,
- struct stasis_subscription *sub, struct stasis_topic *topic,
- struct stasis_message *message)
-{
- queue_member_manager_event("QueueMemberPenalty", message);
-}
-
-static void queue_member_ringinuse_cb(void *data,
- struct stasis_subscription *sub, struct stasis_topic *topic,
- struct stasis_message *message)
-{
- queue_member_manager_event("QueueMemberRinginuse", message);
-}
-
-static void queue_agent_called_cb(void *data,
- struct stasis_subscription *sub, struct stasis_topic *topic,
- struct stasis_message *message)
-{
- queue_multi_channel_manager_event("AgentCalled", message);
-}
-
-static void queue_agent_connect_cb(void *data,
- struct stasis_subscription *sub, struct stasis_topic *topic,
- struct stasis_message *message)
-{
- queue_multi_channel_manager_event("AgentConnect", message);
-}
-
-static void queue_agent_complete_cb(void *data,
- struct stasis_subscription *sub, struct stasis_topic *topic,
- struct stasis_message *message)
-{
- queue_multi_channel_manager_event("AgentComplete", message);
-}
-
-static void queue_agent_dump_cb(void *data,
- struct stasis_subscription *sub, struct stasis_topic *topic,
- struct stasis_message *message)
-{
- queue_multi_channel_manager_event("AgentDump", message);
-}
-
-static void queue_agent_ringnoanswer_cb(void *data,
- struct stasis_subscription *sub, struct stasis_topic *topic,
- struct stasis_message *message)
-{
- queue_multi_channel_manager_event("AgentRingNoAnswer", message);
}
/*! \brief Check if members are available
@@ -10201,73 +10112,73 @@
stasis_message_router_add(message_router,
queue_caller_join_type(),
- queue_caller_join_cb,
- NULL);
+ queue_channel_manager_event,
+ "QueueCallerJoin");
stasis_message_router_add(message_router,
queue_caller_leave_type(),
- queue_caller_leave_cb,
- NULL);
+ queue_channel_manager_event,
+ "QueueCallerLeave");
stasis_message_router_add(message_router,
queue_caller_abandon_type(),
- queue_caller_abandon_cb,
- NULL);
+ queue_channel_manager_event,
+ "QueueCallerAbandon");
stasis_message_router_add(message_router,
queue_member_status_type(),
- queue_member_status_cb,
- NULL);
+ queue_member_manager_event,
+ "QueueMemberStatus");
stasis_message_router_add(message_router,
queue_member_added_type(),
- queue_member_added_cb,
- NULL);
+ queue_member_manager_event,
+ "QueueMemberAdded");
stasis_message_router_add(message_router,
queue_member_removed_type(),
- queue_member_removed_cb,
- NULL);
+ queue_member_manager_event,
+ "QueueMemberRemoved");
stasis_message_router_add(message_router,
queue_member_pause_type(),
- queue_member_pause_cb,
- NULL);
+ queue_member_manager_event,
+ "QueueMemberPause");
stasis_message_router_add(message_router,
queue_member_penalty_type(),
- queue_member_penalty_cb,
- NULL);
+ queue_member_manager_event,
+ "QueueMemberPenalty");
stasis_message_router_add(message_router,
queue_member_ringinuse_type(),
- queue_member_ringinuse_cb,
- NULL);
+ queue_member_manager_event,
+ "QueueMemberRinginuse");
stasis_message_router_add(message_router,
queue_agent_called_type(),
- queue_agent_called_cb,
- NULL);
+ queue_multi_channel_manager_event,
+ "AgentCalled");
stasis_message_router_add(message_router,
queue_agent_connect_type(),
- queue_agent_connect_cb,
- NULL);
+ queue_multi_channel_manager_event,
+ "AgentConnect");
stasis_message_router_add(message_router,
queue_agent_complete_type(),
- queue_agent_complete_cb,
- NULL);
+ queue_multi_channel_manager_event,
+ "AgentComplete");
stasis_message_router_add(message_router,
queue_agent_dump_type(),
- queue_agent_dump_cb,
- NULL);
+ queue_multi_channel_manager_event,
+ "AgentDump");
stasis_message_router_add(message_router,
queue_agent_ringnoanswer_type(),
- queue_agent_ringnoanswer_cb,
- NULL);
+ queue_multi_channel_manager_event,
+ "AgentRingNoAnswer");
ast_extension_state_add(NULL, NULL, extension_state_cb, NULL);
More information about the svn-commits
mailing list