diff --git a/apps/dsm/DSMCall.cpp b/apps/dsm/DSMCall.cpp index 7c4c73a7..47281b09 100644 --- a/apps/dsm/DSMCall.cpp +++ b/apps/dsm/DSMCall.cpp @@ -197,6 +197,15 @@ void DSMCall::onBye(const AmSipRequest& req) engine.runEvent(this, DSMCondition::Hangup, ¶ms); } +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) { diff --git a/apps/dsm/DSMCall.h b/apps/dsm/DSMCall.h index de04cf91..ae3091b5 100644 --- a/apps/dsm/DSMCall.h +++ b/apps/dsm/DSMCall.h @@ -76,6 +76,7 @@ public: 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); diff --git a/apps/dsm/doc/examples/183_early_establish.dsm b/apps/dsm/doc/examples/183_early_establish.dsm index 19d38247..51563113 100644 --- a/apps/dsm/doc/examples/183_early_establish.dsm +++ b/apps/dsm/doc/examples/183_early_establish.dsm @@ -19,36 +19,37 @@ state runinvite 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;