summaryrefslogtreecommitdiff
path: root/include/asterisk/res_pjsip.h
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2015-04-27 16:56:31 -0500
committerMark Michelson <mmichelson@digium.com>2015-04-28 15:02:18 -0500
commite39bd6ba463f25be2265228f835957424563642b (patch)
tree3e0655585500faf6e82d54a6d3b88a1653e376ba /include/asterisk/res_pjsip.h
parente9788056e9f60a8ef6f810f0c5d31e0f3700e3bb (diff)
res_pjsip_outbound_registration: Don't fail on delayed processing: 13.
This is the Asterisk 13 version of a change to master that allows for registration responses to be processed successfully potentially after the original transaction has timed out. The main difference between this and the master change is that the master version has API changes that are unacceptable for 13. For 13, this is worked around by adding a new API call that the outbound registration code uses instead. The following is the text from the master version of this commit: 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 also 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: If1ee5f601be839479a219424f0358a229f358f7c
Diffstat (limited to 'include/asterisk/res_pjsip.h')
-rw-r--r--include/asterisk/res_pjsip.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h
index a15e967b8..cbae5955e 100644
--- a/include/asterisk/res_pjsip.h
+++ b/include/asterisk/res_pjsip.h
@@ -702,6 +702,18 @@ struct ast_sip_outbound_authenticator {
*/
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);
+ /*!
+ * \brief Create a new request with authentication credentials based on old request
+ *
+ * \param auths A vector of IDs of auth sorcery objects
+ * \param challenge The SIP response with authentication challenge(s)
+ * \param old_request The request that resulted in 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_from_old)(const struct ast_sip_auth_vector *auths, struct pjsip_rx_data *challenge,
+ struct pjsip_tx_data *old_request, struct pjsip_tx_data **new_request);
};
/*!
@@ -1397,6 +1409,17 @@ int ast_sip_create_request_with_auth(const struct ast_sip_auth_vector *auths, pj
pjsip_transaction *tsx, pjsip_tx_data **new_request);
/*!
+ * \brief Create a response to an authentication challenge
+ *
+ * This will call into an outbound authenticator's create_request_with_auth callback
+ * to create a new request with authentication credentials. See the create_request_with_auth_from_old
+ * callback in the \ref ast_sip_outbound_authenticator structure for details about
+ * the parameters and return values.
+ */
+int ast_sip_create_request_with_auth_from_old(const struct ast_sip_auth_vector *auths, pjsip_rx_data *challenge,
+ pjsip_tx_data *old_request, pjsip_tx_data **new_request);
+
+/*!
* \brief Determine the endpoint that has sent a SIP message
*
* This will call into each of the registered endpoint identifiers'