[asterisk-commits] qwell: branch 1.4 r92617 - /branches/1.4/apps/app_meetme.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Dec 12 15:15:46 CST 2007
Author: qwell
Date: Wed Dec 12 15:15:45 2007
New Revision: 92617
URL: http://svn.digium.com/view/asterisk?view=rev&rev=92617
Log:
Don't increment user count until after name has been recorded (if enabled).
Issue 11048, tested by pep.
Modified:
branches/1.4/apps/app_meetme.c
Modified: branches/1.4/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_meetme.c?view=diff&rev=92617&r1=92616&r2=92617
==============================================================================
--- branches/1.4/apps/app_meetme.c (original)
+++ branches/1.4/apps/app_meetme.c Wed Dec 12 15:15:45 2007
@@ -1406,6 +1406,7 @@
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 @@
goto outrun;
}
- if (confflags & CONFFLAG_MARKEDUSER)
- conf->markedusers++;
-
ast_mutex_lock(&conf->playlock);
if (AST_LIST_EMPTY(&conf->userlist))
@@ -1480,25 +1478,8 @@
user->userflags = confflags;
user->adminflags = (confflags & CONFFLAG_STARTMUTED) ? ADMINFLAG_SELFMUTED : 0;
user->talking = -1;
- conf->users++;
- /* Update table */
- snprintf(members, sizeof(members), "%d", conf->users);
- ast_update_realtime("meetme", "confno", conf->confno, "members", members , NULL);
-
- /* This device changed state now - if this is the first user */
- if (conf->users == 1)
- ast_device_state_changed("meetme:%s", conf->confno);
ast_mutex_unlock(&conf->playlock);
-
- if (confflags & CONFFLAG_EXIT_CONTEXT) {
- if ((agifile = pbx_builtin_getvar_helper(chan, "MEETME_EXIT_CONTEXT")))
- ast_copy_string(exitcontext, agifile, sizeof(exitcontext));
- else if (!ast_strlen_zero(chan->macrocontext))
- ast_copy_string(exitcontext, chan->macrocontext, sizeof(exitcontext));
- else
- ast_copy_string(exitcontext, chan->context, sizeof(exitcontext));
- }
if (!(confflags & CONFFLAG_QUIET) && ((confflags & CONFFLAG_INTROUSER) || (confflags & CONFFLAG_INTROUSERNOREVIEW))) {
snprintf(user->namerecloc, sizeof(user->namerecloc),
@@ -1510,6 +1491,31 @@
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)
+ ast_device_state_changed("meetme:%s", conf->confno);
+
+ ast_mutex_unlock(&conf->playlock);
+
+ if (confflags & CONFFLAG_EXIT_CONTEXT) {
+ if ((agifile = pbx_builtin_getvar_helper(chan, "MEETME_EXIT_CONTEXT")))
+ ast_copy_string(exitcontext, agifile, sizeof(exitcontext));
+ else if (!ast_strlen_zero(chan->macrocontext))
+ ast_copy_string(exitcontext, chan->macrocontext, sizeof(exitcontext));
+ else
+ ast_copy_string(exitcontext, chan->context, sizeof(exitcontext));
}
if ( !(confflags & (CONFFLAG_QUIET | CONFFLAG_NOONLYPERSON)) ) {
@@ -2274,12 +2280,14 @@
(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);
More information about the asterisk-commits
mailing list