From 4f1db2070da56f0357c10fad729dd5e90644a042 Mon Sep 17 00:00:00 2001 From: Mark Michelson Date: Mon, 27 Apr 2015 16:13:22 -0500 Subject: res_pjsip_outbound_registration: Don't fail on delayed processing. Odd behaviors have been observed during outbound registrations. The most common problem witnessed has been one where a request with authentication credentials cannot be created after receiving a 401 response. Other behaviors include apparently processing an incorrect SIP response. Inspecting the code led to an apparent issue with regards to how we handle transactions in outbound registration code. When a response to a REGISTER arrives, we save a pointer to the transaction and then push a task onto the registration serializer. Between the time that we save the pointer and push the task, it's possible for the transaction to be destroyed due to a timeout. It's also possible for the address to be reused by the transaction layer for a new transaction. To allow for authentication of a REGISTER request to be authenticated after the transaction has timed out, we now hold a reference to the original REGISTER request instead of the transaction. The function for creating a request with authentication has been altered to take the original request instead of the transaction where the original request was sent. ASTERISK-25020 Reported by Mark Michelson Change-Id: I756c19ab05ada5d0503175db9676acf87c686d0a --- include/asterisk/res_pjsip.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h index 12fc400d2..67c9c4b16 100644 --- a/include/asterisk/res_pjsip.h +++ b/include/asterisk/res_pjsip.h @@ -697,13 +697,13 @@ struct ast_sip_outbound_authenticator { * * \param auths A vector of IDs of auth sorcery objects * \param challenge The SIP response with authentication challenge(s) - * \param tsx The transaction in which the challenge was received + * \param old_request The request that received the auth challenge(s) * \param new_request The new SIP request with challenge response(s) * \retval 0 Successfully created new request * \retval -1 Failed to create a new request */ int (*create_request_with_auth)(const struct ast_sip_auth_vector *auths, struct pjsip_rx_data *challenge, - struct pjsip_transaction *tsx, struct pjsip_tx_data **new_request); + struct pjsip_tx_data *old_request, struct pjsip_tx_data **new_request); }; /*! @@ -1396,7 +1396,7 @@ enum ast_sip_check_auth_result ast_sip_check_authentication(struct ast_sip_endpo * the parameters and return values. */ int ast_sip_create_request_with_auth(const struct ast_sip_auth_vector *auths, pjsip_rx_data *challenge, - pjsip_transaction *tsx, pjsip_tx_data **new_request); + pjsip_tx_data *tdata, pjsip_tx_data **new_request); /*! * \brief Determine the endpoint that has sent a SIP message -- cgit v1.2.3