[svn-commits] mjordan: trunk r394346 - in /trunk: ./ apps/app_queue.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Sat Jul 13 21:41:45 CDT 2013
Author: mjordan
Date: Sat Jul 13 21:41:43 2013
New Revision: 394346
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=394346
Log:
Provide error message for QUEUE_MEMBER when member is not in queue
When QUEUE_MEMBER is used and the member specified is not in the queue,
Asterisk provides an ERROR message that indicates that the option specified
is not valid. This patch now properly displays an ERROR message that the
member is not in the queue if an interface is specified.
(closes issue ASTERISK-21980)
Reported by: Avraam David
........
Merged revisions 394345 from http://svn.asterisk.org/svn/asterisk/branches/11
Modified:
trunk/ (props changed)
trunk/apps/app_queue.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.
Modified: trunk/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_queue.c?view=diff&rev=394346&r1=394345&r2=394346
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Sat Jul 13 21:41:43 2013
@@ -413,7 +413,7 @@
</application>
<application name="UnpauseQueueMember" language="en_US">
<synopsis>
- Unpauses a queue member.
+ Unpauses a queue member.
</synopsis>
<syntax>
<parameter name="queuename" />
@@ -1358,8 +1358,8 @@
* q_next links ALL defined callattempt structures into a linked list. call_next is
* a link which allows for a subset of the callattempts to be traversed. This subset
* is used in wait_for_answer so that irrelevant callattempts are not traversed. This
- * also is helpful so that queue logs are always accurate in the case where a call to
- * a member times out, especially if using the ringall strategy.
+ * also is helpful so that queue logs are always accurate in the case where a call to
+ * a member times out, especially if using the ringall strategy.
*/
struct callattempt {
@@ -1565,7 +1565,7 @@
int rrpos; /*!< Round Robin - position */
int memberdelay; /*!< Seconds to delay connecting member to caller */
int autofill; /*!< Ignore the head call status and ring an available agent */
-
+
struct ao2_container *members; /*!< Head of the list of members */
struct queue_ent *head; /*!< Head of the list of callers */
AST_LIST_ENTRY(call_queue) list; /*!< Next call queue */
@@ -1780,7 +1780,7 @@
ao2_unlock(q);
- pbx_builtin_setvar_multiple(chan, interfacevar);
+ pbx_builtin_setvar_multiple(chan, interfacevar);
} else {
ao2_unlock(q);
}
@@ -2304,7 +2304,7 @@
return 0;
} else if (c > 96) {
return c - 64;
- }
+ }
return c - 32;
}
@@ -2466,7 +2466,7 @@
}
contentdup = ast_strdupa(content);
-
+
if (!(maxstr = strchr(contentdup, ','))) {
ast_log(LOG_WARNING, "Improperly formatted penaltychange rule at line %d. Ignoring.\n", linenum);
ast_free(rule);
@@ -2487,7 +2487,7 @@
if ((minstr = strchr(maxstr,','))) {
*minstr++ = '\0';
}
-
+
/* The last check will evaluate true if either no penalty change is indicated for a given rule
* OR if a min penalty change is indicated but no max penalty change is */
if (*maxstr == '+' || *maxstr == '-' || *maxstr == '\0') {
@@ -2519,7 +2519,7 @@
}
}
AST_LIST_TRAVERSE_SAFE_END;
-
+
if (!inserted) {
AST_LIST_INSERT_TAIL(&rl_iter->rules, rule, list);
inserted = 1;
@@ -2572,7 +2572,7 @@
}
/*! \brief Configure a queue parameter.
- *
+ *
* The failunknown flag is set for config files (and static realtime) to show
* errors for unknown parameters. It is cleared for dynamic realtime to allow
* extra fields in the tables.
@@ -2581,7 +2581,7 @@
*/
static void queue_set_param(struct call_queue *q, const char *param, const char *val, int linenum, int failunknown)
{
- if (!strcasecmp(param, "musicclass") ||
+ if (!strcasecmp(param, "musicclass") ||
!strcasecmp(param, "music") || !strcasecmp(param, "musiconhold")) {
ast_string_field_set(q, moh, val);
} else if (!strcasecmp(param, "announce")) {
@@ -2980,7 +2980,7 @@
ao2_unlock(q);
queue_t_unref(q, "Queue is dead; can't return it");
return NULL;
- }
+ }
ast_log(LOG_WARNING, "Static queue '%s' already exists. Not loading from realtime\n", q->name);
ao2_unlock(q);
return q;
@@ -3555,7 +3555,7 @@
}
/*! \brief Caller leaving queue.
- *
+ *
* Search the queue to find the leaving client, if found remove from queue
* create manager event, move others up the queue.
*/
@@ -3866,11 +3866,11 @@
return 1;
}
-/*!
+/*!
* \brief Part 2 of ring_one
*
- * Does error checking before attempting to request a channel and call a member.
- * This function is only called from ring_one().
+ * Does error checking before attempting to request a channel and call a member.
+ * This function is only called from ring_one().
* Failure can occur if:
* - Agent on call
* - Agent is paused
@@ -3941,7 +3941,7 @@
} else if (!ast_strlen_zero(ast_channel_dialed(qe->chan)->number.str)) {
ast_set_callerid(tmp->chan, ast_channel_dialed(qe->chan)->number.str, NULL, NULL);
} else if (!ast_strlen_zero(S_OR(ast_channel_macroexten(qe->chan), ast_channel_exten(qe->chan)))) {
- ast_set_callerid(tmp->chan, S_OR(ast_channel_macroexten(qe->chan), ast_channel_exten(qe->chan)), NULL, NULL);
+ ast_set_callerid(tmp->chan, S_OR(ast_channel_macroexten(qe->chan), ast_channel_exten(qe->chan)), NULL, NULL);
}
tmp->dial_callerid_absent = 1;
}
@@ -4017,7 +4017,7 @@
return best;
}
-/*!
+/*!
* \brief Place a call to a queue member.
*
* Once metrics have been calculated for each member, this function is used
@@ -4051,7 +4051,7 @@
ast_debug(1, "Trying '%s' with metric %d\n", best->interface, best->metric);
ret = ring_entry(qe, best, busies);
}
-
+
/* If we have timed out, break out */
if (qe->expire && (time(NULL) >= qe->expire)) {
ast_debug(1, "Queue timed out while ringing members.\n");
@@ -4133,14 +4133,14 @@
}
ast_verb(3, "Playing periodic announcement\n");
-
+
if (qe->parent->randomperiodicannounce && qe->parent->numperiodicannounce) {
qe->last_periodic_announce_sound = ((unsigned long) ast_random()) % qe->parent->numperiodicannounce;
- } else if (qe->last_periodic_announce_sound >= qe->parent->numperiodicannounce ||
+ } else if (qe->last_periodic_announce_sound >= qe->parent->numperiodicannounce ||
ast_str_strlen(qe->parent->sound_periodicannounce[qe->last_periodic_announce_sound]) == 0) {
qe->last_periodic_announce_sound = 0;
}
-
+
/* play the announcement */
res = play_file(qe->chan, ast_str_buffer(qe->parent->sound_periodicannounce[qe->last_periodic_announce_sound]));
@@ -4785,7 +4785,7 @@
if (qe->parent->periodicannouncefrequency && qe->parent->announce_to_first_user) {
say_periodic_announcement(qe, ringing);
}
-
+
if (!*to) {
for (o = start; o; o = o->call_next) {
rna(orig, qe, o->chan, o->interface, o->member->membername, 1);
@@ -4805,7 +4805,7 @@
return peer;
}
-/*!
+/*!
* \brief Check if we should start attempting to call queue members.
*
* A simple process, really. Count the number of members who are available
@@ -4835,11 +4835,11 @@
if (!ch->pending) {
idx++;
}
- ch = ch->next;
+ ch = ch->next;
}
ao2_unlock(qe->parent);
- /* If the queue entry is within avl [the number of available members] calls from the top ...
+ /* If the queue entry is within avl [the number of available members] calls from the top ...
* Autofill and position check added to support autofill=no (as only calls
* from the front of the queue are valid when autofill is disabled)
*/
@@ -4864,7 +4864,7 @@
{
int max_penalty = qe->pr->max_relative ? qe->max_penalty + qe->pr->max_value : qe->pr->max_value;
int min_penalty = qe->pr->min_relative ? qe->min_penalty + qe->pr->min_value : qe->pr->min_value;
- char max_penalty_str[20], min_penalty_str[20];
+ char max_penalty_str[20], min_penalty_str[20];
/* a relative change to the penalty could put it below 0 */
if (max_penalty < 0) {
max_penalty = 0;
@@ -4939,7 +4939,7 @@
if (qe->parent->periodicannouncefrequency &&
(res = say_periodic_announcement(qe,ringing)))
break;
-
+
/* see if we need to move to the next penalty level for this queue */
while (qe->pr && ((time(NULL) - qe->start) >= qe->pr->time)) {
update_qe_rule(qe);
@@ -4950,7 +4950,7 @@
*reason = QUEUE_TIMEOUT;
break;
}
-
+
/* Wait a second before checking again */
if ((res = ast_waitfordigit(qe->chan, RECHECK * 1000))) {
if (res > 0 && !valid_exit(qe, res)) {
@@ -4959,7 +4959,7 @@
break;
}
}
-
+
/* If we have timed out, break out */
if (qe->expire && (time(NULL) >= qe->expire)) {
*reason = QUEUE_TIMEOUT;
@@ -5003,7 +5003,7 @@
member->calls++;
member->lastqueue = q;
ao2_unlock(q);
- }
+ }
ao2_lock(q);
q->callscompleted++;
if (callcompletedinsl) {
@@ -5187,7 +5187,7 @@
(long) (time(NULL) - callstart), qe->opos);
update_queue(qe->parent, member, callcompletedinsl, (time(NULL) - callstart));
-
+
/* No need to lock the channels because they are already locked in ast_do_masquerade */
if ((datastore = ast_channel_datastore_find(old_chan, &queue_transfer_info, NULL))) {
ast_channel_datastore_remove(old_chan, datastore);
@@ -5320,7 +5320,7 @@
* \param[in] qe the queue_ent structure which corresponds to the caller attempting to reach members
* \param[in] opts the options passed as the third parameter to the Queue() application
* \param[in] opt_args the options passed as the third parameter to the Queue() application
- * \param[in] announceoverride filename to play to user when waiting
+ * \param[in] announceoverride filename to play to user when waiting
* \param[in] url the url passed as the fourth parameter to the Queue() application
* \param[in,out] tries the number of times we have tried calling queue members
* \param[out] noption set if the call to Queue() has the 'n' option set.
@@ -5423,7 +5423,7 @@
ast_set_flag(&(bridge_config.features_caller), AST_FEATURE_PARKCALL);
}
if (ast_test_flag(&opts, OPT_NO_RETRY)) {
- if (qe->parent->strategy == QUEUE_STRATEGY_RRMEMORY || qe->parent->strategy == QUEUE_STRATEGY_LINEAR
+ if (qe->parent->strategy == QUEUE_STRATEGY_RRMEMORY || qe->parent->strategy == QUEUE_STRATEGY_LINEAR
|| qe->parent->strategy == QUEUE_STRATEGY_RRORDERED) {
(*tries)++;
} else {
@@ -5504,7 +5504,7 @@
AST_LIST_LOCK(dialed_interfaces);
AST_LIST_TRAVERSE(dialed_interfaces, di, list) {
if (!strcasecmp(cur->interface, di->interface)) {
- ast_debug(1, "Skipping dialing interface '%s' since it has already been dialed\n",
+ ast_debug(1, "Skipping dialing interface '%s' since it has already been dialed\n",
di->interface);
break;
}
@@ -5559,7 +5559,7 @@
XXX If we're forcibly removed, these outgoing calls won't get
hung up XXX */
tmp->q_next = outgoing;
- outgoing = tmp;
+ outgoing = tmp;
/* If this line is up, don't try anybody else */
if (outgoing->chan && (ast_channel_state(outgoing->chan) == AST_STATE_UP))
break;
@@ -5748,7 +5748,7 @@
pbx_builtin_setvar_multiple(qe->chan, interfacevar);
pbx_builtin_setvar_multiple(peer, interfacevar);
}
-
+
/* if setqueueentryvar is defined, make queue entry (i.e. the caller) variables available to the channel */
/* use pbx_builtin_setvar to set a load of variables with one call */
if (qe->parent->setqueueentryvar) {
@@ -5757,7 +5757,7 @@
pbx_builtin_setvar_multiple(qe->chan, interfacevar);
pbx_builtin_setvar_multiple(peer, interfacevar);
}
-
+
ao2_unlock(qe->parent);
/* try to set queue variables if configured to do so*/
@@ -5798,7 +5798,7 @@
}
} else {
mixmonapp = pbx_findapp("MixMonitor");
-
+
if (mixmonapp) {
ast_debug(1, "Starting MixMonitor as requested.\n");
if (!monitorfilename) {
@@ -5865,7 +5865,7 @@
pbx_substitute_variables_helper(qe->chan, meid2, meid, sizeof(meid) - 1);
}
-
+
snprintf(tmpid2, sizeof(tmpid2), "%s.%s", tmpid, qe->parent->monfmt);
if (!ast_strlen_zero(monitor_exec)) {
@@ -5873,7 +5873,7 @@
} else {
snprintf(mixmonargs, sizeof(mixmonargs), "%s,b%s", tmpid2, monitor_options);
}
-
+
ast_debug(1, "Arguments being passed to MixMonitor: %s\n", mixmonargs);
/* BUGBUG
* This needs to be done differently. We need to start a MixMonitor on
@@ -5890,12 +5890,12 @@
}
}
/* Drop out of the queue at this point, to prepare for next caller */
- leave_queue(qe);
+ leave_queue(qe);
if (!ast_strlen_zero(url) && ast_channel_supports_html(peer)) {
ast_debug(1, "app_queue: sendurl=%s.\n", url);
ast_channel_sendurl(peer, url);
}
-
+
/* run a macro for this connection if defined. The macro simply returns, no action is taken on the result */
/* use macro from dialplan if passed as a option, otherwise use the default queue macro */
if (!ast_strlen_zero(macro)) {
@@ -6026,7 +6026,7 @@
(long) (callstart - qe->start), (long) (time(NULL) - callstart), qe->opos);
send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), AGENT);
}
- if ((tds = ast_channel_datastore_find(qe->chan, &queue_transfer_info, NULL))) {
+ if ((tds = ast_channel_datastore_find(qe->chan, &queue_transfer_info, NULL))) {
ast_channel_datastore_remove(qe->chan, tds);
}
ast_channel_unlock(qe->chan);
@@ -6139,7 +6139,7 @@
ast_free(value);
}
-/*! \brief Remove member from queue
+/*! \brief Remove member from queue
* \retval RES_NOT_DYNAMIC when they aren't a RT member
* \retval RES_NOSUCHQUEUE queue does not exist
* \retval RES_OKAY removed member from queue
@@ -6191,7 +6191,7 @@
return res;
}
-/*! \brief Add member to queue
+/*! \brief Add member to queue
* \retval RES_NOT_DYNAMIC when they aren't a RT member
* \retval RES_NOSUCHQUEUE queue does not exist
* \retval RES_OKAY added member from queue
@@ -6575,7 +6575,7 @@
ast_log(LOG_WARNING, "Error converting penalty: %s: Out of range.\n", penalty_tok);
break;
}
-
+
if (!paused_tok) {
ast_log(LOG_WARNING, "Error parsing persistent member string for '%s' (paused)\n", queue_name);
break;
@@ -6587,7 +6587,7 @@
}
ast_debug(1, "Reload Members: Queue: %s Member: %s Name: %s Penalty: %d Paused: %d\n", queue_name, interface, membername, penalty, paused);
-
+
if (add_to_queue(queue_name, interface, membername, penalty, paused, 0, state_interface) == RES_OUTOFMEMORY) {
ast_log(LOG_ERROR, "Out of Memory when reloading persistent queue member\n");
break;
@@ -6842,7 +6842,7 @@
return -1;
}
- ast_queue_log(args.queuename, args.uniqueid, args.membername, args.event,
+ ast_queue_log(args.queuename, args.uniqueid, args.membername, args.event,
"%s", args.params ? args.params : "");
return 0;
@@ -6880,14 +6880,14 @@
/*!\brief The starting point for all queue calls
*
- * The process involved here is to
+ * The process involved here is to
* 1. Parse the options specified in the call to Queue()
* 2. Join the queue
* 3. Wait in a loop until it is our turn to try calling a queue member
* 4. Attempt to call a queue member
* 5. If 4. did not result in a bridged call, then check for between
* call options such as periodic announcements etc.
- * 6. Try 4 again unless some condition (such as an expiration time) causes us to
+ * 6. Try 4 again unless some condition (such as an expiration time) causes us to
* exit the queue.
*/
static int queue_exec(struct ast_channel *chan, const char *data)
@@ -7072,7 +7072,7 @@
record_abandoned(&qe);
reason = QUEUE_TIMEOUT;
res = 0;
- ast_queue_log(args.queuename, ast_channel_uniqueid(chan),"NONE", "EXITWITHTIMEOUT", "%d|%d|%ld",
+ ast_queue_log(args.queuename, ast_channel_uniqueid(chan),"NONE", "EXITWITHTIMEOUT", "%d|%d|%ld",
qe.pos, qe.opos, (long) time(NULL) - qe.start);
break;
}
@@ -7091,7 +7091,7 @@
goto stop;
}
}
-
+
/* Leave if we have exceeded our queuetimeout */
if (qe.expire && (time(NULL) >= qe.expire)) {
record_abandoned(&qe);
@@ -7133,7 +7133,7 @@
break;
}
-
+
/* Leave if we have exceeded our queuetimeout */
if (qe.expire && (time(NULL) >= qe.expire)) {
record_abandoned(&qe);
@@ -7182,12 +7182,12 @@
/* Don't allow return code > 0 */
if (res >= 0) {
- res = 0;
+ res = 0;
if (ringing) {
ast_indicate(chan, -1);
} else {
ast_moh_stop(chan);
- }
+ }
ast_stopstream(chan);
}
@@ -7362,6 +7362,9 @@
((m = interface_exists(q, args.interface)))) {
count = m->ringinuse;
ao2_ref(m, -1);
+ } else if (!ast_strlen_zero(args.interface)) {
+ ast_log(LOG_ERROR, "Queue member interface %s not in queue %s\n",
+ args.interface, args.queuename);
} else {
ast_log(LOG_ERROR, "Unknown option %s provided to %s, valid values are: "
"logged, free, ready, count, penalty, paused, ringinuse\n", args.option, cmd);
@@ -7476,7 +7479,7 @@
ast_log(LOG_ERROR, "%s requires an argument: queuename\n", cmd);
return -1;
}
-
+
if ((q = find_load_queue_rt_friendly(data))) {
ao2_lock(q);
mem_iter = ao2_iterator_init(q->members, 0);
@@ -7610,7 +7613,7 @@
}
penalty = get_member_penalty (args.queuename, args.interface);
-
+
if (penalty >= 0) { /* remember that buf is already '\0' */
snprintf (buf, len, "%d", penalty);
}
@@ -7706,7 +7709,7 @@
char *rulecat = NULL;
struct ast_variable *rulevar = NULL;
struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
-
+
if (!(cfg = ast_config_load("queuerules.conf", config_flags))) {
ast_log(LOG_NOTICE, "No queuerules.conf file found, queues will not follow penalty rules\n");
return AST_MODULE_LOAD_SUCCESS;
@@ -7907,7 +7910,7 @@
*
* Once we have isolated a queue within reload_queues, we call this. This will either
* reload information for the queue or if we're just reloading member information, we'll just
- * reload that without touching other settings within the queue
+ * reload that without touching other settings within the queue
*
* \param cfg The configuration which we are reading
* \param mask Tells us what information we need to reload
@@ -7943,7 +7946,7 @@
} else {
new = 0;
}
-
+
if (!new) {
ao2_lock(q);
prev_weight = q->weight ? 1 : 0;
@@ -8062,7 +8065,7 @@
* \param mask Gives flags telling us what information to actually reload
* \param queuename If set to a non-zero string, then only reload information from
* that particular queue. Otherwise inspect all queues
- * \retval -1 Failure occurred
+ * \retval -1 Failure occurred
* \retval 0 All clear!
*/
static int reload_queues(int reload, struct ast_flags *mask, const char *queuename)
@@ -8186,9 +8189,9 @@
}
}
-/*!
- * \brief Show queue(s) status and statistics
- *
+/*!
+ * \brief Show queue(s) status and statistics
+ *
* List the queues strategy, calls processed, members logged in,
* other queue statistics such as avg hold time.
*/
@@ -8339,7 +8342,7 @@
return CLI_SUCCESS;
}
-/*!
+/*!
* \brief Check if a given word is in a space-delimited list
*
* \param list Space delimited list of words
@@ -8396,11 +8399,11 @@
/* terminating conditions satisfied, word at beginning or separated by ' ' */
return 1;
}
-
+
return 0;
}
-/*!
+/*!
* \brief Check if a given word is in a space-delimited list
*
* \param line The line as typed not including the current word being completed
@@ -8466,7 +8469,7 @@
" Provides summary information on a specified queue.\n";
return NULL;
case CLI_GENERATE:
- return complete_queue_show(a->line, a->word, a->pos, a->n);
+ return complete_queue_show(a->line, a->word, a->pos, a->n);
}
return __queues_show(NULL, a->fd, a->argc, a->argv);
@@ -8576,7 +8579,7 @@
"Queue: %s\r\n"
"LoggedIn: %d\r\n"
"Available: %d\r\n"
- "Callers: %d\r\n"
+ "Callers: %d\r\n"
"HoldTime: %d\r\n"
"TalkTime: %d\r\n"
"LongestHoldTime: %d\r\n"
@@ -8886,7 +8889,7 @@
{
const char *queuename = NULL;
struct ast_flags mask = {QUEUE_RESET_STATS,};
-
+
queuename = astman_get_header(m, "Queue");
if (!reload_handler(1, &mask, queuename)) {
@@ -8976,7 +8979,7 @@
astman_send_error(s, m, "Need 'Interface' and 'Penalty' parameters.");
return 0;
}
-
+
penalty = atoi(penalty_s);
if (set_member_value((char *)queuename, (char *)interface, MEMBER_PENALTY, penalty)) {
@@ -9198,7 +9201,7 @@
switch (cmd) {
case CLI_INIT:
e->command = "queue {pause|unpause} member";
- e->usage =
+ e->usage =
"Usage: queue {pause|unpause} member <member> [queue <queue> [reason <reason>]]\n"
" Pause or unpause a queue member. Not specifying a particular queue\n"
" will pause or unpause a member across all queues to which the member\n"
@@ -9333,7 +9336,7 @@
switch (cmd) {
case CLI_INIT:
e->command = "queue set penalty";
- e->usage =
+ e->usage =
"Usage: queue set penalty <penalty> on <interface> [in <queue>]\n"
" Set a member's penalty in the queue specified. If no queue is specified\n"
" then that interface's penalty is set in all queues to which that interface is a member\n";
@@ -9366,7 +9369,7 @@
}
}
-static char *complete_queue_rule_show(const char *line, const char *word, int pos, int state)
+static char *complete_queue_rule_show(const char *line, const char *word, int pos, int state)
{
int which = 0;
struct rule_list *rl_iter;
@@ -9420,7 +9423,7 @@
}
}
AST_LIST_UNLOCK(&rule_lists);
- return CLI_SUCCESS;
+ return CLI_SUCCESS;
}
static char *handle_queue_reset(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
@@ -9526,7 +9529,7 @@
return CLI_SUCCESS;
}
-static const char qpm_cmd_usage[] =
+static const char qpm_cmd_usage[] =
"Usage: queue pause member <channel> in <queue> reason <reason>\n";
static const char qum_cmd_usage[] =
More information about the svn-commits
mailing list