[asterisk-commits] branch oej/aum - r7415 in /team/oej/aum: include/asterisk/ res/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Dec 9 13:33:46 CST 2005


Author: oej
Date: Fri Dec  9 13:33:43 2005
New Revision: 7415

URL: http://svn.digium.com/view/asterisk?rev=7415&view=rev
Log:
- Fixed compilation problems, it doesn't crash on load any more
- Activated some more configuration options
- Added a list of devices and channel callback to the user struct, not used yet

Modified:
    team/oej/aum/include/asterisk/aum.h
    team/oej/aum/res/Makefile
    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=7415&r1=7414&r2=7415&view=diff
==============================================================================
--- team/oej/aum/include/asterisk/aum.h (original)
+++ team/oej/aum/include/asterisk/aum.h Fri Dec  9 13:33:43 2005
@@ -131,6 +131,7 @@
 	AUM_CNF_FIRSTNAME,		/*!< First name */
 	AUM_CNF_LASTNAME,		/*!< Last name*/
 	AUM_CNF_TITLE,			/*!< Title */
+	AUM_CNF_LANGUAGE,		/*!< Language */
 	AUM_CNF_SOUNDNAME,		/*!< Sound file */
 	AUM_CNF_CHANVAR,		/*!< Channel variables */
 	AUM_CNF_PERMIT,			/*!< ACL permit */
@@ -209,6 +210,25 @@
 	AST_LIST_ENTRY(aum_presence) list;	/*!< List mechanics */
 };
 
+enum devicereg {
+	AUM_DEVICE_REG_CHANNEL,			/* Added by channel, persistent object */
+	AUM_DEVICE_REG_MANAGER,			/*!< Added by manager, non persistant */
+	AUM_DEVICE_REG_CLI,			/*!< Added by the CLI, non persistant */
+};
+
+/*! \brief List of phones that belongs to this user
+ * For now, kept in memory. Not persistent across reloads... Could use
+ * ASTdb... 
+ */
+struct aum_device {
+	char *devicename;			/*!< tech/devicename */
+	struct ast_flags flags;			/*!< flags class AUM_DEVICE_* */
+	/*! Placeholder for callback to channel to change state */
+	int (* const change_devstate)(char *device, enum aum_presence_state);
+	enum devicereg registrar;		/*!< Device registrar */
+	AST_LIST_ENTRY(aum_device) list;
+};
+
 /*! \brief Context structure 
 	\note Until further notice, Asterisk contexts are ASCII
 */
@@ -247,6 +267,7 @@
 AST_LIST_HEAD(aum_user_addrlist, aum_address);
 AST_LIST_HEAD(aum_user_contextlist, aum_context);
 AST_LIST_HEAD(aum_presencelist, aum_presence);
+AST_LIST_HEAD(aum_devicelist, aum_device);
 
 /*! \brief Main AUM user object
 	\par This is the main AUM object
@@ -283,9 +304,10 @@
 	struct aum_user_contextlist contexts;	/*!< Linked list of contexts this user use */
 	struct aum_user_grouplist groups;	/*!< Linked list of groups we are members to */
 	struct aum_user_addrlist address;	/*!< Linked list of addresses of various types */
-	struct ast_ha	*acl;		/*!< Access control list for user */
-					/*!< The highest priority is used as primary group for setting default values */
-	int managerperm;		/*!< If sat, this user can log in to manager with these permissions */
+	struct aum_devicelist devices;		/*!< Linked list of devices active for this user */
+	struct ast_ha	*acl;			/*!< Access control list for user */
+						/*!< The highest priority is used as primary group for setting default values */
+	int managerperm;			/*!< If sat, this user can log in to manager with these permissions */
 };
 
 /*! \brief the AUM group definition */

Modified: team/oej/aum/res/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/aum/res/Makefile?rev=7415&r1=7414&r2=7415&view=diff
==============================================================================
--- team/oej/aum/res/Makefile (original)
+++ team/oej/aum/res/Makefile Fri Dec  9 13:33:43 2005
@@ -75,7 +75,7 @@
 	rm -f $(DESTDIR)$(ASTHEADERDIR)/parking.h
 	rm -f $(DESTDIR)$(MODULES_DIR)/app_agi.so 
 	rm -f $(DESTDIR)$(MODULES_DIR)/res_parking.so
