Module: sems Branch: master Commit: aee85850918d28c671ab269626e622bcdf3930cd URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=aee85850918d28c671ab269626e622bcdf3930cd
Author: Stefan Sayer <[email protected]> Committer: Stefan Sayer <[email protected]> Date: Fri Dec 3 02:59:04 2010 +0100 DSM: adds onBeforeDestroy event handler to modules --- apps/dsm/DSMCall.cpp | 4 ++++ apps/dsm/DSMCall.h | 1 + apps/dsm/DSMModule.h | 1 + apps/dsm/DSMStateEngine.cpp | 5 +++++ apps/dsm/DSMStateEngine.h | 1 + 5 files changed, 12 insertions(+), 0 deletions(-) diff --git a/apps/dsm/DSMCall.cpp b/apps/dsm/DSMCall.cpp index c793000..11f095e 100644 --- a/apps/dsm/DSMCall.cpp +++ b/apps/dsm/DSMCall.cpp @@ -341,6 +341,10 @@ void DSMCall::onSystemEvent(AmSystemEvent* ev) { } } +void DSMCall::onBeforeDestroy() { + engine.onBeforeDestroy(this, this); +} + void DSMCall::process(AmEvent* event) { diff --git a/apps/dsm/DSMCall.h b/apps/dsm/DSMCall.h index 2f28f26..2dffdeb 100644 --- a/apps/dsm/DSMCall.h +++ b/apps/dsm/DSMCall.h @@ -81,6 +81,7 @@ public: void onCancel(); void onBye(const AmSipRequest& req); void onDtmf(int event, int duration_msec); + void onBeforeDestroy(); void onSipRequest(const AmSipRequest& req); void onSipReply(const AmSipReply& reply, int old_dlg_status, const string& trans_method); diff --git a/apps/dsm/DSMModule.h b/apps/dsm/DSMModule.h index c1d64ea..941d843 100644 --- a/apps/dsm/DSMModule.h +++ b/apps/dsm/DSMModule.h @@ -51,6 +51,7 @@ class DSMModule { virtual int preload() { return 0; } virtual bool onInvite(const AmSipRequest& req, DSMSession* sess) { return true; } + virtual void onBeforeDestroy(DSMSession* sc_sess, AmSession* sess) { } }; typedef map<string,string> EventParamT; diff --git a/apps/dsm/DSMStateEngine.cpp b/apps/dsm/DSMStateEngine.cpp index c43b8ac..4a17593 100644 --- a/apps/dsm/DSMStateEngine.cpp +++ b/apps/dsm/DSMStateEngine.cpp @@ -218,6 +218,11 @@ bool DSMStateEngine::onInvite(const AmSipRequest& req, DSMSession* sess) { return res; } +void DSMStateEngine::onBeforeDestroy(DSMSession* sc_sess, AmSession* sess) { + for (vector<DSMModule*>::iterator it = + mods.begin(); it != mods.end(); it++) + (*it)->onBeforeDestroy(sc_sess, sess); +} bool DSMStateEngine::runactions(vector<DSMAction*>::iterator from, vector<DSMAction*>::iterator to, diff --git a/apps/dsm/DSMStateEngine.h b/apps/dsm/DSMStateEngine.h index 904e1fb..fc1d8df 100644 --- a/apps/dsm/DSMStateEngine.h +++ b/apps/dsm/DSMStateEngine.h @@ -249,6 +249,7 @@ class DSMStateEngine { /** @return whether call should be accepted */ bool onInvite(const AmSipRequest& req, DSMSession* sess); + void onBeforeDestroy(DSMSession* sc_sess, AmSession* sess); }; extern void varPrintArg(const AmArg& a, map<string, string>& dst, const string& name); _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
