summaryrefslogtreecommitdiff
path: root/apps/app_queue.c
diff options
context:
space:
mode:
authorSean Bright <sean@malleable.com>2008-08-10 20:23:50 +0000
committerSean Bright <sean@malleable.com>2008-08-10 20:23:50 +0000
commit790fde68d94de4d7e8260f8ffc0923715783555e (patch)
treeb55253e4a6cb86147db48091cca0af756faf2ed4 /apps/app_queue.c
parentb69c8e6ab5b5d20a964d67e93cda8dc07da61fa4 (diff)
Another batch of files from RSW. The remaining apps and a few more
files from main/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@137089 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_queue.c')
-rw-r--r--apps/app_queue.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 34bdd60d6..40de07b2f 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -1056,7 +1056,7 @@ static int insert_penaltychange (const char *list_name, const char *content, con
char *timestr, *maxstr, *minstr, *contentdup;
struct penalty_rule *rule = NULL, *rule_iter;
struct rule_list *rl_iter;
- int time, inserted = 0;
+ int penaltychangetime, inserted = 0;
if (!(rule = ast_calloc(1, sizeof(*rule)))) {
ast_log(LOG_ERROR, "Cannot allocate memory for penaltychange rule at line %d!\n", linenum);
@@ -1074,13 +1074,13 @@ static int insert_penaltychange (const char *list_name, const char *content, con
*maxstr++ = '\0';
timestr = contentdup;
- if ((time = atoi(timestr)) < 0) {
+ if ((penaltychangetime = atoi(timestr)) < 0) {
ast_log(LOG_WARNING, "Improper time parameter specified for penaltychange rule at line %d. Ignoring.\n", linenum);
ast_free(rule);
return -1;
}
- rule->time = time;
+ rule->time = penaltychangetime;
if ((minstr = strchr(maxstr,',')))
*minstr++ = '\0';
@@ -1684,7 +1684,7 @@ static int join_queue(char *queuename, struct queue_ent *qe, enum queue_result *
int res = -1;
int pos = 0;
int inserted = 0;
- enum queue_member_status stat;
+ enum queue_member_status status;
if (!(q = load_realtime_queue(queuename)))
return res;
@@ -1693,12 +1693,12 @@ static int join_queue(char *queuename, struct queue_ent *qe, enum queue_result *
ao2_lock(q);
/* This is our one */
- stat = get_member_status(q, qe->max_penalty, qe->min_penalty);
- if (!q->joinempty && (stat == QUEUE_NO_MEMBERS))
+ status = get_member_status(q, qe->max_penalty, qe->min_penalty);
+ if (!q->joinempty && (status == QUEUE_NO_MEMBERS))
*reason = QUEUE_JOINEMPTY;
- else if ((q->joinempty == QUEUE_EMPTY_STRICT) && (stat == QUEUE_NO_REACHABLE_MEMBERS || stat == QUEUE_NO_UNPAUSED_REACHABLE_MEMBERS || stat == QUEUE_NO_MEMBERS))
+ else if ((q->joinempty == QUEUE_EMPTY_STRICT) && (status == QUEUE_NO_REACHABLE_MEMBERS || status == QUEUE_NO_UNPAUSED_REACHABLE_MEMBERS || status == QUEUE_NO_MEMBERS))
*reason = QUEUE_JOINUNAVAIL;
- else if ((q->joinempty == QUEUE_EMPTY_LOOSE) && (stat == QUEUE_NO_REACHABLE_MEMBERS || stat == QUEUE_NO_MEMBERS))
+ else if ((q->joinempty == QUEUE_EMPTY_LOOSE) && (status == QUEUE_NO_REACHABLE_MEMBERS || status == QUEUE_NO_MEMBERS))
*reason = QUEUE_JOINUNAVAIL;
else if (q->maxlen && (q->count >= q->maxlen))
*reason = QUEUE_FULL;
@@ -1959,7 +1959,7 @@ static void recalc_holdtime(struct queue_ent *qe, int newholdtime)
static void leave_queue(struct queue_ent *qe)
{
struct call_queue *q;
- struct queue_ent *cur, *prev = NULL;
+ struct queue_ent *current, *prev = NULL;
struct penalty_rule *pr_iter;
int pos = 0;
@@ -1969,8 +1969,8 @@ static void leave_queue(struct queue_ent *qe)
ao2_lock(q);
prev = NULL;
- for (cur = q->head; cur; cur = cur->next) {
- if (cur == qe) {
+ for (current = q->head; current; current = current->next) {
+ if (current == qe) {
q->count--;
/* Take us out of the queue */
@@ -1980,16 +1980,16 @@ static void leave_queue(struct queue_ent *qe)
ast_debug(1, "Queue '%s' Leave, Channel '%s'\n", q->name, qe->chan->name );
/* Take us out of the queue */
if (prev)
- prev->next = cur->next;
+ prev->next = current->next;
else
- q->head = cur->next;
+ q->head = current->next;
/* Free penalty rules */
while ((pr_iter = AST_LIST_REMOVE_HEAD(&qe->qe_rules, list)))
ast_free(pr_iter);
} else {
/* Renumber the people after us in the queue based on a new count */
- cur->pos = ++pos;
- prev = cur;
+ current->pos = ++pos;
+ prev = current;
}
}
ao2_unlock(q);
@@ -2849,7 +2849,7 @@ static int wait_our_turn(struct queue_ent *qe, int ringing, enum queue_result *r
/* This is the holding pen for callers 2 through maxlen */
for (;;) {
- enum queue_member_status stat;
+ enum queue_member_status status;
if (is_our_turn(qe))
break;
@@ -2860,10 +2860,10 @@ static int wait_our_turn(struct queue_ent *qe, int ringing, enum queue_result *r
break;
}
- stat = get_member_status(qe->parent, qe->max_penalty, qe->min_penalty);
+ status = get_member_status(qe->parent, qe->max_penalty, qe->min_penalty);
/* leave the queue if no agents, if enabled */
- if (qe->parent->leavewhenempty && (stat == QUEUE_NO_MEMBERS)) {
+ if (qe->parent->leavewhenempty && (status == QUEUE_NO_MEMBERS)) {
*reason = QUEUE_LEAVEEMPTY;
ast_queue_log(qe->parent->name, qe->chan->uniqueid, "NONE", "EXITEMPTY", "%d|%d|%ld", qe->pos, qe->opos, (long) time(NULL) - qe->start);
leave_queue(qe);
@@ -2871,13 +2871,13 @@ static int wait_our_turn(struct queue_ent *qe, int ringing, enum queue_result *r
}
/* leave the queue if no reachable agents, if enabled */
- if ((qe->parent->leavewhenempty == QUEUE_EMPTY_STRICT) && (stat == QUEUE_NO_REACHABLE_MEMBERS || stat == QUEUE_NO_UNPAUSED_REACHABLE_MEMBERS)) {
+ if ((qe->parent->leavewhenempty == QUEUE_EMPTY_STRICT) && (status == QUEUE_NO_REACHABLE_MEMBERS || status == QUEUE_NO_UNPAUSED_REACHABLE_MEMBERS)) {
*reason = QUEUE_LEAVEUNAVAIL;
ast_queue_log(qe->parent->name, qe->chan->uniqueid, "NONE", "EXITEMPTY", "%d|%d|%ld", qe->pos, qe->opos, (long) time(NULL) - qe->start);
leave_queue(qe);
break;
}
- if ((qe->parent->leavewhenempty == QUEUE_EMPTY_LOOSE) && (stat == QUEUE_NO_REACHABLE_MEMBERS)) {
+ if ((qe->parent->leavewhenempty == QUEUE_EMPTY_LOOSE) && (status == QUEUE_NO_REACHABLE_MEMBERS)) {
*reason = QUEUE_LEAVEUNAVAIL;
ast_queue_log(qe->parent->name, qe->chan->uniqueid, "NONE", "EXITEMPTY", "%d|%d|%ld", qe->pos, qe->opos, (long) time(NULL) - qe->start);
leave_queue(qe);
@@ -3204,7 +3204,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
struct ast_channel *which;
struct callattempt *lpeer;
struct member *member;
- struct ast_app *app;
+ struct ast_app *application;
int res = 0, bridge = 0;
int numbusies = 0;
int x=0;
@@ -3715,10 +3715,10 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
res = -1;
}
- app = pbx_findapp("Macro");
+ application = pbx_findapp("Macro");
- if (app) {
- res = pbx_exec(qe->chan, app, macroexec);
+ if (application) {
+ res = pbx_exec(qe->chan, application, macroexec);
ast_debug(1, "Macro exited with status %d\n", res);
res = 0;
} else {
@@ -3751,9 +3751,9 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
res = -1;
}
- app = pbx_findapp("Gosub");
+ application = pbx_findapp("Gosub");
- if (app) {
+ if (application) {
char *gosub_args, *gosub_argstart;
/* Set where we came from */
@@ -3770,7 +3770,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
asprintf(&gosub_args, "%s,s,1", gosubexec);
}
if (gosub_args) {
- res = pbx_exec(qe->chan, app, gosub_args);
+ res = pbx_exec(qe->chan, application, gosub_args);
ast_pbx_run(qe->chan);
free(gosub_args);
if (option_debug)
@@ -3792,10 +3792,10 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
if (!ast_strlen_zero(agi)) {
ast_debug(1, "app_queue: agi=%s.\n", agi);
- app = pbx_findapp("agi");
- if (app) {
+ application = pbx_findapp("agi");
+ if (application) {
agiexec = ast_strdupa(agi);
- ret = pbx_exec(qe->chan, app, agiexec);
+ ret = pbx_exec(qe->chan, application, agiexec);
} else
ast_log(LOG_WARNING, "Asked to execute an AGI on this channel, but could not find application (agi)!\n");
}
@@ -4704,7 +4704,7 @@ check_turns:
/* they may dial a digit from the queue context; */
/* or, they may timeout. */
- enum queue_member_status stat;
+ enum queue_member_status status;
/* Leave if we have exceeded our queuetimeout */
if (qe.expire && (time(NULL) > qe.expire)) {
@@ -4749,7 +4749,7 @@ check_turns:
goto stop;
}
- stat = get_member_status(qe.parent, qe.max_penalty, qe.min_penalty);
+ status = get_member_status(qe.parent, qe.max_penalty, qe.min_penalty);
/* exit after 'timeout' cycle if 'n' option enabled */
if (noption && tries >= qe.parent->membercount) {
@@ -4762,7 +4762,7 @@ check_turns:
}
/* leave the queue if no agents, if enabled */
- if (qe.parent->leavewhenempty && (stat == QUEUE_NO_MEMBERS)) {
+ if (qe.parent->leavewhenempty && (status == QUEUE_NO_MEMBERS)) {
record_abandoned(&qe);
reason = QUEUE_LEAVEEMPTY;
ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITEMPTY", "%d|%d|%ld", qe.pos, qe.opos, (long)(time(NULL) - qe.start));
@@ -4771,14 +4771,14 @@ check_turns:
}
/* leave the queue if no reachable agents, if enabled */
- if ((qe.parent->leavewhenempty == QUEUE_EMPTY_STRICT) && (stat == QUEUE_NO_REACHABLE_MEMBERS || stat == QUEUE_NO_UNPAUSED_REACHABLE_MEMBERS)) {
+ if ((qe.parent->leavewhenempty == QUEUE_EMPTY_STRICT) && (status == QUEUE_NO_REACHABLE_MEMBERS || status == QUEUE_NO_UNPAUSED_REACHABLE_MEMBERS)) {
record_abandoned(&qe);
reason = QUEUE_LEAVEUNAVAIL;
ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITEMPTY", "%d|%d|%ld", qe.pos, qe.opos, (long)(time(NULL) - qe.start));
res = 0;
break;
}
- if ((qe.parent->leavewhenempty == QUEUE_EMPTY_LOOSE) && (stat == QUEUE_NO_REACHABLE_MEMBERS)) {
+ if ((qe.parent->leavewhenempty == QUEUE_EMPTY_LOOSE) && (status == QUEUE_NO_REACHABLE_MEMBERS)) {
record_abandoned(&qe);
reason = QUEUE_LEAVEUNAVAIL;
res = 0;