aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2006-09-11 21:47:23 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2006-09-11 21:47:23 +0000
commit42bbda4433cfc19548544ca2f7e04796fc8f83b8 (patch)
treebc1fac7df960c04d872584d306b14c932c1962ac
parent27622e54cd4807cfe4bb4c320e08cbc6b0f12806 (diff)
When paging, only wait 5 seconds for the marked user to enter the conference.
After that, assume the paging already completed by the time the channel entered the conference and drop back out. (Issue 7275) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@42783 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--apps/app_meetme.c34
-rw-r--r--apps/app_page.c2
2 files changed, 27 insertions, 9 deletions
diff --git a/apps/app_meetme.c b/apps/app_meetme.c
index 72f90d8e1..1c81aae46 100644
--- a/apps/app_meetme.c
+++ b/apps/app_meetme.c
@@ -96,7 +96,8 @@ static const char *descrip =
" 's' -- Present menu (user or admin) when '*' is received ('send' to menu)\n"
" 't' -- set talk only mode. (Talk only, no listening)\n"
" 'T' -- set talker detection (sent to manager interface and meetme list)\n"
-" 'w' -- wait until the marked user enters the conference\n"
+" 'w[(<secs>)]'\n"
+" -- wait until the marked user enters the conference\n"
" 'x' -- close the conference when last marked user exits\n"
" 'X' -- allow user to exit the conference by entering a valid single\n"
" digit extension ${MEETME_EXIT_CONTEXT} or the current context\n"
@@ -227,6 +228,10 @@ static void *recordthread(void *args);
#define CONFFLAG_EMPTYNOPIN (1 << 20)
#define CONFFLAG_ALWAYSPROMPT (1 << 21)
+enum {
+ OPT_ARG_WAITMARKED = 0,
+ OPT_ARG_ARRAY_SIZE = 1,
+} meetme_option_args;
AST_APP_OPTIONS(meetme_opts, {
AST_APP_OPTION('a', CONFFLAG_ADMIN ),
@@ -243,7 +248,7 @@ AST_APP_OPTIONS(meetme_opts, {
AST_APP_OPTION('X', CONFFLAG_EXIT_CONTEXT ),
AST_APP_OPTION('A', CONFFLAG_MARKEDUSER ),
AST_APP_OPTION('b', CONFFLAG_AGI ),
- AST_APP_OPTION('w', CONFFLAG_WAITMARKED ),
+ AST_APP_OPTION_ARG('w', CONFFLAG_WAITMARKED, OPT_ARG_WAITMARKED ),
AST_APP_OPTION('r', CONFFLAG_RECORDCONF ),
AST_APP_OPTION('d', CONFFLAG_DYNAMIC ),
AST_APP_OPTION('D', CONFFLAG_DYNAMICPIN ),
@@ -790,7 +795,7 @@ static int conf_free(struct ast_conference *conf)
return 0;
}
-static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int confflags)
+static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int confflags, char *optargs[])
{
struct ast_conf_user *user = calloc(1, sizeof(*user));
struct ast_conf_user *usr = NULL;
@@ -822,7 +827,8 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
char meetmesecs[30] = "";
char exitcontext[AST_MAX_CONTEXT] = "";
char recordingtmp[AST_MAX_EXTENSION] = "";
- int dtmf;
+ int dtmf, opt_waitmarked_timeout = 0;
+ time_t timeout = 0;
ZT_BUFFERINFO bi;
char __buf[CONF_SIZE + AST_FRIENDLY_OFFSET];
char *buf = __buf + AST_FRIENDLY_OFFSET;
@@ -832,6 +838,14 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
return ret;
}
+ /* Possible timeout waiting for marked user */
+ if ((confflags & CONFFLAG_WAITMARKED) &&
+ !ast_strlen_zero(optargs[OPT_ARG_WAITMARKED]) &&
+ (sscanf(optargs[OPT_ARG_WAITMARKED], "%d", &opt_waitmarked_timeout) == 1) &&
+ (opt_waitmarked_timeout > 0)) {
+ timeout = time(NULL) + opt_waitmarked_timeout;
+ }
+
if (confflags & CONFFLAG_RECORDCONF && conf->recording !=MEETME_RECORD_ACTIVE) {
conf->recordingfilename = pbx_builtin_getvar_helper(chan, "MEETME_RECORDINGFILE");
if (!conf->recordingfilename) {
@@ -1118,7 +1132,10 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
outfd = -1;
ms = -1;
-
+
+ if (timeout && time(NULL) >= timeout)
+ break;
+
/* if we have just exited from the menu, and the user had a channel-driver
volume adjustment, restore it
*/
@@ -1775,6 +1792,7 @@ static int conf_exec(struct ast_channel *chan, void *data)
int empty = 0, empty_no_pin = 0;
int always_prompt = 0;
char *notdata, *info, *inflags = NULL, *inpin = NULL, the_pin[AST_MAX_EXTENSION] = "";
+ char *optargs[OPT_ARG_ARRAY_SIZE] = { NULL, };
LOCAL_USER_ADD(u);
@@ -1805,7 +1823,7 @@ static int conf_exec(struct ast_channel *chan, void *data)
ast_copy_string(the_pin, inpin, sizeof(the_pin));
if (inflags) {
- ast_app_parse_options(meetme_opts, &confflags, NULL, inflags);
+ ast_app_parse_options(meetme_opts, &confflags, optargs, inflags);
dynamic = ast_test_flag(&confflags, CONFFLAG_DYNAMIC | CONFFLAG_DYNAMICPIN);
if (ast_test_flag(&confflags, CONFFLAG_DYNAMICPIN) && !inpin)
strcpy(the_pin, "q");
@@ -1962,7 +1980,7 @@ static int conf_exec(struct ast_channel *chan, void *data)
if (!ast_strlen_zero(cnf->pinadmin) && !strcasecmp(pin, cnf->pinadmin))
ast_set_flag(&confflags, CONFFLAG_ADMIN);
/* Run the conference */
- res = conf_run(chan, cnf, confflags.flags);
+ res = conf_run(chan, cnf, confflags.flags, optargs);
break;
} else {
/* Pin invalid */
@@ -2003,7 +2021,7 @@ static int conf_exec(struct ast_channel *chan, void *data)
allowretry = 0;
/* Run the conference */
- res = conf_run(chan, cnf, confflags.flags);
+ res = conf_run(chan, cnf, confflags.flags, optargs);
}
}
}
diff --git a/apps/app_page.c b/apps/app_page.c
index bd050d183..c1668cc7f 100644
--- a/apps/app_page.c
+++ b/apps/app_page.c
@@ -179,7 +179,7 @@ static int page_exec(struct ast_channel *chan, void *data)
if (options)
ast_app_parse_options(page_opts, &flags, NULL, options);
- snprintf(meetmeopts, sizeof(meetmeopts), "%ud|%sqxdw", confid, ast_test_flag(&flags, PAGE_DUPLEX) ? "" : "m");
+ snprintf(meetmeopts, sizeof(meetmeopts), "%ud|%sqxdw(5)", confid, ast_test_flag(&flags, PAGE_DUPLEX) ? "" : "m");
while ((tech = strsep(&tmp, "&"))) {
/* don't call the originating device */