" '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"
#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)
{ "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;
int origfd;
int musiconhold = 0;
int firstpass = 0;
+ int origquiet;
int ret = -1;
int x;
int menu_active = 0;
ast_waitstream(chan, "");
goto outrun;
}
-
conf->users++;
if (confflags & CONFFLAG_ADMINEXIT) {
if (conf->markedusers == -1) {
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) */
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')) {