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

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Dec 15 02:49:44 CST 2005


Author: oej
Date: Thu Dec 15 02:49:41 2005
New Revision: 7489

URL: http://svn.digium.com/view/asterisk?rev=7489&view=rev
Log:
- Added custom address types. These can be used for voip provider of your favorite.
- Fixed some compilation warnings

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

Modified: team/oej/aum-trunk/include/asterisk/aum.h
URL: http://svn.digium.com/view/asterisk/team/oej/aum-trunk/include/asterisk/aum.h?rev=7489&r1=7488&r2=7489&view=diff
==============================================================================
--- team/oej/aum-trunk/include/asterisk/aum.h (original)
+++ team/oej/aum-trunk/include/asterisk/aum.h Thu Dec 15 02:49:41 2005
@@ -82,6 +82,11 @@
 	AUM_ADDR_IAXTEL	= (1 << 9),	/*!< IAXtel Dialup User ID */
 	AUM_ADDR_FAX	= (1 << 10),	/*!< Preferred fax number (E.164 Tel URI) */
 	AUM_ADDR_WEB	= (1 << 11),	/*!< HOMEPAGE */
+	AUM_ADDR_CUST0	= (1 << 11),	/*!< Custom address */
+	AUM_ADDR_CUST1	= (1 << 12),	/*!< Custom address */
+	AUM_ADDR_CUST2	= (1 << 13),	/*!< Custom address */
+	AUM_ADDR_CUST3	= (1 << 14),	/*!< Custom address */
+	AUM_ADDR_CUST4	= (1 << 15),	/*!< Custom address */
 	AUM_ADDR_NONE	= (1 << 30),	/*!< Return value */
 };
 
@@ -109,6 +114,11 @@
 	AUM_CNF_ADDR_FWD,		/*!< Free World Dialup account */
 	AUM_CNF_ADDR_IAXTEL,		/*!< IAXtel account ID */
 	AUM_CNF_ADDR_WEB,		/*!< Home page */
+	AUM_CNF_ADDR_CUST0,		/*!< Custom address */
+	AUM_CNF_ADDR_CUST1,		/*!< Custom address */
+	AUM_CNF_ADDR_CUST2,		/*!< Custom address */
+	AUM_CNF_ADDR_CUST3,		/*!< Custom address */
+	AUM_CNF_ADDR_CUST4,		/*!< Custom address */
 	AUM_CNF_VMAILBOX,		/*!< Voicemail mailbox exten at context */
 	AUM_CNF_GROUP,			/*!< Group membership */
 	AUM_CNF_CALLBACKEXT,		/*!< Default extension */
@@ -344,6 +354,13 @@
 */
 struct aum_user *find_aum_user(char *userid, int realtime);
 
+/*! \brief Find specific context for user
+	\param user	AUM user object pointer
+	\param type	AUM context type searched for
+	\result		Context string if found, NULL if not
+*/
+char *find_aum_user_context(struct aum_user *user, enum aum_context_type type);
+
 /*! \brief Find an address for an AUM user 
 	\param user	AUM user object pointer
 	\param type	AUM address type (enum)
@@ -358,7 +375,7 @@
 	\param address	Address
 	\return 	Pointer to AUM address object if found, otherwise NULL
 */
-struct aum_address *find_user_aum_address(struct aum_user *user, enum aum_address_type type, char *address);
+struct aum_address *find_user_address(struct aum_user *user, enum aum_address_type type, char *address);
 
 /*! \brief Find user by any AUM address type address (xmpp, sip, email, iax2 etc)
 	\param type	AUM address type (enum)

Modified: team/oej/aum-trunk/res/res_aum.c
URL: http://svn.digium.com/view/asterisk/team/oej/aum-trunk/res/res_aum.c?rev=7489&r1=7488&r2=7489&view=diff
==============================================================================
--- team/oej/aum-trunk/res/res_aum.c (original)
+++ team/oej/aum-trunk/res/res_aum.c Thu Dec 15 02:49:41 2005
@@ -114,6 +114,11 @@
 	The address object consists of a type and a text string.
 	The type can be a phone number, SIP uri, IAX number or 
 	cell phone number.
+	
+	We will not add an address type for each service provider
+	out there. Instead, there are five "custom" addresses. These
+	will be configurable so that they can have different labels,
+	depending upon your configuration.
 
 	\par The AUM group object
 	Group objects are "master" objects that the User inherits
@@ -309,6 +314,11 @@
 	{AUM_ADDR_WEB,		"homepage", 	"Web",		AUM_CNF_ADDR_WEB},
 	{AUM_ADDR_WEB,		"url", 		"Web",		AUM_CNF_ADDR_WEB},
 	{AUM_ADDR_WEB,		"http", 	"Web",		AUM_CNF_ADDR_WEB},
+	{AUM_ADDR_CUST0,	"cust0", 	"Custom 0",	AUM_CNF_ADDR_CUST0},
+	{AUM_ADDR_CUST1,	"cust0", 	"Custom 1",	AUM_CNF_ADDR_CUST1},
+	{AUM_ADDR_CUST2,	"cust0", 	"Custom 2",	AUM_CNF_ADDR_CUST2},
+	{AUM_ADDR_CUST3,	"cust0", 	"Custom 3",	AUM_CNF_ADDR_CUST3},
+	{AUM_ADDR_CUST4,	"cust0", 	"Custom 4",	AUM_CNF_ADDR_CUST4},
 };
 
 static struct aum_context_table aum_context_text[] = {
@@ -375,7 +385,7 @@
 	if (aum_real_groups_enabled)
 		ast_cli(fd, "  Groups - realtime:     %-10.10d\n", aum_real_groups);
 	if (aum_real_users_enabled)
-		ast_cli(fd, "  Realtime cache:        %d objects (%-10.10d kb) %d %% full\n", aum_usercache_count, (aum_usercache_count * (sizeof(struct aum_user) + sizeof(struct aum_usercache_struct)) / 1000), (aum_usercache_count / aum_usercache_max * 100 ) );
+		ast_cli(fd, "  Realtime cache:        %d objects (%-10.10d kb) %d %% full\n", aum_usercache_count, (aum_usercache_count * (sizeof(struct aum_user) + sizeof(struct aum_usercache_struct)) / 1000), (int) (aum_usercache_count / aum_usercache_max * 100 ) );
 	ast_cli(fd, "\n\n");
 	
 	return RESULT_SUCCESS;
@@ -440,8 +450,10 @@
 		return RESULT_SUCCESS;
 	}
 	ast_cli(fd, "* Userid %s loaded in realtime cache. \n", user->name);
-	ast_cli(fd, "  Realtime cache:        %d objects (%-10.10d kb) %d %% full\n", aum_usercache_count, (aum_usercache_count * (sizeof(struct aum_user) + sizeof(struct aum_usercache_struct)) / 1000), (aum_usercache_count / aum_usercache_max * 100 ) );
+	ast_cli(fd, "  Realtime cache:        %d objects (%-10.10d kb) %d %% full\n", aum_usercache_count, (aum_usercache_count * (sizeof(struct aum_user) + sizeof(struct aum_usercache_struct)) / 1000), (int) (aum_usercache_count / aum_usercache_max * 100 ) );
 	ast_cli(fd, "\n");
+
+	return RESULT_SUCCESS;
 }
 
 /*! \brief CLI command description */
