diff options
author | Richard Mudgett <rmudgett@digium.com> | 2015-01-23 20:13:00 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2015-01-23 20:13:00 +0000 |
commit | e302116e40811660c39e2ceab54d1120e19d5990 (patch) | |
tree | 0f78d40b2239461547b11c5ef3dd65bc9529caa5 /apps | |
parent | f8b3fb6e2fce6f01a01c82d4297584e574c88aec (diff) |
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.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@431052 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps')
-rw-r--r-- | apps/confbridge/conf_chan_record.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/apps/confbridge/conf_chan_record.c b/apps/confbridge/conf_chan_record.c index 0e298e78d..54317e452 100644 --- a/apps/confbridge/conf_chan_record.c +++ b/apps/confbridge/conf_chan_record.c @@ -38,6 +38,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") /* ------------------------------------------------------------------- */ +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 @@ static struct ast_channel *rec_request(const char *type, struct ast_format_cap * 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 @@ static struct ast_channel *rec_request(const char *type, struct ast_format_cap * 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; } |