Module: sems
Branch: rco/offer_answer
Commit: 92d99a4169a1be2a3c0bb79c14d82fc0096bd4af
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=92d99a4169a1be2a3c0bb79c14d82fc0096bd4af

Author: Raphael Coeffic <[email protected]>
Committer: Raphael Coeffic <[email protected]>
Date:   Mon May 16 15:05:40 2011 +0200

aligned onEarlySessionStart & onCancel on AmSession.

---

 apps/dsm/DSMCall.cpp |   37 ++++++++++++++-----------------------
 apps/dsm/DSMCall.h   |    4 ++--
 2 files changed, 16 insertions(+), 25 deletions(-)

diff --git a/apps/dsm/DSMCall.cpp b/apps/dsm/DSMCall.cpp
index f6789ce..ea5e8bb 100644
--- a/apps/dsm/DSMCall.cpp
+++ b/apps/dsm/DSMCall.cpp
@@ -147,13 +147,14 @@ void DSMCall::onOutgoingInvite(const string& headers) {
   // todo: local ringbacktone
 }
 
-void DSMCall::onEarlySessionStart(const AmSipReply& reply) {
-  map<string, string> params;
-  params["code"] = int2str(reply.code);
-  params["reason"] = reply.reason;
-  params["has_body"] = reply.body.empty() ?
-    "false" : "true";
-  engine.runEvent(this, this, DSMCondition::EarlySession, &params);
+void DSMCall::onEarlySessionStart() {
+  // map<string, string> params;
+  // params["code"] = int2str(reply.code);
+  // params["reason"] = reply.reason;
+  // params["has_body"] = reply.body.empty() ?
+  //   "false" : "true";
+  engine.runEvent(this, this, DSMCondition::EarlySession, NULL// , &params
+                 );
 
   if (checkVar(DSM_CONNECT_EARLY_SESSION, DSM_CONNECT_EARLY_SESSION_FALSE)) {
     DBG("call does not connect early session\n");
@@ -162,7 +163,7 @@ void DSMCall::onEarlySessionStart(const AmSipReply& reply) {
       setInput(&playlist);
 
     if (!getOutput())
-      setOutput(&playlist);    
+      setOutput(&playlist);
   }
 }
 
@@ -183,19 +184,6 @@ int DSMCall::onSdpCompleted(const AmSdp& offer, const 
AmSdp& answer)
   return AmB2BCallerSession::onSdpCompleted(offer,answer);
 }
 
-/*
-void DSMCall::onSessionStart(const AmSipReply& rep)
-{
-  if (process_sessionstart) {
-    process_sessionstart = false;
-    DBG("DSMCall::onSessionStart (SEMS originator mode)\n");
-    invite_req.body = rep.body;
- 
-    startSession();    
-  }
-}
-*/
-
 void DSMCall::startSession(){
   engine.init(this, this, startDiagName, DSMCondition::SessionStart);
 
@@ -249,10 +237,13 @@ void DSMCall::onBye(const AmSipRequest& req)
   engine.runEvent(this, this, DSMCondition::Hangup, &params);
 }
 
-void DSMCall::onCancel() {
+void DSMCall::onCancel(const AmSipRequest& cancel) {
   DBG("onCancel\n");
-  if (dlg.getStatus() < AmSipDialog::Connected) 
+  if (dlg.getStatus() < AmSipDialog::Connected) {
+    //TODO: pass the cancel request as a parameter?
+    DBG("hangup event!!!\n");
     engine.runEvent(this, this, DSMCondition::Hangup, NULL);
+  }
   else {
     DBG("ignoring onCancel event in established dialog\n");
   }
diff --git a/apps/dsm/DSMCall.h b/apps/dsm/DSMCall.h
index 23daa62..bea7763 100644
--- a/apps/dsm/DSMCall.h
+++ b/apps/dsm/DSMCall.h
@@ -74,11 +74,11 @@ public:
   void onInvite(const AmSipRequest& req);
   void onOutgoingInvite(const string& headers);
   void onRinging(const AmSipReply& reply);
-  void onEarlySessionStart(const AmSipReply& reply);
+  void onEarlySessionStart();
   void onSessionStart();
   int  onSdpCompleted(const AmSdp& offer, const AmSdp& answer);
   void startSession();
-  void onCancel();
+  void onCancel(const AmSipRequest& cancel);
   void onBye(const AmSipRequest& req);
   void onDtmf(int event, int duration_msec);
   void onBeforeDestroy();

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

Reply via email to