[asterisk-commits] qwell: branch qwell/queue_events r390334 - /team/qwell/queue_events/apps/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri May 31 14:45:09 CDT 2013


Author: qwell
Date: Fri May 31 14:45:07 2013
New Revision: 390334

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=390334
Log:
Move Agent* AMI events to stasis.

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=390334&r1=390333&r2=390334
==============================================================================
--- team/qwell/queue_events/apps/app_queue.c (original)
+++ team/qwell/queue_events/apps/app_queue.c Fri May 31 14:45:07 2013
@@ -1829,6 +1829,12 @@
 struct stasis_message_type *queue_member_penalty_type(void);
 struct stasis_message_type *queue_member_ringinuse_type(void);
 
+struct stasis_message_type *queue_agent_called_type(void);
+struct stasis_message_type *queue_agent_connect_type(void);
+struct stasis_message_type *queue_agent_complete_type(void);
+struct stasis_message_type *queue_agent_dump_type(void);
+struct stasis_message_type *queue_agent_ringnoanswer_type(void);
+
 STASIS_MESSAGE_TYPE_DEFN(queue_caller_join_type);
 STASIS_MESSAGE_TYPE_DEFN(queue_caller_leave_type);
 STASIS_MESSAGE_TYPE_DEFN(queue_caller_abandon_type);
@@ -1840,94 +1846,66 @@
 STASIS_MESSAGE_TYPE_DEFN(queue_member_penalty_type);
 STASIS_MESSAGE_TYPE_DEFN(queue_member_ringinuse_type);
 
-static void queue_caller_join_cb(void *data,
-	struct stasis_subscription *sub, struct stasis_topic *topic,
-	struct stasis_message *message)
+STASIS_MESSAGE_TYPE_DEFN(queue_agent_called_type);
+STASIS_MESSAGE_TYPE_DEFN(queue_agent_connect_type);
+STASIS_MESSAGE_TYPE_DEFN(queue_agent_complete_type);
+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)
 {
 	struct ast_channel_blob *obj = stasis_message_data(message);
 	RAII_VAR(struct ast_str *, channel_event_string, NULL, ast_free);
-	const char *queue = ast_json_string_get(ast_json_object_get(obj->blob, "queue"));
-	int position = ast_json_integer_get(ast_json_object_get(obj->blob, "position"));
-	int count = ast_json_integer_get(ast_json_object_get(obj->blob, "count"));
+	RAII_VAR(struct ast_str *, event_string, NULL, ast_free);
 
 	channel_event_string = ast_manager_build_channel_state_string(obj->snapshot);
-
 	if (!channel_event_string) {
 		return;
 	}
 
-	manager_event(EVENT_FLAG_AGENT, "QueueCallerJoin",
+	event_string = ast_manager_str_from_json_object(obj->blob, NULL);
+	if (!event_string) {
+		return;
+	}
+
+	manager_event(EVENT_FLAG_AGENT, type,
 		"%s"
-		"Queue: %s\r\n"
-		"Position: %d\r\n"
-		"Count: %d\r\n",
+		"%s",
 		ast_str_buffer(channel_event_string),
-		queue, position, count);
-}
-
-static void queue_caller_leave_cb(void *data,
-	struct stasis_subscription *sub, struct stasis_topic *topic,
-	struct stasis_message *message)
-{
-	struct ast_channel_blob *obj = stasis_message_data(message);
-	RAII_VAR(struct ast_str *, channel_event_string, NULL, ast_free);
-	const char *queue = ast_json_string_get(ast_json_object_get(obj->blob, "queue"));
-	int position = ast_json_integer_get(ast_json_object_get(obj->blob, "position"));
-	int count = ast_json_integer_get(ast_json_object_get(obj->blob, "count"));
-
-	channel_event_string = ast_manager_build_channel_state_string(obj->snapshot);
-
-	if (!channel_event_string) {
+		ast_str_buffer(event_string));
+}
+
+static void queue_multi_channel_manager_event(const char *type, struct stasis_message *message)
+{
+	struct ast_multi_channel_blob *obj = stasis_message_data(message);
+	struct ast_channel_snapshot *caller;
+	struct ast_channel_snapshot *agent;
+	RAII_VAR(struct ast_str *, caller_event_string, NULL, ast_free);
+	RAII_VAR(struct ast_str *, agent_event_string, NULL, ast_free);
+	RAII_VAR(struct ast_str *, event_string, NULL, ast_free);
+
+	caller = ast_multi_channel_blob_get_channel(obj, "caller");
+	agent = ast_multi_channel_blob_get_channel(obj, "agent");
+
+	caller_event_string = ast_manager_build_channel_state_string(caller);
+	agent_event_string = ast_manager_build_channel_state_string_prefix(agent, "Dest");
+
+	if (!caller_event_string || !agent_event_string) {
 		return;
 	}
 
-	manager_event(EVENT_FLAG_AGENT, "QueueCallerLeave",
+	event_string = ast_manager_str_from_json_object(ast_multi_channel_blob_get_json(obj), NULL);
+	if (!event_string) {
+		return;
+	}
+
+	manager_event(EVENT_FLAG_AGENT, type,
 		"%s"
-		"Queue: %s\r\n"
-		"Position: %d\r\n"
-		"Count: %d\r\n",
-		ast_str_buffer(channel_event_string),
-		queue, position, count);
-}
-
-static void queue_caller_abandon_cb(void *data,
-	struct stasis_subscription *sub, struct stasis_topic *topic,
-	struct stasis_message *message)
-{
-	struct ast_channel_blob *obj = stasis_message_data(message);
-	RAII_VAR(struct ast_str *, channel_event_string, NULL, ast_free);
-	const char *queue = ast_json_string_get(ast_json_object_get(obj->blob, "queue"));
-	int position = ast_json_integer_get(ast_json_object_get(obj->blob, "position"));
-	int original_position = ast_json_integer_get(ast_json_object_get(obj->blob, "originalposition"));
-	int hold_time = ast_json_integer_get(ast_json_object_get(obj->blob, "holdtime"));
-
-	channel_event_string = ast_manager_build_channel_state_string(obj->snapshot);
-
-	if (!channel_event_string) {
-		return;
-	}
-
-	manager_event(EVENT_FLAG_AGENT, "QueueCallerAbandon",
 		"%s"
-		"Queue: %s\r\n"
-		"Position: %d\r\n"
-		"OriginalPosition: %d\r\n"
-		"HoldTime: %d\r\n",
-		ast_str_buffer(channel_event_string),
-		queue, position, original_position, hold_time);
-}
-
-static void queue_publish_channel_blob(struct ast_channel *chan, struct stasis_message_type *type, struct ast_json *blob)
-{
-	RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
-
-	msg = ast_channel_blob_create(chan, type, blob);
-
-	if (!msg) {
-		return;
-	}
-
-	stasis_publish(ast_channel_topic(chan), msg);
+		"%s",
+		ast_str_buffer(caller_event_string),
+		ast_str_buffer(agent_event_string),
+		ast_str_buffer(event_string));
 }
 
 static void queue_member_manager_event(const char *type, struct stasis_message *message)
@@ -1945,46 +1923,47 @@
 		"%s", ast_str_buffer(event_string));
 }
 
