Add stateful PJSIP response API call, and use it for out-of-dialog responses.

Asterisk had an issue where retransmissions of MESSAGE requests resulted in
Asterisk processing the retransmission as if it were a new MESSAGE request.

This patch fixes the issue by creating a transaction in PJSIP on the incoming
request. This way, if a retransmission arrives, the PJSIP transaction layer
will resend the response and Asterisk will not ever see the retransmission.

ASTERISK-24920 #close
Reported by Mark Michelson

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433619 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Michelson
2015-03-27 20:30:18 +00:00
parent dc2cf21144
commit 85feac857c
5 changed files with 53 additions and 29 deletions

View File

@@ -1279,6 +1279,11 @@ int ast_sip_create_response(const pjsip_rx_data *rdata, int st_code,
/*!
* \brief Send a response to an out of dialog request
*
* Use this function sparingly, since this does not create a transaction
* within PJSIP. This means that if the request is retransmitted, it is
* your responsibility to detect this and not process the same request
* twice, and to send the same response for each retransmission.
*
* \param res_addr The response address for this response
* \param tdata The response to send
* \param endpoint The ast_sip_endpoint associated with this response
@@ -1288,6 +1293,24 @@ int ast_sip_create_response(const pjsip_rx_data *rdata, int st_code,
*/
int ast_sip_send_response(pjsip_response_addr *res_addr, pjsip_tx_data *tdata, struct ast_sip_endpoint *sip_endpoint);
/*!
* \brief Send a stateful response to an out of dialog request
*
* This creates a transaction within PJSIP, meaning that if the request
* that we are responding to is retransmitted, we will not attempt to
* re-handle the request.
*
* \param rdata The request that is being responded to
* \param tdata The response to send
* \param endpoint The ast_sip_endpoint associated with this response
*
* \since 13.4.0
*
* \retval 0 Success
* \retval -1 Failure
*/
int ast_sip_send_stateful_response(pjsip_rx_data *rdata, pjsip_tx_data *tdata, struct ast_sip_endpoint *sip_endpoint);
/*!
* \brief Determine if an incoming request requires authentication
*