[asterisk-commits] mmichelson: branch mmichelson/queue_bugbug r394490 - /team/mmichelson/queue_b...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jul 16 15:02:11 CDT 2013


Author: mmichelson
Date: Tue Jul 16 15:02:09 2013
New Revision: 394490

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=394490
Log:
Update queue statistics once calls finish.


Modified:
    team/mmichelson/queue_bugbug/apps/app_queue.c

Modified: team/mmichelson/queue_bugbug/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/queue_bugbug/apps/app_queue.c?view=diff&rev=394490&r1=394489&r2=394490
==============================================================================
--- team/mmichelson/queue_bugbug/apps/app_queue.c (original)
+++ team/mmichelson/queue_bugbug/apps/app_queue.c Tue Jul 16 15:02:09 2013
@@ -4980,7 +4980,6 @@
 	return res;
 }
 
-#if 0	// BUGBUG
 /*!
  * \brief update the queue status
  * \retval Always 0
@@ -5025,7 +5024,6 @@
 	ao2_unlock(q);
 	return 0;
 }
-#endif	// BUGBUG
 
 /*! \brief Calculate the metric of each member in the outgoing callattempts
  *
@@ -5154,8 +5152,8 @@
 		AST_STRING_FIELD(caller_uniqueid);
 		AST_STRING_FIELD(agent_uniqueid);
 		AST_STRING_FIELD(bridge_uniqueid);
-		AST_STRING_FIELD(queue);
 	);
+	struct call_queue *queue;
 	struct member *member;
 	struct stasis_topic *caller_topic;
 	time_t holdstart;
@@ -5176,6 +5174,7 @@
 	ast_log(LOG_NOTICE, "Things bein' destroyed\n");
 
 	ao2_cleanup(queue_data->member);
+	ao2_cleanup(queue_data->queue);
 	ast_string_field_free_memory(queue_data);
 }
 
@@ -5201,7 +5200,7 @@
 
 	ast_string_field_set(queue_data, caller_uniqueid, ast_channel_uniqueid(qe->chan));
 	ast_string_field_set(queue_data, agent_uniqueid, ast_channel_uniqueid(peer));
-	ast_string_field_set(queue_data, queue, qe->parent->name);
+	queue_data->queue = queue_ref(qe->parent);
 	queue_data->starttime = starttime;
 	queue_data->holdstart = holdstart;
 	queue_data->callcompletedinsl = callcompletedinsl;
@@ -5253,15 +5252,17 @@
 		caller = ast_channel_snapshot_get_latest(queue_data->caller_uniqueid);
 		agent = ast_channel_snapshot_get_latest(queue_data->agent_uniqueid);
 
-		ast_log(LOG_NOTICE, "Detected blind transfer in queue %s\n", queue_data->queue);
-		ast_queue_log(queue_data->queue, caller->uniqueid, queue_data->member->membername, "TRANSFER", "%s|%s|%ld|%ld|%d",
+		ast_log(LOG_NOTICE, "Detected blind transfer in queue %s\n", queue_data->queue->name);
+		ast_queue_log(queue_data->queue->name, caller->uniqueid, queue_data->member->membername, "TRANSFER", "%s|%s|%ld|%ld|%d",
 				ast_json_string_get(ast_json_object_get(blind_blob->blob, "exten")),
 				ast_json_string_get(ast_json_object_get(blind_blob->blob, "context")),
 				(long) queue_data->starttime - queue_data->holdstart,
 				(long) time(NULL) - queue_data->starttime, queue_data->caller_pos);
 
-		send_agent_complete(queue_data->queue, caller, agent, queue_data->member,
+		send_agent_complete(queue_data->queue->name, caller, agent, queue_data->member,
 				queue_data->holdstart, queue_data->starttime, TRANSFER);
+		update_queue(queue_data->queue, queue_data->member, queue_data->callcompletedinsl,
+				time(NULL) - queue_data->starttime);
 		remove_stasis_subscriptions(queue_data);
 	} else if (ast_attended_transfer_type() == stasis_message_type(msg)) {
 		struct ast_attended_transfer_message *atxfer_msg = stasis_message_data(msg);
@@ -5283,13 +5284,15 @@
 		caller = ast_channel_snapshot_get_latest(queue_data->caller_uniqueid);
 		agent = ast_channel_snapshot_get_latest(queue_data->agent_uniqueid);
 
-		ast_log(LOG_NOTICE, "Detected attended transfer in queue %s\n", queue_data->queue);
+		ast_log(LOG_NOTICE, "Detected attended transfer in queue %s\n", queue_data->queue->name);
 		/* XXX Need to send queue log something-or-other here. Problem is that it doesn't really make
 		 * sense to specify an exten and context on an attended transfer. Perhaps separate queue log message
 		 * type?
 		 */
-		send_agent_complete(queue_data->queue, caller, agent, queue_data->member,
+		send_agent_complete(queue_data->queue->name, caller, agent, queue_data->member,
 				queue_data->holdstart, queue_data->starttime, TRANSFER);
+		update_queue(queue_data->queue, queue_data->member, queue_data->callcompletedinsl,
+				time(NULL) - queue_data->starttime);
 		remove_stasis_subscriptions(queue_data);
 	}
 }
@@ -5326,13 +5329,15 @@
 		caller = ast_channel_snapshot_get_latest(queue_data->caller_uniqueid);
 		agent = ast_channel_snapshot_get_latest(queue_data->agent_uniqueid);
 
-		ast_queue_log(queue_data->queue, caller->uniqueid, queue_data->member->membername,
+		ast_queue_log(queue_data->queue->name, caller->uniqueid, queue_data->member->membername,
 				reason == CALLER ? "COMPLETECALLER" : "COMPLETEAGENT", "%ld|%ld|%d",
 			(long) (queue_data->starttime - queue_data->holdstart),
 			(long) (time(NULL) - queue_data->starttime), queue_data->caller_pos);
 		ast_log(LOG_NOTICE, "Detected hangup request on channel %s\n", channel_blob->snapshot->name);
-		send_agent_complete(queue_data->queue, caller, agent, queue_data->member,
+		send_agent_complete(queue_data->queue->name, caller, agent, queue_data->member,
 				queue_data->holdstart, queue_data->starttime, reason);
+		update_queue(queue_data->queue, queue_data->member, queue_data->callcompletedinsl,
+				time(NULL) - queue_data->starttime);
 		remove_stasis_subscriptions(queue_data);
 	}
 }




More information about the asterisk-commits mailing list