summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2005-12-26 00:47:28 +0000
committerMark Spencer <markster@digium.com>2005-12-26 00:47:28 +0000
commitec0b96837ed951846f6e202f23e97d8b1c8ea640 (patch)
treec65dd1cf38bb8476fe7f9564a8554a80935c480f /apps
parent96b3a24637e2bb3ff4c8bd7005753d80449a0ae9 (diff)
Add "local channel" variation so that we don't read/write to the same
channel... (bug #6058) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7627 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps')
-rw-r--r--apps/app_meetme.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/apps/app_meetme.c b/apps/app_meetme.c
index 7e060d1ce..7756f5882 100644
--- a/apps/app_meetme.c
+++ b/apps/app_meetme.c
@@ -139,6 +139,7 @@ static struct ast_conference {
ast_mutex_t listenlock; /* Conference specific lock (listeners) */
char confno[AST_MAX_EXTENSION]; /* Conference */
struct ast_channel *chan; /* Announcements channel */
+ struct ast_channel *lchan; /* Listen/Record channel */
int fd; /* Announcements fd */
int zapconf; /* Zaptel Conf # */
int users; /* Number of active users */
@@ -509,7 +510,18 @@ static struct ast_conference *build_conf(char *confno, char *pin, char *pinadmin
cnf = NULL;
goto cnfout;
}
-
+ cnf->lchan = ast_request("zap", AST_FORMAT_SLINEAR, "pseudo", NULL);
+ if (cnf->lchan) {
+ ast_set_read_format(cnf->lchan, AST_FORMAT_SLINEAR);
+ ast_set_write_format(cnf->lchan, AST_FORMAT_SLINEAR);
+ ztc.chan = 0;
+ ztc.confmode = ZT_CONF_CONFANN | ZT_CONF_CONFANNMON;
+ if (ioctl(cnf->lchan->fds[0], ZT_SETCONF, &ztc)) {
+ ast_log(LOG_WARNING, "Error setting conference\n");
+ ast_hangup(cnf->lchan);
+ cnf->lchan = NULL;
+ }
+ }
/* Fill the conference struct */
cnf->start = time(NULL);
cnf->zapconf = ztc.confno;
@@ -816,6 +828,8 @@ static int conf_free(struct ast_conference *conf)
}
if (conf->origframe)
ast_frfree(conf->origframe);
+ if (conf->lchan)
+ ast_hangup(conf->lchan);
if (conf->chan)
ast_hangup(conf->chan);
else
@@ -885,7 +899,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
}
}
- if ((conf->recording == MEETME_RECORD_OFF) && ((confflags & CONFFLAG_RECORDCONF) || (conf->chan))) {
+ if ((conf->recording == MEETME_RECORD_OFF) && ((confflags & CONFFLAG_RECORDCONF) || (conf->lchan))) {
pthread_attr_init(&conf->attr);
pthread_attr_setdetachstate(&conf->attr, PTHREAD_CREATE_DETACHED);
ast_pthread_create(&conf->recordthread, &conf->attr, recordthread, conf);
@@ -2231,16 +2245,16 @@ static void *recordthread(void *args)
int x;
const char *oldrecordingfilename = NULL;
- if (!cnf || !cnf->chan) {
+ if (!cnf || !cnf->lchan) {
pthread_exit(0);
}
- ast_stopstream(cnf->chan);
+ ast_stopstream(cnf->lchan);
flags = O_CREAT|O_TRUNC|O_WRONLY;
cnf->recording = MEETME_RECORD_ACTIVE;
- while (ast_waitfor(cnf->chan, -1) > -1) {
+ while (ast_waitfor(cnf->lchan, -1) > -1) {
if (cnf->recording == MEETME_RECORD_TERMINATE) {
ast_mutex_lock(&conflock);
ast_mutex_unlock(&conflock);
@@ -2251,7 +2265,7 @@ static void *recordthread(void *args)
oldrecordingfilename = cnf->recordingfilename;
}
- f = ast_read(cnf->chan);
+ f = ast_read(cnf->lchan);
if (!f) {
res = -1;
break;