summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2015-03-27 20:30:18 +0000
committerMark Michelson <mmichelson@digium.com>2015-03-27 20:30:18 +0000
commit85feac857c659c8ddff3af67099f0b0bd34fb2b2 (patch)
treeb825a9916fe72408833484ed5ceb305e1772c2a7 /include
parentdc2cf21144b81800329bad4596ded07ed0882ed7 (diff)
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
Diffstat (limited to 'include')
-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 523b1b4ce..fcad28878 100644
--- a/include/asterisk/res_pjsip.h
+++ b/include/asterisk/res_pjsip.h
@@ -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
@@ -1289,6 +1294,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
*
* This calls into the registered authenticator's requires_authentication callback