[asterisk-commits] rizzo: branch rizzo/astobj2 r76217 - /team/rizzo/astobj2/channels/chan_sip.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jul 20 17:44:17 CDT 2007
Author: rizzo
Date: Fri Jul 20 17:44:16 2007
New Revision: 76217
URL: http://svn.digium.com/view/asterisk?view=rev&rev=76217
Log:
be case insensitive in matching "sip:" in headers
Modified:
team/rizzo/astobj2/channels/chan_sip.c
Modified: team/rizzo/astobj2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_sip.c?view=diff&rev=76217&r1=76216&r2=76217
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Fri Jul 20 17:44:16 2007
@@ -6335,9 +6335,9 @@
++h;
else {
h = uri;
- if (strncmp(h, "sip:", 4) == 0)
+ if (strncasecmp(h, "sip:", 4) == 0)
h += 4;
- else if (strncmp(h, "sips:", 5) == 0)
+ else if (strncasecmp(h, "sips:", 5) == 0)
h += 5;
}
hn = strcspn(h, ":;>") + 1;
@@ -7450,6 +7450,7 @@
c = remove_uri_parameters(c);
if (!ast_strlen_zero(c))
ast_string_field_set(p, uri, c);
+
}
/*! \brief Build contact header - the contact header we send out */
@@ -7459,7 +7460,7 @@
char port[16];
port[0] = '\0';
if (ntohs(p->ourip.sin_port) != STANDARD_SIP_PORT)
- snprintf(port, sizeof(port), ":%6d", ntohs(p->ourip.sin_port));
+ snprintf(port, sizeof(port), ":%d", ntohs(p->ourip.sin_port));
ast_string_field_build(p, our_contact, "<sip:%s%s%s%s>",
p->exten, ast_strlen_zero(p->exten) ? "" : "@",
ast_inet_ntoa(p->ourip.sin_addr), port);
@@ -7850,7 +7851,7 @@
ast_copy_string(from, get_header(&p->initreq, "From"), sizeof(from));
c = get_in_brackets(from);
- if (strncmp(c, "sip:", 4)) {
+ if (strncasecmp(c, "sip:", 4)) {
ast_log(LOG_WARNING, "Huh? Not a SIP header (%s)?\n", c);
return -1;
}
@@ -7859,7 +7860,7 @@
ast_copy_string(to, get_header(&p->initreq, "To"), sizeof(to));
c = get_in_brackets(to);
- if (strncmp(c, "sip:", 4)) {
+ if (strncasecmp(c, "sip:", 4)) {
ast_log(LOG_WARNING, "Huh? Not a SIP header (%s)?\n", c);
return -1;
}
@@ -8242,7 +8243,6 @@
else
snprintf(addr, sizeof(addr), "sip:%s", r->hostname);
}
-
ast_string_field_set(p, uri, addr);
p->branch ^= ast_random();
@@ -8371,7 +8371,7 @@
ast_copy_string(from, of, sizeof(from));
of = get_in_brackets(from);
ast_string_field_set(p, from, of);
- if (strncmp(of, "sip:", 4))
+ if (strncasecmp(of, "sip:", 4))
ast_log(LOG_NOTICE, "From address missing 'sip:', using it anyway\n");
else
of += 4;
@@ -8437,7 +8437,7 @@
{
struct sip_msg_out resp;
- if (0 && sipmethod == SIP_ACK)
+ if (0 && sipmethod == SIP_ACK) /* XXX why is this disabled ? */
p->invitestate = INV_CONFIRMED;
reqprep(&resp, p, sipmethod, seqno, newbranch);
@@ -9120,6 +9120,7 @@
ast_atomic_fetchadd_int(&peer->onHold, (hold ? +1 : -1) );
/* Request device state update */
ast_device_state_changed("SIP/%s", peer->name);
+
return;
}
@@ -9176,10 +9177,12 @@
* Terminate the uri at the first ';' or space.
* Technically we should ignore escaped space per RFC3261 (19.1.1 etc)
* but don't do it for the time being. Remember the uri format is:
+ *\verbatim
*
* sip:user:password at host:port;uri-parameters?headers
* sips:user:password at host:port;uri-parameters?headers
*
+ *\endverbatim
*/
static char *terminate_uri(char *uri)
{
@@ -9213,7 +9216,7 @@
c = get_in_brackets(tmp);
c = remove_uri_parameters(c);
- if (!strncmp(c, "sip:", 4)) {
+ if (!strncasecmp(c, "sip:", 4)) {
name = c + 4;
} else {
name = c;
@@ -9420,7 +9423,7 @@
return 0;
exten = get_in_brackets(tmp);
- if (strncmp(exten, "sip:", 4)) {
+ if (strncasecmp(exten, "sip:", 4)) {
ast_log(LOG_WARNING, "Huh? Not an RDNIS SIP header (%s)?\n", exten);
return -1;
}
@@ -9487,7 +9490,7 @@
uri = get_in_brackets(tmp);
- if (strncmp(uri, "sip:", 4)) {
+ if (strncasecmp(uri, "sip:", 4)) {
ast_log(LOG_WARNING, "Huh? Not a SIP header (%s)?\n", uri);
return -1;
}
@@ -9504,7 +9507,7 @@
}
if (!ast_strlen_zero(from)) {
- if (strncmp(from, "sip:", 4)) {
+ if (strncasecmp(from, "sip:", 4)) {
ast_log(LOG_WARNING, "Huh? Not a SIP header (%s)?\n", from);
return -1;
}
@@ -9818,7 +9821,7 @@
if (pedanticsipchecking)
ast_uri_decode(c);
- if (strncmp(c, "sip:", 4)) {
+ if (strncasecmp(c, "sip:", 4)) {
ast_log(LOG_WARNING, "Huh? Not a SIP header in Also: transfer (%s)?\n", c);
return -1;
}
@@ -10286,7 +10289,7 @@
of = get_in_brackets(from);
if (ast_strlen_zero(p->exten)) {
char *t = uri2;
- if (!strncmp(t, "sip:", 4))
+ if (!strncasecmp(t, "sip:", 4))
t+= 4;
ast_string_field_set(p, exten, t);
t = strchr(p->exten, '@');
@@ -18464,7 +18467,7 @@
ast_log(LOG_ERROR, "Cannot retrieve the 'To' header from the original SIP request!\n");
return 0;
}
- if ((localtmp = strstr(tmp, "sip:")) && (localtmp = strchr(localtmp, '@'))) {
+ if ((localtmp = strcasestr(tmp, "sip:")) && (localtmp = strchr(localtmp, '@'))) {
char lhost[80], lport[80];
memset(lhost, 0, sizeof(lhost));
More information about the asterisk-commits
mailing list