-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_publish_channel_blob(struct ast_channel *chan, struct stasis_message_type *type, struct ast_json *blob)
+{
+	RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
+
+	msg = ast_channel_blob_create(chan, type, blob);
+
+	if (!msg) {
+		return;
+	}
+
+	stasis_publish(ast_channel_topic(chan), msg);
+}
+
+static void queue_publish_multi_channel_blob(struct ast_channel *caller, struct ast_channel *agent, struct stasis_message_type *type, struct ast_json *blob)
+{
+	RAII_VAR(struct ast_multi_channel_blob *, payload, NULL, ao2_cleanup);
+	RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
+	struct ast_channel_snapshot *caller_snapshot;
+	struct ast_channel_snapshot *agent_snapshot;
+
+	payload = ast_multi_channel_blob_create(blob);
+	if (!payload) {
+		return;
+	}
+
+	caller_snapshot = ast_channel_snapshot_create(caller);
+	agent_snapshot = ast_channel_snapshot_create(agent);
+
+	if (!caller_snapshot || !agent_snapshot) {
+		return;
+	}
+
+	ast_multi_channel_blob_add_channel(payload, "caller", caller_snapshot);
+	ast_multi_channel_blob_add_channel(payload, "agent", agent_snapshot);
+
+	msg = stasis_message_create(type, payload);
+	if (!msg) {
+		return;
+	}
+
+	stasis_publish(ast_channel_topic(caller), msg);
 }
 
 static void queue_publish_member_blob(struct stasis_message_type *type, struct ast_json *blob)
