]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res_pjsip_session: Add cleanup to ast_sip_session_terminate
authorGeorge Joseph <gjoseph@digium.com>
Thu, 27 Apr 2017 13:02:12 +0000 (07:02 -0600)
committerGeorge Joseph <gjoseph@digium.com>
Thu, 27 Apr 2017 15:43:00 +0000 (09:43 -0600)
commitc5b9ed20fd36f0941954eae2d032bc762e032f6a
treee21a3d291ef64cb012fe21c84e5dd2bb56515264
parentd2bb9f21d468a019acba36c9c10559406d0cdbb4
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
channels/chan_pjsip.c
include/asterisk/res_pjsip_session.h
res/res_pjsip_session.c