[asterisk-commits] jpeeler: branch jpeeler/bug13173 r154189 - /team/jpeeler/bug13173/apps/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Nov 4 11:03:50 CST 2008
Author: jpeeler
Date: Tue Nov 4 11:03:50 2008
New Revision: 154189
URL: http://svn.digium.com/view/asterisk?view=rev&rev=154189
Log:
Put join announcement queued in the announce thread so that there is (a start at having) one place to do all the announcing. Might use ao2 containers in order to easily determine if an announcement has been made yet or not.
Modified:
team/jpeeler/bug13173/apps/app_meetme.c
Modified: team/jpeeler/bug13173/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/bug13173/apps/app_meetme.c?view=diff&rev=154189&r1=154188&r2=154189
==============================================================================
--- team/jpeeler/bug13173/apps/app_meetme.c (original)
+++ team/jpeeler/bug13173/apps/app_meetme.c Tue Nov 4 11:03:50 2008
@@ -316,12 +316,18 @@
#define MAX_CONFNUM 80
#define MAX_PIN 80
+enum announcetypes {
+ CONF_HASJOIN,
+ CONF_HASLEFT
+};
+
struct announce_listitem {
AST_LIST_ENTRY(announce_listitem) list;
char namerecloc[PATH_MAX]; /*!< Name Recorded file Location */
char language[MAX_LANGUAGE];
struct ast_channel *confchan;
int confusers;
+ enum announcetypes announcetype;
};
/*! \brief The MeetMe Conference object */
@@ -1395,11 +1401,24 @@
return res;
}
+static void get_announce_filename(char *filename, enum announcetypes type)
+{
+ switch (type) {
+ case CONF_HASLEFT:
+ ast_copy_string(filename, "conf-hasleft", 40);
+ break;
+ case CONF_HASJOIN:
+ ast_copy_string(filename, "conf-hasjoin", 40);
+ break;
+ }
+}
+
static void *announce_thread(void *data)
{
struct announce_listitem *next, *current;
struct ast_conference *conf = data;
int res;
+ char filename[40] = ""; /* jpeeler: don't know what amount should put here */
for (;;) {
AST_LIST_LOCK(&conf->announcelist);
@@ -1415,7 +1434,8 @@
if (!ast_streamfile(current->confchan, current->namerecloc, current->language))
res = ast_waitstream(current->confchan, "");
if (!res) {
- if (!ast_streamfile(current->confchan, "conf-hasleft", current->language))
+ get_announce_filename(filename, current->announcetype);
+ if (!ast_streamfile(current->confchan, filename, current->language))
ast_waitstream(current->confchan, "");
}
}
@@ -1739,12 +1759,16 @@
ast_mutex_lock(&conf->playlock);
if (!(confflags & CONFFLAG_QUIET) && ((confflags & CONFFLAG_INTROUSER) || (confflags & CONFFLAG_INTROUSERNOREVIEW)) && conf->users > 1) {
- if (conf->chan && ast_fileexists(user->namerecloc, NULL, NULL)) {
- if (!ast_streamfile(conf->chan, user->namerecloc, chan->language))
- ast_waitstream(conf->chan, "");
- if (!ast_streamfile(conf->chan, "conf-hasjoin", chan->language))
- ast_waitstream(conf->chan, "");
- }
+ struct announce_listitem *item = ast_calloc(1, sizeof(*item));
+ ast_copy_string(item->namerecloc, user->namerecloc, sizeof(item->namerecloc));
+ ast_copy_string(item->language, chan->language, sizeof(item->language));
+ item->confchan = conf->chan;
+ item->confusers = conf->users;
+ item->announcetype = CONF_HASJOIN;
+ AST_LIST_LOCK(&conf->announcelist);
+ AST_LIST_INSERT_TAIL(&conf->announcelist, item, list);
+ ast_cond_signal(&conf->announcelist_addition);
+ AST_LIST_UNLOCK(&conf->announcelist);
}
if (confflags & CONFFLAG_WAITMARKED && !conf->markedusers)
@@ -1756,6 +1780,7 @@
else
ztc.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER;
+ //while (!ast_check_hangup(chan) && !ast_check_hangup(conf->chan) &&
if (ioctl(fd, DAHDI_SETCONF, &ztc)) {
ast_log(LOG_WARNING, "Error setting conference\n");
close(fd);
@@ -2339,6 +2364,7 @@
ast_copy_string(item->language, chan->language, sizeof(item->language));
item->confchan = conf->chan;
item->confusers = conf->users;
+ item->announcetype = CONF_HASLEFT;
AST_LIST_LOCK(&conf->announcelist);
AST_LIST_INSERT_TAIL(&conf->announcelist, item, list);
ast_cond_signal(&conf->announcelist_addition);
More information about the asterisk-commits
mailing list