@@ -2007,7 +1986,7 @@
 
 static struct ast_json *queue_member_blob_create(struct call_queue *q, struct member *mem)
 {
-	return ast_json_pack("{s: s, s: s, s: s, s: s, s: s, s: i, s: i, s: i, s: i, s: i, s: b}",
+	return ast_json_pack("{s: s, s: s, s: s, s: s, s: s, s: i, s: i, s: i, s: i, s: i, s: i}",
 		"Queue", q->name,
 		"MemberName", mem->membername,
 		"Interface", mem->interface,
@@ -2019,6 +1998,104 @@
 		"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
@@ -3357,9 +3434,9 @@
 		res = 0;
 
 		blob = ast_json_pack("{s: s, s: i, s: i}",
-				     "queue", q->name,
-				     "position", qe->pos,
-				     "count", q->count);
+				     "Queue", q->name,
+				     "Position", qe->pos,
+				     "Count", q->count);
 		queue_publish_channel_blob(qe->chan, queue_caller_join_type(), blob);
 		ast_debug(1, "Queue '%s' Join, Channel '%s', Position '%d'\n", q->name, ast_channel_name(qe->chan), qe->pos );
 	}
@@ -3636,9 +3713,9 @@
 			}
 
 			blob = ast_json_pack("{s: s, s: i, s: i}",
-					     "queue", q->name,
-					     "position", qe->pos,
-					     "count", q->count);
+					     "Queue", q->name,
+					     "Position", qe->pos,
+					     "Count", q->count);
 			queue_publish_channel_blob(qe->chan, queue_caller_leave_type(), blob);
 			ast_debug(1, "Queue '%s' Leave, Channel '%s'\n", q->name, ast_channel_name(qe->chan));
 			/* Take us out of the queue */
@@ -3940,6 +4017,7 @@
 	char tech[256];
 	char *location;
 	const char *macrocontext, *macroexten;
+	RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
 
 	/* on entry here, we know that tmp->chan == NULL */
 	if (!can_ring_entry(qe, tmp)) {
@@ -4053,12 +4131,11 @@
 
 	ast_channel_lock_both(tmp->chan, qe->chan);
 
-	manager_event(EVENT_FLAG_AGENT, "AgentCalled",
-		"Queue: %s\r\n"
-		"AgentCalled: %s\r\n"
-		"AgentName: %s\r\n"
-		"DestinationChannel: %s\r\n",
-		qe->parent->name, tmp->interface, tmp->member->membername, ast_channel_name(tmp->chan));
+	blob = ast_json_pack("{s: s, s: s, s: s}",
+			     "Queue", qe->parent->name,
+			     "Interface", tmp->interface,
+			     "MemberName", tmp->member->membername);
+	queue_publish_multi_channel_blob(qe->chan, tmp->chan, queue_agent_called_type(), blob);
 
 	ast_channel_publish_dial(qe->chan, tmp->chan, tmp->interface, NULL);
 
@@ -4250,10 +4327,10 @@
 	set_queue_variables(qe->parent, qe->chan);
 	ao2_lock(qe->parent);
 	blob = ast_json_pack("{s: s, s: i, s: i}",
-			     "queue", qe->parent->name,
-			     "position", qe->pos,
-			     "originalposition", qe->opos,
-			     "holdtime", (int)(time(NULL) - qe->start));
+			     "Queue", qe->parent->name,
+			     "Position", qe->pos,
+			     "OriginalPosition", qe->opos,
+			     "HoldTime", (int)(time(NULL) - qe->start));
 	queue_publish_channel_blob(qe->chan, queue_caller_abandon_type(), blob);
 
 	qe->parent->callsabandoned++;
@@ -4261,8 +4338,10 @@
 }
 
 /*! \brief RNA == Ring No Answer. Common code that is executed when we try a queue member and they don't answer. */
