[Asterisk-code-review] res pjsip distributor: Don't send 503 response to responses. (asterisk[13])

Joshua Colp asteriskteam at digium.com
Thu Nov 12 11:31:29 CST 2015


Joshua Colp has submitted this change and it was merged.

Change subject: res_pjsip distributor: Don't send 503 response to responses.
......................................................................


res_pjsip distributor: Don't send 503 response to responses.

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
---
M res/res_pjsip/pjsip_distributor.c
1 file changed, 3 insertions(+), 1 deletion(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Matt Jordan: Looks good to me, approved
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/res/res_pjsip/pjsip_distributor.c b/res/res_pjsip/pjsip_distributor.c
index 1d39e0f..c40f7f9 100644
--- a/res/res_pjsip/pjsip_distributor.c
+++ b/res/res_pjsip/pjsip_distributor.c
@@ -287,7 +287,9 @@
 		 * 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 {

-- 
To view, visit https://gerrit.asterisk.org/1617
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie2b418d89c0e453cc6c2b5c7d543651c981e1404
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list