diff --git a/core/AmSession.cpp b/core/AmSession.cpp index 6b1942d4..da43b5b5 100644 --- a/core/AmSession.cpp +++ b/core/AmSession.cpp @@ -369,6 +369,7 @@ void AmSession::run() ERROR("%i %s\n",e.code,e.reason.c_str()); } + onBeforeDestroy(); destroy(); session_num_mut.lock(); diff --git a/core/AmSession.h b/core/AmSession.h index 20086f22..8bf39a27 100644 --- a/core/AmSession.h +++ b/core/AmSession.h @@ -416,7 +416,9 @@ public: * Entry point for SIP events */ virtual void onSipEvent(AmSipEvent* sip_ev); + /** Entry point for SIP Requests */ virtual void onSipRequest(const AmSipRequest& req); + /** Entry point for SIP Replies */ virtual void onSipReply(const AmSipReply& reply); @@ -435,7 +437,7 @@ public: /** This callback is called if RTP timeout encountered */ virtual void onRtpTimeout(); - /* only called by AmSipDialog */ + /* Called by AmSipDialog when a request is sent */ virtual void onSendRequest(const string& method, const string& content_type, const string& body, @@ -443,6 +445,7 @@ public: int flags, unsigned int cseq); + /* Called by AmSipDialog when a reply is sent */ virtual void onSendReply(const AmSipRequest& req, unsigned int code, const string& reason, @@ -451,6 +454,12 @@ public: string& hdrs, int flags); + /** + * called in the session thread before the session is destroyed, + * i.e. after the main event loop has finished + */ + virtual void onBeforeDestroy() { } + // The IP address to put as c= in SDP bodies and to use for Contact:. string advertisedIP(); };