[asterisk-commits] file: branch file/bridging r66227 - in /team/file/bridging: bridges/ include/...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat May 26 12:47:56 MST 2007


Author: file
Date: Sat May 26 14:47:56 2007
New Revision: 66227

URL: http://svn.digium.com/view/asterisk?view=rev&rev=66227
Log:
Add preference levels for bridge technologies.

Modified:
    team/file/bridging/bridges/bridge_simple.c
    team/file/bridging/bridges/bridge_softmix.c
    team/file/bridging/bridges/bridge_zaptel.c
    team/file/bridging/include/asterisk/bridging.h
    team/file/bridging/main/bridging.c

Modified: team/file/bridging/bridges/bridge_simple.c
URL: http://svn.digium.com/view/asterisk/team/file/bridging/bridges/bridge_simple.c?view=diff&rev=66227&r1=66226&r2=66227
==============================================================================
--- team/file/bridging/bridges/bridge_simple.c (original)
+++ team/file/bridging/bridges/bridge_simple.c Sat May 26 14:47:56 2007
@@ -77,6 +77,7 @@
 static struct ast_bridge_technology simple_bridge = {
 	.name = "simple_bridge",
 	.capabilities = AST_BRIDGE_CAPABILITY_1TO1MIX | AST_BRIDGE_CAPABILITY_NATIVE,
+	.preference = AST_BRIDGE_PREFERENCE_HIGH,
 	.formats = AST_FORMAT_AUDIO_MASK | AST_FORMAT_VIDEO_MASK | AST_FORMAT_TEXT_MASK,
 	.join = simple_bridge_join,
 	.write = simple_bridge_write,

Modified: team/file/bridging/bridges/bridge_softmix.c
URL: http://svn.digium.com/view/asterisk/team/file/bridging/bridges/bridge_softmix.c?view=diff&rev=66227&r1=66226&r2=66227
==============================================================================
--- team/file/bridging/bridges/bridge_softmix.c (original)
+++ team/file/bridging/bridges/bridge_softmix.c Sat May 26 14:47:56 2007
@@ -102,6 +102,7 @@
 static struct ast_bridge_technology softmix_bridge = {
 	.name = "softmix",
 	.capabilities = AST_BRIDGE_CAPABILITY_MULTIMIX,
+	.preference = AST_BRIDGE_PREFERENCE_LOW,
 	.formats = AST_FORMAT_SLINEAR,
 	.create = softmix_bridge_create,
 	.destroy = softmix_bridge_destroy,

Modified: team/file/bridging/bridges/bridge_zaptel.c
URL: http://svn.digium.com/view/asterisk/team/file/bridging/bridges/bridge_zaptel.c?view=diff&rev=66227&r1=66226&r2=66227
==============================================================================
--- team/file/bridging/bridges/bridge_zaptel.c (original)
+++ team/file/bridging/bridges/bridge_zaptel.c Sat May 26 14:47:56 2007
@@ -197,6 +197,7 @@
 static struct ast_bridge_technology zaptel_bridge = {
 	.name = "zaptel_bridge",
 	.capabilities = AST_BRIDGE_CAPABILITY_MULTIMIX,
+	.preference = AST_BRIDGE_PREFERENCE_HIGH,
 	.formats = AST_FORMAT_SLINEAR,
 	.create = zaptel_bridge_create,
 	.destroy = zaptel_bridge_destroy,

Modified: team/file/bridging/include/asterisk/bridging.h
URL: http://svn.digium.com/view/asterisk/team/file/bridging/include/asterisk/bridging.h?view=diff&rev=66227&r1=66226&r2=66227
==============================================================================
--- team/file/bridging/include/asterisk/bridging.h (original)
+++ team/file/bridging/include/asterisk/bridging.h Sat May 26 14:47:56 2007
@@ -35,6 +35,13 @@
 	AST_BRIDGE_CAPABILITY_NATIVE = (1 << 1),   /*! Bridge can natively bridge two channels */
 };
 
+/*! \brief Preference for choosing the bridge technology */
+enum ast_bridge_preference {
+	AST_BRIDGE_PREFERENCE_HIGH = 0, /*! Strongly prefer this bridge technology when compared to others */
+	AST_BRIDGE_PREFERENCE_MEDIUM,   /*! Meh, middle - this isn't great but this isn't the best */
+	AST_BRIDGE_PREFERENCE_LOW,      /*! Only use this bridge technology as a last resort */
+};
+
 /*! \brief Flags used to notify the bridge thread of things */
 enum ast_bridge_notify_flags {
 	AST_BRIDGE_NOTIFY_REBUILD = (1 << 0), /*! Someone wants us to rebuild the bridge a bit */
@@ -60,6 +67,7 @@
 struct ast_bridge_technology {
 	const char *name;                                                                                             /*! Unique name to this bridge technology */
 	int capabilities;                                                                                             /*! What this bridge technology is capable of */
+	enum ast_bridge_preference preference;                                                                        /*! Preference level of this bridge technology */
 	int (*create)(struct ast_bridge *bridge);                                                                     /*! Callback for when a bridge is created */
 	int (*destroy)(struct ast_bridge *bridge);                                                                    /*! Callback for when a bridge is destroyed */
 	int (*join)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);                            /*! Callback for when a channel joins a bridge */

Modified: team/file/bridging/main/bridging.c
URL: http://svn.digium.com/view/asterisk/team/file/bridging/main/bridging.c?view=diff&rev=66227&r1=66226&r2=66227
==============================================================================
--- team/file/bridging/main/bridging.c (original)
+++ team/file/bridging/main/bridging.c Sat May 26 14:47:56 2007
@@ -221,6 +221,8 @@
 			ast_log(LOG_DEBUG, "Bridge technology %s has capabilities %d and we want %d\n", current->name, current->capabilities, capabilities);
 		if (!(current->capabilities & capabilities))
 			continue;
+		if (best && best->preference < current->preference)
+			continue;
 		best = current;
 	}
 	AST_RWLIST_UNLOCK(&bridge_technologies);



More information about the asterisk-commits mailing list