aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-12-12 21:15:45 +0000
committerqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-12-12 21:15:45 +0000
commit1223e184cd605d66ae8e8f3910a39a0f2cf0c4a0 (patch)
tree8087e7e4dd19aba98879b3730dfa816a54de576f
parentf34463cba480a44c0b85e8ca2513246cddf86a99 (diff)
Don't increment user count until after name has been recorded (if enabled).
Issue 11048, tested by pep. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@92617 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--apps/app_meetme.c50
1 files changed, 29 insertions, 21 deletions
diff --git a/apps/app_meetme.c b/apps/app_meetme.c
index d7090a254..84cd7978d 100644
--- a/apps/app_meetme.c
+++ b/apps/app_meetme.c
@@ -1406,6 +1406,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
ZT_BUFFERINFO bi;
char __buf[CONF_SIZE + AST_FRIENDLY_OFFSET];
char *buf = __buf + AST_FRIENDLY_OFFSET;
+ int setusercount = 0;
if (!(user = ast_calloc(1, sizeof(*user))))
return ret;
@@ -1464,9 +1465,6 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
goto outrun;
}
- if (confflags & CONFFLAG_MARKEDUSER)
- conf->markedusers++;
-
ast_mutex_lock(&conf->playlock);
if (AST_LIST_EMPTY(&conf->userlist))
@@ -1480,10 +1478,30 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
user->userflags = confflags;
user->adminflags = (confflags & CONFFLAG_STARTMUTED) ? ADMINFLAG_SELFMUTED : 0;
user->talking = -1;
+
+ ast_mutex_unlock(&conf->playlock);
+
+ if (!(confflags & CONFFLAG_QUIET) && ((confflags & CONFFLAG_INTROUSER) || (confflags & CONFFLAG_INTROUSERNOREVIEW))) {
+ snprintf(user->namerecloc, sizeof(user->namerecloc),
+ "%s/meetme/meetme-username-%s-%d", ast_config_AST_SPOOL_DIR,
+ conf->confno, user->user_no);
+ if (confflags & CONFFLAG_INTROUSERNOREVIEW)
+ res = ast_play_and_record(chan, "vm-rec-name", user->namerecloc, 10, "sln", &duration, 128, 0, NULL);
+ else
+ res = ast_record_review(chan, "vm-rec-name", user->namerecloc, 10, "sln", &duration, NULL);
+ if (res == -1)
+ goto outrun;
+ }
+
+ ast_mutex_lock(&conf->playlock);
+
+ if (confflags & CONFFLAG_MARKEDUSER)
+ conf->markedusers++;
conf->users++;
/* Update table */
snprintf(members, sizeof(members), "%d", conf->users);
ast_update_realtime("meetme", "confno", conf->confno, "members", members , NULL);
+ setusercount = 1;
/* This device changed state now - if this is the first user */
if (conf->users == 1)
@@ -1500,18 +1518,6 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
ast_copy_string(exitcontext, chan->context, sizeof(exitcontext));
}
- if (!(confflags & CONFFLAG_QUIET) && ((confflags & CONFFLAG_INTROUSER) || (confflags & CONFFLAG_INTROUSERNOREVIEW))) {
- snprintf(user->namerecloc, sizeof(user->namerecloc),
- "%s/meetme/meetme-username-%s-%d", ast_config_AST_SPOOL_DIR,
- conf->confno, user->user_no);
- if (confflags & CONFFLAG_INTROUSERNOREVIEW)
- res = ast_play_and_record(chan, "vm-rec-name", user->namerecloc, 10, "sln", &duration, 128, 0, NULL);
- else
- res = ast_record_review(chan, "vm-rec-name", user->namerecloc, 10, "sln", &duration, NULL);
- if (res == -1)
- goto outrun;
- }
-
if ( !(confflags & (CONFFLAG_QUIET | CONFFLAG_NOONLYPERSON)) ) {
if (conf->users == 1 && !(confflags & CONFFLAG_WAITMARKED))
if (!ast_streamfile(chan, "conf-onlyperson", chan->language))
@@ -2274,12 +2280,14 @@ bailoutandtrynormal:
(long)(now - user->jointime));
}
- conf->users--;
- /* Update table */
- snprintf(members, sizeof(members), "%d", conf->users);
- ast_update_realtime("meetme", "confno", conf->confno, "members", members, NULL);
- if (confflags & CONFFLAG_MARKEDUSER)
- conf->markedusers--;
+ if (setusercount) {
+ conf->users--;
+ /* Update table */
+ snprintf(members, sizeof(members), "%d", conf->users);
+ ast_update_realtime("meetme", "confno", conf->confno, "members", members, NULL);
+ if (confflags & CONFFLAG_MARKEDUSER)
+ conf->markedusers--;
+ }
/* Remove ourselves from the list */
AST_LIST_REMOVE(&conf->userlist, user, list);