[asterisk-commits] file: branch file/bridge_native r388162 - in /team/file/bridge_native: ./ app...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 9 05:42:49 CDT 2013


Author: file
Date: Thu May  9 05:42:40 2013
New Revision: 388162

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=388162
Log:
Multiple revisions 388109,388115

........
  r388109 | rmudgett | 2013-05-09 00:33:50 -0300 (Thu, 09 May 2013) | 2 lines
  
  Rework smart bridge technology selection and bridge preference priority.
........
  r388115 | root | 2013-05-09 01:17:38 -0300 (Thu, 09 May 2013) | 69 lines
  
  Multiple revisions 388110,388113
  
  ........
    r388110 | elguero | 2013-05-08 22:35:25 -0500 (Wed, 08 May 2013) | 26 lines
    
    Fix Segfault In app_queue When "persistentmembers" Is Enabled And Using Realtime
    
    When the "ignorebusy" setting was deprecated, we added some code to allow us to
    be compatible with older setups that are still using the "ignorebusy" setting
    instead of "ringinuse".  We set a char *variable with the column name to use,
    which helps the realtime functions to use the correct column in their SQL
    queries.  When "persistentmembers" is enabled, we are not setting this variable
    before the realtime functions were called to load members.  This results in the
    variable being NULL and therefore causing a segfault when loading members during
    the module's process of loading.
    
    The solution was to move the code that sets that variable to be before these
    realtime functions are called during the loading of the module.
    
    (closes issue ASTERISK-21738)
    Reported by: JoshE
    Tested by: JoshE
    Patches:
        asterisk-21738-rt-ringinuse-field-not-set.diff
                                         uploaded by Michael L. Young (license 5026)
    
    Review: https://reviewboard.asterisk.org/r/2499/
    ........
    
    Merged revisions 388108 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
    r388113 | elguero | 2013-05-08 23:11:59 -0500 (Wed, 08 May 2013) | 33 lines
    
    Fix The Payload Being Set On CN Packets And Do Not Set Marker Bit
    
    When we send out a CN packet (for instance, in the case of using rtpkeepalives),
    we are not setting the payload code properly.  Also, we are setting the marker
    bit when we shouldn't be according to RFC 3389, section 4.
    
    AST_RTP_CN is not defined by AST_FORMAT codes.  Therefore, we should be using
    ast_rtp_codecs_payload_code() rather than ast_rtp_codecs_payload_lookup().
    
    11 and trunk already use the appropriate function.
    
    * In 1.8, use ast_rtp_codecs_payload_code()
    
    * Remove the setting of the marker bit
    
    * Fix the debug message by incrementing the seqno after the debug message is set
      in order to display the correct seqno that was sent out
    
    (closes issue ASTERISK-21246)
    Reported by: Peter Katzmann
    Tested by: Peter Katzmann, Michael L. Young
    Patches:
        asterisk-21246-rtp-cng-payload-error_1.8_v2.diff
                                         uploaded by Michael L. Young (license 5026)
    
    Review: https://reviewboard.asterisk.org/r/2500/
    ........
    
    Merged revisions 388111 from http://svn.asterisk.org/svn/asterisk/branches/1.8
    ........
    
    Merged revisions 388112 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 388110,388113 from file:///srv/subversion/repos/asterisk/trunk
........

Merged revisions 388109,388115 from http://svn.asterisk.org/svn/asterisk/team/group/bridge_construction

Modified:
    team/file/bridge_native/   (props changed)
    team/file/bridge_native/apps/app_queue.c
    team/file/bridge_native/bridges/bridge_builtin_features.c
    team/file/bridge_native/bridges/bridge_holding.c
    team/file/bridge_native/bridges/bridge_native_rtp.c
    team/file/bridge_native/bridges/bridge_simple.c
    team/file/bridge_native/bridges/bridge_softmix.c
    team/file/bridge_native/include/asterisk/bridging.h
    team/file/bridge_native/include/asterisk/bridging_technology.h
    team/file/bridge_native/main/bridging.c
    team/file/bridge_native/main/bridging_basic.c
    team/file/bridge_native/res/res_rtp_asterisk.c

Propchange: team/file/bridge_native/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/file/bridge_native/
------------------------------------------------------------------------------
--- bridge_construction-integrated (original)
+++ bridge_construction-integrated Thu May  9 05:42:40 2013
@@ -1,1 +1,1 @@
-/trunk:1-388079
+/trunk:1-388114

