[svn-commits] rmudgett: branch 13 r431052 - /branches/13/apps/confbridge/conf_chan_record.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Jan 23 14:13:05 CST 2015


Author: rmudgett
Date: Fri Jan 23 14:13:00 2015
New Revision: 431052

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=431052
Log:
app_confbridge: Make CBRec channel names more unique.

Channel names should be different from other channels in the system while
the channel exists.

* Use a sequence number for CBRec channels instead of a random number
because the same random number could be picked again for the next CBRec
channel.

Modified:
    branches/13/apps/confbridge/conf_chan_record.c

Modified: branches/13/apps/confbridge/conf_chan_record.c
URL: http://svnview.digium.com/svn/asterisk/branches/13/apps/confbridge/conf_chan_record.c?view=diff&rev=431052&r1=431051&r2=431052
==============================================================================
--- branches/13/apps/confbridge/conf_chan_record.c (original)
+++ branches/13/apps/confbridge/conf_chan_record.c Fri Jan 23 14:13:00 2015
@@ -38,6 +38,8 @@
 
 /* ------------------------------------------------------------------- */
 
+static unsigned int name_sequence = 0;
+
 static int rec_call(struct ast_channel *chan, const char *addr, int timeout)
 {
 	/* Make sure anyone calling ast_call() for this channel driver is going to fail. */
@@ -59,6 +61,7 @@
 	struct ast_channel *chan;
 	const char *conf_name = data;
 	RAII_VAR(struct ast_format_cap *, capabilities, NULL, ao2_cleanup);
+	int generated_seqno = ast_atomic_fetchadd_int((int *) &name_sequence, +1);
 
 	capabilities = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
 	if (!capabilities) {
@@ -67,8 +70,8 @@
 	ast_format_cap_append_by_type(capabilities, AST_MEDIA_TYPE_UNKNOWN);
 
 	chan = ast_channel_alloc(1, AST_STATE_UP, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0,
-		"CBRec/conf-%s-uid-%d",
-		conf_name, (int) ast_random());
+		"CBRec/conf-%s-uid-%08x",
+		conf_name, (unsigned) generated_seqno);
 	if (!chan) {
 		return NULL;
 	}




More information about the svn-commits mailing list