[asterisk-dev] [Code Review] SIP uri parsing cleanup
Nick Lewis
Nick.Lewis at atltelecom.com
Thu Aug 27 05:07:56 CDT 2009
David
Rather than having parse_uri_helper why not keep parse_uri basically
as-is but simply remove the *scheme. Then have something like
- if (scheme) {
- int l = strlen(scheme);
- if (!strncasecmp(uri, scheme, l))
- uri += l;
+ if (!strncasecmp(uri, "sips:", 5)
+ uri += 5;
+ else if(!strncasecmp(uri, "sip:", 4)
+ uri += 4;
else {
- ast_debug(1, "Missing scheme '%s' in '%s'\n",
scheme, uri);
+ ast_debug(1, "Missing sip/sips scheme in
'%s'\n", uri);
error = -1;
}
}
It may look a bit odd hardcoding it down here but *scheme never
contained anything else and is never likely to. After all this is
chan_*sip*
Best Regards
Nick
-----Original Message-----
From: asterisk-dev-bounces at lists.digium.com
[mailto:asterisk-dev-bounces at lists.digium.com] On Behalf Of David Vossel
Sent: 27 August 2009 00:29
To: David Vossel; Asterisk Developers
Subject: [asterisk-dev] [Code Review] SIP uri parsing cleanup
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/343/
-----------------------------------------------------------
Review request for Asterisk Developers.
Summary
-------
Originally anytime parse_uri() was used it first had to be passed the
"sip" scheme, then if that failed it had to be passed the "sips" scheme.
This required two identical uri buffers and was quite ridiculous. Now
parse_uri can just be called once with a single buffer. This patch also
addresses an issue where the "transport=" field of a uri was not being
handled correctly.
I was about to copy the old trend again with some new code I am writing,
but I just could not stand it any longer.
Diffs
-----
/trunk/channels/chan_sip.c 214269
Diff: https://reviewboard.asterisk.org/r/343/diff
Testing
-------
compiles, registers, makes calls..
Thanks,
David
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--
AstriCon 2009 - October 13 - 15 Phoenix, Arizona
Register Now: http://www.astricon.net
asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-dev
______________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
______________________________________________________________________
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet delivered through the MessageLabs Virus Control Centre.
_____________________________________________________________________
Disclaimer of Liability
ATL Telecom Ltd shall not be held liable for any improper or incorrect use of the information described and/or contained herein and assumes no responsibility for anyones use of the information. In no event shall ATL Telecom Ltd be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement or substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this system, even if advised of the possibility of such damage.
Registered Office: ATL Telecom Ltd, Fountain Lane, St. Mellons Cardiff, CF3 0FB
Registered in Wales Number 4335781
All goods and services supplied by ATL Telecom Ltd are supplied subject to ATL Telecom Ltd standard terms and conditions, available upon request.
More information about the asterisk-dev
mailing list