diff options
author | Luigi Rizzo <rizzo@icir.org> | 2006-05-22 01:08:41 +0000 |
---|---|---|
committer | Luigi Rizzo <rizzo@icir.org> | 2006-05-22 01:08:41 +0000 |
commit | 8414445108ce922e3ccd5007cff9261a06cec078 (patch) | |
tree | 8065d0a7398985151f8464579ed28f67bd39cf70 /channels/chan_sip.c | |
parent | 917182e2868a6175dc9c3c2b43fae573aa297ac5 (diff) |
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.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@29298 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r-- | channels/chan_sip.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 7dce504a3..3a1f89e09 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -4543,7 +4543,6 @@ static int reqprep(struct sip_request *req, struct sip_pvt *p, int sipmethod, in 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 @@ static int reqprep(struct sip_request *req, struct sip_pvt *p, int sipmethod, in } 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 int transmit_reinvite_with_sdp(struct sip_pvt *p) 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); } |