[asterisk-commits] dvossel: branch dvossel/hd_confbridge r311666 - /team/dvossel/hd_confbridge/a...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 24 15:21:23 CDT 2011


Author: dvossel
Date: Thu Mar 24 15:21:19 2011
New Revision: 311666

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=311666
Log:
Fixes reliablity issues with conference recording

Modified:
    team/dvossel/hd_confbridge/apps/app_confbridge.c

Modified: team/dvossel/hd_confbridge/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/app_confbridge.c?view=diff&rev=311666&r1=311665&r2=311666
==============================================================================
--- team/dvossel/hd_confbridge/apps/app_confbridge.c (original)
+++ team/dvossel/hd_confbridge/apps/app_confbridge.c Thu Mar 24 15:21:19 2011
@@ -300,9 +300,10 @@
 {
 	struct ast_channel *tmp;
 	struct ast_format fmt;
+	const char *conf_name = data;
 	if (!(tmp = ast_channel_alloc(1, AST_STATE_UP, 0, 0, "", "", "", NULL, 0,
-		"ConfBrideRecorder/%d%d",
-		(int) ast_random(),
+		"ConfBrideRecorder/conf-%s-uid-%d",
+		conf_name,
 		(int) ast_random()))) {
 		return NULL;
 	}
@@ -352,12 +353,11 @@
 	pbx_exec(chan, mixmonapp, ast_str_buffer(filename));
 	ast_bridge_join(conference_bridge->bridge, chan, NULL, NULL, NULL);
 
-	chan = ast_channel_unref(chan);
-
 	ao2_lock(conference_bridge);
 	conference_bridge->record_thread = AST_PTHREADT_NULL;
 	ao2_unlock(conference_bridge);
 
+	ast_hangup(chan); /* This will eat this threads reference to the channel as well */
 	ao2_ref(conference_bridge, -1);
 	return NULL;
 }
@@ -378,15 +378,17 @@
 		ao2_unlock(conference_bridge);
 
 		ast_bridge_remove(conference_bridge->bridge, chan);
+		ast_queue_frame(chan, &ast_null_frame);
+
 		chan = ast_channel_unref(chan);
 		pthread_join(thread, NULL);
 
 		ao2_lock(conference_bridge);
 	}
 
+	/* this is the reference given to the channel during the channel alloc */
 	if (conference_bridge->record_chan) {
-		ast_hangup(conference_bridge->record_chan);
-		conference_bridge->record_chan = NULL;
+		conference_bridge->record_chan = ast_channel_unref(conference_bridge->record_chan);
 	}
 
 	ao2_unlock(conference_bridge);
@@ -415,7 +417,7 @@
 		return -1;
 	}
 	ast_format_cap_add(cap, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0));
-	if (!(conference_bridge->record_chan = ast_request("ConfBridgeRec", cap, NULL, "", &cause))) {
+	if (!(conference_bridge->record_chan = ast_request("ConfBridgeRec", cap, NULL, conference_bridge->name, &cause))) {
 		cap = ast_format_cap_destroy(cap);
 		ao2_unlock(conference_bridge);
 		return -1;




More information about the asterisk-commits mailing list