mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-22 12:52:33 +00:00
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.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89602 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -4306,8 +4306,8 @@ static int queue_function_queuememberlist(struct ast_channel *chan, const char *
|
||||
|
||||
/*! \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 @@ static int queue_function_memberpenalty_read(struct ast_channel *chan, const cha
|
||||
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 @@ static int queue_function_memberpenalty_read(struct ast_channel *chan, const cha
|
||||
|
||||
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,34 +4351,27 @@ static int queue_function_memberpenalty_write(struct ast_channel *chan, const ch
|
||||
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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user