Propchange: team/file/bridge_native/
------------------------------------------------------------------------------
--- native-integrated (original)
+++ native-integrated Thu May  9 05:42:40 2013
@@ -1,1 +1,1 @@
-/team/group/bridge_construction:1-388100
+/team/group/bridge_construction:1-388161

Modified: team/file/bridge_native/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/file/bridge_native/apps/app_queue.c?view=diff&rev=388162&r1=388161&r2=388162
==============================================================================
--- team/file/bridge_native/apps/app_queue.c (original)
+++ team/file/bridge_native/apps/app_queue.c Thu May  9 05:42:40 2013
@@ -9915,6 +9915,31 @@
 	if (reload_handler(0, &mask, NULL))
 		return AST_MODULE_LOAD_DECLINE;
 
+	ast_realtime_require_field("queue_members", "paused", RQ_INTEGER1, 1, "uniqueid", RQ_UINTEGER2, 5, SENTINEL);
+
+	/*
+	 * This section is used to determine which name for 'ringinuse' to use in realtime members
+	 * Necessary for supporting older setups.
+	 */
+	member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name LIKE", "%", SENTINEL);
+	if (!member_config) {
+		realtime_ringinuse_field = "ringinuse";
+	} else {
+		const char *config_val;
+		if ((config_val = ast_variable_retrieve(member_config, NULL, "ringinuse"))) {
+			ast_log(LOG_NOTICE, "ringinuse field entries found in queue_members table. Using 'ringinuse'\n");
+			realtime_ringinuse_field = "ringinuse";
+		} else if ((config_val = ast_variable_retrieve(member_config, NULL, "ignorebusy"))) {
+			ast_log(LOG_NOTICE, "ignorebusy field found in queue_members table with no ringinuse field. Using 'ignorebusy'\n");
+			realtime_ringinuse_field = "ignorebusy";
+		} else {
+			ast_log(LOG_NOTICE, "No entries were found for ringinuse/ignorebusy in queue_members table. Using 'ringinuse'\n");
+			realtime_ringinuse_field = "ringinuse";
+		}
+	}
+
+	ast_config_destroy(member_config);
+
 	if (queue_persistent_members)
 		reload_queue_members();
 
@@ -9954,31 +9979,6 @@
 
 	ast_extension_state_add(NULL, NULL, extension_state_cb, NULL);
 
-	ast_realtime_require_field("queue_members", "paused", RQ_INTEGER1, 1, "uniqueid", RQ_UINTEGER2, 5, SENTINEL);
-
-	/*
-	 * This section is used to determine which name for 'ringinuse' to use in realtime members
-	 * Necessary for supporting older setups.
-	 */
-	member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name LIKE", "%", SENTINEL);
-	if (!member_config) {
-		realtime_ringinuse_field = "ringinuse";
-	} else {
-		const char *config_val;
-		if ((config_val = ast_variable_retrieve(member_config, NULL, "ringinuse"))) {
-			ast_log(LOG_NOTICE, "ringinuse field entries found in queue_members table. Using 'ringinuse'\n");
-			realtime_ringinuse_field = "ringinuse";
-		} else if ((config_val = ast_variable_retrieve(member_config, NULL, "ignorebusy"))) {
-			ast_log(LOG_NOTICE, "ignorebusy field found in queue_members table with no ringinuse field. Using 'ignorebusy'\n");
-			realtime_ringinuse_field = "ignorebusy";
-		} else {
-			ast_log(LOG_NOTICE, "No entries were found for ringinuse/ignorebusy in queue_members table. Using 'ringinuse'\n");
-			realtime_ringinuse_field = "ringinuse";
-		}
-	}
-
-	ast_config_destroy(member_config);
-
 	return res ? AST_MODULE_LOAD_DECLINE : 0;
 }
 

Modified: team/file/bridge_native/bridges/bridge_builtin_features.c
URL: http://svnview.digium.com/svn/asterisk/team/file/bridge_native/bridges/bridge_builtin_features.c?view=diff&rev=388162&r1=388161&r2=388162
==============================================================================
--- team/file/bridge_native/bridges/bridge_builtin_features.c (original)
+++ team/file/bridge_native/bridges/bridge_builtin_features.c Thu May  9 05:42:40 2013
@@ -308,8 +308,7 @@
 	}
 
 	/* Create a bridge to use to talk to the person we are calling */
