aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-06-23 04:55:04 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-06-23 04:55:04 +0000
commit3ce80140ef51b18d7cd8dcc8d3f67d2dff1dd02f (patch)
tree2be6315b59dcc9fb65415507b08017b2c47a7283
parent3f5dae5224d0a5a429284917c19ba872369030be (diff)
Add 'w' option to meetme which causes us to wait for a "marked" user to enter the bridge
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3284 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-xapps/app_meetme.c46
1 files changed, 43 insertions, 3 deletions
diff --git a/apps/app_meetme.c b/apps/app_meetme.c
index 97e54a073..c3b0d8c99 100755
--- a/apps/app_meetme.c
+++ b/apps/app_meetme.c
@@ -67,6 +67,7 @@ static char *descrip =
" 'q' -- quiet mode (don't play enter/leave sounds)\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"
+" 'w' -- wait until a marked user has entered the conference\n"
" 'b' -- run AGI script specified in ${MEETME_AGI_BACKGROUND}\n"
" Default: conf-background.agi\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_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_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)
@@ -464,6 +466,16 @@ static struct ast_cli_entry cli_conf = {
{ "meetme", NULL, NULL }, conf_cmd,
"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)
{
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 musiconhold = 0;
int firstpass = 0;
+ int origquiet;
int ret = -1;
int x;
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, "");
goto outrun;
}
-
conf->users++;
if (confflags & CONFFLAG_ADMINEXIT) {
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->adminflags = 0;
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 (!ast_streamfile(chan, "conf-onlyperson", chan->language))
- ast_waitstream(chan, "");
+ if (!ast_streamfile(chan, "conf-onlyperson", chan->language)) {
+ if (ast_waitstream(chan, "") < 0)
+ goto outrun;
+ } else
+ goto outrun;
}
/* Set it into linear mode (write) */
@@ -1137,6 +1175,8 @@ static int conf_exec(struct ast_channel *chan, void *data)
confflags |= CONFFLAG_ADMINEXIT;
if (strchr(inflags, 'b'))
confflags |= CONFFLAG_AGI;
+ if (strchr(inflags, 'w'))
+ confflags |= CONFFLAG_WAITMARKED;
if (strchr(inflags, 'd'))
dynamic = 1;
if (strchr(inflags, 'D')) {