[asterisk-commits] oej: branch oej/pinequeue-trunk r363927 - in /team/oej/pinequeue-trunk: apps/...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Apr 26 03:11:37 CDT 2012
Author: oej
Date: Thu Apr 26 03:11:32 2012
New Revision: 363927
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=363927
Log:
Cleaning up
Modified:
team/oej/pinequeue-trunk/apps/app_queue.c
team/oej/pinequeue-trunk/include/asterisk/channel.h
team/oej/pinequeue-trunk/include/asterisk/file.h
team/oej/pinequeue-trunk/main/channel.c
team/oej/pinequeue-trunk/main/features.c
team/oej/pinequeue-trunk/main/file.c
team/oej/pinequeue-trunk/main/say.c
Modified: team/oej/pinequeue-trunk/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinequeue-trunk/apps/app_queue.c?view=diff&rev=363927&r1=363926&r2=363927
==============================================================================
--- team/oej/pinequeue-trunk/apps/app_queue.c (original)
+++ team/oej/pinequeue-trunk/apps/app_queue.c Thu Apr 26 03:11:32 2012
@@ -994,6 +994,7 @@
{ QUEUE_AUTOPAUSE_ALL,"all" },
};
+
static struct ast_taskprocessor *devicestate_tps;
#define DEFAULT_RETRY 5
@@ -1042,8 +1043,8 @@
/*! \brief queues.conf [general] option */
static int shared_lastcall = 1;
-/*! \brief Play prompts without interrupts (foreground) */
-static int background_prompts = 0;
+/*! \brief Play prompts without interrupts (foreground) Default disabled */
+static int background_prompts;
/*! \brief Subscription to device state change events */
static struct ast_event_sub *device_state_sub;
@@ -2806,13 +2807,6 @@
return 0;
}
- /* Commented out by old Olle patch */
- /* if (ringing) { */
- /* ast_indicate(qe->chan,-1); */
- /* } else { */
- /* ast_moh_stop(qe->chan); */
- /* } */
-
if (qe->parent->announceposition == ANNOUNCEPOSITION_YES ||
qe->parent->announceposition == ANNOUNCEPOSITION_MORE_THAN ||
(qe->parent->announceposition == ANNOUNCEPOSITION_LIMIT &&
@@ -2832,7 +2826,7 @@
} else {
if (qe->parent->announceposition == ANNOUNCEPOSITION_MORE_THAN && qe->pos > qe->parent->announcepositionlimit){
/* More than Case*/
- res = play_file(qe->chan, qe->parent->queue_quantity1, ringing, NULL);
+ res = play_file(qe->chan, qe->parent->queue_quantity1, ringing, NULL);
if (res) {
goto playout;
}
@@ -2927,7 +2921,7 @@
ast_channel_name(qe->chan), qe->parent->name, qe->pos);
}
if (say_thanks) {
- res = play_file(qe->chan, qe->parent->sound_thanks, ringing, NULL);
+ res = play_file(qe->chan, qe->parent->sound_thanks, ringing, NULL);
}
playout:
@@ -2939,15 +2933,6 @@
qe->last_pos = now;
qe->last_pos_said = qe->pos;
- /* Don't restart music on hold if we're about to exit the caller from the queue */
- /* Next section commented out by old Olle patch */
- /* if (!res) {
- if (ringing) {
- ast_indicate(qe->chan, AST_CONTROL_RINGING);
- } else {
- ast_moh_start(qe->chan, qe->moh, NULL);
- }
- } */
/* it used to be, that we'd fire up the MOH/Indication at this point;
now, play_file handles those details; it no longer waits for any
user input... so no questions about valid_exit().
@@ -3552,14 +3537,6 @@
return 0;
}
- if (!background_prompts) {
- if (ringing) {
- ast_indicate(qe->chan,-1);
- } else {
- ast_moh_stop(qe->chan);
- }
- }
-
ast_verb(3, "Playing periodic announcement\n");
if (qe->parent->randomperiodicannounce && qe->parent->numperiodicannounce) {
@@ -3739,13 +3716,13 @@
#endif
while (*to && !peer) {
-
int numlines, retry, pos = 1;
struct ast_channel *watchers[AST_MAX_WATCHERS];
watchers[0] = in;
start = NULL;
if (background_prompts) {
+ /* Maintain the background queue */
play_file(qe->chan, NULL, 0, qe->moh);
}
@@ -4489,7 +4466,6 @@
.destroy = queue_transfer_destroy,
};
-
/*! \brief Log an attended transfer when a queue caller channel is masqueraded
*
* When a caller is masqueraded, we want to log a transfer. Fixup time is the closest we can come to when
@@ -5032,7 +5008,7 @@
/* Play announcement to the caller telling it's his turn if defined */
if (!ast_strlen_zero(qe->parent->sound_callerannounce)) {
- if (play_file(qe->chan, qe->parent->sound_callerannounce,ringing,qe->moh))
+ if (play_file(qe->chan, qe->parent->sound_callerannounce, ringing, qe->moh))
ast_log(LOG_WARNING, "Announcement file '%s' is unavailable, continuing anyway...\n", qe->parent->sound_callerannounce);
}
@@ -6141,8 +6117,9 @@
const char *tmp = ast_strlen_zero(rulename) ? qe->parent->defaultrule : rulename;
AST_LIST_LOCK(&rule_lists);
AST_LIST_TRAVERSE(&rule_lists, rl_iter, list) {
- if (!strcasecmp(rl_iter->name, tmp))
+ if (!strcasecmp(rl_iter->name, tmp)) {
break;
+ }
}
if (rl_iter) {
AST_LIST_TRAVERSE(&rl_iter->rules, pr_iter, list) {
@@ -6197,12 +6174,6 @@
ast_channel_stream_set(state->chan, NULL);
state->stream = NULL;
state->aqsi->now_playing = 0; /* Important flag to indicate we are no longer playing on this channel */
- //ast_log(LOG_DEBUG, "--- Restarting MOH --\n");
- //if (state->aqsi->ringing) {
- //ast_indicate(state->chan, AST_CONTROL_RINGING);
- //} else if (state->aqsi->moh) {
- //ast_moh_start(state->chan, state->aqsi->moh, NULL);
- //}
}
/*! \brief Release generator on channel */
@@ -6255,8 +6226,6 @@
struct ast_frame *f = NULL;
int res = 0;
- ast_debug(2, "***** Generating good old prompts for your benefit. Did I hear a thank you?\n");
-
if (!state) {
ast_log(LOG_ERROR, "---- Do not have a current state data structure\n");
return -1;
@@ -6267,11 +6236,9 @@
}
state->sample_queue += samples;
- ast_debug(3, "--------->>>>> Generating %d samples - sample queue now %d channel %s\n", samples, state->sample_queue, ast_channel_name(chan));
while (state->sample_queue > 0) {
if (!(f = gen_readframe(state))) {
- ast_debug(3, "---- :-( Could not get more frames\n");
return -1;
}
@@ -6287,7 +6254,7 @@
return res;
}
-/*! \brief Generator initialization structure for play_file */
+/*! \brief Generator initialization structure for \ref play_file() */
static struct ast_generator play_file_gen =
{
alloc: gen_alloc, /*! \ref gen_alloc() */
@@ -6330,16 +6297,16 @@
}
ast_stopstream(chan);
if (ringing) {
- ast_indicate(chan, AST_CONTROL_RINGING);
- } else {
- ast_moh_start(chan, moh, NULL);
- }
+ ast_indicate(chan, AST_CONTROL_RINGING);
+ } else {
+ ast_moh_start(chan, moh, NULL);
+ }
return res;
}
/* look up the datastore and the play_finished struct, and set appropriate values */
- if ((datastore = ast_channel_datastore_find(chan, ast_sound_ending(), NULL))) {
+ if ((datastore = ast_channel_datastore_find(chan, ast_prompt_list(), NULL))) {
aqsi = datastore->data;
if (aqsi) { /* copy this stuff into place */
aqsi->ringing = ringing;
@@ -6348,10 +6315,10 @@
}
}
} else {
- ast_log(LOG_ERROR, "Can't find the ast_sound_ending datastore! on chan %s\n", ast_channel_name(chan));
+ ast_log(LOG_ERROR, "Can't find the ast_prompt_list datastore! on chan %s\n", ast_channel_name(chan));
return 1; /* Why continue, if I can't access the datastore & list? */
}
- ast_debug(2, "---- Aqsi now playing: %d\n", aqsi->now_playing);
+ ast_debug(2, "---- Background prompts now playing: %d\n", aqsi->now_playing);
if (aqsi->now_playing == 0) {
playfilename[0] = '\0';
@@ -6363,10 +6330,8 @@
ringing = aqsi->ringing;
moh = aqsi->moh;
free(sfn);
- ast_debug(3, "--- No filename and not playing - selecting next file in playlist - %s\n", playfilename);
}
if (ast_strlen_zero(playfilename)) {
- ast_debug(3, "--- empty queue... No filename and not currently playing\n");
if (ringing) {
ast_indicate(chan, AST_CONTROL_RINGING);
} else {
@@ -6381,7 +6346,6 @@
}
} else {
if (ast_strlen_zero(filename)) {
- ast_debug(3, "--- just checking... No filename and currently playing\n");
return -1;
}
}
@@ -6391,7 +6355,7 @@
if (aqsi->now_playing) {
struct ast_queue_streamfile_name *fn = ast_calloc(1, sizeof(*fn));
fn->filename = ast_strdup(filename);
- ast_debug(3, " queued sound file %s for playing on chan %s\n", filename, ast_channel_name(chan));
+ ast_debug(3, "Background prompts: queued sound file %s for playing on chan %s\n", filename, ast_channel_name(chan));
/* link the struct into the current ast_queue_streamfile_info struct */
AST_LIST_INSERT_TAIL(&aqsi->flist, fn, list);
@@ -6401,17 +6365,11 @@
/* Stop the music on hold so we can play our own file */
if (ringing) {
- ast_debug(3, "Stopping Indication on %s\n", ast_channel_name(chan));
ast_indicate(chan,-1);
} else {
- ast_debug(3, "Stopping MOH on chan %s\n", ast_channel_name(chan));
ast_moh_stop(chan);
}
-
- ast_debug(3, "Stopping Streaming on chan %s\n", ast_channel_name(chan));
ast_stopstream(chan);
-
- ast_debug(3, "Autoservice stop on chan %s\n", ast_channel_name(chan));
ast_autoservice_stop(chan);
/* Create generator to start playing audio without waiting */
@@ -6423,8 +6381,6 @@
ast_copy_string(generatordata->filename, playfilename, sizeof(generatordata->filename));
generatordata->chan = chan;
generatordata->aqsi = aqsi;
-
-
/* Starting new generator on channel. */
if (ast_activate_generator(chan, &play_file_gen, generatordata)) {
@@ -6439,7 +6395,7 @@
AST_LIST_UNLOCK(&aqsi->flist);
return 1;
} else {
- ast_debug(3, "--- Generator Starting to play file %s \n", playfilename);
+ ast_debug(3, "--- Background Prompt Generator Starting to play file %s \n", playfilename);
}
aqsi->now_playing = 1; /* We have begun playback */
}
@@ -6489,8 +6445,8 @@
int qcontinue = 0;
int max_penalty, min_penalty;
enum queue_result reason = QUEUE_UNKNOWN;
- struct ast_datastore *datastore = NULL;
- struct ast_queue_streamfile_info *aqsi = calloc(1,sizeof(struct ast_queue_streamfile_info));
+ struct ast_datastore *datastore;
+ struct ast_queue_streamfile_info *aqsi;
/* whether to exit Queue application after the timeout hits */
int tries = 0;
@@ -6621,11 +6577,14 @@
S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""),
qe.opos);
if (background_prompts) {
+ aqsi = calloc(1,sizeof(struct ast_queue_streamfile_info));
+ datastore = NULL;
+
/* Set up the channel datastore for the playlist of prompts
that we're going to play in the background while the call
is in the queue.
*/
- datastore = ast_datastore_alloc(ast_sound_ending(), NULL);
+ datastore = ast_datastore_alloc(ast_prompt_list(), NULL);
aqsi->qe = &qe;
aqsi->chan = chan;
aqsi->ringing = ringing;
@@ -6755,11 +6714,13 @@
}
stop:
- /* remove the playdata datastore */
- ast_channel_datastore_remove(chan, datastore);
+ if (background_prompts) {
+ /* remove the playdata datastore */
+ ast_channel_datastore_remove(chan, datastore);
- /* get rid of the datastore for non-wait sound playing */
- destroy_streamfile_info(aqsi);
+ /* get rid of the datastore for non-wait sound playing */
+ destroy_streamfile_info(aqsi);
+ }
if (res) {
if (res < 0) {
Modified: team/oej/pinequeue-trunk/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinequeue-trunk/include/asterisk/channel.h?view=diff&rev=363927&r1=363926&r2=363927
==============================================================================
--- team/oej/pinequeue-trunk/include/asterisk/channel.h (original)
+++ team/oej/pinequeue-trunk/include/asterisk/channel.h Thu Apr 26 03:11:32 2012
@@ -3518,20 +3518,20 @@
Used (at least at first) in app_queue - in the ast_queue_streamfile_info channel datastore
*/
struct ast_queue_streamfile_name {
- char *filename;
- AST_LIST_ENTRY(ast_queue_streamfile_name) list;
+ char *filename;
+ AST_LIST_ENTRY(ast_queue_streamfile_name) list;
};
/*! \brief Information data about background playing of prompts */
struct ast_queue_streamfile_info {
- void (*digitHandler)(void *data, char digit); /* a func ptr to the handler that will do what needs doing when the streaming of a soundfile is finished */
- struct queue_ent *qe;
- AST_LIST_HEAD(,ast_queue_streamfile_name) flist; /* a list of other sound files that need to be played in sequence */
- struct ast_channel *chan;
- int ringing;
- char moh[80];
- int now_playing;
- int valid_exit; /* if valid_exit() in app_queue is true */
+ void (*digitHandler)(void *data, char digit); /* a func ptr to the handler that will do what needs doing when the streaming of a soundfile is finished */
+ struct queue_ent *qe;
+ AST_LIST_HEAD(,ast_queue_streamfile_name) flist; /* a list of other sound files that need to be played in sequence */
+ struct ast_channel *chan;
+ int ringing;
+ char moh[80];
+ int now_playing;
+ int valid_exit; /* if valid_exit() in app_queue is true */
};
Modified: team/oej/pinequeue-trunk/include/asterisk/file.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinequeue-trunk/include/asterisk/file.h?view=diff&rev=363927&r1=363926&r2=363927
==============================================================================
--- team/oej/pinequeue-trunk/include/asterisk/file.h (original)
+++ team/oej/pinequeue-trunk/include/asterisk/file.h Thu Apr 26 03:11:32 2012
@@ -40,7 +40,8 @@
struct ast_filestream;
struct ast_format;
-const struct ast_datastore_info *ast_sound_ending(void);
+/* Prompt list for background play of audio */
+const struct ast_datastore_info *ast_prompt_list(void);
/*! The maximum number of formats we expect to see in a format string */
#define AST_MAX_FORMATS 10
@@ -340,7 +341,6 @@
*/
char *ast_format_str_reduce(char *fmts);
-
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
Modified: team/oej/pinequeue-trunk/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinequeue-trunk/main/channel.c?view=diff&rev=363927&r1=363926&r2=363927
==============================================================================
--- team/oej/pinequeue-trunk/main/channel.c (original)
+++ team/oej/pinequeue-trunk/main/channel.c Thu Apr 26 03:11:32 2012
@@ -2878,7 +2878,6 @@
ast_channel_generator(chan)->write_format_change(chan, ast_channel_generatordata(chan));
}
ast_channel_unlock(chan);
- ast_debug(3, "ast_deactivate_generator() done on chan %s\n", ast_channel_name(chan));
}
static int generator_force(const void *data)
@@ -4081,7 +4080,6 @@
/* Run generator sitting on the line if timing device not available
* and synchronous generation of outgoing frames is necessary */
- ast_debug(3, ">>>>>>>>> just another silly message. We are generating, man! \n");
ast_read_generator_actions(chan, f);
}
break;
Modified: team/oej/pinequeue-trunk/main/features.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinequeue-trunk/main/features.c?view=diff&rev=363927&r1=363926&r2=363927
==============================================================================
--- team/oej/pinequeue-trunk/main/features.c (original)
+++ team/oej/pinequeue-trunk/main/features.c Thu Apr 26 03:11:32 2012
@@ -1619,13 +1619,10 @@
ast_debug(4, "AMI ParkedCall Channel: %s\n", ast_channel_name(chan));
ast_debug(4, "AMI ParkedCall From: %s\n", event_from);
-/* OEJ */
-#ifdef HAVE_ADSI
if (peer && adsipark && ast_adsi_available(peer)) {
adsi_announce_park(peer, pu->parkingexten); /* Only supports parking numbers */
ast_adsi_unload_session(peer);
}
-#endif
snprintf(app_data, sizeof(app_data), "%s,%s", pu->parkingexten,
pu->parkinglot->name);
Modified: team/oej/pinequeue-trunk/main/file.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinequeue-trunk/main/file.c?view=diff&rev=363927&r1=363926&r2=363927
==============================================================================
--- team/oej/pinequeue-trunk/main/file.c (original)
+++ team/oej/pinequeue-trunk/main/file.c Thu Apr 26 03:11:32 2012
@@ -772,15 +772,15 @@
return NULL;
}
-static const struct ast_datastore_info ast_sound_ending_obj = { /* this is here because it is referenced here
+static const struct ast_datastore_info ast_prompt_list_obj = { /* this is here because it is referenced here
and the only other place it is used is in app_queue,
which is not always loaded. */
- .type = "ast_sound_ending"
+ .type = "ast_prompt_list"
};
-const struct ast_datastore_info *ast_sound_ending()
-{
- return &ast_sound_ending_obj;
+const struct ast_datastore_info *ast_prompt_list()
+{
+ return &ast_prompt_list_obj;
}
@@ -842,7 +842,6 @@
ast_log(LOG_WARNING, "Failed to write frame\n");
ast_frfree(fr);
}
- ast_log(LOG_DEBUG, "--- Giving up here now\n");
goto return_failure;
}
Modified: team/oej/pinequeue-trunk/main/say.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinequeue-trunk/main/say.c?view=diff&rev=363927&r1=363926&r2=363927
==============================================================================
--- team/oej/pinequeue-trunk/main/say.c (original)
+++ team/oej/pinequeue-trunk/main/say.c Thu Apr 26 03:11:32 2012
@@ -416,7 +416,8 @@
/* if a datastore is present, we are in the queue app (perhaps others in time)
and don't want to wait around for the sounds to finish playing */
- if ((datastore = ast_channel_datastore_find(chan, ast_sound_ending(), NULL))) { /* app_queue wants to schedule this instead of play & wait */
+ if ((datastore = ast_channel_datastore_find(chan, ast_prompt_list(), 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);
@@ -440,12 +441,8 @@
ast_autoservice_stop(aqsi->chan);
- ast_debug(3, "Starting to stream %s\n", file);
res = ast_streamfile(aqsi->chan, file, ast_channel_language(aqsi->chan)); /* 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;
fn = AST_LIST_REMOVE_HEAD(&aqsi->flist, list);
@@ -472,20 +469,19 @@
AST_LIST_UNLOCK(&aqsi->flist);
return 0;
}
+ 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
More information about the asterisk-commits
mailing list