[prev in list] [next in list] [prev in thread] [next in thread] 

List:       semsdev
Subject:    [Semsdev] git:master: decoupled dtmf detector from AmSession.
From:       Raphael Coeffic <rco () iptel ! org>
Date:       2012-05-21 17:46:03
Message-ID: 20120521174603.8FFA5EF804E () rimmer ! ryngle ! com
[Download RAW message or body]

Module: sems
Branch: master
Commit: e475abbdf8647031774fdc52fb80319215a22756
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=e475abbdf8647031774fdc52fb80319215a22756


Author: Raphael Coeffic <rco@iptel.org>
Committer: Raphael Coeffic <rco@iptel.org>
Date:   Thu Apr 26 07:45:52 2012 +0200

decoupled dtmf detector from AmSession.

---

 core/AmDtmfDetector.cpp |    6 +++---
 core/AmDtmfDetector.h   |   16 ++++++++++++++--
 core/AmSession.h        |    3 ++-
 3 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/core/AmDtmfDetector.cpp b/core/AmDtmfDetector.cpp
index 3a1e148..c6cfaf3 100644
--- a/core/AmDtmfDetector.cpp
+++ b/core/AmDtmfDetector.cpp
@@ -176,8 +176,8 @@ void AmSipDtmfDetector::process(AmSipDtmfEvent *evt)
 //
 // AmDtmfDetector methods
 //
-AmDtmfDetector::AmDtmfDetector(AmSession *session)
-  : m_session(session), m_rtpDetector(this),
+AmDtmfDetector::AmDtmfDetector(AmDtmfSink *dtmf_sink)
+  : m_dtmfSink(dtmf_sink), m_rtpDetector(this),
     m_sipDetector(this),
     m_eventPending(false), m_sipEventReceived(false),
     m_inbandEventReceived(false), m_rtpEventReceived(false),
@@ -366,7 +366,7 @@ void AmDtmfDetector::reportEvent()
 
   long duration = (m_lastReportTime.tv_sec - m_startTime.tv_sec) * 1000 +
     (m_lastReportTime.tv_usec - m_startTime.tv_usec) / 1000;
-  m_session->postDtmfEvent(new AmDtmfEvent(m_currentEvent, duration));
+  m_dtmfSink->postDtmfEvent(new AmDtmfEvent(m_currentEvent, duration));
   m_eventPending = false;
   m_sipEventReceived = false;
   m_rtpEventReceived = false;
diff --git a/core/AmDtmfDetector.h b/core/AmDtmfDetector.h
index 5090a2b..88567e9 100644
--- a/core/AmDtmfDetector.h
+++ b/core/AmDtmfDetector.h
@@ -379,6 +379,18 @@ class AmRtpDtmfDetector
 };
 
 /**
+ * \brief DTMF sink class
+ *
+ * This class is an interface for components that whish to
+ * receive DTMF event notification.
+ */
+class AmDtmfSink
+{
+public:
+  virtual void postDtmfEvent(AmDtmfEvent *) = 0;
+};
+
+/**
  * \brief DTMF detector class
  *
  * This class collects DTMF info from three sources: RTP (RFC 2833), 
@@ -395,7 +407,7 @@ class AmDtmfDetector
   /**
    * Session this class belongs to.
    */
-  AmSession *m_session;
+  AmDtmfSink *m_dtmfSink;
   AmRtpDtmfDetector m_rtpDetector;
   AmSipDtmfDetector m_sipDetector;
   std::auto_ptr<AmInbandDtmfDetector> m_inbandDetector;
@@ -450,7 +462,7 @@ class AmDtmfDetector
    * Constructor
    * @param session is the owner of this class instance
    */
-  AmDtmfDetector(AmSession *session);
+  AmDtmfDetector(AmDtmfSink *dtmf_sink);
   virtual ~AmDtmfDetector() {}
 
   void checkTimeout();
diff --git a/core/AmSession.h b/core/AmSession.h
index 0413843..74d131e 100644
--- a/core/AmSession.h
+++ b/core/AmSession.h
@@ -74,7 +74,8 @@ class AmSession :
   public AmEventQueue, 
   public AmEventHandler,
   public AmSipDialogEventHandler,
-  public AmMediaSession
+  public AmMediaSession,
+  public AmDtmfSink
 {
   AmMutex      audio_mut;
 

_______________________________________________
Semsdev mailing list
Semsdev@lists.iptel.org
http://lists.iptel.org/mailman/listinfo/semsdev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic