Module: sems Branch: 1.2 Commit: 9bc57776812b555d4af18f3b2e8d202a1357cfa2 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=9bc57776812b555d4af18f3b2e8d202a1357cfa2
Author: Stefan Sayer <[email protected]> Committer: Stefan Sayer <[email protected]> Date: Mon Apr 26 23:21:35 2010 +0000 propagate event TS to aggregating DTMF detector. this help detecting same key presses that follow each other closely git-svn-id: http://svn.berlios.de/svnroot/repos/sems/tr...@1833 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- core/AmDtmfDetector.cpp | 16 ++++++++++++---- core/AmDtmfDetector.h | 10 ++++++++-- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/core/AmDtmfDetector.cpp b/core/AmDtmfDetector.cpp index 2a21d19..aae0b1f 100644 --- a/core/AmDtmfDetector.cpp +++ b/core/AmDtmfDetector.cpp @@ -182,7 +182,8 @@ AmDtmfDetector::AmDtmfDetector(AmSession *session) m_eventPending(false), m_sipEventReceived(false), m_inbandEventReceived(false), m_rtpEventReceived(false), m_inband_type(Dtmf::SEMSInternal), - m_currentEvent(-1) + m_currentEvent(-1), + m_current_eventid_i(false) { #ifndef USE_SPANDSP setInbandDetector(Dtmf::SEMSInternal); @@ -240,16 +241,22 @@ void AmDtmfDetector::process(AmEvent *evt) void AmDtmfDetector::registerKeyReleased(int event, Dtmf::EventSource source, const struct timeval& start, const struct timeval& stop, - bool flush) + bool flush, + bool has_eventid, unsigned int event_id) { // Old event has not been sent yet // push out it now - if (flush || (m_eventPending && m_currentEvent != event)) + if (flush || (m_eventPending && m_currentEvent != event) || + (m_eventPending && has_eventid && m_current_eventid_i && (event_id != m_current_eventid))) { reportEvent(); } + m_eventPending = true; m_currentEvent = event; + m_current_eventid_i = true; + m_current_eventid = event_id; + memcpy(&m_startTime, &start, sizeof(struct timeval)); memcpy(&m_lastReportTime, &stop, sizeof(struct timeval)); switch (source) @@ -325,6 +332,7 @@ void AmDtmfDetector::reportEvent() m_sipEventReceived = false; m_rtpEventReceived = false; m_inbandEventReceived = false; + m_current_eventid_i = false; m_reportLock.unlock(); } @@ -388,7 +396,7 @@ void AmRtpDtmfDetector::sendPending(bool flush) { struct timeval end_time; gettimeofday(&end_time, NULL); - m_keysink->registerKeyReleased(m_currentEvent, Dtmf::SOURCE_RTP, m_startTime, end_time, flush); + m_keysink->registerKeyReleased(m_currentEvent, Dtmf::SOURCE_RTP, m_startTime, end_time, flush, true, m_currentTS); m_eventPending = false; m_currentTS_i = false; m_lastTS = m_currentTS; diff --git a/core/AmDtmfDetector.h b/core/AmDtmfDetector.h index 59809e2..e9dba50 100644 --- a/core/AmDtmfDetector.h +++ b/core/AmDtmfDetector.h @@ -132,7 +132,8 @@ class AmKeyPressSink { * @param flush whether key should be registered as own keypress immediately */ virtual void registerKeyReleased(int event, Dtmf::EventSource source, - const struct timeval& start, const struct timeval& stop, bool flush=false) = 0; + const struct timeval& start, const struct timeval& stop, bool flush=false, + bool has_eventid = false, unsigned int event_id = 0) = 0; /** * Through this method the AmDtmfDetector receives events that was * detected by specific detectors. @@ -397,6 +398,9 @@ class AmDtmfDetector int m_currentEvent; bool m_eventPending; + bool m_current_eventid_i; + unsigned int m_current_eventid; + bool m_sipEventReceived; bool m_inbandEventReceived; bool m_rtpEventReceived; @@ -420,10 +424,12 @@ class AmDtmfDetector * @param start time when key was pressed * @param stop time when key was released * @param flush whether key should be registered as own keypress immediately + * @param has_eventid whether event has an id + * @param event_id id of the event */ void registerKeyReleased(int event, Dtmf::EventSource source, const struct timeval& start, const struct timeval& stop, - bool flush=false); + bool flush=false, bool has_eventid = false, unsigned int event_id = 0); /** * Through this method the AmDtmfDetector receives events that was * detected by specific detectors. _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
