Index: app_meetme.c =================================================================== RCS file: /usr/cvsroot/asterisk/apps/app_meetme.c,v retrieving revision 1.60.2.3 diff -u -r1.60.2.3 app_meetme.c --- app_meetme.c 15 Apr 2005 07:15:39 -0000 1.60.2.3 +++ app_meetme.c 27 Aug 2005 19:49:50 -0000 @@ -111,6 +111,9 @@ int isdynamic; /* Created on the fly? */ int locked; /* Is the conference locked? */ char pin[AST_MAX_EXTENSION]; /* If protected by a PIN */ + int conflimit; /* Number of seconds allowed, combining the time used by all joined users */ + int conflimit_5; /* Have we played the 5 min warning */ + int conflimit_1; /* Have we played the 1 min warning */ struct ast_conference *next; } *confs; @@ -762,6 +765,44 @@ } } } + + /* Calculate usage time */ + if (conf->conflimit) { + time_t ttNow = time(NULL); + time_t ttUsed = 0; + int numPeople = 0; + struct ast_conf_user *cusers = conf->firstuser; + do { + ttUsed += (ttNow - cusers->jointime); + cusers = cusers->nextuser; + numPeople++; + } while(cusers); + int fivewarn = (conf->conflimit - (300 * numPeople)); + int onewarn = (conf->conflimit - (60 * numPeople)); + if (!conf->conflimit_5 && ttUsed >= fivewarn && conf->conflimit > fivewarn) { + ast_log(LOG_WARNING, "Five minutes remaining before conference expires.\n"); + if(!ast_play_and_wait(chan, "vm-youhave")) { + if(!ast_say_number(chan, 5, AST_DIGIT_ANY, chan->language, (char *) NULL)) { + if(ast_play_and_wait(chan, "vm-minutes")) + ast_log(LOG_ERROR, "Error playing 5 minute warning.\n"); + } + } + + conf->conflimit_5 = 1; + } else if (!conf->conflimit_1 && ttUsed >= onewarn) { + ast_log(LOG_WARNING, "One minute remaining before conference expires.\n"); + if(!ast_play_and_wait(chan, "vm-youhave")) { + if(!ast_say_number(chan, 1, AST_DIGIT_ANY, chan->language, (char *) NULL)) { + if(ast_play_and_wait(chan, "vm-minutes")) + ast_log(LOG_ERROR, "Error playing 1 minute warning.\n"); + } + } + conf->conflimit_1 = 1; + } else if (ttUsed >= conf->conflimit) { + ast_log(LOG_WARNING, "Conference has expired.\n"); + user->adminflags |= ADMINFLAG_KICKME; + } + } /* Leave if the last marked user left */ if (conf->markedusers == 0 && confflags & CONFFLAG_MARKEDEXIT) { @@ -1173,8 +1214,9 @@ int confflags = 0; int dynamic = 0; int empty = 0, empty_no_pin = 0; - char *notdata, *info, *inflags = NULL, *inpin = NULL, the_pin[AST_MAX_EXTENSION] = ""; - + int conflimit = 0; + char *notdata, *info, *inflags = NULL, *inpin = NULL, the_pin[AST_MAX_EXTENSION] = "", *inlimit = NULL; + if (!data || ast_strlen_zero(data)) { allowretry = 1; notdata = ""; @@ -1200,6 +1242,12 @@ inpin = strsep(&info, "|"); if (inpin) strncpy(the_pin, inpin, sizeof(the_pin) - 1); + if (info) + inlimit = strsep(&info, "|"); + if (inlimit) { + conflimit = (int)atol(inlimit); + ast_log(LOG_NOTICE, "Conference call will be limited to %d seconds via combined caller usage.\n",conflimit); + } if (inflags) { if (strchr(inflags, 'a')) @@ -1366,6 +1414,7 @@ if (allowretry) confno[0] = '\0'; } else { + cnf->conflimit = conflimit; if (!ast_strlen_zero(cnf->pin)) { char pin[AST_MAX_EXTENSION]=""; int j; @@ -1415,6 +1464,7 @@ allowretry = 0; /* Run the conference */ + cnf->conflimit = conflimit; res = conf_run(chan, cnf, confflags); } }