mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-01 19:43:03 +00:00
Add 'w' option to meetme which causes us to wait for a "marked" user to enter the bridge
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3284 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -67,6 +67,7 @@ static char *descrip =
|
|||||||
" 'q' -- quiet mode (don't play enter/leave sounds)\n"
|
" 'q' -- quiet mode (don't play enter/leave sounds)\n"
|
||||||
" 'M' -- enable music on hold when the conference has a single caller\n"
|
" 'M' -- enable music on hold when the conference has a single caller\n"
|
||||||
" 'x' -- exit the conference if the last marked user left\n"
|
" 'x' -- exit the conference if the last marked user left\n"
|
||||||
|
" 'w' -- wait until a marked user has entered the conference\n"
|
||||||
" 'b' -- run AGI script specified in ${MEETME_AGI_BACKGROUND}\n"
|
" 'b' -- run AGI script specified in ${MEETME_AGI_BACKGROUND}\n"
|
||||||
" Default: conf-background.agi\n"
|
" Default: conf-background.agi\n"
|
||||||
" (Note: This does not work with non-Zap channels in the same conference)\n"
|
" (Note: This does not work with non-Zap channels in the same conference)\n"
|
||||||
@@ -146,6 +147,7 @@ static int admin_exec(struct ast_channel *chan, void *data);
|
|||||||
#define CONFFLAG_AGI (1 << 8) /* Set to run AGI Script in Background */
|
#define CONFFLAG_AGI (1 << 8) /* Set to run AGI Script in Background */
|
||||||
#define CONFFLAG_MOH (1 << 9) /* Set to have music on hold when user is alone in conference */
|
#define CONFFLAG_MOH (1 << 9) /* Set to have music on hold when user is alone in conference */
|
||||||
#define CONFFLAG_ADMINEXIT (1 << 10) /* If set the MeetMe will return if all marked with this flag left */
|
#define CONFFLAG_ADMINEXIT (1 << 10) /* If set the MeetMe will return if all marked with this flag left */
|
||||||
|
#define CONFFLAG_WAITMARKED (1 << 11) /* If set, the MeetMe will wait until a marked user enters */
|
||||||
|
|
||||||
|
|
||||||
static int careful_write(int fd, unsigned char *data, int len)
|
static int careful_write(int fd, unsigned char *data, int len)
|
||||||
@@ -464,6 +466,16 @@ static struct ast_cli_entry cli_conf = {
|
|||||||
{ "meetme", NULL, NULL }, conf_cmd,
|
{ "meetme", NULL, NULL }, conf_cmd,
|
||||||
"Execute a command on a conference or conferee", conf_usage, complete_confcmd };
|
"Execute a command on a conference or conferee", conf_usage, complete_confcmd };
|
||||||
|
|
||||||
|
static int confnonzero(void *ptr)
|
||||||
|
{
|
||||||
|
struct ast_conference *conf = ptr;
|
||||||
|
int res;
|
||||||
|
ast_mutex_lock(&conflock);
|
||||||
|
res = (conf->markedusers < 0);
|
||||||
|
ast_mutex_unlock(&conflock);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
struct ast_conference *prev=NULL, *cur;
|
struct ast_conference *prev=NULL, *cur;
|
||||||
@@ -482,6 +494,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
|
|||||||
int origfd;
|
int origfd;
|
||||||
int musiconhold = 0;
|
int musiconhold = 0;
|
||||||
int firstpass = 0;
|
int firstpass = 0;
|
||||||
|
int origquiet;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
int x;
|
int x;
|
||||||
int menu_active = 0;
|
int menu_active = 0;
|
||||||
@@ -504,7 +517,6 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
|
|||||||
ast_waitstream(chan, "");
|
ast_waitstream(chan, "");
|
||||||
goto outrun;
|
goto outrun;
|
||||||
}
|
}
|
||||||
|
|
||||||
conf->users++;
|
conf->users++;
|
||||||
if (confflags & CONFFLAG_ADMINEXIT) {
|
if (confflags & CONFFLAG_ADMINEXIT) {
|
||||||
if (conf->markedusers == -1) {
|
if (conf->markedusers == -1) {
|
||||||
@@ -540,10 +552,36 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
|
|||||||
user->userflags = confflags;
|
user->userflags = confflags;
|
||||||
user->adminflags = 0;
|
user->adminflags = 0;
|
||||||
ast_mutex_unlock(&conflock);
|
ast_mutex_unlock(&conflock);
|
||||||
|
origquiet = confflags & CONFFLAG_QUIET;
|
||||||
|
while((confflags & CONFFLAG_WAITMARKED) && (conf->markedusers < 0)) {
|
||||||
|
confflags &= ~CONFFLAG_QUIET;
|
||||||
|
confflags |= origquiet;
|
||||||
|
/* XXX Announce that we're waiting on the conference lead to join */
|
||||||
|
if (!(confflags & CONFFLAG_QUIET)) {
|
||||||
|
res = ast_streamfile(chan, "vm-dialout", chan->language);
|
||||||
|
if (!res)
|
||||||
|
res = ast_waitstream(chan, "");
|
||||||
|
} else
|
||||||
|
res = 0;
|
||||||
|
/* If we're waiting with hold music, set to silent mode */
|
||||||
|
if (!res) {
|
||||||
|
confflags |= CONFFLAG_QUIET;
|
||||||
|
ast_moh_start(chan, NULL);
|
||||||
|
res = ast_safe_sleep_conditional(chan, 60000, confnonzero, conf);
|
||||||
|
ast_moh_stop(chan);
|
||||||
|
}
|
||||||
|
if (res < 0) {
|
||||||
|
ast_log(LOG_DEBUG, "Got hangup on '%s' already\n", chan->name);
|
||||||
|
goto outrun;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!(confflags & CONFFLAG_QUIET) && conf->users == 1) {
|
if (!(confflags & CONFFLAG_QUIET) && conf->users == 1) {
|
||||||
if (!ast_streamfile(chan, "conf-onlyperson", chan->language))
|
if (!ast_streamfile(chan, "conf-onlyperson", chan->language)) {
|
||||||
ast_waitstream(chan, "");
|
if (ast_waitstream(chan, "") < 0)
|
||||||
|
goto outrun;
|
||||||
|
} else
|
||||||
|
goto outrun;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set it into linear mode (write) */
|
/* Set it into linear mode (write) */
|
||||||
@@ -1137,6 +1175,8 @@ static int conf_exec(struct ast_channel *chan, void *data)
|
|||||||
confflags |= CONFFLAG_ADMINEXIT;
|
confflags |= CONFFLAG_ADMINEXIT;
|
||||||
if (strchr(inflags, 'b'))
|
if (strchr(inflags, 'b'))
|
||||||
confflags |= CONFFLAG_AGI;
|
confflags |= CONFFLAG_AGI;
|
||||||
|
if (strchr(inflags, 'w'))
|
||||||
|
confflags |= CONFFLAG_WAITMARKED;
|
||||||
if (strchr(inflags, 'd'))
|
if (strchr(inflags, 'd'))
|
||||||
dynamic = 1;
|
dynamic = 1;
|
||||||
if (strchr(inflags, 'D')) {
|
if (strchr(inflags, 'D')) {
|
||||||
|
|||||||
Reference in New Issue
Block a user