[asterisk-commits] oej: branch oej/pinequeue-1.8 r363518 - in /team/oej/pinequeue-1.8: apps/ main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Apr 25 03:53:22 CDT 2012
Author: oej
Date: Wed Apr 25 03:53:18 2012
New Revision: 363518
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=363518
Log:
- Updates after comparing patches (1.6 and 1.8)
- Simplify some code
Modified:
team/oej/pinequeue-1.8/apps/app_queue.c
team/oej/pinequeue-1.8/main/file.c
team/oej/pinequeue-1.8/main/say.c
Modified: team/oej/pinequeue-1.8/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinequeue-1.8/apps/app_queue.c?view=diff&rev=363518&r1=363517&r2=363518
==============================================================================
--- team/oej/pinequeue-1.8/apps/app_queue.c (original)
+++ team/oej/pinequeue-1.8/apps/app_queue.c Wed Apr 25 03:53:18 2012
@@ -3314,22 +3314,11 @@
}
/* play the announcement */
- res = play_file(qe->chan, ast_str_buffer(qe->parent->sound_periodicannounce[qe->last_periodic_announce_sound]),ringing, qe->moh);
-
- /* if (res > 0 && !valid_exit(qe, res))
- res = 0;
- */
+ res = play_file(qe->chan, ast_str_buffer(qe->parent->sound_periodicannounce[qe->last_periodic_announce_sound]), ringing, qe->moh);
+
/* we no longer check for valid_exit(), as we simply
start the playback and let the autoservice thread
keep it going */
-
- /* Resume Music on Hold if the caller is going to stay in the queue */
- if (!res) {
- if (ringing)
- ast_indicate(qe->chan, AST_CONTROL_RINGING);
- else
- ast_moh_start(qe->chan, qe->moh, NULL);
- }
/* update last_periodic_announce_time */
if (qe->parent->relativeperiodicannounce)
@@ -5963,18 +5952,24 @@
if (ast_strlen_zero(filename)) {
return 0;
}
- /* Play prompts like before, with no interruption */
+
+ if (!ast_fileexists(filename, NULL, chan->language)) {
+ return 0;
+ }
+
ast_stopstream(chan);
+
res = ast_streamfile(chan, filename, chan->language);
if (!res) {
res = ast_waitstream(chan, AST_DIGIT_ANY);
}
+
ast_stopstream(chan);
if (ringing) {
ast_indicate(chan, AST_CONTROL_RINGING);
} else {
ast_moh_start(chan, moh, NULL);
- }
+ }
return res;
}
@@ -6872,8 +6867,9 @@
if ((general_val = ast_variable_retrieve(cfg, "general", "updatecdr")))
update_cdr = ast_true(general_val);
background_prompts = 0;
- if ((general_val = ast_variable_retrieve(cfg, "general", "background_prompts")))
+ if ((general_val = ast_variable_retrieve(cfg, "general", "background_prompts"))) {
background_prompts = ast_true(general_val);
+ }
shared_lastcall = 0;
if ((general_val = ast_variable_retrieve(cfg, "general", "shared_lastcall")))
shared_lastcall = ast_true(general_val);
Modified: team/oej/pinequeue-1.8/main/file.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinequeue-1.8/main/file.c?view=diff&rev=363518&r1=363517&r2=363518
==============================================================================
--- team/oej/pinequeue-1.8/main/file.c (original)
+++ team/oej/pinequeue-1.8/main/file.c Wed Apr 25 03:53:18 2012
@@ -769,7 +769,7 @@
struct ast_frame *fr;
if (s->orig_chan_name && strcasecmp(s->owner->name, s->orig_chan_name)) {
- ast_log(LOG_DEBUG, "--- Giving up here\n");
+ ast_debug(3, "--- Giving up here\n");
goto return_failure;
}
@@ -780,7 +780,7 @@
ast_log(LOG_WARNING, "Failed to write frame\n");
ast_frfree(fr);
}
- ast_log(LOG_DEBUG, "--- Giving up here now\n");
+ ast_ldebug(3, "--- Giving up here now\n");
goto return_failure;
}
@@ -807,9 +807,7 @@
return FSREAD_SUCCESS_SCHED;
return_failure:
- if (option_debug > 1) {
- ast_log(LOG_DEBUG, "DEBUG: return_failure called. Giving up. !\n");
- }
+ ast_debug(3, "DEBUG: return_failure called. Giving up. !\n");
s->owner->streamid = -1;
ast_settimeout(s->owner, 0, NULL, NULL);
Modified: team/oej/pinequeue-1.8/main/say.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinequeue-1.8/main/say.c?view=diff&rev=363518&r1=363517&r2=363518
==============================================================================
--- team/oej/pinequeue-1.8/main/say.c (original)
+++ team/oej/pinequeue-1.8/main/say.c Wed Apr 25 03:53:18 2012
@@ -404,8 +404,7 @@
return wait_file_full(chan, ints, file, lang, -1, -1);
}
-/* this routine to provide wait_file capability for those with audiofd, ctrlfd */
-
+/*! \brief this routine to provide \ref wait_file() capability for those with audiofd, ctrlfd */
static int wait_file_full(struct ast_channel *chan, const char *ints, const char *file, const char *lang, int audiofd, int ctrlfd)
{
int res;
@@ -416,72 +415,73 @@
if ((datastore = ast_channel_datastore_find(chan, ast_sound_ending(), NULL))) { /* app_queue wants to schedule this instead of play & wait */
struct ast_queue_streamfile_info *aqsi = datastore->data;
- if (aqsi) {
- AST_LIST_LOCK(&aqsi->flist);
- if (aqsi->now_playing) {
- struct ast_queue_streamfile_name *fn = ast_calloc(1, sizeof(*fn));
+ if (!aqsi) {
+ return 0;
+ }
+ AST_LIST_LOCK(&aqsi->flist);
+ if (aqsi->now_playing) {
+ struct ast_queue_streamfile_name *fn = ast_calloc(1, sizeof(*fn));
+
+ fn->filename = ast_strdup(file);
+ ast_debug(3, "----> Adding file %s to playlist for %s\n", file, chan->name);
+
+ /* link the struct into the current ast_queue_streamfile_info struct */
+ AST_LIST_INSERT_TAIL(&aqsi->flist, fn, list);
+ } else {
+ /* if not playing, then start playing this file */
+ if (aqsi->ringing) {
+ ast_indicate(aqsi->chan,-1);
+ } else {
+ ast_moh_stop(aqsi->chan);
+ }
- fn->filename = ast_strdup(file);
- ast_debug(3, "----> Adding file %s to playlist for %s\n", file, chan->name);
+ ast_stopstream(aqsi->chan);
- /* link the struct into the current ast_queue_streamfile_info struct */
- AST_LIST_INSERT_TAIL(&aqsi->flist, fn, list);
- } else {
- /* if not playing, then start playing this file */
- if (aqsi->ringing) {
- ast_indicate(aqsi->chan,-1);
- } else {
- ast_moh_stop(aqsi->chan);
- }
+ ast_autoservice_stop(aqsi->chan);
- ast_stopstream(aqsi->chan);
+ ast_debug(3, "Starting to stream %s\n", file);
+ res = ast_streamfile(aqsi->chan, file, aqsi->chan->language); /* begin the streaming */
- ast_autoservice_stop(aqsi->chan);
-
- ast_debug(3, "Starting to stream %s\n", file);
- res = ast_streamfile(aqsi->chan, file, aqsi->chan->language); /* begin the streaming */
-
- while (res && !AST_LIST_EMPTY(&aqsi->flist)) {
- /* really, how could this even be possible?
- just in case.... */
- struct ast_queue_streamfile_name *fn;
+ while (res && !AST_LIST_EMPTY(&aqsi->flist)) {
+ /* really, how could this even be possible? just in case.... */
+ struct ast_queue_streamfile_name *fn;
+
+ fn = AST_LIST_REMOVE_HEAD(&aqsi->flist, list);
- fn = AST_LIST_REMOVE_HEAD(&aqsi->flist, list);
-
- ast_debug(3,"Start streaming file %s\n", fn->filename);
- res = ast_streamfile(aqsi->chan, fn->filename, aqsi->chan->language);
- }
+ ast_debug(3,"Start streaming file %s\n", fn->filename);
+ res = ast_streamfile(aqsi->chan, fn->filename, aqsi->chan->language);
+ }
- if (res) {
- /* oops, the current file has problems */
- /* restore the moh */
- if (aqsi->ringing) {
- ast_indicate(aqsi->chan, AST_CONTROL_RINGING);
- } else {
- ast_moh_start(aqsi->chan, aqsi->moh, NULL);
- }
- AST_LIST_UNLOCK(&aqsi->flist);
- return 1;
- }
- aqsi->now_playing = 1; /* We have begun playback */
- ast_autoservice_start(aqsi->chan); /* this will let the sound file play in a different thread */
- }
- AST_LIST_UNLOCK(&aqsi->flist);
- return 0;
- }
+ if (res) {
+ /* oops, the current file has problems */
+ /* restore the moh */
+ if (aqsi->ringing) {
+ ast_indicate(aqsi->chan, AST_CONTROL_RINGING);
+ } else {
+ ast_moh_start(aqsi->chan, aqsi->moh, NULL);
+ }
+ AST_LIST_UNLOCK(&aqsi->flist);
+ return 1;
+ }
+ aqsi->now_playing = 1; /* We have begun playback */
+ ast_autoservice_start(aqsi->chan); /* this will let the sound file play in a different thread */
+ }
+ AST_LIST_UNLOCK(&aqsi->flist);
+ return 0;
+ }
+
+ /* otherwise, exactly business as usual */
+ if ((res = ast_streamfile(chan, file, lang))) {
+ ast_log(LOG_WARNING, "Unable to play message %s\n", file);
+ }
+ if ((audiofd > -1) && (ctrlfd > -1)) {
+ res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
} else {
- /* otherwise, exactly business as usual */
- if ((res = ast_streamfile(chan, file, lang)))
- ast_log(LOG_WARNING, "Unable to play message %s\n", file);
- if ((audiofd > -1) && (ctrlfd > -1))
- res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
- else
- res = ast_waitstream(chan, ints);
- return res;
- }
- return 0;
+ res = ast_waitstream(chan, ints);
+ }
+ return res;
}
/*! \brief ast_say_number_full: call language-specific functions */
@@ -3227,7 +3227,7 @@
}
if (!res)
res = ast_say_number(chan, tm.tm_mday, ints, lang, (char * ) NULL);
-#ifdef IS_THIS_A_MISTAKE
+#ifdef IS_THIS_A_MISTAKE
if (!res)
res = ast_waitstream(chan, ints);
#endif
More information about the asterisk-commits
mailing list