[asterisk-commits] file: trunk r89602 - in /trunk: apps/app_queue.c res/res_features.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Nov 26 12:11:31 CST 2007


Author: file
Date: Mon Nov 26 12:11:31 2007
New Revision: 89602

URL: http://svn.digium.com/view/asterisk?view=rev&rev=89602
Log:
Perform some module use counting audits. This is now done outside the scope of the application/dialplan function so they do not need to worry about it.

Modified:
    trunk/apps/app_queue.c
    trunk/res/res_features.c

Modified: trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_queue.c?view=diff&rev=89602&r1=89601&r2=89602
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Mon Nov 26 12:11:31 2007
@@ -4306,8 +4306,8 @@
 
 /*! \brief Dialplan function QUEUE_MEMBER_PENALTY() 
  * Gets the members penalty. */
-static int queue_function_memberpenalty_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) {
-	struct ast_module_user *lu;
+static int queue_function_memberpenalty_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
+{
 	int penalty;
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(queuename);
@@ -4321,13 +4321,10 @@
 		return -1;
 	}
 
-	lu = ast_module_user_add(chan);
-
 	AST_STANDARD_APP_ARGS(args, data);
 
 	if (args.argc < 2) {
 		ast_log(LOG_ERROR, "Missing argument. QUEUE_MEMBER_PENALTY(<queuename>,<interface>)\n");
-		ast_module_user_remove(lu);
 		return -1;
 	}
 
@@ -4335,15 +4332,14 @@
 	
 	if (penalty >= 0) /* remember that buf is already '\0' */
 		snprintf (buf, len, "%d", penalty);
-	
-	ast_module_user_remove(lu);
+
 	return 0;
 }
 
 /*! Dialplan function QUEUE_MEMBER_PENALTY() 
  * Sets the members penalty. */
-static int queue_function_memberpenalty_write(struct ast_channel *chan, const char *cmd, char *data, const char *value) {
-	struct ast_module_user *lu;
+static int queue_function_memberpenalty_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
+{
 	int penalty;
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(queuename);
@@ -4355,33 +4351,26 @@
 		return -1;
 	}
 
-	lu = ast_module_user_add(chan);
-
 	AST_STANDARD_APP_ARGS(args, data);
 
 	if (args.argc < 2) {
 		ast_log(LOG_ERROR, "Missing argument. QUEUE_MEMBER_PENALTY(<queuename>,<interface>)\n");
-		ast_module_user_remove(lu);
 		return -1;
 	}
 
 	penalty = atoi(value);
 	if (penalty < 0) {
 		ast_log(LOG_ERROR, "Invalid penalty\n");
-		ast_module_user_remove(lu);
 		return -1;
 	}
 
 	if (ast_strlen_zero(args.interface)) {
 		ast_log (LOG_ERROR, "<interface> parameter can't be null\n");
-		ast_module_user_remove(lu);
 		return -1;
 	}
 
 	/* if queuename = NULL then penalty will be set for interface in all the queues. */
 	set_member_penalty(args.queuename, args.interface, penalty);
-
-	ast_module_user_remove(lu);
 
 	return 0;
 }

Modified: trunk/res/res_features.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_features.c?view=diff&rev=89602&r1=89601&r2=89602
==============================================================================
--- trunk/res/res_features.c (original)
+++ trunk/res/res_features.c Mon Nov 26 12:11:31 2007
@@ -2235,9 +2235,6 @@
 	/* Data is unused at the moment but could contain a parking
 	   lot context eventually */
 	int res = 0;
-	struct ast_module_user *u;
-
-	u = ast_module_user_add(chan);
 
 	/* Setup the exten/priority to be s/1 since we don't know
 	   where this call should return */
@@ -2253,8 +2250,6 @@
 	if (!res)
 		res = park_call_full(chan, chan, 0, NULL, orig_chan_name);
 
-	ast_module_user_remove(u);
-
 	return !res ? AST_PBX_KEEPALIVE : res;
 }
 
@@ -2262,14 +2257,11 @@
 static int park_exec(struct ast_channel *chan, void *data)
 {
 	int res = 0;
-	struct ast_module_user *u;
 	struct ast_channel *peer=NULL;
 	struct parkeduser *pu;
 	struct ast_context *con;
 	int park = 0;
 	struct ast_bridge_config config;
-
-	u = ast_module_user_add(chan);
 
 	if (data)
 		park = atoi((char *)data);
@@ -2336,7 +2328,6 @@
 			if (error) {
 				ast_log(LOG_WARNING, "Failed to play courtesy tone!\n");
 				ast_hangup(peer);
-				ast_module_user_remove(u);
 				return -1;
 			}
 		} else
@@ -2346,7 +2337,6 @@
 		if (res < 0) {
 			ast_log(LOG_WARNING, "Could not make channels %s and %s compatible for bridge\n", chan->name, peer->name);
 			ast_hangup(peer);
-			ast_module_user_remove(u);
 			return -1;
 		}
 		/* This runs sorta backwards, since we give the incoming channel control, as if it
@@ -2372,7 +2362,6 @@
 		/* Simulate the PBX hanging up */
 		if (res != AST_PBX_NO_HANGUP_PEER)
 			ast_hangup(peer);
-		ast_module_user_remove(u);
 		return res;
 	} else {
 		/*! \todo XXX Play a message XXX */
@@ -2381,8 +2370,6 @@
 		ast_verb(3, "Channel %s tried to talk to nonexistent parked call %d\n", chan->name, park);
 		res = -1;
 	}
-
-	ast_module_user_remove(u);
 
 	return res;
 }
@@ -3147,7 +3134,6 @@
 */
 static int bridge_exec(struct ast_channel *chan, void *data)
 {
-	struct ast_module_user *u;
 	struct ast_channel *current_dest_chan, *final_dest_chan;
 	char *tmp_data  = NULL;
 	struct ast_flags opts = { 0, };
@@ -3162,8 +3148,6 @@
 		ast_log(LOG_WARNING, "Bridge require at least 1 argument specifying the other end of the bridge\n");
 		return -1;
 	}
-	
-	u = ast_module_user_add(chan);
 
 	tmp_data = ast_strdupa(data);
 	AST_STANDARD_APP_ARGS(args, tmp_data);
@@ -3182,7 +3166,6 @@
 					"Channel2: %s\r\n",
 					chan->name, args.dest_chan);
 		pbx_builtin_setvar_helper(chan, "BRIDGERESULT", "LOOP");
-		ast_module_user_remove(u);
 		return 0;
 	}
 
@@ -3197,7 +3180,6 @@
 					"Channel1: %s\r\n"
 					"Channel2: %s\r\n", chan->name, args.dest_chan);
 		pbx_builtin_setvar_helper(chan, "BRIDGERESULT", "NONEXISTENT");
-		ast_module_user_remove(u);
 		return 0;
 	}
 	ast_channel_unlock(current_dest_chan);
@@ -3229,7 +3211,6 @@
 					"Channel2: %s\r\n", chan->name, final_dest_chan->name);
 		ast_hangup(final_dest_chan); /* may be we should return this channel to the PBX? */
 		pbx_builtin_setvar_helper(chan, "BRIDGERESULT", "INCOMPATIBLE");
-		ast_module_user_remove(u);
 		return 0;
 	}
 
@@ -3266,8 +3247,6 @@
 		ast_debug(1, "hangup chan %s since the other endpoint has hung up\n", final_dest_chan->name);
 		ast_hangup(final_dest_chan);
 	}
-
-	ast_module_user_remove(u);
 
 	return 0;
 }




More information about the asterisk-commits mailing list