Add support for changing the exit key from # to any DTMF.

This does not break existing configs - the arguments to p are optional.

Issue 8827, initial patch by junky, mostly rewritten by fw to re-use option p, further modified by me.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@73144 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Jason Parker
2007-07-03 20:34:27 +00:00
parent 8a53d595a5
commit fe37e0dd7f

View File

@@ -111,8 +111,8 @@ enum {
CONFFLAG_ADMIN = (1 << 0), CONFFLAG_ADMIN = (1 << 0),
/*! If set the user can only receive audio from the conference */ /*! If set the user can only receive audio from the conference */
CONFFLAG_MONITOR = (1 << 1), CONFFLAG_MONITOR = (1 << 1),
/*! If set asterisk will exit conference when '#' is pressed */ /*! If set asterisk will exit conference when key defined in p() option is pressed */
CONFFLAG_POUNDEXIT = (1 << 2), CONFFLAG_KEYEXIT = (1 << 2),
/*! If set asterisk will provide a menu to the user when '*' is pressed */ /*! If set asterisk will provide a menu to the user when '*' is pressed */
CONFFLAG_STARMENU = (1 << 3), CONFFLAG_STARMENU = (1 << 3),
/*! If set the use can only send audio to the conference */ /*! If set the use can only send audio to the conference */
@@ -163,7 +163,8 @@ enum {
enum { enum {
OPT_ARG_WAITMARKED = 0, OPT_ARG_WAITMARKED = 0,
OPT_ARG_ARRAY_SIZE = 1, OPT_ARG_EXITKEYS = 1,
OPT_ARG_ARRAY_SIZE = 2,
}; };
AST_APP_OPTIONS(meetme_opts, BEGIN_OPTIONS AST_APP_OPTIONS(meetme_opts, BEGIN_OPTIONS
@@ -182,7 +183,7 @@ AST_APP_OPTIONS(meetme_opts, BEGIN_OPTIONS
AST_APP_OPTION('M', CONFFLAG_MOH ), AST_APP_OPTION('M', CONFFLAG_MOH ),
AST_APP_OPTION('m', CONFFLAG_STARTMUTED ), AST_APP_OPTION('m', CONFFLAG_STARTMUTED ),
AST_APP_OPTION('P', CONFFLAG_ALWAYSPROMPT ), AST_APP_OPTION('P', CONFFLAG_ALWAYSPROMPT ),
AST_APP_OPTION('p', CONFFLAG_POUNDEXIT ), AST_APP_OPTION_ARG('p', CONFFLAG_KEYEXIT, OPT_ARG_EXITKEYS ),
AST_APP_OPTION('q', CONFFLAG_QUIET ), AST_APP_OPTION('q', CONFFLAG_QUIET ),
AST_APP_OPTION('r', CONFFLAG_RECORDCONF ), AST_APP_OPTION('r', CONFFLAG_RECORDCONF ),
AST_APP_OPTION('s', CONFFLAG_STARMENU ), AST_APP_OPTION('s', CONFFLAG_STARMENU ),
@@ -240,7 +241,10 @@ static const char *descrip =
" being muted, meaning (a) No encode is done on transmission and\n" " being muted, meaning (a) No encode is done on transmission and\n"
" (b) Received audio that is not registered as talking is omitted\n" " (b) Received audio that is not registered as talking is omitted\n"
" causing no buildup in background noise\n" " causing no buildup in background noise\n"
" 'p' -- allow user to exit the conference by pressing '#'\n" " 'p[(<keys>)]'\n"
" -- allow user to exit the conference by pressing '#' (default)\n"
" or any of the defined keys. If keys contain '*' this will override\n"
" option 's'. The key used is set to channel variable MEETME_EXIT_KEY.\n"
" 'P' -- always prompt for the pin even if it is specified\n" " 'P' -- always prompt for the pin even if it is specified\n"
" 'q' -- quiet mode (don't play enter/leave sounds)\n" " 'q' -- quiet mode (don't play enter/leave sounds)\n"
" 'r' -- Record conference (records as ${MEETME_RECORDINGFILE}\n" " 'r' -- Record conference (records as ${MEETME_RECORDINGFILE}\n"
@@ -1419,6 +1423,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
ZT_BUFFERINFO bi; ZT_BUFFERINFO bi;
char __buf[CONF_SIZE + AST_FRIENDLY_OFFSET]; char __buf[CONF_SIZE + AST_FRIENDLY_OFFSET];
char *buf = __buf + AST_FRIENDLY_OFFSET; char *buf = __buf + AST_FRIENDLY_OFFSET;
char *exitkeys;
if (!(user = ast_calloc(1, sizeof(*user)))) if (!(user = ast_calloc(1, sizeof(*user))))
return ret; return ret;
@@ -1431,6 +1436,14 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
timeout = time(NULL) + opt_waitmarked_timeout; timeout = time(NULL) + opt_waitmarked_timeout;
} }
/* Get exit keys */
if ((confflags & CONFFLAG_KEYEXIT)) {
if (!ast_strlen_zero(optargs[OPT_ARG_EXITKEYS]))
exitkeys = ast_strdupa(optargs[OPT_ARG_EXITKEYS]);
else
exitkeys = ast_strdupa("#"); /* Default */
}
if (confflags & CONFFLAG_RECORDCONF) { if (confflags & CONFFLAG_RECORDCONF) {
if (!conf->recordingfilename) { if (!conf->recordingfilename) {
conf->recordingfilename = pbx_builtin_getvar_helper(chan, "MEETME_RECORDINGFILE"); conf->recordingfilename = pbx_builtin_getvar_helper(chan, "MEETME_RECORDINGFILE");
@@ -1993,7 +2006,14 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
} else { } else {
ast_debug(2, "Exit by single digit did not work in meetme. Extension %s does not exist in context %s\n", tmp, exitcontext); ast_debug(2, "Exit by single digit did not work in meetme. Extension %s does not exist in context %s\n", tmp, exitcontext);
} }
} else if ((f->frametype == AST_FRAME_DTMF) && (f->subclass == '#') && (confflags & CONFFLAG_POUNDEXIT)) { } else if ((f->frametype == AST_FRAME_DTMF) && (strchr(exitkeys, f->subclass)) && (confflags & CONFFLAG_KEYEXIT)) {
char exitkey[2];
exitkey[0] = f->subclass;
exitkey[1] = '\0';
pbx_builtin_setvar_helper(chan, "MEETME_EXIT_KEY", exitkey);
ret = 0; ret = 0;
ast_frfree(f); ast_frfree(f);
break; break;