summaryrefslogtreecommitdiff
path: root/include/asterisk/res_pjsip_session.h
diff options
context:
space:
mode:
authorGeorge Joseph <gjoseph@digium.com>2017-04-27 07:02:12 -0600
committerGeorge Joseph <gjoseph@digium.com>2017-04-27 10:43:32 -0500
commitd6b2a58736a6c831f11a8d28a2a1d74d83bd74cb (patch)
tree64a0275cc1c991a2c138bcaeca7aa0ea3a5a777f /include/asterisk/res_pjsip_session.h
parent54e27cad3ceddfb3494c0a8333a4764375620a84 (diff)
res_pjsip_session: Add cleanup to ast_sip_session_terminate
If you use ast_request to create a PJSIP channel but then hang it up without causing a transaction to be sent, the session will never be destroyed. This is due ot the fact that it's pjproject that triggers the session cleanup when the transaction ends. app_chanisavail was doing this to get more granular channel state and it's also possible for this to happen via ARI. * ast_sip_session_terminate was modified to explicitly call the cleanup tasks and unreference session if the invite state is NULL AND invite_tsx is NULL (meaning we never sent a transaction). * chan_pjsip/hangup was modified to bump session before it calls ast_sip_session_terminate to insure that session stays valid while it does its own cleanup. * Added test events to session_destructor for a future testsuite test. ASTERISK-26908 #close Reported-by: Richard Mudgett Change-Id: I52daf6f757184e5544c261f64f6fe9602c4680a9
Diffstat (limited to 'include/asterisk/res_pjsip_session.h')
-rw-r--r--include/asterisk/res_pjsip_session.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/asterisk/res_pjsip_session.h b/include/asterisk/res_pjsip_session.h
index d4d3f705a..10e55f133 100644
--- a/include/asterisk/res_pjsip_session.h
+++ b/include/asterisk/res_pjsip_session.h
@@ -459,6 +459,10 @@ struct ast_sip_session *ast_sip_session_create_outgoing(struct ast_sip_endpoint
*
* \param session The session to terminate
* \param response The response code to use for termination if possible
+ *
+ * \warning Calling this function MAY cause the last session reference to be
+ * released and the session destructor to be called. If you need to do something
+ * with session after this call, be sure to bump the ref count before calling terminate.
*/
void ast_sip_session_terminate(struct ast_sip_session *session, int response);