[asterisk-commits] murf: branch group/pinequeue r290025 - in /team/group/pinequeue: ./ apps/ cha...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sat Oct 2 09:44:37 CDT 2010
Author: murf
Date: Sat Oct 2 09:44:31 2010
New Revision: 290025
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=290025
Log:
More debug! I have a suspicion that the core of the
matter is in the waiting-- more precisely, who is waiting
for what.
Modified:
team/group/pinequeue/README.pinequeue
team/group/pinequeue/apps/app_queue.c
team/group/pinequeue/channels/chan_dahdi.c
team/group/pinequeue/channels/chan_sip.c
team/group/pinequeue/main/channel.c
team/group/pinequeue/main/file.c
team/group/pinequeue/res/res_musiconhold.c
Modified: team/group/pinequeue/README.pinequeue
URL: http://svnview.digium.com/svn/asterisk/team/group/pinequeue/README.pinequeue?view=diff&rev=290025&r1=290024&r2=290025
==============================================================================
--- team/group/pinequeue/README.pinequeue (original)
+++ team/group/pinequeue/README.pinequeue Sat Oct 2 09:44:31 2010
@@ -2,5 +2,5 @@
a queue member is ready and waiting for a new call while a prompt is played
to the call waiting in the queue. Currently the prompt is played fully.
-With this code the prompt will be interrupted and the call will
+With this code such prompts will be played asynchronously, and the call will
be connected to the queue member.
Modified: team/group/pinequeue/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pinequeue/apps/app_queue.c?view=diff&rev=290025&r1=290024&r2=290025
==============================================================================
--- team/group/pinequeue/apps/app_queue.c (original)
+++ team/group/pinequeue/apps/app_queue.c Sat Oct 2 09:44:31 2010
@@ -2599,7 +2599,9 @@
}
/* Poll for events from both the incoming channel as well as any outgoing channels */
+ ast_log(LOG_ERROR,"About to do ast_waitfor_n()\n");
winner = ast_waitfor_n(watchers, pos, to);
+ ast_log(LOG_ERROR,"Returned from ast_waitfor_n() winner=%p\n",winner);
/* Service all of the outgoing channels */
for (o = start; o; o = o->call_next) {
@@ -2964,12 +2966,15 @@
}
/* Wait a second before checking again */
+ ast_log(LOG_ERROR,"About to Wait for digit(%d ms)\n", RECHECK * 1000);
if ((res = ast_waitfordigit(qe->chan, RECHECK * 1000))) {
+ ast_log(LOG_ERROR,"Returned (%d) from waitfordigit\n", res);
if (res > 0 && !valid_exit(qe, res))
res = 0;
else
break;
}
+ ast_log(LOG_ERROR,"Returned (%d) from waitfordigit\n", res);
/* If we have timed out, break out */
if (qe->expire && (time(NULL) >= qe->expire)) {
@@ -3582,7 +3587,7 @@
int res2;
res2 = ast_autoservice_start(qe->chan);
- ast_log(LOG_ERROR,"Autoservice started on chan\n");
+ ast_log(LOG_ERROR,"Autoservice started on chan %s\n",qe->chan->name);
/* instead of starting autoservice and jacking this thread to push sound to the
peer channel, let's set up a background player to the peer channel and
get on with life in this thread. */
@@ -3602,7 +3607,6 @@
ast_channel_datastore_add(chan, datastore);
*/
- ast_log(LOG_ERROR,"Autoservice started\n");
if (qe->parent->memberdelay) {
ast_log(LOG_NOTICE, "Delaying member connect for %d seconds\n", qe->parent->memberdelay);
res2 |= ast_safe_sleep(peer, qe->parent->memberdelay * 1000);
@@ -3629,7 +3633,7 @@
}
}
}
- ast_log(LOG_ERROR,"Autoservice stopped\n");
+ ast_log(LOG_ERROR,"Autoservice stopped on chan %s\n", qe->chan->name);
res2 |= ast_autoservice_stop(qe->chan);
if (ast_check_hangup(peer)) {
/* Agent must have hung up */
@@ -3664,7 +3668,7 @@
ast_log(LOG_ERROR,"Stopping indicate\n");
ast_indicate(qe->chan,-1);
} else {
- ast_log(LOG_ERROR,"Stopping MOH\n");
+ ast_log(LOG_ERROR,"Stopping MOH on chan %s\n", qe->chan->name);
ast_moh_stop(qe->chan);
}
/* If appropriate, log that we have a destination channel */
@@ -3845,10 +3849,10 @@
if (!ast_strlen_zero(macroexec)) {
ast_debug(1, "app_queue: macro=%s.\n", macroexec);
- ast_log(LOG_ERROR,"Autoservice started\n");
+ ast_log(LOG_ERROR,"Autoservice started on chan %s\n", qe->chan->name);
res = ast_autoservice_start(qe->chan);
if (res) {
- ast_log(LOG_ERROR, "Unable to start autoservice on calling channel\n");
+ ast_log(LOG_ERROR, "Unable to start autoservice on calling channel %s\n", qe->chan->name);
res = -1;
}
@@ -3863,7 +3867,7 @@
res = -1;
}
- ast_log(LOG_ERROR,"Autoservice stopped\n");
+ ast_log(LOG_ERROR,"Autoservice stopped on chan %s\n", qe->chan->name);
if (ast_autoservice_stop(qe->chan) < 0) {
ast_log(LOG_ERROR, "Could not stop autoservice on calling channel\n");
res = -1;
@@ -3882,7 +3886,7 @@
if (!ast_strlen_zero(gosubexec)) {
if (option_debug)
ast_log(LOG_DEBUG, "app_queue: gosub=%s.\n", gosubexec);
- ast_log(LOG_ERROR,"Autoservice started\n");
+ ast_log(LOG_ERROR,"Autoservice started on chan %s\n", qe->chan->name);
res = ast_autoservice_start(qe->chan);
if (res) {
ast_log(LOG_ERROR, "Unable to start autoservice on calling channel\n");
@@ -3932,7 +3936,7 @@
res = -1;
}
- ast_log(LOG_ERROR,"Autoservice stopped\n");
+ ast_log(LOG_ERROR,"Autoservice stopped on chan %s\n", qe->chan->name);
if (ast_autoservice_stop(qe->chan) < 0) {
ast_log(LOG_ERROR, "Could not stop autoservice on calling channel\n");
res = -1;
@@ -4033,8 +4037,11 @@
{
/* Don't need to hold the lock while we setup the outgoing calls */
int retrywait = qe->parent->retry * 1000;
-
- int res = ast_waitfordigit(qe->chan, retrywait);
+ int res;
+
+ ast_log(LOG_ERROR,"About to call ast_waitfordigit(%d)\n", retrywait);
+ res = ast_waitfordigit(qe->chan, retrywait);
+ ast_log(LOG_ERROR,"ast_waitfordigit returns %d\n", res);
if (res > 0 && !valid_exit(qe, res))
res = 0;
@@ -4773,10 +4780,10 @@
and handle the EOF asynchronously via ast_autoservice_*().
*/
- ast_log(LOG_WARNING,"----SOUND_FINISHED_HANDLER CALLED! chan=%p\n", chan);
- ast_log(LOG_ERROR,"StopStream\n");
+ ast_log(LOG_WARNING,"----SOUND_FINISHED_HANDLER CALLED! chan=%s\n", chan->name);
+ ast_log(LOG_ERROR,"StopStream on chan %s\n", chan->name);
ast_stopstream(chan);
- ast_log(LOG_ERROR,"AutoServiceStop\n");
+ ast_log(LOG_ERROR,"AutoServiceStop %s\n", chan->name);
ast_autoservice_stop(chan);
/* if there are any files in flist, now is the time to start playing them! */
AST_LIST_LOCK(&playdata->flist);
@@ -4784,7 +4791,7 @@
fn = AST_LIST_REMOVE_HEAD(&playdata->flist, list);
- ast_log(LOG_ERROR,"Start streaming file %s\n", fn->filename);
+ ast_log(LOG_ERROR,"Start streaming file %s on chan %s\n", fn->filename, chan->name);
res = ast_streamfile(chan, fn->filename, chan->language);
if (res) {
/* perhaps this file was not found, whatever...
@@ -4795,7 +4802,7 @@
}
ast_autoservice_start(chan);
- ast_log(LOG_ERROR,"AutoServiceStart\n");
+ ast_log(LOG_ERROR,"AutoServiceStart on chan %s\n", chan->name);
ast_free(fn->filename);
ast_free(fn);
@@ -4809,11 +4816,12 @@
/* Resume Music on Hold if the caller is going to stay in the queue */
if (!playdata->valid_exit) { /* don't start up moh if we are on our way out */
if (ringing) {
- ast_log(LOG_ERROR,"Starting indicate CONTROL_RINGING\n");
+ ast_log(LOG_ERROR,"Starting indicate CONTROL_RINGING on chan %s\n", chan->name);
ast_indicate(chan, AST_CONTROL_RINGING);
} else {
- ast_log(LOG_ERROR,"Starting MOH\n");
+ ast_log(LOG_ERROR,"Starting MOH on chan %s\n", chan->name);
ast_moh_start(chan, moh, NULL);
+ /* ast_waitfor(chan, 1); */
}
}
}
@@ -4823,7 +4831,7 @@
around for each one to finish before playing the next, instead we put them into
a list, which we insert at the tail.
- The file-finished handler will, upon a file completion, check to see if annything
+ The file-finished handler will, upon a file compltion, check to see if annything
is in that list, and remove from the head and begin the playback.
Make sure to get things rolling with a plain play_file(), then use this
@@ -4846,7 +4854,7 @@
strcpy(aqsi->moh, moh);
}
} else {
- ast_log(LOG_ERROR, "Can't find the queue_ds_sound_ending datastore!\n");
+ ast_log(LOG_ERROR, "Can't find the queue_ds_sound_ending datastore! on chan %s\n", chan->name);
return 1; /* Why continue, if I can't access the datastore & list? */
}
@@ -4859,7 +4867,7 @@
if (aqsi->now_playing) {
struct ast_queue_streamfile_name *fn = ast_calloc(1, sizeof(*fn));
fn->filename = ast_strdup(filename);
- ast_log(LOG_ERROR,"queued sound file %s for playing\n", filename);
+ ast_log(LOG_ERROR,"queued sound file %s for playing on chan %s\n", filename, chan->name);
/* link the struct into the current ast_queue_streamfile_info struct */
AST_LIST_INSERT_TAIL(&aqsi->flist, fn, list); /* in this case, nothing else to do,
@@ -4868,20 +4876,20 @@
/* Stop the music on hold so we can play our own file */
if (ringing) {
ast_log(LOG_ERROR, "Stopping Indicate\n");
- ast_indicate(aqsi->chan,-1);
+ ast_indicate(chan,-1);
} else {
- ast_log(LOG_ERROR, "Stopping MOH\n");
- ast_moh_stop(aqsi->chan);
+ ast_log(LOG_ERROR, "Stopping MOH on chan %s\n", chan->name);
+ ast_moh_stop(chan);
}
- ast_log(LOG_ERROR, "Stopping Streaming\n");
- ast_stopstream(aqsi->chan);
+ ast_log(LOG_ERROR, "Stopping Streaming on chan %s\n", chan->name);
+ ast_stopstream(chan);
- ast_log(LOG_ERROR, "Autoservice stop\n");
- ast_autoservice_stop(aqsi->chan);
+ ast_log(LOG_ERROR, "Autoservice stop on chan %s\n", chan->name);
+ ast_autoservice_stop(chan);
- ast_log(LOG_ERROR, "Starting to stream %s\n", filename);
- res = ast_streamfile(aqsi->chan, filename, aqsi->chan->language); /* begin the streaming */
+ ast_log(LOG_ERROR, "Starting to stream %s on chan %s\n", filename, chan->name);
+ res = ast_streamfile(chan, filename, aqsi->chan->language); /* begin the streaming */
while (res && !AST_LIST_EMPTY(&aqsi->flist)) {
/* really, how could this even be possible?
@@ -4890,8 +4898,8 @@
fn = AST_LIST_REMOVE_HEAD(&aqsi->flist, list);
- ast_log(LOG_ERROR,"Start streaming file %s\n", fn->filename);
- res = ast_streamfile(aqsi->chan, fn->filename, aqsi->chan->language);
+ ast_log(LOG_ERROR,"Start streaming file %s on chan %s\n", fn->filename, chan->name);
+ res = ast_streamfile(chan, fn->filename, chan->language);
}
@@ -4900,20 +4908,23 @@
/* restore the moh */
if (ringing) {
ast_log(LOG_ERROR, "Starting Indicate\n");
- ast_indicate(aqsi->qe->chan, AST_CONTROL_RINGING);
+ ast_indicate(chan, AST_CONTROL_RINGING);
} else {
- ast_log(LOG_ERROR, "Starting MOH\n");
- ast_moh_start(aqsi->qe->chan, aqsi->qe->moh, NULL);
+ ast_log(LOG_ERROR, "Starting MOH %s on chan %s\n", aqsi->qe->moh, chan->name);
+ ast_moh_start(chan, aqsi->qe->moh, NULL);
}
AST_LIST_UNLOCK(&aqsi->flist);
return 1;
}
aqsi->now_playing = 1; /* We have begun playback */
- ast_log(LOG_ERROR,"Autoservice start");
- ast_autoservice_start(aqsi->qe->chan); /* this will let the sound file play in a different thread */
+ ast_log(LOG_ERROR,"Autoservice start\n");
+ ast_autoservice_start(chan); /* this will let the sound file play in a different thread */
+
}
AST_LIST_UNLOCK(&aqsi->flist);
+ ast_log(LOG_ERROR,"ast_waitfor(1) called\n");
+ ast_waitfor(chan, 1);
return 0; /* non-zero most likely means the file doesn't exist */
}
@@ -5081,8 +5092,9 @@
ast_log(LOG_ERROR,"Starting indicate CONTROL_RINGING\n");
ast_indicate(chan, AST_CONTROL_RINGING);
} else {
- ast_log(LOG_ERROR,"Starting MOH\n");
+ ast_log(LOG_ERROR,"Starting MOH on chan %s\n", chan->name);
ast_moh_start(chan, qe.moh, NULL);
+ /* ast_waitfor(chan,1); */
}
/* This is the wait loop for callers 2 through maxlen */
Modified: team/group/pinequeue/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pinequeue/channels/chan_dahdi.c?view=diff&rev=290025&r1=290024&r2=290025
==============================================================================
--- team/group/pinequeue/channels/chan_dahdi.c (original)
+++ team/group/pinequeue/channels/chan_dahdi.c Sat Oct 2 09:44:31 2010
@@ -3347,8 +3347,8 @@
}
if (newslot < 0) {
newslot = 0;
- ast_log(LOG_WARNING, "No D-channels available! Using Primary channel %d as D-channel anyway!\n",
- pri->dchannels[newslot]);
+ /* ast_log(LOG_WARNING, "No D-channels available! Using Primary channel %d as D-channel anyway!\n",
+ pri->dchannels[newslot]); */
}
if (old && (oldslot != newslot))
ast_log(LOG_NOTICE, "Switching from from d-channel %d to channel %d!\n",
Modified: team/group/pinequeue/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pinequeue/channels/chan_sip.c?view=diff&rev=290025&r1=290024&r2=290025
==============================================================================
--- team/group/pinequeue/channels/chan_sip.c (original)
+++ team/group/pinequeue/channels/chan_sip.c Sat Oct 2 09:44:31 2010
@@ -17136,10 +17136,13 @@
static void ast_quiet_chan(struct ast_channel *chan)
{
if (chan && chan->_state == AST_STATE_UP) {
- if (ast_test_flag(chan, AST_FLAG_MOH))
+ if (ast_test_flag(chan, AST_FLAG_MOH)) {
+ ast_log(LOG_ERROR,"about to call ast_moh_stop!\n");
ast_moh_stop(chan);
- else if (chan->generatordata)
+ } else if (chan->generatordata) {
+ ast_log(LOG_ERROR,"about to call deactivate_generator!\n");
ast_deactivate_generator(chan);
+ }
}
}
Modified: team/group/pinequeue/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pinequeue/main/channel.c?view=diff&rev=290025&r1=290024&r2=290025
==============================================================================
--- team/group/pinequeue/main/channel.c (original)
+++ team/group/pinequeue/main/channel.c Sat Oct 2 09:44:31 2010
@@ -1944,10 +1944,12 @@
void ast_deactivate_generator(struct ast_channel *chan)
{
+ ast_log(LOG_ERROR,"ast_deactivate_generator() called on chan %s\n", chan->name);
ast_channel_lock(chan);
if (chan->generatordata) {
if (chan->generator && chan->generator->release)
chan->generator->release(chan, chan->generatordata);
+ ast_log(LOG_ERROR,"removing the generator stuff on chan %s\n", chan->name);
chan->generatordata = NULL;
chan->generator = NULL;
ast_channel_set_fd(chan, AST_GENERATOR_FD, -1);
@@ -1964,7 +1966,7 @@
int res;
int (*generate)(struct ast_channel *chan, void *tmp, int datalen, int samples) = NULL;
struct ast_channel *chan = (struct ast_channel *)data;
-
+ ast_log(LOG_ERROR, "GENERATOR_FORCE CALLED on chan %s\n", chan->name);
ast_channel_lock(chan);
tmp = chan->generatordata;
chan->generatordata = NULL;
@@ -1979,8 +1981,9 @@
chan->generatordata = tmp;
+ ast_log(LOG_ERROR, "GENERATOR_FORCE: generate() CALLED res=%d on chan %s\n", res, chan->name);
if (res) {
- ast_debug(1, "Auto-deactivating generator\n");
+ ast_debug(1, "Auto-deactivating generator on chan %s\n", chan->name);
ast_deactivate_generator(chan);
}
@@ -1991,6 +1994,7 @@
{
int res = 0;
+ ast_log(LOG_ERROR,"In the activate_generator func. gen->alloc = %p on chan %s\n", gen->alloc, chan->name);
ast_channel_lock(chan);
if (chan->generatordata) {
if (chan->generator && chan->generator->release)
@@ -1998,12 +2002,15 @@
chan->generatordata = NULL;
}
if (gen->alloc && !(chan->generatordata = gen->alloc(chan, params))) {
+ ast_log(LOG_ERROR,"Generator Data is -1\n");
res = -1;
}
if (!res) {
+ ast_log(LOG_ERROR,"About to settimeout for generator_force on chan %s\n", chan->name);
ast_settimeout(chan, 160, generator_force, chan);
chan->generator = gen;
}
+ ast_log(LOG_ERROR,"Leaving the activate_generator, res=%d on chan %s\n", res, chan->name);
ast_channel_unlock(chan);
ast_prod(chan);
@@ -2400,8 +2407,10 @@
int ast_settimeout(struct ast_channel *c, int samples, int (*func)(const void *data), void *data)
{
int res = -1;
+ ast_log(LOG_ERROR,"in settimeout\n");
#ifdef HAVE_DAHDI
ast_channel_lock(c);
+ ast_log(LOG_ERROR,"in settimeout (HAVE DAHDI) timingfd=%d; timingfunc=%p; timingdata=%p\n", c->timingfd, c->timingfunc, c->timingdata);
if (c->timingfd > -1) {
if (!func) {
samples = 0;
@@ -2661,7 +2670,7 @@
* this happens so that it can be addressed.
*/
if (chan->fdno == -1) {
- ast_log(LOG_ERROR, "ast_read() called with no recorded file descriptor.\n");
+ ast_log(LOG_ERROR, "ast_read() called with no recorded file descriptor on chan %s.\n", chan->name);
}
#endif
Modified: team/group/pinequeue/main/file.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pinequeue/main/file.c?view=diff&rev=290025&r1=290024&r2=290025
==============================================================================
--- team/group/pinequeue/main/file.c (original)
+++ team/group/pinequeue/main/file.c Sat Oct 2 09:44:31 2010
@@ -755,6 +755,7 @@
}
fr = read_frame(s, &whennext);
+ ast_log(LOG_ERROR, "Read a frame on channel %s\n", s->owner->name);
if (!fr /* stream complete */ || ast_write(s->owner, fr) /* error writing */) {
if (fr) {
@@ -763,6 +764,7 @@
}
goto return_failure;
}
+ ast_log(LOG_ERROR, "and wrote it, too!\n");
if (fr) {
ast_frfree(fr);
@@ -780,11 +782,14 @@
factor = ((float) rate) / ((float) 8000.0);
dahdi_timer_samples = (int) ( ((float) dahdi_timer_samples) / factor );
}
+ ast_log(LOG_ERROR,"About to call ast_settimeout with %d for ast_fsread_audio\n", dahdi_timer_samples);
ast_settimeout(s->owner, dahdi_timer_samples, ast_fsread_audio, s);
- } else
+ } else {
#endif
+ ast_log(LOG_ERROR,"About to call ast_sched_add with %d for ast_fsread_audio\n", whennext / (ast_format_rate(s->fmt->format) / 1000));
s->owner->streamid = ast_sched_add(s->owner->sched,
whennext / (ast_format_rate(s->fmt->format) / 1000), ast_fsread_audio, s);
+ }
s->lasttimeout = whennext;
return FSREAD_SUCCESS_NOSCHED;
}
@@ -793,6 +798,7 @@
return_failure:
s->owner->streamid = -1;
#ifdef HAVE_DAHDI
+ ast_log(LOG_ERROR, "Calling ast_settimeout(%s, 0, NULL, NULL);\n", s->owner->name);
ast_settimeout(s->owner, 0, NULL, NULL);
#endif
return FSREAD_FAILURE;
Modified: team/group/pinequeue/res/res_musiconhold.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pinequeue/res/res_musiconhold.c?view=diff&rev=290025&r1=290024&r2=290025
==============================================================================
--- team/group/pinequeue/res/res_musiconhold.c (original)
+++ team/group/pinequeue/res/res_musiconhold.c Sat Oct 2 09:44:31 2010
@@ -306,6 +306,7 @@
state->sample_queue += samples;
while (state->sample_queue > 0) {
+ ast_log(LOG_ERROR,"about to lock chan & read & write data\n");
ast_channel_lock(chan);
if ((f = moh_files_readframe(chan))) {
/* We need to be sure that we unlock
@@ -315,9 +316,11 @@
* indirect channels, like local channels
*/
ast_channel_unlock(chan);
+ ast_log(LOG_ERROR,"read frame, about to write it\n");
state->samples += f->samples;
state->sample_queue -= f->samples;
res = ast_write(chan, f);
+ ast_log(LOG_ERROR,"wrote frame, res=%d\n", res);
ast_frfree(f);
if (res < 0) {
ast_log(LOG_WARNING, "Failed to write frame to '%s': %s\n", chan->name, strerror(errno));
@@ -1404,9 +1407,13 @@
ast_set_flag(chan, AST_FLAG_MOH);
if (mohclass->total_files) {
+ ast_log(LOG_ERROR,"MOH about to activate_generator: total_files=%d; class=%s;\n", mohclass->total_files, mohclass->mode);
res = ast_activate_generator(chan, &moh_file_stream, mohclass);
+ ast_log(LOG_ERROR,"MOH started, total_files=%d; class=%s;\n", mohclass->total_files, mohclass->mode);
} else {
+ ast_log(LOG_ERROR,"MOH about to activate_generator: total_files=%d; class=%s;\n", mohclass->total_files, mohclass->mode);
res = ast_activate_generator(chan, &mohgen, mohclass);
+ ast_log(LOG_ERROR,"MOH started, total_files=%d; class=%s;\n", mohclass->total_files, mohclass->mode);
}
mohclass = mohclass_unref(mohclass);
More information about the asterisk-commits
mailing list