@@ -667,6 +679,16 @@
 		res = aum_find_address(user, AUM_ADDR_IAX2);
 	} else if (!strcasecmp(param, "fwd")) {
 		res = aum_find_address(user, AUM_ADDR_FWD);
+	} else if (!strcasecmp(param, "cust0")) {
+		res = aum_find_address(user, AUM_ADDR_CUST0);
+	} else if (!strcasecmp(param, "cust1")) {
+		res = aum_find_address(user, AUM_ADDR_CUST1);
+	} else if (!strcasecmp(param, "cust2")) {
+		res = aum_find_address(user, AUM_ADDR_CUST2);
+	} else if (!strcasecmp(param, "cust3")) {
+		res = aum_find_address(user, AUM_ADDR_CUST3);
+	} else if (!strcasecmp(param, "cust4")) {
+		res = aum_find_address(user, AUM_ADDR_CUST4);
 	} else if (!strcasecmp(param, "numuserid")) {
 		res = user->numuserid;
 	} else if (!strcasecmp(param, "pincode")) {
@@ -831,6 +853,11 @@
 	{ AUM_CNF_ADDR_TEL,	"tel" 		,AUM_CONFOBJ_USER },
 	{ AUM_CNF_ADDR_CELL_TEL,"cell" 		,AUM_CONFOBJ_USER },
 	{ AUM_CNF_ADDR_FAX,	"fax" 		,AUM_CONFOBJ_USER },
+	{ AUM_CNF_ADDR_CUST0,	"cust0" 	,AUM_CONFOBJ_USER },
+	{ AUM_CNF_ADDR_CUST1,	"cust1" 	,AUM_CONFOBJ_USER },
+	{ AUM_CNF_ADDR_CUST2,	"cust2" 	,AUM_CONFOBJ_USER },
+	{ AUM_CNF_ADDR_CUST3,	"cust3" 	,AUM_CONFOBJ_USER },
+	{ AUM_CNF_ADDR_CUST4,	"cust4" 	,AUM_CONFOBJ_USER },
 	{ AUM_CNF_PIN,		"pin" 		,AUM_CONFOBJ_USER },
 	{ AUM_CNF_VMAILBOX,	"mailbox" 	,AUM_CONFOBJ_USER },
 	{ AUM_CNF_GROUP,	"group" 	,AUM_CONFOBJ_USER },
@@ -1179,6 +1206,11 @@
 		case AUM_CNF_ADDR_FWD:
 		case AUM_CNF_ADDR_IAXTEL:
 		case AUM_CNF_ADDR_WEB:
+		case AUM_CNF_ADDR_CUST0:
+		case AUM_CNF_ADDR_CUST1:
+		case AUM_CNF_ADDR_CUST2:
+		case AUM_CNF_ADDR_CUST3:
+		case AUM_CNF_ADDR_CUST4:
 			address = build_address(AUM_ADDR_NONE, option, x->value);
 			/* Link this address to user list */
 			if (address)
@@ -1833,7 +1865,7 @@
 }
 
 /*! \brief Initialize charset conversion handlers */
-void initialize_charset_conversion(void)
+static void initialize_charset_conversion(void)
 {
 	ichandler_utf8_to_iso88591 = iconv_open("utf8", "ISO-8859-1");
 	ichandler_iso88591_to_utf8 = iconv_open("ISO-8859-1", "utf8");



More information about the asterisk-commits mailing list