res_pjsip_refer: Fix occasional unexpected BYE sent after receiving a REFER.

A race condition happened between initiating a transfer and requesting
that a dialog termination be delayed.  Occasionally, the transferrer
channels would exit the bridge and hangup before the dialog termination
delay was requested.

* Made request dialog termination delay before initiating the transfer
action.  If the transfer fails then cancel the delayed dialog termination
request.

ASTERISK-24755 #close
Reported by: John Bigelow

Review: https://reviewboard.asterisk.org/r/4460/


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@432668 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Richard Mudgett
2015-03-10 16:04:32 +00:00
parent 110b99646c
commit cae712d986
4 changed files with 142 additions and 47 deletions

View File

@@ -139,6 +139,8 @@ struct ast_sip_session {
struct ast_dsp *dsp;
/*! Whether the termination of the session should be deferred */
unsigned int defer_terminate:1;
/*! Termination requested while termination deferred */
unsigned int terminate_while_deferred:1;
/*! Deferred incoming re-invite */
pjsip_rx_data *deferred_reinvite;
/*! Current T.38 state */
@@ -447,8 +449,18 @@ void ast_sip_session_terminate(struct ast_sip_session *session, int response);
* \brief Defer local termination of a session until remote side terminates, or an amount of time passes
*
* \param session The session to defer termination on
*
* \retval 0 Success
* \retval -1 Failure
*/
void ast_sip_session_defer_termination(struct ast_sip_session *session);
int ast_sip_session_defer_termination(struct ast_sip_session *session);
/*!
* \brief Cancel a pending deferred termination.
*
* \param session The session to cancel a deferred termination on.
*/
void ast_sip_session_defer_termination_cancel(struct ast_sip_session *session);
/*!
* \brief Register an SDP handler