Author: sayer
Date: 2010-03-01 17:21:07 +0100 (Mon, 01 Mar 2010)
New Revision: 1647

Modified:
   trunk/apps/dsm/DSMCall.cpp
   trunk/apps/dsm/DSMCall.h
   trunk/apps/dsm/doc/examples/183_early_establish.dsm
Log:
implemented CANCEL handling in early dialogs


Modified: trunk/apps/dsm/DSMCall.cpp
===================================================================
--- trunk/apps/dsm/DSMCall.cpp  2010-02-26 13:26:06 UTC (rev 1646)
+++ trunk/apps/dsm/DSMCall.cpp  2010-03-01 16:21:07 UTC (rev 1647)
@@ -197,6 +197,15 @@
   engine.runEvent(this, DSMCondition::Hangup, &params);
 }
 
+void DSMCall::onCancel() {
+  DBG("onCancel\n");
+  if (dlg.getStatus() < AmSipDialog::Connected) 
+    engine.runEvent(this, DSMCondition::Hangup, NULL);
+  else {
+    DBG("ignoring onCancel event in established dialog\n");
+  }
+}
+
 void DSMCall::process(AmEvent* event)
 {
 

Modified: trunk/apps/dsm/DSMCall.h
===================================================================
--- trunk/apps/dsm/DSMCall.h    2010-02-26 13:26:06 UTC (rev 1646)
+++ trunk/apps/dsm/DSMCall.h    2010-03-01 16:21:07 UTC (rev 1647)
@@ -76,6 +76,7 @@
   void onSessionStart(const AmSipRequest& req);
   void onSessionStart(const AmSipReply& rep);
   void startSession();
+  void onCancel();
   void onBye(const AmSipRequest& req);
   void onDtmf(int event, int duration_msec);
 

Modified: trunk/apps/dsm/doc/examples/183_early_establish.dsm
===================================================================
--- trunk/apps/dsm/doc/examples/183_early_establish.dsm 2010-02-26 13:26:06 UTC 
(rev 1646)
+++ trunk/apps/dsm/doc/examples/183_early_establish.dsm 2010-03-01 16:21:07 UTC 
(rev 1647)
@@ -19,36 +19,37 @@
 
 state runstart
       enter { 
-       log(2, run start!); 
-       -- we don't want to have session connected (RTP sent) yet
-       set(connect_session=0);
-       setTimer(1, 2);
+        log(2, run start!); 
+        -- we don't want to have session connected (RTP sent) yet
+        set(connect_session=0);
+        setTimer(1, 2);
       };
-
 transition "go early" runstart - timerTest(#id==1) / 
-          dlg.acceptInvite(183, progress);
-          connectMedia();
-          playFile(wav/default_en.wav);
+        dlg.acceptInvite(183, progress);
+        connectMedia();
+        playFile(wav/default_en.wav);
    -> playing_early_msg; 
 transition "playing file failed" runstart - exception; test(#type==file) / {
- log(1, Error playing file!); 
- dlg.reply(500, server error); 
- stop 
+        log(1, Error playing file!); 
+        dlg.reply(500, server error); 
+        stop 
 } -> FIN;
 
 state playing_early_msg;
-
 transition "early message ended" playing_early_msg - noAudioTest / 
-           dlg.acceptInvite(200, ok);
-           recordFile(/tmp/test.wav);
-           setTimer(3,10);
+        dlg.acceptInvite(200, ok);
+        recordFile(/tmp/test.wav);
+        setTimer(3,10);
   -> recording;
 transition "recording failed" playing_early_msg - exception; / 
    log(1, Error recording!); stop(true) -> FIN;
 
 state recording;
 
-transition "recording timer" recording - timerTest(#id==3) / stop(true) -> FIN;
-transition bye (playing_early_msg, recording) - hangup / stop -> FIN;
-
+transition "bye in early" (playing_early_msg, runstart) - hangup / {
+        dlg.reply(487,call terminated);
+        stop(false) 
+} -> FIN;
+transition "recording timer" recording - timerTest(#id==3) / stop -> FIN;
+transition "bye in recording" recording - hangup / stop -> FIN;
 state FIN;

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

Reply via email to