[asterisk-commits] rmudgett: trunk r312897 - in /trunk: ./ channels/chan_sip.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Apr 5 11:21:32 CDT 2011
Author: rmudgett
Date: Tue Apr 5 11:21:28 2011
New Revision: 312897
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=312897
Log:
Merged revisions 312889 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
........
r312889 | rmudgett | 2011-04-05 11:19:35 -0500 (Tue, 05 Apr 2011) | 5 lines
Add 416 response to OPTIONS packet.
RFC3261 Section 11.2 says the response code to an OPTIONS packet needs to
be the same as if it were an INVITE.
........
Modified:
trunk/ (props changed)
trunk/channels/chan_sip.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.
Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=312897&r1=312896&r2=312897
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Tue Apr 5 11:21:28 2011
@@ -21015,6 +21015,8 @@
*/
static int handle_request_options(struct sip_pvt *p, struct sip_request *req, struct ast_sockaddr *addr, const char *e)
{
+ const char *msg;
+ enum sip_get_dest_result gotdest;
int res;
if (p->lastinvite) {
@@ -21046,24 +21048,37 @@
}
/* must go through authentication before getting here */
- res = (get_destination(p, req, NULL) == SIP_GET_DEST_EXTEN_FOUND ? 0 : -1);
+ gotdest = get_destination(p, req, NULL);
build_contact(p);
if (ast_strlen_zero(p->context))
ast_string_field_set(p, context, sip_cfg.default_context);
- 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);
+ if (ast_shutting_down()) {
+ msg = "503 Unavailable";
+ } else {
+ msg = "404 Not Found";
+ switch (gotdest) {
+ case SIP_GET_DEST_INVALID_URI:
+ msg = "416 Unsupported URI scheme";
+ break;
+ case SIP_GET_DEST_PICKUP_EXTEN_FOUND:
+ case SIP_GET_DEST_REFUSED:
+ case SIP_GET_DEST_EXTEN_NOT_FOUND:
+ //msg = "404 Not Found";
+ break;
+ case SIP_GET_DEST_EXTEN_FOUND:
+ msg = "200 OK";
+ break;
+ }
+ }
+ transmit_response_with_allow(p, msg, req, 0);
/* Destroy if this OPTIONS was the opening request, but not if
it's in the middle of a normal call flow. */
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
- return res;
+ return 0;
}
/*! \brief Handle the transfer part of INVITE with a replaces: header,
More information about the asterisk-commits
mailing list