diff options
author | Luigi Rizzo <rizzo@icir.org> | 2006-10-08 22:45:01 +0000 |
---|---|---|
committer | Luigi Rizzo <rizzo@icir.org> | 2006-10-08 22:45:01 +0000 |
commit | dd2121b0758b2c7999b57e5b0847dbed09404adb (patch) | |
tree | 2dd0250daae9f6dc92f546b23cd75cfee38fdb2f /channels | |
parent | 36e4f62e7cce1523c2799a31b645542da919577c (diff) |
small simplification to initreqprep()
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@44748 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index a2356bcfe..624a9204e 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -6360,31 +6360,25 @@ static void initreqprep(struct sip_request *req, struct sip_pvt *p, int sipmetho char tmp[BUFSIZ/2]; char tmp2[BUFSIZ/2]; const char *l = NULL, *n = NULL; - int x; - char urioptions[256]=""; + const char *urioptions = ""; if (ast_test_flag(&p->flags[0], SIP_USEREQPHONE)) { - char onlydigits = TRUE; - x=0; + const char *s = p->username; /* being a string field, cannot be NULL */ /* Test p->username against allowed characters in AST_DIGIT_ANY If it matches the allowed characters list, then sipuser = ";user=phone" If not, then sipuser = "" */ /* + is allowed in first position in a tel: uri */ - if (p->username && p->username[0] == '+') - x=1; - - for (; x < strlen(p->username); x++) { - if (!strchr(AST_DIGIT_ANYNUM, p->username[x])) { - onlydigits = FALSE; + if (*s == '+') + s++; + for (; *s; s++) { + if (!strchr(AST_DIGIT_ANYNUM, *s) ) break; - } } - /* If we have only digits, add ;user=phone to the uri */ - if (onlydigits) - strcpy(urioptions, ";user=phone"); + if (*s) + urioptions = ";user=phone"; } |