-	attended_bridge = ast_bridge_base_new(
-		AST_BRIDGE_CAPABILITY_NATIVE | AST_BRIDGE_CAPABILITY_1TO1MIX,
+	attended_bridge = ast_bridge_base_new(AST_BRIDGE_CAPABILITY_1TO1MIX,
 		AST_BRIDGE_FLAG_DISSOLVE_HANGUP);
 	if (!attended_bridge) {
 		ast_bridge_features_cleanup(&caller_features);

Modified: team/file/bridge_native/bridges/bridge_holding.c
URL: http://svnview.digium.com/svn/asterisk/team/file/bridge_native/bridges/bridge_holding.c?view=diff&rev=388162&r1=388161&r2=388162
==============================================================================
--- team/file/bridge_native/bridges/bridge_holding.c (original)
+++ team/file/bridge_native/bridges/bridge_holding.c Thu May  9 05:42:40 2013
@@ -283,7 +283,7 @@
 static struct ast_bridge_technology holding_bridge = {
 	.name = "holding_bridge",
 	.capabilities = AST_BRIDGE_CAPABILITY_HOLDING,
-	.preference = AST_BRIDGE_PREFERENCE_MEDIUM,
+	.preference = AST_BRIDGE_PREFERENCE_BASE_HOLDING,
 	.write = holding_bridge_write,
 	.join = holding_bridge_join,
 	.leave = holding_bridge_leave,

Modified: team/file/bridge_native/bridges/bridge_native_rtp.c
URL: http://svnview.digium.com/svn/asterisk/team/file/bridge_native/bridges/bridge_native_rtp.c?view=diff&rev=388162&r1=388161&r2=388162
==============================================================================
--- team/file/bridge_native/bridges/bridge_native_rtp.c (original)
+++ team/file/bridge_native/bridges/bridge_native_rtp.c Thu May  9 05:42:40 2013
@@ -373,8 +373,8 @@
 
 static struct ast_bridge_technology native_rtp_bridge = {
 	.name = "native_rtp",
-	.capabilities = AST_BRIDGE_CAPABILITY_1TO1MIX | AST_BRIDGE_CAPABILITY_NATIVE,
-	.preference = AST_BRIDGE_PREFERENCE_HIGH,
+	.capabilities = AST_BRIDGE_CAPABILITY_NATIVE,
+	.preference = AST_BRIDGE_PREFERENCE_BASE_NATIVE,
 	.join = native_rtp_bridge_join,
 	.unsuspend = native_rtp_bridge_unsuspend,
 	.leave = native_rtp_bridge_leave,

Modified: team/file/bridge_native/bridges/bridge_simple.c
URL: http://svnview.digium.com/svn/asterisk/team/file/bridge_native/bridges/bridge_simple.c?view=diff&rev=388162&r1=388161&r2=388162
==============================================================================
--- team/file/bridge_native/bridges/bridge_simple.c (original)
+++ team/file/bridge_native/bridges/bridge_simple.c Thu May  9 05:42:40 2013
@@ -85,7 +85,7 @@
 static struct ast_bridge_technology simple_bridge = {
 	.name = "simple_bridge",
 	.capabilities = AST_BRIDGE_CAPABILITY_1TO1MIX,
-	.preference = AST_BRIDGE_PREFERENCE_MEDIUM,
+	.preference = AST_BRIDGE_PREFERENCE_BASE_1TO1MIX,
 	.join = simple_bridge_join,
 	.write = simple_bridge_write,
 };

Modified: team/file/bridge_native/bridges/bridge_softmix.c
URL: http://svnview.digium.com/svn/asterisk/team/file/bridge_native/bridges/bridge_softmix.c?view=diff&rev=388162&r1=388161&r2=388162
==============================================================================
--- team/file/bridge_native/bridges/bridge_softmix.c (original)
+++ team/file/bridge_native/bridges/bridge_softmix.c Thu May  9 05:42:40 2013
@@ -1091,7 +1091,7 @@
 static struct ast_bridge_technology softmix_bridge = {
 	.name = "softmix",
 	.capabilities = AST_BRIDGE_CAPABILITY_MULTIMIX,
-	.preference = AST_BRIDGE_PREFERENCE_LOW,
+	.preference = AST_BRIDGE_PREFERENCE_BASE_MULTIMIX,
 	.create = softmix_bridge_create,
 	.destroy = softmix_bridge_destroy,
 	.join = softmix_bridge_join,

Modified: team/file/bridge_native/include/asterisk/bridging.h
URL: http://svnview.digium.com/svn/asterisk/team/file/bridge_native/include/asterisk/bridging.h?view=diff&rev=388162&r1=388161&r2=388162
==============================================================================
--- team/file/bridge_native/include/asterisk/bridging.h (original)
+++ team/file/bridge_native/include/asterisk/bridging.h Thu May  9 05:42:40 2013
@@ -76,15 +76,15 @@
 
 /*! \brief Capabilities for a bridge technology */
 enum ast_bridge_capability {
-	/*! Bridge technology can service calls on hold */
+	/*! Bridge technology can service calls on hold. */
 	AST_BRIDGE_CAPABILITY_HOLDING = (1 << 0),
-	/*! Bridge waits for channel to answer.  Passes early media. */
+	/*! Bridge waits for channel to answer.  Passes early media. (XXX Not supported yet) */
 	AST_BRIDGE_CAPABILITY_EARLY = (1 << 1),
-	/*! Bridge should natively bridge two channels if possible */
+	/*! Bridge is capable of natively bridging two channels. (Smart bridge only) */
 	AST_BRIDGE_CAPABILITY_NATIVE = (1 << 2),
-	/*! Bridge is only capable of mixing 2 channels */
+	/*! Bridge is capable of mixing at most two channels. (Smart bridgeable) */
 	AST_BRIDGE_CAPABILITY_1TO1MIX = (1 << 3),
-	/*! Bridge is capable of mixing 2 or more channels */
+	/*! Bridge is capable of mixing an arbitrary number of channels. (Smart bridgeable) */
 	AST_BRIDGE_CAPABILITY_MULTIMIX = (1 << 4),
 };
 
@@ -404,6 +404,8 @@
 	struct ast_bridge_video_mode video_mode;
 	/*! Bridge flags to tweak behavior */
 	struct ast_flags feature_flags;
+	/*! Allowed bridge technology capabilities when AST_BRIDGE_FLAG_SMART enabled. */
+	uint32_t allowed_capabilities;
 	/*! Number of channels participating in the bridge */
 	unsigned int num_channels;
 	/*! Number of active channels in the bridge. */
@@ -572,25 +574,6 @@
 	} while (0)
 
 /*!
- * \brief See if it is possible to create a bridge
- *
- * \param capabilities The capabilities that the bridge will use
- *
- * \retval 1 if possible
- * \retval 0 if not possible
- *
- * Example usage:
- *
- * \code
- * int possible = ast_bridge_check(AST_BRIDGE_CAPABILITY_1TO1MIX);
- * \endcode
- *
- * This sees if it is possible to create a bridge capable of bridging two channels
- * together.
- */
-int ast_bridge_check(uint32_t capabilities);
-
-/*!
  * \brief Destroy a bridge
  *
  * \param bridge Bridge to destroy

Modified: team/file/bridge_native/include/asterisk/bridging_technology.h
URL: http://svnview.digium.com/svn/asterisk/team/file/bridge_native/include/asterisk/bridging_technology.h?view=diff&rev=388162&r1=388161&r2=388162
==============================================================================
--- team/file/bridge_native/include/asterisk/bridging_technology.h (original)
+++ team/file/bridge_native/include/asterisk/bridging_technology.h Thu May  9 05:42:40 2013
@@ -28,14 +28,17 @@
 extern "C" {
 #endif
 
-/*! \brief Preference for choosing the bridge technology */
+/*!
+ * \brief Base preference values for choosing a bridge technology.
+ *
+ * \note Higher is more preference.
+ */
 enum ast_bridge_preference {
-	/*! Bridge technology should have high precedence over other bridge technologies */
-	AST_BRIDGE_PREFERENCE_HIGH = 0,
-	/*! Bridge technology is decent, not the best but should still be considered over low */
-	AST_BRIDGE_PREFERENCE_MEDIUM,
-	/*! Bridge technology is low, it should not be considered unless it is absolutely needed */
-	AST_BRIDGE_PREFERENCE_LOW,
+	AST_BRIDGE_PREFERENCE_BASE_HOLDING  = 50,
+	AST_BRIDGE_PREFERENCE_BASE_EARLY    = 100,
+	AST_BRIDGE_PREFERENCE_BASE_NATIVE   = 90,
+	AST_BRIDGE_PREFERENCE_BASE_1TO1MIX  = 50,
+	AST_BRIDGE_PREFERENCE_BASE_MULTIMIX = 10,
 };
 
 /*!

Modified: team/file/bridge_native/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/file/bridge_native/main/bridging.c?view=diff&rev=388162&r1=388161&r2=388162
==============================================================================
--- team/file/bridge_native/main/bridging.c (original)
+++ team/file/bridge_native/main/bridging.c Thu May  9 05:42:40 2013
@@ -1014,7 +1014,7 @@
 	}
 }
 
-/*! \brief Helper function used to find the "best" bridge technology given a specified capabilities */
+/*! \brief Helper function used to find the "best" bridge technology given specified capabilities */
 static struct ast_bridge_technology *find_best_technology(uint32_t capabilities, struct ast_bridge *bridge)
 {
 	struct ast_bridge_technology *current;
@@ -1027,19 +1027,19 @@
 				current->name);
 			continue;
 		}
-		if ((current->capabilities & capabilities) != capabilities) {
-			ast_debug(1, "Bridge technology %s does not have the capabilities we need.\n",
+		if (!(current->capabilities & capabilities)) {
+			ast_debug(1, "Bridge technology %s does not have any capabilities we want.\n",
 				current->name);
 			continue;
 		}
-		if (bridge && current->compatible && !current->compatible(bridge)) {
+		if (best && current->preference <= best->preference) {
+			ast_debug(1, "Bridge technology %s has less preference than %s (%d <= %d). Skipping.\n",
+				current->name, best->name, current->preference, best->preference);
+			continue;
+		}
+		if (current->compatible && !current->compatible(bridge)) {
 			ast_debug(1, "Bridge technology %s is not compatible with properties of existing bridge.\n",
 				current->name);
-			continue;
-		}
-		if (best && best->preference < current->preference) {
-			ast_debug(1, "Bridge technology %s has preference %d while %s has preference %d. Skipping.\n",
-				current->name, current->preference, best->name, best->preference);
 			continue;
 		}
 		best = current;
@@ -1244,25 +1244,13 @@
 
 	ast_uuid_generate_str(self->uniqueid, sizeof(self->uniqueid));
 	ast_set_flag(&self->feature_flags, flags);
-
-	/* If we need to be a smart bridge see if we can move between 1to1 and multimix bridges */
-	if (flags & AST_BRIDGE_FLAG_SMART) {
-		if (!ast_bridge_check((capabilities & AST_BRIDGE_CAPABILITY_1TO1MIX)
-			? AST_BRIDGE_CAPABILITY_MULTIMIX : AST_BRIDGE_CAPABILITY_1TO1MIX)) {
-			ao2_ref(self, -1);
-			return NULL;
-		}
-	}
-
-	/*
-	 * 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.
-	 */
-	self->technology = capabilities
-		? find_best_technology(capabilities, NULL)
-		: find_best_technology(AST_BRIDGE_CAPABILITY_1TO1MIX, NULL);
+	self->allowed_capabilities = capabilities;
+
+	/* Use our helper function to find the "best" bridge technology. */
+	self->technology = find_best_technology(capabilities, self);
 	if (!self->technology) {
+		ast_debug(1, "Bridge %s: Could not create.  No technology available to support it.\n",
+			self->uniqueid);
 		ao2_ref(self, -1);
 		return NULL;
 	}
@@ -1404,19 +1392,6 @@
 	return bridge;
 }
 
-int ast_bridge_check(uint32_t capabilities)
-{
-	struct ast_bridge_technology *bridge_technology;
-
-	if (!(bridge_technology = find_best_technology(capabilities, NULL))) {
-		return 0;
-	}
-
-	ast_module_unref(bridge_technology->mod);
-
-	return 1;
-}
-
 int ast_bridge_destroy(struct ast_bridge *bridge)
 {
 	ast_debug(1, "Bridge %s: telling all channels to leave the party\n", bridge->uniqueid);
@@ -1509,7 +1484,7 @@
  */
 static int smart_bridge_operation(struct ast_bridge *bridge)
 {
-	uint32_t new_capabilities = 0;
+	uint32_t new_capabilities;
 	struct ast_bridge_technology *new_technology;
 	struct ast_bridge_technology *old_technology = bridge->technology;
 	struct ast_bridge_channel *bridge_channel;
@@ -1525,60 +1500,47 @@
 		return 0;
 	}
 
-	/*
-	 * Based on current capabilities determine whether we want to
-	 * change bridge technologies.
-	 */
-	if (bridge->technology->compatible && bridge->technology->compatible(bridge)) {
-		/* Circumstances have changed and the bridging technology is no longer able to
-		 * bridge the channels. By simply using the capabilities as presented on the
-		 * technology we will naturally find, and skip, this technology during our check.
-		 */
-		new_capabilities = bridge->technology->capabilities;
-	} else if (bridge->technology->capabilities & AST_BRIDGE_CAPABILITY_1TO1MIX) {
-		if (bridge->num_channels <= 2) {
-			/* If we start out as a generic 1to1mix technology try to migrate to native for performance reasons */
-			new_capabilities = AST_BRIDGE_CAPABILITY_1TO1MIX | AST_BRIDGE_CAPABILITY_NATIVE;
-		} else {
-			new_capabilities = AST_BRIDGE_CAPABILITY_MULTIMIX | AST_BRIDGE_CAPABILITY_NATIVE;
-		}
-	} else if (bridge->technology->capabilities & AST_BRIDGE_CAPABILITY_MULTIMIX) {
-		if (2 < bridge->num_channels) {
-			new_capabilities = AST_BRIDGE_CAPABILITY_MULTIMIX | AST_BRIDGE_CAPABILITY_NATIVE;
-		} else {
-			new_capabilities = AST_BRIDGE_CAPABILITY_1TO1MIX | AST_BRIDGE_CAPABILITY_NATIVE;
-		}
-	}
-
-	if (!new_capabilities) {
-		ast_debug(1, "Bridge %s has no new capabilities, not performing smart bridge operation.\n",
-			bridge->uniqueid);
-		return 0;
-	}
-
-	/* Attempt to find a new bridge technology to satisfy the capabilities */
+	/* Determine new bridge technology capabilities needed. */
+	if (2 < bridge->num_channels) {
+		new_capabilities = AST_BRIDGE_CAPABILITY_MULTIMIX;
+		new_capabilities &= bridge->allowed_capabilities;
+	} else {
+		new_capabilities = AST_BRIDGE_CAPABILITY_NATIVE | AST_BRIDGE_CAPABILITY_1TO1MIX;
+		new_capabilities &= bridge->allowed_capabilities;
+		if (!new_capabilities
+			&& (bridge->allowed_capabilities & AST_BRIDGE_CAPABILITY_MULTIMIX)) {
+			/* Allow switching between different multimix bridge technologies. */
+			new_capabilities = AST_BRIDGE_CAPABILITY_MULTIMIX;
+		}
+	}
+
+	/* Find a bridge technology to satisfy the new capabilities. */
 	new_technology = find_best_technology(new_capabilities, bridge);
 	if (!new_technology) {
-		/* We favor native bridging if possible but if not then move on without it */
-		new_capabilities &= ~AST_BRIDGE_CAPABILITY_NATIVE;
-		new_technology = find_best_technology(new_capabilities, bridge);
-	}
-
-	if (!new_technology) {
-		if (bridge->technology->capabilities & AST_BRIDGE_CAPABILITY_MULTIMIX) {
-			ast_debug(1, "Bridge %s could not get a new bridge technology, staying with old technology.\n",
+		int is_compatible = 0;
+
+		if (old_technology->compatible) {
+			is_compatible = old_technology->compatible(bridge);
+		} else if (old_technology->capabilities & AST_BRIDGE_CAPABILITY_MULTIMIX) {
+			is_compatible = 1;
+		} else if (bridge->num_channels <= 2
+			&& (old_technology->capabilities & AST_BRIDGE_CAPABILITY_1TO1MIX)) {
+			is_compatible = 1;
+		}
+
+		if (is_compatible) {
+			ast_debug(1, "Bridge %s could not get a new technology, staying with old technology.\n",
 				bridge->uniqueid);
 			return 0;
 		}
-		ast_log(LOG_WARNING, "Bridge %s has no bridge technology available to support it\n",
+		ast_log(LOG_WARNING, "Bridge %s has no technology available to support it.\n",
 			bridge->uniqueid);
 		return -1;
 	}
-
-	if (new_technology == bridge->technology) {
-		ast_debug(1, "Bridge %s is using existing technology.\n",
+	if (new_technology == old_technology) {
+		ast_debug(1, "Bridge %s is already using the new technology.\n",
 			bridge->uniqueid);
-		ast_module_unref(bridge->technology->mod);
+		ast_module_unref(old_technology->mod);
 		return 0;
 	}
 
@@ -2242,13 +2204,13 @@
 		chan = ast_waitfor_nandfds(&bridge_channel->chan, 1,
 			&bridge_channel->alert_pipe[0], 1, NULL, &outfd, &ms);
 		bridge_channel->waiting = 0;
-		if (ast_channel_softhangup_internal_flag(bridge_channel->chan) & AST_SOFTHANGUP_UNBRIDGE) {
+        if (ast_channel_softhangup_internal_flag(bridge_channel->chan) & AST_SOFTHANGUP_UNBRIDGE) {
 			ast_channel_clear_softhangup(bridge_channel->chan, AST_SOFTHANGUP_UNBRIDGE);
 			ast_bridge_channel_lock_bridge(bridge_channel);
 			bridge_channel->bridge->reconfigured = 1;
 			bridge_reconfigured(bridge_channel->bridge);
 			ast_bridge_unlock(bridge_channel->bridge);
-		}
+        }
 		ast_bridge_channel_lock(bridge_channel);
 		bridge_channel->activity = AST_BRIDGE_CHANNEL_THREAD_FRAME;
 		ast_bridge_channel_unlock(bridge_channel);
@@ -3327,7 +3289,8 @@
 	}
 	if (2 + num_kick < merge.dest->num_channels + merge.src->num_channels
 		&& !(merge.dest->technology->capabilities & AST_BRIDGE_CAPABILITY_MULTIMIX)
-		&& !ast_test_flag(&merge.dest->feature_flags, AST_BRIDGE_FLAG_SMART)) {
+		&& (!ast_test_flag(&merge.dest->feature_flags, AST_BRIDGE_FLAG_SMART)
+			|| !(merge.dest->allowed_capabilities & AST_BRIDGE_CAPABILITY_MULTIMIX))) {
 		ast_debug(1, "Can't merge bridge %s into bridge %s, multimix is needed and it cannot be acquired.\n",
 			merge.src->uniqueid, merge.dest->uniqueid);
 		return -1;
@@ -3760,7 +3723,8 @@
 			merge.src->uniqueid);
 	} else if ((2 + 2) < merge.dest->num_channels + merge.src->num_channels
 		&& !(merge.dest->technology->capabilities & AST_BRIDGE_CAPABILITY_MULTIMIX)
-		&& !ast_test_flag(&merge.dest->feature_flags, AST_BRIDGE_FLAG_SMART)) {
+		&& (!ast_test_flag(&merge.dest->feature_flags, AST_BRIDGE_FLAG_SMART)
+			|| !(merge.dest->allowed_capabilities & AST_BRIDGE_CAPABILITY_MULTIMIX))) {
 		ast_debug(4, "Can't optimize %s -- %s out, multimix is needed and it cannot be acquired.\n",
 			ast_channel_name(chan_bridge_channel->chan),
 			ast_channel_name(peer_bridge_channel->chan));
@@ -5196,29 +5160,10 @@
 	return type;
 }
 
-/*! Bridge technology priority preference to string. */
-static const char *tech_preference2str(enum ast_bridge_preference preference)
-{
-	const char *priority;
-
-	priority = "<Unknown>";
-	switch (preference) {
-	case AST_BRIDGE_PREFERENCE_HIGH:
-		priority = "High";
-		break;
-	case AST_BRIDGE_PREFERENCE_MEDIUM:
-		priority = "Medium";
-		break;
-	case AST_BRIDGE_PREFERENCE_LOW:
-		priority = "Low";
-		break;
-	}
-	return priority;
-}
-
 static char *handle_bridge_technology_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
-#define FORMAT "%-20s %-20s %-10s %s\n"
+#define FORMAT_HDR "%-20s %-20s %8s %s\n"
+#define FORMAT_ROW "%-20s %-20s %8d %s\n"
 
 	struct ast_bridge_technology *cur;
 
@@ -5233,19 +5178,16 @@
 		return NULL;
 	}
 
-	ast_cli(a->fd, FORMAT, "Name", "Type", "Priority", "Suspended");
+	ast_cli(a->fd, FORMAT_HDR, "Name", "Type", "Priority", "Suspended");
 	AST_RWLIST_RDLOCK(&bridge_technologies);
 	AST_RWLIST_TRAVERSE(&bridge_technologies, cur, entry) {
 		const char *type;
-		const char *priority;
 
 		/* Decode type for display */
 		type = tech_capability2str(cur->capabilities);
 
-		/* Decode priority preference for display */
-		priority = tech_preference2str(cur->preference);
-
-		ast_cli(a->fd, FORMAT, cur->name, type, priority, AST_CLI_YESNO(cur->suspended));
+		ast_cli(a->fd, FORMAT_ROW, cur->name, type, cur->preference,
+			AST_CLI_YESNO(cur->suspended));
 	}
 	AST_RWLIST_UNLOCK(&bridge_technologies);
 	return CLI_SUCCESS;

Modified: team/file/bridge_native/main/bridging_basic.c
URL: http://svnview.digium.com/svn/asterisk/team/file/bridge_native/main/bridging_basic.c?view=diff&rev=388162&r1=388161&r2=388162
==============================================================================
--- team/file/bridge_native/main/bridging_basic.c (original)
+++ team/file/bridge_native/main/bridging_basic.c Thu May  9 05:42:40 2013
@@ -141,8 +141,8 @@
 
 	bridge = ast_bridge_alloc(sizeof(struct ast_bridge), &ast_bridge_basic_v_table);
 	bridge = ast_bridge_base_init(bridge,
-		AST_BRIDGE_CAPABILITY_EARLY | AST_BRIDGE_CAPABILITY_NATIVE
-			| AST_BRIDGE_CAPABILITY_1TO1MIX | AST_BRIDGE_CAPABILITY_MULTIMIX,
+		AST_BRIDGE_CAPABILITY_NATIVE | AST_BRIDGE_CAPABILITY_1TO1MIX
+			| AST_BRIDGE_CAPABILITY_MULTIMIX,
 		AST_BRIDGE_FLAG_DISSOLVE_HANGUP | AST_BRIDGE_FLAG_DISSOLVE_EMPTY
 			| AST_BRIDGE_FLAG_SMART);
 	bridge = ast_bridge_register(bridge);

Modified: team/file/bridge_native/res/res_rtp_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/file/bridge_native/res/res_rtp_asterisk.c?view=diff&rev=388162&r1=388161&r2=388162
==============================================================================
--- team/file/bridge_native/res/res_rtp_asterisk.c (original)
+++ team/file/bridge_native/res/res_rtp_asterisk.c Thu May  9 05:42:40 2013
@@ -4184,8 +4184,7 @@
 {
 	unsigned int *rtpheader;
 	int hdrlen = 12;
-	int res;
-	int payload;
+	int res, payload = 0;
 	char data[256];
 	struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
 	struct ast_sockaddr remote_address = { {0,} };
@@ -4205,7 +4204,7 @@
 
 	/* Get a pointer to the header */
 	rtpheader = (unsigned int *)data;
-	rtpheader[0] = htonl((2 << 30) | (1 << 23) | (payload << 16) | (rtp->seqno++));
+	rtpheader[0] = htonl((2 << 30) | (payload << 16) | (rtp->seqno));
 	rtpheader[1] = htonl(rtp->lastts);
 	rtpheader[2] = htonl(rtp->ssrc); 
 	data[12] = level;
@@ -4225,6 +4224,8 @@
 			    ice ? " (via ICE)" : "",
 			    AST_RTP_CN, rtp->seqno, rtp->lastdigitts, res - hdrlen);
 	}
+
+	rtp->seqno++;
 
 	return res;
 }




More information about the asterisk-commits mailing list