Module: sems Branch: master Commit: 2f2f8048ef538396b02300ed1c52ac880b2edaea URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=2f2f8048ef538396b02300ed1c52ac880b2edaea
Author: Stefan Sayer <[email protected]> Committer: Stefan Sayer <[email protected]> Date: Tue Nov 22 16:46:23 2011 +0100 DSM: support sessionTimeout and rtpTimeout to be handled in script --- apps/dsm/DSMCall.cpp | 26 ++++++++++++++++++++++++++ apps/dsm/DSMCall.h | 2 ++ apps/dsm/DSMCoreModule.cpp | 6 ++++++ doc/dsm/dsm_syntax.txt | 12 ++++++++++++ doc/dsm/examples/test_rtptimeout.dsm | 13 +++++++++++++ 5 files changed, 59 insertions(+), 0 deletions(-) diff --git a/apps/dsm/DSMCall.cpp b/apps/dsm/DSMCall.cpp index 966f487..e3fccff 100644 --- a/apps/dsm/DSMCall.cpp +++ b/apps/dsm/DSMCall.cpp @@ -364,6 +364,32 @@ void DSMCall::onRemoteDisappeared(const AmSipReply& reply) { AmB2BCallerSession::onRemoteDisappeared(reply); } +void DSMCall::onSessionTimeout() { + map<string, string> params; + + engine.runEvent(this, this, DSMCondition::SessionTimeout, ¶ms); + + if (checkParam(DSM_PROCESSED, DSM_TRUE, ¶ms)) { + DBG("DSM script processed onSessionTimeout, returning\n"); + return; + } + + AmB2BCallerSession::onSessionTimeout(); +} + +void DSMCall::onRtpTimeout() { + map<string, string> params; + + engine.runEvent(this, this, DSMCondition::RtpTimeout, ¶ms); + + if (checkParam(DSM_PROCESSED, DSM_TRUE, ¶ms)) { + DBG("DSM script processed onRtpTimeout, returning\n"); + return; + } + + AmB2BCallerSession::onRtpTimeout(); +} + void DSMCall::onSystemEvent(AmSystemEvent* ev) { map<string, string> params; params["type"] = AmSystemEvent::getDescription(ev->sys_event); diff --git a/apps/dsm/DSMCall.h b/apps/dsm/DSMCall.h index aaa8f41..e5de3ea 100644 --- a/apps/dsm/DSMCall.h +++ b/apps/dsm/DSMCall.h @@ -84,6 +84,8 @@ public: void onDtmf(int event, int duration_msec); void onBeforeDestroy(); + void onSessionTimeout(); + void onRtpTimeout(); void onRemoteDisappeared(const AmSipReply& reply); void onSipRequest(const AmSipRequest& req); diff --git a/apps/dsm/DSMCoreModule.cpp b/apps/dsm/DSMCoreModule.cpp index 4b6a4ce..02ae4cf 100644 --- a/apps/dsm/DSMCoreModule.cpp +++ b/apps/dsm/DSMCoreModule.cpp @@ -193,6 +193,12 @@ DSMCondition* DSMCoreModule::getCondition(const string& from_str) { if (cmd == "remoteDisappeared") return new TestDSMCondition(params, DSMCondition::RemoteDisappeared); + if (cmd == "sessionTimeout") + return new TestDSMCondition(params, DSMCondition::SessionTimeout); + + if (cmd == "rtpTimeout") + return new TestDSMCondition(params, DSMCondition::RtpTimeout); + if (cmd == "jsonRpcRequest") return new TestDSMCondition(params, DSMCondition::JsonRpcRequest); diff --git a/doc/dsm/dsm_syntax.txt b/doc/dsm/dsm_syntax.txt index 3f5a63e..653f318 100644 --- a/doc/dsm/dsm_syntax.txt +++ b/doc/dsm/dsm_syntax.txt @@ -327,6 +327,18 @@ brackets match. set #processed="true" if you don't want default behaviour (clear call) + sessionTimeout(expr) + session expired (SST) + parameters: none + + set #processed="true" if you don't want default behaviour (clear call) + + rtpTimeout(expr) + RTP timeout detected + parameters: none + + set #processed="true" if you don't want default behaviour (clear call) + invite invite received/sent (only with run_invite_event): parameters: none diff --git a/doc/dsm/examples/test_rtptimeout.dsm b/doc/dsm/examples/test_rtptimeout.dsm new file mode 100644 index 0000000..5eb25a6 --- /dev/null +++ b/doc/dsm/examples/test_rtptimeout.dsm @@ -0,0 +1,13 @@ +import(mod_dlg); + +initial state START + enter { playFile(wav/default_en.wav) }; + +transition "remote unreachable" START - rtpTimeout / { + log(1, "oh, that's sad, the far end seems to have disappeared..."); +-- handle it ourselves + set(#processed="true"); + stop(true); +} -> END; + +state END; _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
