summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorzuul <zuul@gerrit.asterisk.org>2016-05-24 19:09:13 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2016-05-24 19:09:13 -0500
commitd1ab0936ab365b1f81489b3a53e9d32d9b09c43b (patch)
tree11a8c737efe4d325b6c936ed12c1b57b85be9dc7 /res
parent80ff2c2540544123b1cf040f1a651cbde4ab4e14 (diff)
parent85d0272e76858a571d01bcf2ccaba871daa10e16 (diff)
Merge "res_pjsip: Only check transaction on transaction state events."
Diffstat (limited to 'res')
-rw-r--r--res/res_pjsip.c72
1 files changed, 37 insertions, 35 deletions
diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index c06b67ecf..bebe941b5 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -3513,46 +3513,48 @@ static void send_request_cb(void *token, pjsip_event *e)
pjsip_rx_data *challenge;
struct ast_sip_supplement *supplement;
- switch(e->body.tsx_state.type) {
- case PJSIP_EVENT_TRANSPORT_ERROR:
- case PJSIP_EVENT_TIMER:
- /*
- * Check the request status on transport error or timeout. A transport
- * error can occur when a TCP socket closes and that can be the result
- * of a 503. Also we may need to failover on a timeout (408).
- */
- if (check_request_status(req_data, e)) {
- return;
- }
- break;
- case PJSIP_EVENT_RX_MSG:
- challenge = e->body.tsx_state.src.rdata;
-
- /*
- * Call any supplements that want to know about a response
- * with any received data.
- */
- AST_RWLIST_RDLOCK(&supplements);
- AST_LIST_TRAVERSE(&supplements, supplement, next) {
- if (supplement->incoming_response
- && does_method_match(&challenge->msg_info.cseq->method.name,
- supplement->method)) {
- supplement->incoming_response(req_data->endpoint, challenge);
+ if (e->type == PJSIP_EVENT_TSX_STATE) {
+ switch(e->body.tsx_state.type) {
+ case PJSIP_EVENT_TRANSPORT_ERROR:
+ case PJSIP_EVENT_TIMER:
+ /*
+ * Check the request status on transport error or timeout. A transport
+ * error can occur when a TCP socket closes and that can be the result
+ * of a 503. Also we may need to failover on a timeout (408).
+ */
+ if (check_request_status(req_data, e)) {
+ return;
}
- }
- AST_RWLIST_UNLOCK(&supplements);
+ break;
+ case PJSIP_EVENT_RX_MSG:
+ challenge = e->body.tsx_state.src.rdata;
- if (check_request_status(req_data, e)) {
/*
- * Request with challenge response or failover sent.
- * Passed our req_data ref to the new request.
+ * Call any supplements that want to know about a response
+ * with any received data.
*/
- return;
+ AST_RWLIST_RDLOCK(&supplements);
+ AST_LIST_TRAVERSE(&supplements, supplement, next) {
+ if (supplement->incoming_response
+ && does_method_match(&challenge->msg_info.cseq->method.name,
+ supplement->method)) {
+ supplement->incoming_response(req_data->endpoint, challenge);
+ }
+ }
+ AST_RWLIST_UNLOCK(&supplements);
+
+ if (check_request_status(req_data, e)) {
+ /*
+ * Request with challenge response or failover sent.
+ * Passed our req_data ref to the new request.
+ */
+ return;
+ }
+ break;
+ default:
+ ast_log(LOG_ERROR, "Unexpected PJSIP event %u\n", e->body.tsx_state.type);
+ break;
}
- break;
- default:
- ast_log(LOG_ERROR, "Unexpected PJSIP event %u\n", e->body.tsx_state.type);
- break;
}
if (req_data->callback) {