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/
........

Merged revisions 433619 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433620 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Michelson
2015-03-27 20:46:55 +00:00
parent a18da4eaf2
commit 0b62e41654
5 changed files with 53 additions and 29 deletions

View File

@@ -577,7 +577,6 @@ static pj_status_t send_options_response(pjsip_rx_data *rdata, int code)
pjsip_transaction *trans = pjsip_rdata_get_tsx(rdata);
pjsip_tx_data *tdata;
const pjsip_hdr *hdr;
pjsip_response_addr res_addr;
pj_status_t status;
/* Make the response object */
@@ -611,17 +610,8 @@ static pj_status_t send_options_response(pjsip_rx_data *rdata, int code)
} else {
struct ast_sip_endpoint *endpoint;
/* Get where to send response. */
status = pjsip_get_response_addr(tdata->pool, rdata, &res_addr);
if (status != PJ_SUCCESS) {
ast_log(LOG_ERROR, "Unable to get response address (%d)\n", status);
pjsip_tx_data_dec_ref(tdata);
return status;
}
endpoint = ast_pjsip_rdata_get_endpoint(rdata);
status = ast_sip_send_response(&res_addr, tdata, endpoint);
status = ast_sip_send_stateful_response(rdata, tdata, endpoint);
ao2_cleanup(endpoint);
}