Merge Tilghman's meetme updates (bug #1934)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3334 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2004-06-28 22:10:50 +00:00
parent a11c4965b7
commit 5fec7176e0

View File

@@ -541,6 +541,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
user->nextuser = NULL;
if (conf->lastuser->nextuser != NULL) {
ast_log(LOG_WARNING, "Error in User Management!\n");
ast_mutex_unlock(&conflock);
goto outrun;
} else {
conf->lastuser->nextuser = user;
@@ -847,7 +848,6 @@ zapretry:
if (!ast_streamfile(chan, "conf-lockednow", chan->language))
ast_waitstream(chan, "");
}
break;
default:
menu_active = 0;
@@ -1216,7 +1216,8 @@ static int conf_exec(struct ast_channel *chan, void *data)
}
ast_mutex_unlock(&conflock);
/* Disqualify static conferences with pins */
/* We only need to load the config file for static and empty_no_pin (otherwise we don't care) */
if ((empty_no_pin) || (!dynamic)) {
cfg = ast_load("meetme.conf");
if (cfg) {
var = ast_variable_browse(cfg, "rooms");
@@ -1227,7 +1228,7 @@ static int conf_exec(struct ast_channel *chan, void *data)
char *confno_tmp = strsep(&stringp, "|,");
int found = 0;
if (sscanf(confno_tmp, "%d", &confno_int) == 1) {
if (confno_int >= 0 && confno_int < 1024) {
if ((confno_int >= 0) && (confno_int < 1024)) {
if (stringp && empty_no_pin) {
map[confno_int]++;
}
@@ -1239,29 +1240,39 @@ static int conf_exec(struct ast_channel *chan, void *data)
cnf = confs;
while (cnf) {
if (!strcmp(confno_tmp, cnf->confno)) {
/* The conference exists, therefore it's not empty */
found = 1;
break;
}
cnf = cnf->next;
}
ast_mutex_unlock(&conflock);
if (!found) {
if ((empty_no_pin && (!stringp)) || (!empty_no_pin)) {
/* At this point, we have a confno_tmp (static conference) that is empty */
if ((empty_no_pin && ((!stringp) || (stringp && (stringp[0] == '\0')))) || (!empty_no_pin)) {
/* Case 1: empty_no_pin and pin is nonexistant (NULL)
* Case 2: empty_no_pin and pin is blank (but not NULL)
* Case 3: not empty_no_pin
*/
strncpy(confno, confno_tmp, sizeof(confno) - 1);
break;
/* XXX the map is not complete (but we do have a confno) */
}
}
}
} else {
ast_log(LOG_ERROR, "Out of memory\n");
}
}
var = var->next;
}
ast_destroy(cfg);
}
}
/* Select first conference number not in use */
if (dynamic) {
if (ast_strlen_zero(confno) && dynamic) {
for (i=0;i<1024;i++) {
if (dynamic && (!map[i])) {
if (!map[i]) {
snprintf(confno, sizeof(confno) - 1, "%d", i);
break;
}
@@ -1280,6 +1291,8 @@ static int conf_exec(struct ast_channel *chan, void *data)
ast_waitstream(chan, "");
res = ast_say_digits(chan, confno_int, "", chan->language);
}
} else {
ast_log(LOG_ERROR, "Could not scan confno '%s'\n", confno);
}
}
}