From: Richard Mudgett Date: Tue, 5 Apr 2011 15:38:14 +0000 (+0000) Subject: Responding to OPTIONS packet with 404 because Asterisk not looking for "s" extension. X-Git-Tag: 1.8.5-rc1~11^2~240 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0acdb60dbdd572cb9f9a05fcf21f77b22485e32a;p=thirdparty%2Fasterisk.git Responding to OPTIONS packet with 404 because Asterisk not looking for "s" extension. The get_destination() function was not using the "s" extension when the request URI did not specify an extension. This is a regression caused when the URI parsing code was extracted into parse_uri(). Made get_destination() substitute the "s" extension when the parsed URI results in an empty string. (closes issue #18348) Reported by: shmaize Patches: issue18348_v1.8.patch uploaded by rmudgett (license 664) Tested by: shmaize git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@312866 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 9d9dacefb0..7c11ba6d5c 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -14398,16 +14398,20 @@ static int get_rdnis(struct sip_pvt *p, struct sip_request *oreq, char **name, c return 0; } -/*! \brief Find out who the call is for. - We use the request uri as a destination. - This code assumes authentication has been done, so that the - device (peer/user) context is already set. - \return 0 on success (found a matching extension), non-zero on failure - - \note If the incoming uri is a SIPS: uri, we are required to carry this across - the dialplan, so that the outbound call also is a sips: call or encrypted - IAX2 call. If that's not available, the call should FAIL. -*/ +/*! + * \brief Find out who the call is for. + * + * \details + * We use the request uri as a destination. + * This code assumes authentication has been done, so that the + * device (peer/user) context is already set. + * + * \return 0 on success (found a matching extension), non-zero on failure + * + * \note If the incoming uri is a SIPS: uri, we are required to carry this across + * the dialplan, so that the outbound call also is a sips: call or encrypted + * IAX2 call. If that's not available, the call should FAIL. + */ static enum sip_get_dest_result get_destination(struct sip_pvt *p, struct sip_request *oreq, int *cc_recall_core_id) { char tmp[256] = "", *uri, *domain, *dummy = NULL; @@ -14433,6 +14437,14 @@ static enum sip_get_dest_result get_destination(struct sip_pvt *p, struct sip_re SIP_PEDANTIC_DECODE(domain); SIP_PEDANTIC_DECODE(uri); + if (ast_strlen_zero(uri)) { + /* + * Either there really was no extension found or the request + * URI had encoded nulls that made the string "empty". Use "s" + * as the extension. + */ + uri = "s"; + } ast_string_field_set(p, domain, domain);