fixes the bug causing the bye message not to be played in the mailbox_query application.

Thanks to Juha for reporting and debugging.


git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@248 8eb893ce-cfd4-0310-b710-fb5ebe64c474
sayer/1.4-spce2.6
Raphael Coeffic 19 years ago
parent 6c8fe2c0bd
commit 65cffa7f3c

@ -227,6 +227,13 @@ static PyObject* IvrDialogBase_flush(IvrDialogBase* self, PyObject* args)
return Py_None;
}
static PyObject* IvrDialogBase_queueIsEmpty(IvrDialogBase* self, PyObject* args)
{
assert(self->p_dlg);
return PyBool_FromLong(self->p_dlg->playlist.isEmpty());
}
static PyObject* IvrDialogBase_mute(IvrDialogBase* self, PyObject* args)
{
assert(self->p_dlg);
@ -492,6 +499,9 @@ static PyMethodDef IvrDialogBase_methods[] = {
{"enqueue", (PyCFunction)IvrDialogBase_enqueue, METH_VARARGS,
"Add some audio to the queue (mostly IvrAudioFile)"
},
{"queueIsEmpty", (PyCFunction)IvrDialogBase_queueIsEmpty, METH_NOARGS,
"Is the audio queue empty?"
},
{"flush", (PyCFunction)IvrDialogBase_flush, METH_NOARGS,
"Flush the queue"
},

@ -152,8 +152,9 @@ class IvrDialog(IvrDialogBase):
def onEmptyQueue(self):
if self.exit:
self.bye()
self.stopSession()
if self.queueIsEmpty():
self.bye()
self.stopSession()
def onDtmf(self,key,duration):

@ -31,8 +31,10 @@ void AmPlaylist::gotoNextItem()
}
updateCurrentItem();
if(had_item && !cur_item)
if(had_item && !cur_item){
DBG("posting AmAudioEvent::noAudio event!\n");
ev_q->postEvent(new AmAudioEvent(AmAudioEvent::noAudio));
}
}
int AmPlaylist::get(unsigned int user_ts, unsigned char* buffer, unsigned int nb_samples)
@ -120,3 +122,18 @@ void AmPlaylist::close()
gotoNextItem();
cur_mut.unlock();
}
bool AmPlaylist::isEmpty()
{
bool res(true);
cur_mut.lock();
items_mut.lock();
res = (!cur_item) && items.empty();
items_mut.unlock();
cur_mut.unlock();
return res;
}

@ -54,6 +54,8 @@ class AmPlaylist: public AmAudio
AmPlaylist(AmEventQueue* q);
~AmPlaylist();
bool isEmpty();
void addToPlaylist(AmPlaylistItem* item);
void addToPlayListFront(AmPlaylistItem* item);
void close();

Loading…
Cancel
Save