[asterisk-commits] trunk r29298 - /trunk/channels/chan_sip.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sun May 21 18:08:42 MST 2006
Author: rizzo
Date: Sun May 21 20:08:41 2006
New Revision: 29298
URL: http://svn.digium.com/view/asterisk?rev=29298&view=rev
Log:
use a more compact method to trim the trailing ;... from SIP lines.
These are just the first two instances, there are many more to replace.
Modified:
trunk/channels/chan_sip.c
Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=29298&r1=29297&r2=29298&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Sun May 21 20:08:41 2006
@@ -4543,7 +4543,6 @@
char tmp[80];
char newto[256];
const char *c;
- char *n;
const char *ot, *of;
int is_strict = FALSE; /*!< Strict routing flag */
@@ -4582,13 +4581,12 @@
} else if (!ast_strlen_zero(p->uri)) {
c = p->uri;
} else {
+ char *n;
/* We have no URI, use To: or From: header as URI (depending on direction) */
ast_copy_string(stripped, get_header(orig, (ast_test_flag(&p->flags[0], SIP_OUTGOING)) ? "To" : "From"),
sizeof(stripped));
- c = get_in_brackets(stripped);
- n = strchr(c, ';');
- if (n)
- *n = '\0';
+ n = get_in_brackets(stripped);
+ c = strsep(&n, ";"); /* trim ; and beyond */
}
init_req(req, sipmethod, c);
@@ -5139,13 +5137,11 @@
static void extract_uri(struct sip_pvt *p, struct sip_request *req)
{
char stripped[256];
- char *c, *n;
+ char *c;
ast_copy_string(stripped, get_header(req, "Contact"), sizeof(stripped));
c = get_in_brackets(stripped);
- n = strchr(c, ';');
- if (n)
- *n = '\0';
+ c = strsep(&c, ";"); /* trim ; and beyond */
if (!ast_strlen_zero(c))
ast_string_field_set(p, uri, c);
}
More information about the asterisk-commits
mailing list