[asterisk-commits] rizzo: trunk r44748 - /trunk/channels/chan_sip.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sun Oct 8 15:45:02 MST 2006
Author: rizzo
Date: Sun Oct 8 17:45:01 2006
New Revision: 44748
URL: http://svn.digium.com/view/asterisk?rev=44748&view=rev
Log:
small simplification to initreqprep()
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=44748&r1=44747&r2=44748&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Sun Oct 8 17:45:01 2006
@@ -6360,31 +6360,25 @@
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";
}
More information about the asterisk-commits
mailing list