[asterisk-commits] oej: branch oej/codename-pineapple r45212 - /team/oej/codename-pineapple/chan...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Oct 16 06:28:00 MST 2006


Author: oej
Date: Mon Oct 16 08:28:00 2006
New Revision: 45212

URL: http://svn.digium.com/view/asterisk?rev=45212&view=rev
Log:
Rev 44748 - Rizzo's fix of initreqprep

Modified:
    team/oej/codename-pineapple/channels/chan_sip3.c

Modified: team/oej/codename-pineapple/channels/chan_sip3.c
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/channels/chan_sip3.c?rev=45212&r1=45211&r2=45212&view=diff
==============================================================================
--- team/oej/codename-pineapple/channels/chan_sip3.c (original)
+++ team/oej/codename-pineapple/channels/chan_sip3.c Mon Oct 16 08:28:00 2006
@@ -5330,31 +5330,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