[asterisk-commits] file: branch file/bridging r176097 - in /team/file/bridging: apps/ bridges/ m...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Feb 16 10:41:07 CST 2009


Author: file
Date: Mon Feb 16 10:41:07 2009
New Revision: 176097

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=176097
Log:
Change our tactic a bit so we do not rely on having timing modules loaded before bridge_softmix (which apparently does not happen automatically). Instead when we request a smart bridge do a check to see if it can move to the other type of bridge needed immediately. If that is not possible then no bridge will be returned.

Modified:
    team/file/bridging/apps/app_confbridge.c
    team/file/bridging/bridges/bridge_softmix.c
    team/file/bridging/main/bridging.c

Modified: team/file/bridging/apps/app_confbridge.c
URL: http://svn.digium.com/svn-view/asterisk/team/file/bridging/apps/app_confbridge.c?view=diff&rev=176097&r1=176096&r2=176097
==============================================================================
--- team/file/bridging/apps/app_confbridge.c (original)
+++ team/file/bridging/apps/app_confbridge.c Mon Feb 16 10:41:07 2009
@@ -421,13 +421,6 @@
 
 	/* If no conference bridge was found see if we can create one */
 	if (!conference_bridge) {
-		/* See if it is even possible for us to create a bridge that will go to a multimix if needed */
-		if (!ast_bridge_check(AST_BRIDGE_CAPABILITY_MULTIMIX)) {
-			ao2_unlock(conference_bridges);
-			ast_log(LOG_ERROR, "Conference bridge '%s' could not be created. Bridging core is incapable of going to multi party.\n", name);
-			return NULL;
-		}
-		
 		/* Try to allocate memory for a new conference bridge, if we fail... this won't end well. */
 		if (!(conference_bridge = ao2_alloc(sizeof(*conference_bridge), destroy_conference_bridge))) {
 			ao2_unlock(conference_bridges);

Modified: team/file/bridging/bridges/bridge_softmix.c
URL: http://svn.digium.com/svn-view/asterisk/team/file/bridging/bridges/bridge_softmix.c?view=diff&rev=176097&r1=176096&r2=176097
==============================================================================
--- team/file/bridging/bridges/bridge_softmix.c (original)
+++ team/file/bridging/bridges/bridge_softmix.c Mon Feb 16 10:41:07 2009
@@ -82,6 +82,20 @@
 	short our_buf[SOFTMIX_DATALEN];
 };
 
+/*! \brief Function called when a bridge is created */
+static int softmix_bridge_create(struct ast_bridge *bridge)
+{
+	int timingfd;
+
+	if ((timingfd = ast_timer_open()) < 0) {
+		return -1;
+	}
+
+	ast_timer_close(timingfd);
+
+	return 0;
+}
+
 /*! \brief Function called when a channel is joined into the bridge */
 static int softmix_bridge_join(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
 {
@@ -268,6 +282,7 @@
 #else
 	.formats = AST_FORMAT_SLINEAR,
 #endif
+	.create = softmix_bridge_create,
 	.join = softmix_bridge_join,
 	.leave = softmix_bridge_leave,
 	.write = softmix_bridge_write,
@@ -282,15 +297,6 @@
 
 static int load_module(void)
 {
-	int timingfd;
-
-	if ((timingfd = ast_timer_open()) < 0) {
-		ast_log(LOG_ERROR, "There is no timing module loaded. bridge_softmix can not be loaded without one.\n");
-		return AST_MODULE_LOAD_DECLINE;
-	}
-
-	ast_timer_close(timingfd);
-	
 	return ast_bridge_technology_register(&softmix_bridge);
 }
 

Modified: team/file/bridging/main/bridging.c
URL: http://svn.digium.com/svn-view/asterisk/team/file/bridging/main/bridging.c?view=diff&rev=176097&r1=176096&r2=176097
==============================================================================
--- team/file/bridging/main/bridging.c (original)
+++ team/file/bridging/main/bridging.c Mon Feb 16 10:41:07 2009
@@ -434,6 +434,17 @@
 	struct ast_bridge *bridge = NULL;
 	struct ast_bridge_technology *bridge_technology = NULL;
 
+	/* If we need to be a smart bridge see if we can move between 1to1 and multimix bridges */
+	if (flags & AST_BRIDGE_FLAG_SMART) {
+		struct ast_bridge *other_bridge;
+
+		if (!(other_bridge = ast_bridge_new((capabilities & AST_BRIDGE_CAPABILITY_1TO1MIX) ? AST_BRIDGE_CAPABILITY_MULTIMIX : AST_BRIDGE_CAPABILITY_1TO1MIX, 0))) {
+			return NULL;
+		}
+
+		ast_bridge_destroy(other_bridge);
+	}
+	
 	/* If capabilities were provided use our helper function to find the "best" bridge technology, otherwise we can
 	 * just look for the most basic capability needed, single 1to1 mixing. */
 	bridge_technology = (capabilities ? find_best_technology(capabilities) : find_best_technology(AST_BRIDGE_CAPABILITY_1TO1MIX));




More information about the asterisk-commits mailing list