Module: sems Branch: refs/tags/rel_0.10.0_rc1 Commit: 3eb44c63528b6b7bf7256eb480112a4911b7a511 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=3eb44c63528b6b7bf7256eb480112a4911b7a511
Author: Raphael Coeffic <[email protected]> Committer: Raphael Coeffic <[email protected]> Date: Tue Feb 27 09:39:07 2007 +0000 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/tags/rel_0.10.0_rc1@249 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- apps/ivr/IvrDialogBase.cpp | 10 ++++++++++ apps/mailbox/mailbox_query.py | 5 +++-- core/AmPlaylist.cpp | 19 ++++++++++++++++++- core/AmPlaylist.h | 2 ++ 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/apps/ivr/IvrDialogBase.cpp b/apps/ivr/IvrDialogBase.cpp index 8afe6d6..e9f5dae 100644 --- a/apps/ivr/IvrDialogBase.cpp +++ b/apps/ivr/IvrDialogBase.cpp @@ -217,6 +217,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); @@ -459,6 +466,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" }, diff --git a/apps/mailbox/mailbox_query.py b/apps/mailbox/mailbox_query.py index 9bb5283..c5edae6 100644 --- a/apps/mailbox/mailbox_query.py +++ b/apps/mailbox/mailbox_query.py @@ -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): diff --git a/core/AmPlaylist.cpp b/core/AmPlaylist.cpp index 57d8cbd..e5de7c4 100644 --- a/core/AmPlaylist.cpp +++ b/core/AmPlaylist.cpp @@ -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; +} diff --git a/core/AmPlaylist.h b/core/AmPlaylist.h index e613f67..3054fd1 100644 --- a/core/AmPlaylist.h +++ b/core/AmPlaylist.h @@ -54,6 +54,8 @@ class AmPlaylist: public AmAudio AmPlaylist(AmEventQueue* q); ~AmPlaylist(); + bool isEmpty(); + void addToPlaylist(AmPlaylistItem* item); void addToPlayListFront(AmPlaylistItem* item); void close(); _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