-static void rna(int rnatime, struct queue_ent *qe, char *interface, char *membername, int autopause)
-{
+static void rna(int rnatime, struct queue_ent *qe, struct ast_channel *peer, char *interface, char *membername, int autopause)
+{
+	RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
+
 	ast_verb(3, "Nobody picked up in %d ms\n", rnatime);
 
 	/* Stop ringing, and resume MOH if specified */
@@ -4271,15 +4350,12 @@
 		ast_moh_start(qe->chan, qe->moh, NULL);
 	}
 
-	manager_event(EVENT_FLAG_AGENT, "AgentRingNoAnswer",
-					"Queue: %s\r\n"
-					"Member: %s\r\n"
-					"MemberName: %s\r\n"
-					"RingTime: %d\r\n",
-					qe->parent->name,
-					interface,
-					membername,
-					rnatime);
+	blob = ast_json_pack("{s: s, s: s, s: s, s: i}",
+			     "Queue", qe->parent->name,
+			     "Interface", interface,
+			     "MemberName", membername,
+			     "RingTime", rnatime);
+	queue_publish_multi_channel_blob(qe->chan, peer, queue_agent_ringnoanswer_type(), blob);
 
 	ast_queue_log(qe->parent->name, ast_channel_uniqueid(qe->chan), membername, "RINGNOANSWER", "%d", rnatime);
 	if (qe->parent->autopause != QUEUE_AUTOPAUSE_OFF && autopause) {
@@ -4653,7 +4729,7 @@
 							do_hang(o);
 							endtime = (long) time(NULL);
 							endtime -= starttime;
-							rna(endtime * 1000, qe, on, membername, qe->parent->autopausebusy);
+							rna(endtime * 1000, qe, o->chan, on, membername, qe->parent->autopausebusy);
 							if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
 								if (qe->parent->timeoutrestart) {
 									start_time_tv = ast_tvnow();
@@ -4674,7 +4750,7 @@
 							ast_channel_publish_dial(qe->chan, o->chan, on, "CONGESTION");
 							endtime = (long) time(NULL);
 							endtime -= starttime;
-							rna(endtime * 1000, qe, on, membername, qe->parent->autopauseunavail);
+							rna(endtime * 1000, qe, o->chan, on, membername, qe->parent->autopauseunavail);
 							do_hang(o);
 							if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
 								if (qe->parent->timeoutrestart) {
@@ -4770,7 +4846,7 @@
 				} else { /* ast_read() returned NULL */
 					endtime = (long) time(NULL) - starttime;
 					ast_channel_publish_dial(qe->chan, o->chan, on, "NOANSWER");
-					rna(endtime * 1000, qe, on, membername, 1);
+					rna(endtime * 1000, qe, o->chan, on, membername, 1);
 					do_hang(o);
 					if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
 						if (qe->parent->timeoutrestart) {
@@ -4872,7 +4948,7 @@
  
 	if (!*to) {
 		for (o = start; o; o = o->call_next) {
-			rna(orig, qe, o->interface, o->member->membername, 1);
+			rna(orig, qe, o->chan, o->interface, o->member->membername, 1);
 		}
 
 		publish_dial_end_event(qe->chan, outgoing, NULL, "NOANSWER");
@@ -5200,6 +5276,7 @@
 	char *vars, size_t vars_len, enum agent_complete_reason rsn)
 {
 	const char *reason = NULL;	/* silence dumb compilers */
+	RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
 
 	switch (rsn) {
 	case CALLER:
@@ -5213,16 +5290,14 @@
 		break;
 	}
 
-	manager_event(EVENT_FLAG_AGENT, "AgentComplete",
-		"Queue: %s\r\n"
-		"Channel: %s\r\n"
-		"Member: %s\r\n"
-		"MemberName: %s\r\n"
-		"HoldTime: %ld\r\n"
-		"TalkTime: %ld\r\n"
-		"Reason: %s\r\n",
-		queuename, ast_channel_name(peer), member->interface, member->membername,
-		(long)(callstart - qe->start), (long)(time(NULL) - callstart), reason);
+	blob = ast_json_pack("{s: s, s: s, s: s, s: i, s: i, s: s}",
+			     "Queue", queuename,
+			     "Interface", member->interface,
+			     "MemberName", member->membername,
+			     "HoldTime", (long)(callstart - qe->start)
+			     "TalkTime", (long)(time(NULL) - callstart)
+			     "Reason", reason);
+	queue_publish_multi_channel_blob(qe->chan, peer, queue_agent_complete_type(), blob);
 }
 #endif	// BUGBUG
 
@@ -5731,6 +5806,7 @@
 			}
 		}
 	} else { /* peer is valid */
+		RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
 		/* Ah ha!  Someone answered within the desired timeframe.  Of course after this
 		   we will always return with -1 so that it is hung up properly after the
 		   conversation.  */
@@ -5795,12 +5871,11 @@
 				ast_log(LOG_WARNING, "Agent on %s hungup on the customer.\n", ast_channel_name(peer));
 				ast_queue_log(queuename, ast_channel_uniqueid(qe->chan), member->membername, "AGENTDUMP", "%s", "");
 
-				manager_event(EVENT_FLAG_AGENT, "AgentDump",
-						"Queue: %s\r\n"
-						"Channel: %s\r\n"
-						"Member: %s\r\n"
-						"MemberName: %s\r\n",
-						queuename, ast_channel_name(peer), member->interface, member->membername);
+				blob = ast_json_pack("{s: s, s: s, s: s}",
+						     "Queue", queuename,
+						     "Interface", member->interface,
+						     "MemberName", member->membername);
+				queue_publish_multi_channel_blob(qe->chan, peer, queue_agent_dump_type(), blob);
 
 				ast_channel_publish_dial(qe->chan, peer, member->interface, ast_hangup_cause_to_dial_status(ast_channel_hangupcause(peer)));
 				ast_autoservice_chan_hangup_peer(qe->chan, peer);
@@ -6104,16 +6179,13 @@
 			}
 		}
 
-		manager_event(EVENT_FLAG_AGENT, "AgentConnect",
-				"Queue: %s\r\n"
-				"Channel: %s\r\n"
-				"Member: %s\r\n"
-				"MemberName: %s\r\n"
-				"HoldTime: %ld\r\n"
-				"BridgedChannel: %s\r\n"
-				"RingTime: %ld\r\n",
-				queuename, ast_channel_name(peer), member->interface, member->membername,
-				(long) time(NULL) - qe->start, ast_channel_uniqueid(peer), (long)(orig - to > 0 ? (orig - to) / 1000 : 0));
+		blob = ast_json_pack("{s: s, s: s, s: s, s: i, s: i}",
+				     "Queue", queuename,
+				     "Interface", member->interface,
+				     "MemberName", member->membername,
+				     "HoldTime", (long) time(NULL) - qe->start,
+				     "RingTime", (long)(orig - to > 0 ? (orig - to) / 1000 : 0));
+		queue_publish_multi_channel_blob(qe->chan, peer, queue_agent_connect_type(), blob);
 
 		ast_copy_string(oldcontext, ast_channel_context(qe->chan), sizeof(oldcontext));
 		ast_copy_string(oldexten, ast_channel_exten(qe->chan), sizeof(oldexten));
@@ -9969,6 +10041,12 @@
 	STASIS_MESSAGE_TYPE_CLEANUP(queue_member_penalty_type);
 	STASIS_MESSAGE_TYPE_CLEANUP(queue_member_ringinuse_type);
 
+	STASIS_MESSAGE_TYPE_CLEANUP(queue_agent_called_type);
+	STASIS_MESSAGE_TYPE_CLEANUP(queue_agent_connect_type);
+	STASIS_MESSAGE_TYPE_CLEANUP(queue_agent_complete_type);
+	STASIS_MESSAGE_TYPE_CLEANUP(queue_agent_dump_type);
+	STASIS_MESSAGE_TYPE_CLEANUP(queue_agent_ringnoanswer_type);
+
 	ast_cli_unregister_multiple(cli_queue, ARRAY_LEN(cli_queue));
 	res = ast_manager_unregister("QueueStatus");
 	res |= ast_manager_unregister("Queues");
@@ -10115,6 +10193,12 @@
 	STASIS_MESSAGE_TYPE_INIT(queue_member_penalty_type);
 	STASIS_MESSAGE_TYPE_INIT(queue_member_ringinuse_type);
 
+	STASIS_MESSAGE_TYPE_INIT(queue_agent_called_type);
+	STASIS_MESSAGE_TYPE_INIT(queue_agent_connect_type);
+	STASIS_MESSAGE_TYPE_INIT(queue_agent_complete_type);
+	STASIS_MESSAGE_TYPE_INIT(queue_agent_dump_type);
+	STASIS_MESSAGE_TYPE_INIT(queue_agent_ringnoanswer_type);
+
 	stasis_message_router_add(message_router,
 				  queue_caller_join_type(),
 				  queue_caller_join_cb,
@@ -10158,6 +10242,31 @@
 	stasis_message_router_add(message_router,
 				  queue_member_ringinuse_type(),
 				  queue_member_ringinuse_cb,
+				  NULL);
+
+	stasis_message_router_add(message_router,
+				  queue_agent_called_type(),
+				  queue_agent_called_cb,
+				  NULL);
+
+	stasis_message_router_add(message_router,
+				  queue_agent_connect_type(),
+				  queue_agent_connect_cb,
+				  NULL);
+
+	stasis_message_router_add(message_router,
+				  queue_agent_complete_type(),
+				  queue_agent_complete_cb,
+				  NULL);
+
+	stasis_message_router_add(message_router,
+				  queue_agent_dump_type(),
+				  queue_agent_dump_cb,
+				  NULL);
+
+	stasis_message_router_add(message_router,
+				  queue_agent_ringnoanswer_type(),
+				  queue_agent_ringnoanswer_cb,
 				  NULL);
 
 	ast_extension_state_add(NULL, NULL, extension_state_cb, NULL);




More information about the asterisk-commits mailing list