[svn-commits] twilson: trunk r147854 - in /trunk: configs/ phoneprov/ res/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Oct 9 12:04:11 CDT 2008


Author: twilson
Date: Thu Oct  9 12:04:11 2008
New Revision: 147854

URL: http://svn.digium.com/view/asterisk?view=rev&rev=147854
Log:
Make phoneprov case-insensitive to remove the func_strings dependency of the default config

Modified:
    trunk/configs/phoneprov.conf.sample
    trunk/phoneprov/000000000000.cfg
    trunk/res/res_phoneprov.c

Modified: trunk/configs/phoneprov.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/phoneprov.conf.sample?view=diff&rev=147854&r1=147853&r2=147854
==============================================================================
--- trunk/configs/phoneprov.conf.sample (original)
+++ trunk/configs/phoneprov.conf.sample Thu Oct  9 12:04:11 2008
@@ -53,8 +53,8 @@
 static_file => sip.ver,plain/text
 static_file => sip.cfg
 static_file => custom.cfg
-${TOLOWER(${MAC})}.cfg => 000000000000.cfg               ; Dynamically generated files.
-${TOLOWER(${MAC})}-phone.cfg => 000000000000-phone.cfg   ; (relative to AST_DATA_DIR/phoneprov)
-config/${TOLOWER(${MAC})} => polycom.xml                 ; Dynamic Filename => template file 
-${TOLOWER(${MAC})}-directory.xml => 000000000000-directory.xml
+${MAC}.cfg => 000000000000.cfg               ; Dynamically generated files.
+${MAC}-phone.cfg => 000000000000-phone.cfg   ; (relative to AST_DATA_DIR/phoneprov)
+config/${MAC} => polycom.xml                 ; Dynamic Filename => template file 
+${MAC}-directory.xml => 000000000000-directory.xml
 setvar => CUSTOM_CONFIG=/var/lib/asterisk/phoneprov/configs/custom.cfg  ; Custom variable

Modified: trunk/phoneprov/000000000000.cfg
URL: http://svn.digium.com/view/asterisk/trunk/phoneprov/000000000000.cfg?view=diff&rev=147854&r1=147853&r2=147854
==============================================================================
--- trunk/phoneprov/000000000000.cfg (original)
+++ trunk/phoneprov/000000000000.cfg Thu Oct  9 12:04:11 2008
@@ -1,2 +1,2 @@
 <?xml version="1.0" standalone="yes"?>
-	<APPLICATION APP_FILE_PATH="sip.ld" CONFIG_FILES="${IF($[${STAT(e|${CUSTOM_CONFIG})}] ? "custom.cfg, ")}config/${TOLOWER(${MAC})}, sip.cfg" MISC_FILES="" LOG_FILE_DIRECTORY=""/>
+	<APPLICATION APP_FILE_PATH="sip.ld" CONFIG_FILES="${IF($[${STAT(e|${CUSTOM_CONFIG})}] ? "custom.cfg, ")}config/${MAC}, sip.cfg" MISC_FILES="" LOG_FILE_DIRECTORY=""/>

Modified: trunk/res/res_phoneprov.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_phoneprov.c?view=diff&rev=147854&r1=147853&r2=147854
==============================================================================
--- trunk/res/res_phoneprov.c (original)
+++ trunk/res/res_phoneprov.c Thu Oct  9 12:04:11 2008
@@ -28,6 +28,7 @@
 
 #include "asterisk.h"
 
+#include <ctype.h>
 #include <sys/ioctl.h>
 #include <sys/socket.h>
 #include <net/if.h>
@@ -287,15 +288,22 @@
 static int routes_hash_fn(const void *obj, const int flags)
 {
 	const struct http_route *route = obj;
-	
-	return ast_str_hash(route->uri);
+	char *tmp,  *uri;
+   
+	uri = tmp = ast_strdupa(route->uri);
+
+	while (*tmp++) {
+		*tmp = tolower(*tmp);
+	}
+
+	return ast_str_hash(uri);
 }
 
 static int routes_cmp_fn(void *obj, void *arg, int flags)
 {
 	const struct http_route *route1 = obj, *route2 = arg;
 
-	return !strcmp(route1->uri, route2->uri) ? CMP_MATCH | CMP_STOP : 0;
+	return !strcasecmp(route1->uri, route2->uri) ? CMP_MATCH | CMP_STOP : 0;
 }
 
 static void route_destructor(void *obj)
@@ -776,8 +784,15 @@
 static int users_hash_fn(const void *obj, const int flags)
 {
 	const struct user *user = obj;
-	
-	return ast_str_hash(user->macaddress);
+	char *tmp, *mac;
+
+	mac = tmp = ast_strdupa(user->macaddress);
+
+	while (*tmp++) {
+		*tmp = tolower(*tmp);
+	}
+	
+	return ast_str_hash(mac);
 }
 
 static int users_cmp_fn(void *obj, void *arg, int flags)
@@ -821,7 +836,6 @@
 static struct user *build_user(const char *mac, struct phone_profile *profile)
 {
 	struct user *user;
-
 		
 	if (!(user = ao2_alloc(sizeof(*user), user_destructor))) {
 		profile = unref_profile(profile);




More information about the svn-commits mailing list