diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-07-11 22:42:45 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-07-11 22:42:45 +0000 |
commit | c5a4ca4c85cf6bff5822adfb7b4b754d3c51d3d9 (patch) | |
tree | 5ce3f7b459b6fc02e82423d8027c7c84c7a70d84 /apps | |
parent | d38ae6e7da2e5fa1d8cf08a855b3402599b31b68 (diff) |
if the first user hangs up while being prompted for a pin, don't hold the
conference open (bug #4656)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/v1-0@6088 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rwxr-xr-x | apps/app_meetme.c | 63 |
1 files changed, 41 insertions, 22 deletions
diff --git a/apps/app_meetme.c b/apps/app_meetme.c index 51a8da618..47d05e5a4 100755 --- a/apps/app_meetme.c +++ b/apps/app_meetme.c @@ -482,9 +482,39 @@ static int confnonzero(void *ptr) return res; } +/* Remove the conference from the list and free it. + We assume that this was called while holding conflock. */ +static int conf_free(struct ast_conference *conf) +{ + struct ast_conference *prev = NULL, *cur = confs; + + while(cur) { + if (cur == conf) { + if (prev) + prev->next = conf->next; + else + confs = conf->next; + break; + } + prev = cur; + cur = cur->next; + } + + if (!cur) + ast_log(LOG_WARNING, "Conference not found\n"); + + if (conf->chan) + ast_hangup(conf->chan); + else + close(conf->fd); + + free(conf); + + return 0; +} + static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int confflags) { - struct ast_conference *prev=NULL, *cur; struct ast_conf_user *user = malloc(sizeof(struct ast_conf_user)); int fd; struct zt_confinfo ztc; @@ -991,31 +1021,12 @@ outrun: "Meetme: %s\r\n" "Usernum: %i\r\n", chan->name, chan->uniqueid, conf->confno, user->user_no); - prev = NULL; conf->users--; if (confflags & CONFFLAG_MARKEDUSER) conf->markedusers--; - cur = confs; if (!conf->users) { /* No more users -- close this one out */ - while(cur) { - if (cur == conf) { - if (prev) - prev->next = conf->next; - else - confs = conf->next; - break; - } - prev = cur; - cur = cur->next; - } - if (!cur) - ast_log(LOG_WARNING, "Conference not found\n"); - if (conf->chan) - ast_hangup(conf->chan); - else - close(conf->fd); - free(conf); + conf_free(conf); } else { /* Remove the user struct */ if (user == conf->firstuser) { @@ -1400,8 +1411,15 @@ static int conf_exec(struct ast_channel *chan, void *data) confno[0] = '\0'; } } else { + /* failed when getting the pin */ res = -1; allowretry = 0; + /* see if we need to get rid of the conference */ + ast_mutex_lock(&conflock); + if (!cnf->users) { + conf_free(cnf); + } + ast_mutex_unlock(&conflock); break; } @@ -1420,8 +1438,9 @@ static int conf_exec(struct ast_channel *chan, void *data) } } } while (allowretry); - /* Do the conference */ + LOCAL_USER_REMOVE(u); + return res; } |