/*! \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);
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;
}
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);
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;
}
/* 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 */
if (!res)
res = park_call_full(chan, chan, 0, NULL, orig_chan_name);
- ast_module_user_remove(u);
-
return !res ? AST_PBX_KEEPALIVE : res;
}
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);
if (error) {
ast_log(LOG_WARNING, "Failed to play courtesy tone!\n");
ast_hangup(peer);
- ast_module_user_remove(u);
return -1;
}
} else
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
/* 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 */
res = -1;
}
- ast_module_user_remove(u);
-
return res;
}
*/
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, };
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);
"Channel2: %s\r\n",
chan->name, args.dest_chan);
pbx_builtin_setvar_helper(chan, "BRIDGERESULT", "LOOP");
- ast_module_user_remove(u);
return 0;
}
"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);
"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;
}
ast_hangup(final_dest_chan);
}
- ast_module_user_remove(u);
-
return 0;
}