[asterisk-commits] branch oej/aum - r7373 in /team/oej/aum: include/asterisk/aum.h res/res_aum.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Dec 6 21:11:19 CST 2005


Author: oej
Date: Tue Dec  6 21:11:16 2005
New Revision: 7373

URL: http://svn.digium.com/view/asterisk?rev=7373&view=rev
Log:
Fiddling with realtime for res_aum

Modified:
    team/oej/aum/include/asterisk/aum.h
    team/oej/aum/res/res_aum.c

Modified: team/oej/aum/include/asterisk/aum.h
URL: http://svn.digium.com/view/asterisk/team/oej/aum/include/asterisk/aum.h?rev=7373&r1=7372&r2=7373&view=diff
==============================================================================
--- team/oej/aum/include/asterisk/aum.h (original)
+++ team/oej/aum/include/asterisk/aum.h Tue Dec  6 21:11:16 2005
@@ -275,6 +275,8 @@
 	struct ast_variable *chanvars;
 	char *description;			/*!< Description */
 	struct aum_user_grouplist members;
+	char language[MAX_LANGUAGE];	/*!< Default language */
+	char registrar[20];		/*!< Who added this object? */
 };
 
 /*--------------------------- GLOBAL FUNCTIONS ----------------------*/

Modified: team/oej/aum/res/res_aum.c
URL: http://svn.digium.com/view/asterisk/team/oej/aum/res/res_aum.c?rev=7373&r1=7372&r2=7373&view=diff
==============================================================================
--- team/oej/aum/res/res_aum.c (original)
+++ team/oej/aum/res/res_aum.c Tue Dec  6 21:11:16 2005
@@ -193,6 +193,7 @@
 	  	strings (firstname, lastname, sip uri etc)
 		- Figure out what character set is used in config and relatime
 	- Continue with other projects
+ 	- Investigate the possibility of a chan_user as a proxy channel
 	- \b Remember: It's only software
 */
 
@@ -849,7 +850,7 @@
 	enum aum_config_options option;
 
 	/* Check if username exists already */
-	if (aum_find_user(username)) {
+	if (find_aum_user(username)) {
 		ast_log(LOG_WARNING, "Ignoring duplicate user %s\n", username);
 		return NULL;
 	}
@@ -1062,27 +1063,50 @@
 	return group;
 }
 
+
+/*! \brief Get user object from realtime storage 
+	Checks the \b aumusers realtime family from extconfig.conf 
+	\param field name to match on
+	\param value the value of the field
+	
+ */
+
+static struct aum_user *aum_user_realtime_loadbyfield(char *field, char *value)
+	struct aum_user *user = (struct aum_user *) NULL;
+	struct ast_variable *var;
+	
+	var = ast_load_realtime("aumusers", field, value, NULL);
+	if (!var)
+		return (struct aum_user *) NULL;
+
+	/* User found in realtime, now build it in memory */
+	user = aum_build_user(username, var, 1);
+	if (user) {
+		ASTOBJ_CONTAINER_LINK(&aum_userlist, user);
+		aum_real_users++;
+	}
+	ast_variables_destroy(var);
+	return user;
+}
+
 /*! \brief Get user from realtime storage 
 	Checks the \b aumusers realtime family from extconfig.conf 
 	\param username user to load
  */
 static struct aum_user *aum_user_realtime_load(char *username)
 {
-	struct aum_user *user = (struct aum_user *) NULL;
-	struct ast_variable *var;
-	
-	var = ast_load_realtime("aumusers", "name", username, NULL);
-	if (!var)
-		return (struct aum_user *) NULL;
-
-	/* User found in realtime, now build it in memory */
-	user = aum_build_user(username, var, 1);
-	if (user) {
-		ASTOBJ_CONTAINER_LINK(&aum_userlist, user);
-		aum_real_users++;
-	}
-	ast_variables_destroy(var);
-	return user;
+	return aum_user_realtime_loadbyfield("name", username);
+
+}
+
+/*! \brief Get user from realtime storage 
+	Checks the \b aumusers realtime family from extconfig.conf 
+	\param username user to load
+ */
+static struct aum_user *aum_user_realtime_load_by_numuserid(char *numuserid)
+{
+	return aum_user_realtime_loadbyfield("numuserid", numuserid);
+
 }
 
 
@@ -1394,14 +1418,27 @@
 
 struct aum_group *find_group_by_name(char *groupname)
 {
+	struct aum_group *res;
 	if (ast_strlen_zero(groupname))
 		return NULL;
-	return ASTOBJ_CONTAINER_FIND(&aum_grouplist, groupname);	
+	res = ASTOBJ_CONTAINER_FIND(&aum_grouplist, groupname);	
+
+	if (!res && aum_real_groups_enabled) {
+		res = aum_group_realtime_load(groupname);
+	}
+	return res;
+		
 }
 
 struct aum_user *find_aum_user(char *userid)
 {
-	return ASTOBJ_CONTAINER_FIND(&aum_userlist, userid);	
+	struct aum_user *res;
+
+	res = ASTOBJ_CONTAINER_FIND(&aum_userlist, userid);	
+	if (!res && aum_real_users_enabled) {
+		res = aum_user_realtime_load(username);
+	};
+	return res;
 }
 
 struct aum_user *find_aum_user_email(char *email)



More information about the asterisk-commits mailing list