-	for x in $(MODS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
+	for x in $(MODS); do ($(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR);echo Installing $$x) ; done
 	@if [ x`which mpg123 2>/dev/null | grep -v '^no'` != x ] ; then \
 	  if mpg123 --longhelp 2>&1 | grep -q .59r 2>&1 >/dev/null ; then echo ; else \
 			echo "*************************************************************";\

Modified: team/oej/aum/res/res_aum.c
URL: http://svn.digium.com/view/asterisk/team/oej/aum/res/res_aum.c?rev=7415&r1=7414&r2=7415&view=diff
==============================================================================
--- team/oej/aum/res/res_aum.c (original)
+++ team/oej/aum/res/res_aum.c Fri Dec  9 13:33:43 2005
@@ -421,26 +421,26 @@
 	ast_cli(fd, "* Userid:        %s\n", user->name);
 
 	if (ast_test_flag(user, AUM_USER_FLAG_REALTIME))
-		ast_cli(fd, " Usertype:        Realtime (cached)\n");
+		ast_cli(fd, " Usertype:   Realtime (cached)\n");
 	else
-		ast_cli(fd, " Usertype:        Static\n");
+		ast_cli(fd, " Usertype:   Static\n");
 
 	if (ast_test_flag(user, AUM_USER_FLAG_DISABLED))
-		ast_cli(fd, " Status:          Disabled\n");
+		ast_cli(fd, " Status:     Disabled\n");
 	else
-		ast_cli(fd, " Status:          Enabled\n");
+		ast_cli(fd, " Status:     Enabled\n");
 
 	if (!ast_strlen_zero(user->title))
-		ast_cli(fd, " Title:          %s\n", user->title);
+		ast_cli(fd, " Title:      %s\n", user->title);
 	if (!ast_strlen_zero(user->last_name))
-		ast_cli(fd, " Name:          %s %s\n", user->first_name, user->last_name);
+		ast_cli(fd, " Name:       %s %s\n", user->first_name, user->last_name);
 	
 	AST_LIST_TRAVERSE(&user->groups, member, list) {
-		ast_cli(fd, " Member of : %s\n", member->group->name);
+		ast_cli(fd, " Member of:  %s\n", member->group->name);
 	};
 
 	AST_LIST_TRAVERSE(&user->address, addr, list) {
-		ast_cli(fd, " Address   : %s - %s\n", aum_addrtype2txt(addr->type), addr->address);
+		ast_cli(fd, " Address:    %s - %s\n", aum_addrtype2txt(addr->type), addr->address);
 	};
 
 	AST_LIST_TRAVERSE(&user->contexts, context, list) {
@@ -451,6 +451,7 @@
 	ast_cli(fd, " Music class:    %s\n", user->musicclass);
 	ast_cli(fd, " Language:       %s\n", user->language);
 	ast_cli(fd, " Mailbox:        %s\n", user->mailbox);
+	ast_cli(fd, " ACL:            %s\n", (user->acl?"Yes (IP address restriction)":"No"));
 	
 	return RESULT_SUCCESS;
 }
@@ -721,6 +722,7 @@
 	{ AUM_CNF_FIRSTNAME,	"firstname" 	,AUM_CONFOBJ_USER },
 	{ AUM_CNF_LASTNAME,	"lastname" 	,AUM_CONFOBJ_USER },
 	{ AUM_CNF_TITLE,	"title" 	,AUM_CONFOBJ_USER },
+	{ AUM_CNF_LANGUAGE,	"language" 	,AUM_CONFOBJ_USER },
 	{ AUM_CNF_SOUNDNAME,	"audioname" 	,AUM_CONFOBJ_USER },
 	{ AUM_CNF_CHANVAR,	"chanvar" 	,AUM_CONFOBJ_USER & AUM_CONFOBJ_GROUP },
 	{ AUM_CNF_PERMIT,	"permit" 	,AUM_CONFOBJ_USER & AUM_CONFOBJ_GROUP },
@@ -1144,6 +1146,9 @@
 			break;
 		case AUM_CNF_TYPE:	/* NO op */
 			break;
+		case AUM_CNF_LANGUAGE:
+			ast_copy_string(user->language, x->value, sizeof(user->language));
+			break;
 		case AUM_CNF_SIPDOMAIN:
 			break;
 		case AUM_CNF_NOT_FOUND:
@@ -1448,6 +1453,8 @@
 		ast_log(LOG_NOTICE, "Unable to load config %s\n", aum_config_file);
 		return -1;
 	}
+	if (option_debug)
+		ast_log(LOG_DEBUG, "Loading configuration for the Asterisk User Management module\n");
 	
 
 	/* Initialize some reasonable defaults at AUM reload */
@@ -1487,15 +1494,15 @@
 	v = ast_variable_browse(cfg, "groups");
 	ast_log(LOG_DEBUG, "- Found group section \n");
 	while (v) {
-		ast_log(LOG_DEBUG, "- Found new group: %s=%s\n", x->name, x->value);
+		ast_log(LOG_DEBUG, "- Found new group: %s=%s\n", v->name, v->value);
 		if (!strcmp(v->name, "group")) {
 			/* get the group */
 			x = ast_variable_browse(cfg, v->value);
 			if (x) {
-				ast_log(LOG_DEBUG, "- Trying to build new group: %s\n", x->value);
-				group = aum_build_group(x->value, x, 0);	/* Build the group */
+				ast_log(LOG_DEBUG, "- Trying to build new group: %s\n", v->value);
+				group = aum_build_group(v->value, x, 0);	/* Build the group */
 				if (group) {
-					ast_log(LOG_VERBOSE, "- Built new group:%s\n", x->value);
+					ast_log(LOG_VERBOSE, "- Built new group:%s\n", v->value);
 					ASTOBJ_CONTAINER_LINK(&aum_grouplist, group);
 				}
 			}



More information about the asterisk-commits mailing list