aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-10-17 17:57:45 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-10-17 17:57:45 +0000
commit0e5d8763f4019607be77d5802829b5dd6ff41915 (patch)
tree592888cfd2a2d0ea12f62b514dc9d77d206e7e2f /channels
parentb6f894cead165141fecc9f6d312fa170edea87ce (diff)
If Asterisk is in the middle of shutting down, respond to OPTIONS
with 503 Unavailable. (closes issue #10994) Reported by: eserra Patches: sip-options-503.patch uploaded by eserra (license 45) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@86149 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 6131cd4c9..5c32d86df 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -13202,13 +13202,19 @@ static int handle_request_options(struct sip_pvt *p, struct sip_request *req)
res = get_destination(p, req);
build_contact(p);
+
/* XXX Should we authenticate OPTIONS? XXX */
+
if (ast_strlen_zero(p->context))
ast_string_field_set(p, context, default_context);
- if (res < 0)
+
+ if (ast_shutting_down())
+ transmit_response_with_allow(p, "503 Unavailable", req, 0);
+ else if (res < 0)
transmit_response_with_allow(p, "404 Not Found", req, 0);
else
transmit_response_with_allow(p, "200 OK", req, 0);
+
/* Destroy if this OPTIONS was the opening request, but not if
it's in the middle of a normal call flow. */
if (!p->lastinvite)