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

Author: Stefan Sayer <[email protected]>
Committer: Stefan Sayer <[email protected]>
Date:   Tue Dec 14 19:47:35 2010 +0100

b2b: return value of relayEvent

return -1 if the other leg doesn't exist

---

 apps/sbc/SBC.cpp      |    8 ++++----
 apps/sbc/SBC.h        |    4 ++--
 core/AmB2BSession.cpp |   16 ++++++++++------
 core/AmB2BSession.h   |    6 +++---
 4 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/apps/sbc/SBC.cpp b/apps/sbc/SBC.cpp
index 08d9be0..25175ba 100644
--- a/apps/sbc/SBC.cpp
+++ b/apps/sbc/SBC.cpp
@@ -543,7 +543,7 @@ void SBCDialog::process(AmEvent* ev)
   AmB2BCallerSession::process(ev);
 }
 
-void SBCDialog::relayEvent(AmEvent* ev) {
+int SBCDialog::relayEvent(AmEvent* ev) {
   if ((call_profile.headerfilter != Transparent) &&
       (ev->event_id == B2BSipRequest)) {
     // header filter
@@ -578,7 +578,7 @@ void SBCDialog::relayEvent(AmEvent* ev) {
     }
   }
 
-  AmB2BCallerSession::relayEvent(ev);
+  return AmB2BCallerSession::relayEvent(ev);
 }
 
 int SBCDialog::filterBody(AmSdp& sdp, bool is_a2b) {
@@ -880,7 +880,7 @@ inline UACAuthCred* SBCCalleeSession::getCredentials() {
   return &call_profile.auth_credentials;
 }
 
-void SBCCalleeSession::relayEvent(AmEvent* ev) {
+int SBCCalleeSession::relayEvent(AmEvent* ev) {
   if ((call_profile.headerfilter != Transparent) &&
       (ev->event_id == B2BSipRequest)) {
     // header filter
@@ -915,7 +915,7 @@ void SBCCalleeSession::relayEvent(AmEvent* ev) {
     }
   }
 
-  AmB2BCalleeSession::relayEvent(ev);
+  return AmB2BCalleeSession::relayEvent(ev);
 }
 
 void SBCCalleeSession::onSipRequest(const AmSipRequest& req) {
diff --git a/apps/sbc/SBC.h b/apps/sbc/SBC.h
index c656098..33fe52d 100644
--- a/apps/sbc/SBC.h
+++ b/apps/sbc/SBC.h
@@ -126,7 +126,7 @@ class SBCDialog : public AmB2BCallerSession
   void onCancel();
 
  protected:
-  void relayEvent(AmEvent* ev);
+  int relayEvent(AmEvent* ev);
 
   void onSipReply(const AmSipReply& reply, int old_dlg_status,
                  const string& trans_method);
@@ -147,7 +147,7 @@ class SBCCalleeSession
   SBCCallProfile call_profile;
 
  protected:
-  void relayEvent(AmEvent* ev);
+  int relayEvent(AmEvent* ev);
 
   void onSipRequest(const AmSipRequest& req);
   void onSipReply(const AmSipReply& reply, int old_dlg_status,
diff --git a/core/AmB2BSession.cpp b/core/AmB2BSession.cpp
index 819098d..d18c94d 100644
--- a/core/AmB2BSession.cpp
+++ b/core/AmB2BSession.cpp
@@ -252,15 +252,19 @@ void AmB2BSession::onInvite2xx(const AmSipReply& reply)
   }
 }
 
-void AmB2BSession::relayEvent(AmEvent* ev)
+int AmB2BSession::relayEvent(AmEvent* ev)
 {
   DBG("AmB2BSession::relayEvent: id=%s\n",
       other_id.c_str());
 
-  if(!other_id.empty())
-    AmSessionContainer::instance()->postEvent(other_id,ev);
-  else 
+  if(!other_id.empty()) {
+    if (!AmSessionContainer::instance()->postEvent(other_id,ev))
+      return -1;
+  } else {
     delete ev;
+  }
+
+  return 0;
 }
 
 void AmB2BSession::onOtherBye(const AmSipRequest& req)
@@ -587,7 +591,7 @@ void AmB2BCallerSession::onB2BEvent(B2BEvent* ev)
     AmB2BSession::onB2BEvent(ev);
 }
 
-void AmB2BCallerSession::relayEvent(AmEvent* ev)
+int AmB2BCallerSession::relayEvent(AmEvent* ev)
 {
   if(other_id.empty()){
 
@@ -605,7 +609,7 @@ void AmB2BCallerSession::relayEvent(AmEvent* ev)
     }
   }
 
-  AmB2BSession::relayEvent(ev);
+  return AmB2BSession::relayEvent(ev);
 }
 
 void AmB2BCallerSession::onSessionStart(const AmSipRequest& req)
diff --git a/core/AmB2BSession.h b/core/AmB2BSession.h
index a8ebd5d..cd554c7 100644
--- a/core/AmB2BSession.h
+++ b/core/AmB2BSession.h
@@ -166,8 +166,8 @@ class AmB2BSession: public AmSession
   /** reset relation with other leg */
   virtual void clear_other();
 
-  /** Relay one event to the other side. */
-  virtual void relayEvent(AmEvent* ev);
+  /** Relay one event to the other side. @return 0 on success */
+  virtual int relayEvent(AmEvent* ev);
 
   /** send a relayed SIP Request */
   void relaySip(const AmSipRequest& req);
@@ -251,7 +251,7 @@ class AmB2BCallerSession: public AmB2BSession
  protected:
   AmSipRequest invite_req;
   virtual void createCalleeSession();
-  void relayEvent(AmEvent* ev);
+  int relayEvent(AmEvent* ev);
 
   /** Tell if the session should
    *  relay early media SDPs to

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to