[asterisk-commits] dlee: branch dlee/stasis-app r383263 - in /team/dlee/stasis-app: ./ autoconf/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Mar 15 19:21:02 CDT 2013


Author: dlee
Date: Fri Mar 15 19:20:58 2013
New Revision: 383263

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=383263
Log:
Merged revisions 383063-383242 from http://svn.asterisk.org/svn/asterisk/trunk

Added:
    team/dlee/stasis-app/configs/stasis_core.conf.sample
      - copied unchanged from r383242, trunk/configs/stasis_core.conf.sample
    team/dlee/stasis-app/include/asterisk/stasis_message_router.h
      - copied unchanged from r383242, trunk/include/asterisk/stasis_message_router.h
    team/dlee/stasis-app/main/stasis_message_router.c
      - copied unchanged from r383242, trunk/main/stasis_message_router.c
Modified:
    team/dlee/stasis-app/   (props changed)
    team/dlee/stasis-app/autoconf/ast_ext_lib.m4
    team/dlee/stasis-app/channels/chan_sip.c
    team/dlee/stasis-app/include/asterisk/stasis.h
    team/dlee/stasis-app/main/channel_internal_api.c
    team/dlee/stasis-app/main/http.c
    team/dlee/stasis-app/main/manager.c
    team/dlee/stasis-app/main/stasis.c
    team/dlee/stasis-app/main/stasis_cache.c
    team/dlee/stasis-app/main/stasis_message.c
    team/dlee/stasis-app/main/tcptls.c
    team/dlee/stasis-app/pbx/pbx_spool.c
    team/dlee/stasis-app/tests/test_stasis.c

Propchange: team/dlee/stasis-app/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/dlee/stasis-app/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Mar 15 19:20:58 2013
@@ -1,1 +1,1 @@
-/trunk:1-383057
+/trunk:1-383262

Modified: team/dlee/stasis-app/autoconf/ast_ext_lib.m4
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-app/autoconf/ast_ext_lib.m4?view=diff&rev=383263&r1=383262&r2=383263
==============================================================================
--- team/dlee/stasis-app/autoconf/ast_ext_lib.m4 (original)
+++ team/dlee/stasis-app/autoconf/ast_ext_lib.m4 Fri Mar 15 19:20:58 2013
@@ -112,9 +112,9 @@
    # if --with-$1=DIR has been specified, use it.
    if test "x${$1_DIR}" != "x"; then
       if test -d ${$1_DIR}/lib; then
-      	 pbxlibdir="-L${$1_DIR}/lib"
+         pbxlibdir="-L${$1_DIR}/lib"
       else
-      	 pbxlibdir="-L${$1_DIR}"
+         pbxlibdir="-L${$1_DIR}"
       fi
    fi
    pbxfuncname="$3"

