]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_pjsip distributor: Don't send 503 response to responses. 18/1618/1
authorMark Michelson <mmichelson@digium.com>
Thu, 12 Nov 2015 17:17:51 +0000 (11:17 -0600)
committerMark Michelson <mmichelson@digium.com>
Thu, 12 Nov 2015 17:21:29 +0000 (12:21 -0500)
When the SIP threadpool is backed up with tasks, we send 503 responses
to ensure that we don't try to overload ourselves. The problem is that
we were not insuring that we were not trying to send a 503 to an
incoming SIP response.

This change makes it so that we only send the 503 on incoming requests.

Change-Id: Ie2b418d89c0e453cc6c2b5c7d543651c981e1404

res/res_pjsip/pjsip_distributor.c

index 3b6c262ecd09a94d02546fdc1a07fe905e2cb734..32f6154f07d9639b48e0036f4e57a936d0302007 100644 (file)
@@ -286,7 +286,9 @@ static pj_bool_t distributor(pjsip_rx_data *rdata)
                 * some sort of terrible condition and don't need to be adding more work to the threadpool.
                 * It's in our best interest to send back a 503 response and be done with it.
                 */
-               pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 503, NULL, NULL, NULL);
+               if (rdata->msg_info.msg->type == PJSIP_REQUEST_MSG) {
+                       pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 503, NULL, NULL, NULL);
+               }
                ao2_cleanup(clone->endpt_info.mod_data[endpoint_mod.id]);
                pjsip_rx_data_free_cloned(clone);
        } else {