[svn-commits] mmichelson: branch mmichelson/queue_bugbug r395202 - in /team/mmichelson/queu...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jul 23 15:59:57 CDT 2013


Author: mmichelson
Date: Tue Jul 23 15:59:55 2013
New Revision: 395202

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395202
Log:
Create a queue topic on which to publish agent complete messages.

Most stasis messages in app_queue are published on the caller's channel
topic. This works fine since the messages are published prior to bridging.
The problem is that once the caller and member are bridged, the caller's
channel may no longer be the same. It may be that the caller's channel
gets optimized away and a new channel becomes the caller's channel. As such,
publishing on this new caller's topic may be a bit odd. Instead, we now publish
the completion event on the queue's topic.

It may be worthwhile to publish other messages on the queue's topic but that
can be a different task.


Modified:
    team/mmichelson/queue_bugbug/apps/app_queue.c
    team/mmichelson/queue_bugbug/include/asterisk/app.h
    team/mmichelson/queue_bugbug/main/app.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=395202&r1=395201&r2=395202
==============================================================================
--- team/mmichelson/queue_bugbug/apps/app_queue.c (original)
+++ team/mmichelson/queue_bugbug/apps/app_queue.c Tue Jul 23 15:59:55 2013
@@ -5141,10 +5141,7 @@
 			     "TalkTime", (long)(time(NULL) - callstart),
 			     "Reason", reason);
 
-	/* XXX Topic is currently BS. Just filler for the moment until a queue
-	 * topic is created
-	 */
-	queue_publish_multi_channel_snapshot_blob(ast_bridge_topic_all(), caller, peer,
+	queue_publish_multi_channel_snapshot_blob(ast_queue_topic(queuename), caller, peer,
 			queue_agent_complete_type(), blob);
 }
 

Modified: team/mmichelson/queue_bugbug/include/asterisk/app.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/queue_bugbug/include/asterisk/app.h?view=diff&rev=395202&r1=395201&r2=395202
==============================================================================
--- team/mmichelson/queue_bugbug/include/asterisk/app.h (original)
+++ team/mmichelson/queue_bugbug/include/asterisk/app.h Tue Jul 23 15:59:55 2013
@@ -1277,6 +1277,22 @@
  */
 struct stasis_message_type *ast_mwi_vm_app_type(void);
 
+/*!
+ * \brief Get the \ref stasis topic for queue messages
+ * \retval The topic structure for queue messages
+ * \retval NULL if it has not been allocated
+ * \since 12
+ */
+struct stasis_topic *ast_queue_topic_all(void);
+
+/*!
+ * \brief Get the \ref stasis topic for queue messages for a particular queue name 
+ * \param queuename The name for which to get the topic
+ * \retval The topic structure for queue messages for a given name
+ * \retval NULL if it failed to be found or allocated
+ * \since 12
+ */
+struct stasis_topic *ast_queue_topic(const char *queuename);
 /*! @} */
 
 /*!

Modified: team/mmichelson/queue_bugbug/main/app.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/queue_bugbug/main/app.c?view=diff&rev=395202&r1=395201&r2=395202
==============================================================================
--- team/mmichelson/queue_bugbug/main/app.c (original)
+++ team/mmichelson/queue_bugbug/main/app.c Tue Jul 23 15:59:55 2013
@@ -85,11 +85,14 @@
 static AST_LIST_HEAD_STATIC(zombies, zombie);
 
 /*
- * @{ \brief Define \ref stasis topic objects for MWI
+ * @{ \brief Define \ref stasis topic objects
  */
 static struct stasis_topic *mwi_topic_all;
 static struct stasis_caching_topic *mwi_topic_cached;
 static struct stasis_topic_pool *mwi_topic_pool;
+
+static struct stasis_topic *queue_topic_all;
+static struct stasis_topic_pool *queue_topic_pool;
 /* @} */
 
 /*
@@ -2830,8 +2833,22 @@
 	return msg;
 }
 
+struct stasis_topic *ast_queue_topic_all(void)
+{
+	return queue_topic_all;
+}
+
+struct stasis_topic *ast_queue_topic(const char *queuename)
+{
+	return stasis_topic_pool_get_topic(queue_topic_pool, queuename);
+}
+
 static void app_cleanup(void)
 {
+	ao2_cleanup(queue_topic_pool);
+	queue_topic_pool = NULL;
+	ao2_cleanup(queue_topic_all);
+	queue_topic_all = NULL;
 	ao2_cleanup(mwi_topic_pool);
 	mwi_topic_pool = NULL;
 	ao2_cleanup(mwi_topic_all);
@@ -2863,7 +2880,14 @@
 	if (!mwi_topic_pool) {
 		return -1;
 	}
-
+	queue_topic_all = stasis_topic_create("stasis_queue_topic");
+	if (!queue_topic_all) {
+		return -1;
+	}
+	queue_topic_pool = stasis_topic_pool_create(queue_topic_all);
+	if (!queue_topic_pool) {
+		return -1;
+	}
 	return 0;
 }
 




More information about the svn-commits mailing list