Modified: team/dlee/stasis-app/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-app/channels/chan_sip.c?view=diff&rev=383263&r1=383262&r2=383263
==============================================================================
--- team/dlee/stasis-app/channels/chan_sip.c (original)
+++ team/dlee/stasis-app/channels/chan_sip.c Fri Mar 15 19:20:58 2013
@@ -29271,7 +29271,11 @@
 
 	if (p->stimer->st_ref == SESSION_TIMER_REFRESHER_US) {
 		res = 1;
-		transmit_reinvite_with_sdp(p, FALSE, TRUE);
+		if (T38_ENABLED == p->t38.state) {
+			transmit_reinvite_with_sdp(p, TRUE, TRUE);
+		} else {
+			transmit_reinvite_with_sdp(p, FALSE, TRUE);
+		}
 	} else {
 		p->stimer->st_expirys++;
 		if (p->stimer->st_expirys >= 2) {
@@ -31642,8 +31646,11 @@
 			continue;
 		}
 
-		/* handle tls conf */
-		if (!ast_tls_read_conf(&default_tls_cfg, &sip_tls_desc, v->name, v->value)) {
+		/* handle tls conf, don't allow setting of tlsverifyclient as it isn't supported by chan_sip */
+		if (!strcasecmp(v->name, "tlsverifyclient")) {
+			ast_log(LOG_WARNING, "Ignoring unsupported option 'tlsverifyclient'\n");
+			continue;
+		} else if (!ast_tls_read_conf(&default_tls_cfg, &sip_tls_desc, v->name, v->value)) {
 			continue;
 		}
 

Modified: team/dlee/stasis-app/include/asterisk/stasis.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-app/include/asterisk/stasis.h?view=diff&rev=383263&r1=383262&r2=383263
==============================================================================
--- team/dlee/stasis-app/include/asterisk/stasis.h (original)
+++ team/dlee/stasis-app/include/asterisk/stasis.h Fri Mar 15 19:20:58 2013
@@ -306,9 +306,10 @@
  * delivery of the final message.
  *
  * \param subscription Subscription to cancel.
- * \since 12
- */
-void stasis_unsubscribe(struct stasis_subscription *subscription);
+ * \retval NULL for convenience
+ * \since 12
+ */
+struct stasis_subscription *stasis_unsubscribe(struct stasis_subscription *subscription);
 
 /*!
  * \brief Create a subscription which forwards all messages from one topic to
@@ -450,9 +451,10 @@
 /*!
  * Unsubscribes a caching topic from its upstream topic.
  * \param caching_topic Caching topic to unsubscribe
- * \since 12
- */
-void stasis_caching_unsubscribe(struct stasis_caching_topic *caching_topic);
+ * \retval NULL for convenience
+ * \since 12
+ */
+struct stasis_caching_topic *stasis_caching_unsubscribe(struct stasis_caching_topic *caching_topic);
 
 /*!
  * \brief Returns the topic of cached events from a caching topics.

Modified: team/dlee/stasis-app/main/channel_internal_api.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-app/main/channel_internal_api.c?view=diff&rev=383263&r1=383262&r2=383263
==============================================================================
--- team/dlee/stasis-app/main/channel_internal_api.c (original)
+++ team/dlee/stasis-app/main/channel_internal_api.c Fri Mar 15 19:20:58 2013
@@ -1367,8 +1367,7 @@
 
 	ast_string_field_free_memory(chan);
 
-	stasis_unsubscribe(chan->forwarder);
-	chan->forwarder = NULL;
+	chan->forwarder = stasis_unsubscribe(chan->forwarder);
 
 	ao2_cleanup(chan->topic);
 	chan->topic = NULL;

Modified: team/dlee/stasis-app/main/http.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-app/main/http.c?view=diff&rev=383263&r1=383262&r2=383263
==============================================================================
--- team/dlee/stasis-app/main/http.c (original)
+++ team/dlee/stasis-app/main/http.c Fri Mar 15 19:20:58 2013
@@ -1060,8 +1060,17 @@
 		v = ast_variable_browse(cfg, "general");
 		for (; v; v = v->next) {
 
-			/* handle tls conf */
-			if (!ast_tls_read_conf(&http_tls_cfg, &https_desc, v->name, v->value)) {
+			/* read tls config options while preventing unsupported options from being set */
+			if (strcasecmp(v->name, "tlscafile")
+				&& strcasecmp(v->name, "tlscapath")
+				&& strcasecmp(v->name, "tlscadir")
+				&& strcasecmp(v->name, "tlsverifyclient")
+				&& strcasecmp(v->name, "tlsdontverifyserver")
+				&& strcasecmp(v->name, "tlsclientmethod")
+				&& strcasecmp(v->name, "sslclientmethod")
+				&& strcasecmp(v->name, "tlscipher")
+				&& strcasecmp(v->name, "sslcipher")
+				&& !ast_tls_read_conf(&http_tls_cfg, &https_desc, v->name, v->value)) {
 				continue;
 			}
 

Modified: team/dlee/stasis-app/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-app/main/manager.c?view=diff&rev=383263&r1=383262&r2=383263
==============================================================================
--- team/dlee/stasis-app/main/manager.c (original)
+++ team/dlee/stasis-app/main/manager.c Fri Mar 15 19:20:58 2013
@@ -7590,8 +7590,7 @@
 {
 	struct ast_manager_user *user;
 
-	stasis_unsubscribe(channel_state_sub);
-	channel_state_sub = NULL;
+	channel_state_sub = stasis_unsubscribe(channel_state_sub);
 
 	if (registered) {
 		ast_manager_unregister("Ping");
@@ -7795,7 +7794,15 @@
 	for (var = ast_variable_browse(cfg, "general"); var; var = var->next) {
 		val = var->value;
 
-		if (!ast_tls_read_conf(&ami_tls_cfg, &amis_desc, var->name, val)) {
+		/* read tls config options while preventing unsupported options from being set */
+		if (strcasecmp(var->name, "tlscafile")
+			&& strcasecmp(var->name, "tlscapath")
+			&& strcasecmp(var->name, "tlscadir")
+			&& strcasecmp(var->name, "tlsverifyclient")
+			&& strcasecmp(var->name, "tlsdontverifyserver")
+			&& strcasecmp(var->name, "tlsclientmethod")
+			&& strcasecmp(var->name, "sslclientmethod")
+			&& !ast_tls_read_conf(&ami_tls_cfg, &amis_desc, var->name, val)) {
 			continue;
 		}
 

Modified: team/dlee/stasis-app/main/stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-app/main/stasis.c?view=diff&rev=383263&r1=383262&r2=383263
==============================================================================
--- team/dlee/stasis-app/main/stasis.c (original)
+++ team/dlee/stasis-app/main/stasis.c Fri Mar 15 19:20:58 2013
@@ -46,7 +46,7 @@
 
 static struct stasis_message_type *__subscription_change_message_type;
 
-/*! \private */
+/*! \internal */
 struct stasis_topic {
 	char *name;
 	/*! Variable length array of the subscribers (raw pointer to avoid cyclic references) */
@@ -86,7 +86,7 @@
 	}
 
 	topic->num_subscribers_max = INITIAL_SUBSCRIBERS_MAX;
-	topic->subscribers = ast_calloc(topic->num_subscribers_max, sizeof(topic->subscribers));
+	topic->subscribers = ast_calloc(topic->num_subscribers_max, sizeof(*topic->subscribers));
 	if (!topic->subscribers) {
 		return NULL;
 	}
@@ -100,7 +100,7 @@
 	return topic->name;
 }
 
-/*! \private */
+/*! \internal */
 struct stasis_subscription {
 	/*! Unique ID for this subscription */
 	char *uniqueid;
@@ -172,7 +172,7 @@
 	return __stasis_subscribe(topic, callback, data, 1);
 }
 
-void stasis_unsubscribe(struct stasis_subscription *sub)
+struct stasis_subscription *stasis_unsubscribe(struct stasis_subscription *sub)
 {
 	if (sub) {
 		size_t i;
@@ -186,12 +186,13 @@
 				topic->subscribers[i] = topic->subscribers[--topic->num_subscribers_current];
 				/* Unsubscribing unrefs the subscription */
 				ao2_cleanup(sub);
-				return;
+				return NULL;
 			}
 		}
 
 		ast_log(LOG_ERROR, "Internal error: subscription has invalid topic\n");
 	}
+	return NULL;
 }
 
 int stasis_subscription_is_subscribed(const struct stasis_subscription *sub)
@@ -263,7 +264,7 @@
 }
 
 /*!
- * \private
+ * \internal
  * \brief Information needed to dispatch a message to a subscription
  */
 struct dispatch {

Modified: team/dlee/stasis-app/main/stasis_cache.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-app/main/stasis_cache.c?view=diff&rev=383263&r1=383262&r2=383263
==============================================================================
--- team/dlee/stasis-app/main/stasis_cache.c (original)
+++ team/dlee/stasis-app/main/stasis_cache.c Fri Mar 15 19:20:58 2013
@@ -42,7 +42,7 @@
 #define NUM_CACHE_BUCKETS 563
 #endif
 
-/*! \private */
+/*! \internal */
 struct stasis_caching_topic {
 	struct ao2_container *cache;
 	struct stasis_topic *topic;
@@ -65,7 +65,7 @@
 	return caching_topic->topic;
 }
 
-void stasis_caching_unsubscribe(struct stasis_caching_topic *caching_topic)
+struct stasis_caching_topic *stasis_caching_unsubscribe(struct stasis_caching_topic *caching_topic)
 {
 	if (caching_topic) {
 		if (stasis_subscription_is_subscribed(caching_topic->sub)) {
@@ -74,6 +74,7 @@
 			ast_log(LOG_ERROR, "stasis_caching_topic unsubscribed multiple times\n");
 		}
 	}
+	return NULL;
 }
 
 struct cache_entry {

Modified: team/dlee/stasis-app/main/stasis_message.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-app/main/stasis_message.c?view=diff&rev=383263&r1=383262&r2=383263
==============================================================================
--- team/dlee/stasis-app/main/stasis_message.c (original)
+++ team/dlee/stasis-app/main/stasis_message.c Fri Mar 15 19:20:58 2013
@@ -35,7 +35,7 @@
 #include "asterisk/stasis.h"
 #include "asterisk/utils.h"
 
-/*! \private */
+/*! \internal */
 struct stasis_message_type {
 	char *name;
 };
@@ -70,7 +70,7 @@
 	return type->name;
 }
 
-/*! \private */
+/*! \internal */
 struct stasis_message {
 	/*! Time the message was created */
 	struct timeval timestamp;

Modified: team/dlee/stasis-app/main/tcptls.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-app/main/tcptls.c?view=diff&rev=383263&r1=383262&r2=383263
==============================================================================
--- team/dlee/stasis-app/main/tcptls.c (original)
+++ team/dlee/stasis-app/main/tcptls.c Fri Mar 15 19:20:58 2013
@@ -373,6 +373,11 @@
 		cfg->enabled = 0;
 		return 0;
 	}
+
+	SSL_CTX_set_verify(cfg->ssl_ctx,
+		ast_test_flag(&cfg->flags, AST_SSL_VERIFY_CLIENT) ? SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT : SSL_VERIFY_NONE,
+		NULL);
+
 	if (!ast_strlen_zero(cfg->certfile)) {
 		char *tmpprivate = ast_strlen_zero(cfg->pvtfile) ? cfg->certfile : cfg->pvtfile;
 		if (SSL_CTX_use_certificate_file(cfg->ssl_ctx, cfg->certfile, SSL_FILETYPE_PEM) == 0) {

Modified: team/dlee/stasis-app/pbx/pbx_spool.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-app/pbx/pbx_spool.c?view=diff&rev=383263&r1=383262&r2=383263
==============================================================================
--- team/dlee/stasis-app/pbx/pbx_spool.c (original)
+++ team/dlee/stasis-app/pbx/pbx_spool.c Fri Mar 15 19:20:58 2013
@@ -645,9 +645,10 @@
 	char buf[8192] __attribute__((aligned (sizeof(int))));
 	struct pollfd pfd = { .fd = inotify_fd, .events = POLLIN };
 #else
-	struct timespec nowait = { 0, 1 };
+	struct timespec nowait = { .tv_sec = 0, .tv_nsec = 1 };
 	int inotify_fd = kqueue();
 	struct kevent kev;
+	struct kevent event;
 #endif
 	struct direntry *cur;
 
@@ -678,7 +679,7 @@
 
 #ifndef HAVE_INOTIFY
 	EV_SET(&kev, dirfd(dir), EVFILT_VNODE, EV_ADD | EV_ENABLE | EV_CLEAR, NOTE_WRITE, 0, NULL);
-	if (kevent(inotify_fd, &kev, 1, NULL, 0, &nowait) < 0 && errno != 0) {
+	if (kevent(inotify_fd, &kev, 1, &event, 1, &nowait) < 0 && errno != 0) {
 		ast_log(LOG_ERROR, "Unable to watch directory %s: %s\n", qdir, strerror(errno));
 	}
 #endif
@@ -750,8 +751,18 @@
 		}
 		queue_created_files();
 #else
-			struct timespec ts2 = { next - now, 0 };
-			if (kevent(inotify_fd, NULL, 0, &kev, 1, &ts2) <= 0) {
+			int num_events;
+			/* If queue empty then wait forever */
+			if (next == INT_MAX) {
+				num_events = kevent(inotify_fd, &kev, 1, &event, 1, NULL);
+			} else {
+				struct timespec ts2 = { .tv_sec = (unsigned long int)(next - now), .tv_nsec = 0 };
+				num_events = kevent(inotify_fd, &kev, 1, &event, 1, &ts2);
+			}
+			if ((num_events < 0) || (event.flags == EV_ERROR)) {
+				ast_debug(10, "KEvent error %s\n", strerror(errno));
+				continue;
+			} else if (num_events == 0) {
 				/* Interrupt or timeout, restart calculations */
 				continue;
 			} else {

Modified: team/dlee/stasis-app/tests/test_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-app/tests/test_stasis.c?view=diff&rev=383263&r1=383262&r2=383263
==============================================================================
--- team/dlee/stasis-app/tests/test_stasis.c (original)
+++ team/dlee/stasis-app/tests/test_stasis.c Fri Mar 15 19:20:58 2013
@@ -36,6 +36,7 @@
 #include "asterisk/astobj2.h"
 #include "asterisk/module.h"
 #include "asterisk/stasis.h"
+#include "asterisk/stasis_message_router.h"
 #include "asterisk/test.h"
 
 static const char *test_category = "/stasis/core/";
@@ -276,8 +277,7 @@
 	ao2_ref(consumer, +1);
 	expected_uniqueid = ast_strdup(stasis_subscription_uniqueid(uut));
 
-	stasis_unsubscribe(uut);
-	uut = NULL;
+	uut = stasis_unsubscribe(uut);
 	complete = consumer_wait_for_completion(consumer);
 	ast_test_validate(test, 1 == complete);
 
@@ -376,8 +376,7 @@
 	ast_test_validate(test, NULL != uut);
 	ao2_ref(consumer, +1);
 
-	stasis_unsubscribe(uut);
-	uut = NULL;
+	uut = stasis_unsubscribe(uut);
 
 	test_data = ao2_alloc(1, NULL);
 	ast_test_validate(test, NULL != test_data);
@@ -676,6 +675,148 @@
 	return AST_TEST_PASS;
 }
 
+AST_TEST_DEFINE(route_conflicts)
+{
+	RAII_VAR(struct stasis_topic *, topic, NULL, ao2_cleanup);
+	RAII_VAR(struct stasis_message_router *, uut, NULL, stasis_message_router_unsubscribe);
+	RAII_VAR(struct stasis_message_type *, test_message_type, NULL, ao2_cleanup);
+	RAII_VAR(struct consumer *, consumer1, NULL, ao2_cleanup);
+	RAII_VAR(struct consumer *, consumer2, NULL, ao2_cleanup);
+	int ret;
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = __func__;
+		info->category = test_category;
+		info->summary =
+			"Multiple routes to the same message_type should fail";
+		info->description =
+			"Multiple routes to the same message_type should fail";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
+
+	topic = stasis_topic_create("TestTopic");
+	ast_test_validate(test, NULL != topic);
+
+	consumer1 = consumer_create(1);
+	ast_test_validate(test, NULL != consumer1);
+	consumer2 = consumer_create(1);
+	ast_test_validate(test, NULL != consumer2);
+
+	test_message_type = stasis_message_type_create("TestMessage");
+	ast_test_validate(test, NULL != test_message_type);
+
+	uut = stasis_message_router_create(topic);
+	ast_test_validate(test, NULL != uut);
+
+	ret = stasis_message_router_add(
+		uut, test_message_type, consumer_exec, consumer1);
+	ast_test_validate(test, 0 == ret);
+	ret = stasis_message_router_add(
+		uut, test_message_type, consumer_exec, consumer2);
+	ast_test_validate(test, 0 != ret);
+
+	return AST_TEST_PASS;
+}
+
+AST_TEST_DEFINE(router)
+{
+	RAII_VAR(struct stasis_topic *, topic, NULL, ao2_cleanup);
+	RAII_VAR(struct stasis_message_router *, uut, NULL, stasis_message_router_unsubscribe);
+	RAII_VAR(char *, test_data, NULL, ao2_cleanup);
+	RAII_VAR(struct stasis_message_type *, test_message_type1, NULL, ao2_cleanup);
+	RAII_VAR(struct stasis_message_type *, test_message_type2, NULL, ao2_cleanup);
+	RAII_VAR(struct stasis_message_type *, test_message_type3, NULL, ao2_cleanup);
+	RAII_VAR(struct consumer *, consumer1, NULL, ao2_cleanup);
+	RAII_VAR(struct consumer *, consumer2, NULL, ao2_cleanup);
+	RAII_VAR(struct consumer *, consumer3, NULL, ao2_cleanup);
+	RAII_VAR(struct stasis_message *, test_message1, NULL, ao2_cleanup);
+	RAII_VAR(struct stasis_message *, test_message2, NULL, ao2_cleanup);
+	RAII_VAR(struct stasis_message *, test_message3, NULL, ao2_cleanup);
+	int actual_len, ret;
+	struct stasis_message *actual;
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = __func__;
+		info->category = test_category;
+		info->summary = "Test simple message routing";
+		info->description = "Test simple message routing";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
+
+	topic = stasis_topic_create("TestTopic");
+	ast_test_validate(test, NULL != topic);
+
+	consumer1 = consumer_create(1);
+	ast_test_validate(test, NULL != consumer1);
+	consumer2 = consumer_create(1);
+	ast_test_validate(test, NULL != consumer2);
+	consumer3 = consumer_create(1);
+	ast_test_validate(test, NULL != consumer3);
+
+	test_message_type1 = stasis_message_type_create("TestMessage1");
+	ast_test_validate(test, NULL != test_message_type1);
+	test_message_type2 = stasis_message_type_create("TestMessage2");
+	ast_test_validate(test, NULL != test_message_type2);
+	test_message_type3 = stasis_message_type_create("TestMessage3");
+	ast_test_validate(test, NULL != test_message_type3);
+
+	uut = stasis_message_router_create(topic);
+	ast_test_validate(test, NULL != uut);
+
+	ret = stasis_message_router_add(
+		uut, test_message_type1, consumer_exec, consumer1);
+	ast_test_validate(test, 0 == ret);
+	ao2_ref(consumer1, +1);
+	ret = stasis_message_router_add(
+		uut, test_message_type2, consumer_exec, consumer2);
+	ast_test_validate(test, 0 == ret);
+	ao2_ref(consumer2, +1);
+	ret = stasis_message_router_set_default(uut, consumer_exec, consumer3);
+	ast_test_validate(test, 0 == ret);
+	ao2_ref(consumer3, +1);
+
+	test_data = ao2_alloc(1, NULL);
+	ast_test_validate(test, NULL != test_data);
+	test_message1 = stasis_message_create(test_message_type1, test_data);
+	ast_test_validate(test, NULL != test_message1);
+	test_message2 = stasis_message_create(test_message_type2, test_data);
+	ast_test_validate(test, NULL != test_message2);
+	test_message3 = stasis_message_create(test_message_type3, test_data);
+	ast_test_validate(test, NULL != test_message3);
+
+	stasis_publish(topic, test_message1);
+	stasis_publish(topic, test_message2);
+	stasis_publish(topic, test_message3);
+
+	actual_len = consumer_wait_for(consumer1, 1);
+	ast_test_validate(test, 1 == actual_len);
+	actual_len = consumer_wait_for(consumer2, 1);
+	ast_test_validate(test, 1 == actual_len);
+	actual_len = consumer_wait_for(consumer3, 1);
+	ast_test_validate(test, 1 == actual_len);
+
+	actual = consumer1->messages_rxed[0];
+	ast_test_validate(test, test_message1 == actual);
+
+	actual = consumer2->messages_rxed[0];
+	ast_test_validate(test, test_message2 == actual);
+
+	actual = consumer3->messages_rxed[0];
+	ast_test_validate(test, test_message3 == actual);
+
+	/* consumer1 and consumer2 do not get the final message. */
+	ao2_cleanup(consumer1);
+	ao2_cleanup(consumer2);
+
+	return AST_TEST_PASS;
+}
+
 static int unload_module(void)
 {
 	AST_TEST_UNREGISTER(message_type);
@@ -686,6 +827,8 @@
 	AST_TEST_UNREGISTER(forward);
 	AST_TEST_UNREGISTER(cache_passthrough);
 	AST_TEST_UNREGISTER(cache);
+	AST_TEST_UNREGISTER(route_conflicts);
+	AST_TEST_UNREGISTER(router);
 	return 0;
 }
 
@@ -699,6 +842,8 @@
 	AST_TEST_REGISTER(forward);
 	AST_TEST_REGISTER(cache_passthrough);
 	AST_TEST_REGISTER(cache);
+	AST_TEST_REGISTER(route_conflicts);
+	AST_TEST_REGISTER(router);
 	return AST_MODULE_LOAD_SUCCESS;
 }
 




More information about the asterisk-commits mailing list