[svn-commits] file: branch file/bridging r172703 - in /team/file/bridging: bridges/ include...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sat Jan 31 08:47:26 CST 2009


Author: file
Date: Sat Jan 31 08:47:26 2009
New Revision: 172703

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=172703
Log:
Take care of some review comments from Michelson. Don't let bridge_softmix load if timing is unavailable. Some code clean up and log message changes.

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

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=172703&r1=172702&r2=172703
==============================================================================
--- team/file/bridging/bridges/bridge_softmix.c (original)
+++ team/file/bridging/bridges/bridge_softmix.c Sat Jan 31 08:47:26 2009
@@ -280,6 +280,15 @@
 
 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/include/asterisk/bridging.h
URL: http://svn.digium.com/svn-view/asterisk/team/file/bridging/include/asterisk/bridging.h?view=diff&rev=172703&r1=172702&r2=172703
==============================================================================
--- team/file/bridging/include/asterisk/bridging.h (original)
+++ team/file/bridging/include/asterisk/bridging.h Sat Jan 31 08:47:26 2009
@@ -144,11 +144,16 @@
 typedef int (*ast_bridge_features_hook_callback)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt);
 
 /*!
+ * \brief Maximum length of a DTMF feature string
+ */
+#define MAXIMUM_DTMF_FEATURE_STRING 8
+	
+/*!
  * \brief Structure that is the essence of a features hook
  */
 struct ast_bridge_features_hook {
 	/*! DTMF String that is examined during a feature hook lookup */
-	char dtmf[8];
+	char dtmf[MAXIMUM_DTMF_FEATURE_STRING];
 	/*! Callback that is called when DTMF string is matched */
 	ast_bridge_features_hook_callback callback;
 	/*! Unique data that was passed into us */
@@ -288,7 +293,7 @@
  * ast_bridge_destroy(bridge);
  * \endcode
  *
- * This destroys a bridge that was previously created used ast_bridge_new.
+ * This destroys a bridge that was previously created using ast_bridge_new.
  */
 int ast_bridge_destroy(struct ast_bridge *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=172703&r1=172702&r2=172703
==============================================================================
--- team/file/bridging/main/bridging.c (original)
+++ team/file/bridging/main/bridging.c Sat Jan 31 08:47:26 2009
@@ -44,9 +44,6 @@
 
 static AST_RWLIST_HEAD_STATIC(bridge_technologies, ast_bridge_technology);
 
-/* Maximum length of a DTMF feature string */
-#define MAXIMUM_DTMF_FEATURE_STRING 8
-
 /* Initial starting point for the bridge array of channels */
 #define BRIDGE_ARRAY_START 128
 
@@ -158,7 +155,7 @@
 
 	bridge->array[bridge->array_num++] = chan;
 
-	ast_debug(1, "Added channel %p to bridge array on %p, new count is %d\n", chan, bridge, (int)bridge->array_num);
+	ast_debug(1, "Added channel %s(%p) to bridge array on %p, new count is %d\n", chan->name, chan, bridge, (int)bridge->array_num);
 
 	/* If the next addition of a channel will exceed our array size grow it out */
 	if (bridge->array_num == bridge->array_size) {
@@ -565,6 +562,11 @@
 		new_capabilities = AST_BRIDGE_CAPABILITY_1TO1MIX;
 	}
 
+	if (!new_capabilities) {
+		ast_debug(1, "Bridge '%p' has no new capabilities, not performing smart bridge operation.\n", bridge);
+		return 0;
+	}
+	
 	/* Attempt to find a new bridge technology to satisfy the capabilities */
 	if (!(new_technology = find_best_technology(new_capabilities))) {
 		ast_debug(1, "Smart bridge operation was unable to find new bridge technology with capabilities %d to satisfy bridge %p\n", new_capabilities, bridge);
@@ -582,8 +584,8 @@
 		} else {
 			ast_debug(1, "Telling current bridge thread for bridge %p to stop\n", bridge);
 			bridge->stop = 1;
-			pthread_kill(bridge->thread, SIGURG);
-		}
+		}
+		bridge_poke(bridge);
 	}
 
 	/* Since we are soon going to pass this bridge to a new technology we need to NULL out the bridge_pvt pointer but don't worry as it still exists in temp_bridge, ditto for the old technology */
@@ -712,11 +714,14 @@
 
 	/* Wait for DTMF on the channel and put it into a buffer. If the buffer matches any feature hook execute the hook. */
 	while (look_for_dtmf) {
-		int res = ast_waitfordigit(bridge_channel->chan, 500);
+		int res = ast_waitfordigit(bridge_channel->chan, 3000);
 
 		/* If the above timed out simply exit */
-		if (res < 1) {
+		if (!res) {
 			ast_debug(1, "DTMF feature string collection on bridge channel %p timed out\n", bridge_channel);
+			break;
+		} else if (res < 0) {
+			ast_debug(1, "DTMF feature string collection failed on bridge channel %p for some reason\n", bridge_channel);
 			break;
 		}
 




More information about the svn-commits mailing list