Whitespace fix

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@37596 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.4
Tilghman Lesher 19 years ago
parent 6dd28d9670
commit d8ccfb6711

@ -140,7 +140,7 @@ static char *descrip =
" 'h' -- allow callee to hang up by hitting *.\n" " 'h' -- allow callee to hang up by hitting *.\n"
" 'H' -- allow caller to hang up by hitting *.\n" " 'H' -- allow caller to hang up by hitting *.\n"
" 'n' -- no retries on the timeout; will exit this application and \n" " 'n' -- no retries on the timeout; will exit this application and \n"
" go to the next step.\n" " go to the next step.\n"
" 'r' -- ring instead of playing MOH\n" " 'r' -- ring instead of playing MOH\n"
" 't' -- allow the called user transfer the calling user\n" " 't' -- allow the called user transfer the calling user\n"
" 'T' -- to allow the calling user to transfer the call.\n" " 'T' -- to allow the calling user to transfer the call.\n"
@ -285,37 +285,37 @@ struct callattempt {
LOCAL_USER_DECL; LOCAL_USER_DECL;
struct queue_ent { struct queue_ent {
struct call_queue *parent; /*!< What queue is our parent */ struct call_queue *parent; /*!< What queue is our parent */
char moh[80]; /*!< Name of musiconhold to be used */ char moh[80]; /*!< Name of musiconhold to be used */
char announce[80]; /*!< Announcement to play for member when call is answered */ char announce[80]; /*!< Announcement to play for member when call is answered */
char context[AST_MAX_CONTEXT]; /*!< Context when user exits queue */ char context[AST_MAX_CONTEXT]; /*!< Context when user exits queue */
char digits[AST_MAX_EXTENSION]; /*!< Digits entered while in queue */ char digits[AST_MAX_EXTENSION]; /*!< Digits entered while in queue */
int pos; /*!< Where we are in the queue */ int pos; /*!< Where we are in the queue */
int prio; /*!< Our priority */ int prio; /*!< Our priority */
int last_pos_said; /*!< Last position we told the user */ int last_pos_said; /*!< Last position we told the user */
time_t last_periodic_announce_time; /*!< The last time we played a periodic announcement */ time_t last_periodic_announce_time; /*!< The last time we played a periodic announcement */
int last_periodic_announce_sound; /* The last periodic announcement we made */ int last_periodic_announce_sound; /*!< The last periodic announcement we made */
time_t last_pos; /*!< Last time we told the user their position */ time_t last_pos; /*!< Last time we told the user their position */
int opos; /*!< Where we started in the queue */ int opos; /*!< Where we started in the queue */
int handled; /*!< Whether our call was handled */ int handled; /*!< Whether our call was handled */
int max_penalty; /*!< Limit the members that can take this call to this penalty or lower */ int max_penalty; /*!< Limit the members that can take this call to this penalty or lower */
time_t start; /*!< When we started holding */ time_t start; /*!< When we started holding */
time_t expire; /*!< When this entry should expire (time out of queue) */ time_t expire; /*!< When this entry should expire (time out of queue) */
struct ast_channel *chan; /*!< Our channel */ struct ast_channel *chan; /*!< Our channel */
struct queue_ent *next; /*!< The next queue entry */ struct queue_ent *next; /*!< The next queue entry */
}; };
struct member { struct member {
char interface[80]; /*!< Technology/Location */ char interface[80]; /*!< Technology/Location */
int penalty; /*!< Are we a last resort? */ int penalty; /*!< Are we a last resort? */
int calls; /*!< Number of calls serviced by this member */ int calls; /*!< Number of calls serviced by this member */
int dynamic; /*!< Are we dynamically added? */ int dynamic; /*!< Are we dynamically added? */
int status; /*!< Status of queue member */ int status; /*!< Status of queue member */
int paused; /*!< Are we paused (not accepting calls)? */ int paused; /*!< Are we paused (not accepting calls)? */
time_t lastcall; /*!< When last successful call was hungup */ time_t lastcall; /*!< When last successful call was hungup */
unsigned int dead:1; /*!< Used to detect members deleted in realtime */ unsigned int dead:1; /*!< Used to detect members deleted in realtime */
unsigned int delme:1; /*!< Flag to delete entry on reload */ unsigned int delme:1; /*!< Flag to delete entry on reload */
struct member *next; /*!< Next member */ struct member *next; /*!< Next member */
}; };
struct member_interface { struct member_interface {
@ -334,10 +334,10 @@ static AST_LIST_HEAD_STATIC(interfaces, member_interface);
struct call_queue { struct call_queue {
ast_mutex_t lock; ast_mutex_t lock;
char name[80]; /*!< Name */ char name[80]; /*!< Name */
char moh[80]; /*!< Music On Hold class to be used */ char moh[80]; /*!< Music On Hold class to be used */
char announce[80]; /*!< Announcement to play when call is answered */ char announce[80]; /*!< Announcement to play when call is answered */
char context[AST_MAX_CONTEXT]; /*!< Exit context */ char context[AST_MAX_CONTEXT]; /*!< Exit context */
unsigned int monjoin:1; unsigned int monjoin:1;
unsigned int dead:1; unsigned int dead:1;
unsigned int joinempty:2; unsigned int joinempty:2;
@ -352,44 +352,44 @@ struct call_queue {
unsigned int strategy:3; unsigned int strategy:3;
unsigned int maskmemberstatus:1; unsigned int maskmemberstatus:1;
unsigned int realtime:1; unsigned int realtime:1;
int announcefrequency; /*!< How often to announce their position */ int announcefrequency; /*!< How often to announce their position */
int periodicannouncefrequency; /*!< How often to play periodic announcement */ int periodicannouncefrequency; /*!< How often to play periodic announcement */
int roundingseconds; /*!< How many seconds do we round to? */ int roundingseconds; /*!< How many seconds do we round to? */
int holdtime; /*!< Current avg holdtime, based on recursive boxcar filter */ int holdtime; /*!< Current avg holdtime, based on recursive boxcar filter */
int callscompleted; /*!< Number of queue calls completed */ int callscompleted; /*!< Number of queue calls completed */
int callsabandoned; /*!< Number of queue calls abandoned */ int callsabandoned; /*!< Number of queue calls abandoned */
int servicelevel; /*!< seconds setting for servicelevel*/ int servicelevel; /*!< seconds setting for servicelevel*/
int callscompletedinsl; /*!< Number of calls answered with servicelevel*/ int callscompletedinsl; /*!< Number of calls answered with servicelevel*/
char monfmt[8]; /*!< Format to use when recording calls */ char monfmt[8]; /*!< Format to use when recording calls */
int montype; /*!< Monitor type Monitor vs. MixMonitor */ int montype; /*!< Monitor type Monitor vs. MixMonitor */
char sound_next[80]; /*!< Sound file: "Your call is now first in line" (def. queue-youarenext) */ char sound_next[80]; /*!< Sound file: "Your call is now first in line" (def. queue-youarenext) */
char sound_thereare[80]; /*!< Sound file: "There are currently" (def. queue-thereare) */ char sound_thereare[80]; /*!< Sound file: "There are currently" (def. queue-thereare) */
char sound_calls[80]; /*!< Sound file: "calls waiting to speak to a representative." (def. queue-callswaiting)*/ char sound_calls[80]; /*!< Sound file: "calls waiting to speak to a representative." (def. queue-callswaiting)*/
char sound_holdtime[80]; /*!< Sound file: "The current estimated total holdtime is" (def. queue-holdtime) */ char sound_holdtime[80]; /*!< Sound file: "The current estimated total holdtime is" (def. queue-holdtime) */
char sound_minutes[80]; /*!< Sound file: "minutes." (def. queue-minutes) */ char sound_minutes[80]; /*!< Sound file: "minutes." (def. queue-minutes) */
char sound_lessthan[80]; /*!< Sound file: "less-than" (def. queue-lessthan) */ char sound_lessthan[80]; /*!< Sound file: "less-than" (def. queue-lessthan) */
char sound_seconds[80]; /*!< Sound file: "seconds." (def. queue-seconds) */ char sound_seconds[80]; /*!< Sound file: "seconds." (def. queue-seconds) */
char sound_thanks[80]; /*!< Sound file: "Thank you for your patience." (def. queue-thankyou) */ char sound_thanks[80]; /*!< Sound file: "Thank you for your patience." (def. queue-thankyou) */
char sound_reporthold[80]; /*!< Sound file: "Hold time" (def. queue-reporthold) */ char sound_reporthold[80]; /*!< Sound file: "Hold time" (def. queue-reporthold) */
char sound_periodicannounce[MAX_PERIODIC_ANNOUNCEMENTS][80];/* Sound files: Custom announce, no default */ char sound_periodicannounce[MAX_PERIODIC_ANNOUNCEMENTS][80];/*!< Sound files: Custom announce, no default */
int count; /*!< How many entries */ int count; /*!< How many entries */
int maxlen; /*!< Max number of entries */ int maxlen; /*!< Max number of entries */
int wrapuptime; /*!< Wrapup Time */ int wrapuptime; /*!< Wrapup Time */
int retry; /*!< Retry calling everyone after this amount of time */ int retry; /*!< Retry calling everyone after this amount of time */
int timeout; /*!< How long to wait for an answer */ int timeout; /*!< How long to wait for an answer */
int weight; /*!< Respective weight */ int weight; /*!< Respective weight */
int autopause; /*!< Auto pause queue members if they fail to answer */ int autopause; /*!< Auto pause queue members if they fail to answer */
/* Queue strategy things */ /* Queue strategy things */
int rrpos; /*!< Round Robin - position */ int rrpos; /*!< Round Robin - position */
int memberdelay; /*!< Seconds to delay connecting member to caller */ int memberdelay; /*!< Seconds to delay connecting member to caller */
int autofill; /*!< Ignore the head call status and ring an available agent */ int autofill; /*!< Ignore the head call status and ring an available agent */
struct member *members; /*!< Head of the list of members */ struct member *members; /*!< Head of the list of members */
struct queue_ent *head; /*!< Head of the list of callers */ struct queue_ent *head; /*!< Head of the list of callers */
AST_LIST_ENTRY(call_queue) list; /*!< Next call queue */ AST_LIST_ENTRY(call_queue) list; /*!< Next call queue */
}; };
static AST_LIST_HEAD_STATIC(queues, call_queue); static AST_LIST_HEAD_STATIC(queues, call_queue);
@ -529,7 +529,7 @@ static void *changethread(void *data)
ast_log(LOG_DEBUG, "Device '%s/%s' changed to state '%d' (%s) but we don't care because they're not a member of any queue.\n", technology, loc, sc->state, devstate2str(sc->state)); ast_log(LOG_DEBUG, "Device '%s/%s' changed to state '%d' (%s) but we don't care because they're not a member of any queue.\n", technology, loc, sc->state, devstate2str(sc->state));
free(sc); free(sc);
return NULL; return NULL;
} }
if (option_debug) if (option_debug)
ast_log(LOG_DEBUG, "Device '%s/%s' changed to state '%d' (%s)\n", technology, loc, sc->state, devstate2str(sc->state)); ast_log(LOG_DEBUG, "Device '%s/%s' changed to state '%d' (%s)\n", technology, loc, sc->state, devstate2str(sc->state));
@ -546,16 +546,16 @@ static void *changethread(void *data)
continue; continue;
manager_event(EVENT_FLAG_AGENT, "QueueMemberStatus", manager_event(EVENT_FLAG_AGENT, "QueueMemberStatus",
"Queue: %s\r\n" "Queue: %s\r\n"
"Location: %s\r\n" "Location: %s\r\n"
"Membership: %s\r\n" "Membership: %s\r\n"
"Penalty: %d\r\n" "Penalty: %d\r\n"
"CallsTaken: %d\r\n" "CallsTaken: %d\r\n"
"LastCall: %d\r\n" "LastCall: %d\r\n"
"Status: %d\r\n" "Status: %d\r\n"
"Paused: %d\r\n", "Paused: %d\r\n",
q->name, cur->interface, cur->dynamic ? "dynamic" : "static", q->name, cur->interface, cur->dynamic ? "dynamic" : "static",
cur->penalty, cur->calls, (int)cur->lastcall, cur->status, cur->paused); cur->penalty, cur->calls, (int)cur->lastcall, cur->status, cur->paused);
} }
} }
ast_mutex_unlock(&q->lock); ast_mutex_unlock(&q->lock);
@ -728,7 +728,7 @@ static int remove_from_interfaces(char *interface)
AST_LIST_TRAVERSE_SAFE_END; AST_LIST_TRAVERSE_SAFE_END;
AST_LIST_UNLOCK(&interfaces); AST_LIST_UNLOCK(&interfaces);
return 0; return 0;
} }
static void clear_and_free_interfaces(void) static void clear_and_free_interfaces(void)
@ -892,7 +892,7 @@ static void queue_set_param(struct call_queue *q, const char *param, const char
we will not see any effect on use_weight until next reload. */ we will not see any effect on use_weight until next reload. */
} else if (!strcasecmp(param, "timeoutrestart")) { } else if (!strcasecmp(param, "timeoutrestart")) {
q->timeoutrestart = ast_true(val); q->timeoutrestart = ast_true(val);
} else if(failunknown) { } else if (failunknown) {
if (linenum >= 0) { if (linenum >= 0) {
ast_log(LOG_WARNING, "Unknown keyword in queue '%s': %s at line %d of queues.conf\n", ast_log(LOG_WARNING, "Unknown keyword in queue '%s': %s at line %d of queues.conf\n",
q->name, param, linenum); q->name, param, linenum);
@ -915,8 +915,8 @@ static void rt_handle_member_record(struct call_queue *q, char *interface, const
/* Find the member, or the place to put a new one. */ /* Find the member, or the place to put a new one. */
for (m = q->members, prev_m = NULL; for (m = q->members, prev_m = NULL;
m && strcmp(m->interface, interface); m && strcmp(m->interface, interface);
prev_m = m, m = m->next); prev_m = m, m = m->next);
/* Create a new one if not found, else update penalty */ /* Create a new one if not found, else update penalty */
if (!m) { if (!m) {
@ -1176,11 +1176,11 @@ static int join_queue(char *queuename, struct queue_ent *qe, enum queue_result *
q->count++; q->count++;
res = 0; res = 0;
manager_event(EVENT_FLAG_CALL, "Join", manager_event(EVENT_FLAG_CALL, "Join",
"Channel: %s\r\nCallerID: %s\r\nCallerIDName: %s\r\nQueue: %s\r\nPosition: %d\r\nCount: %d\r\nUniqueid: %s\r\n", "Channel: %s\r\nCallerID: %s\r\nCallerIDName: %s\r\nQueue: %s\r\nPosition: %d\r\nCount: %d\r\nUniqueid: %s\r\n",
qe->chan->name, qe->chan->name,
S_OR(qe->chan->cid.cid_num, "unknown"), /* XXX somewhere else it is <unknown> */ S_OR(qe->chan->cid.cid_num, "unknown"), /* XXX somewhere else it is <unknown> */
S_OR(qe->chan->cid.cid_name, "unknown"), S_OR(qe->chan->cid.cid_name, "unknown"),
q->name, qe->pos, q->count, qe->chan->uniqueid ); q->name, qe->pos, q->count, qe->chan->uniqueid );
if (option_debug) if (option_debug)
ast_log(LOG_DEBUG, "Queue '%s' Join, Channel '%s', Position '%d'\n", q->name, qe->chan->name, qe->pos ); ast_log(LOG_DEBUG, "Queue '%s' Join, Channel '%s', Position '%d'\n", q->name, qe->chan->name, qe->pos );
} }
@ -1216,7 +1216,7 @@ static int valid_exit(struct queue_ent *qe, char digit)
return 0; return 0;
} }
/* If there's no context to goto, short-circuit */ /* If there's no context to goto, short-circuit */
if (ast_strlen_zero(qe->context)) if (ast_strlen_zero(qe->context))
return 0; return 0;
@ -1285,7 +1285,7 @@ static int say_position(struct queue_ent *qe)
/* If the hold time is >1 min, if it's enabled, and if it's not /* If the hold time is >1 min, if it's enabled, and if it's not
supposed to be only once and we have already said it, say it */ supposed to be only once and we have already said it, say it */
if ((avgholdmins+avgholdsecs) > 0 && (qe->parent->announceholdtime) && if ((avgholdmins+avgholdsecs) > 0 && (qe->parent->announceholdtime) &&
(!(qe->parent->announceholdtime == ANNOUNCEHOLDTIME_ONCE) && qe->last_pos)) { (!(qe->parent->announceholdtime == ANNOUNCEHOLDTIME_ONCE) && qe->last_pos)) {
res = play_file(qe->chan, qe->parent->sound_holdtime); res = play_file(qe->chan, qe->parent->sound_holdtime);
if (res && valid_exit(qe, res)) if (res && valid_exit(qe, res))
goto playout; goto playout;
@ -1321,17 +1321,17 @@ static int say_position(struct queue_ent *qe)
} }
posout: posout:
if (option_verbose > 2) if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Told %s in %s their queue position (which was %d)\n", ast_verbose(VERBOSE_PREFIX_3 "Told %s in %s their queue position (which was %d)\n",
qe->chan->name, qe->parent->name, qe->pos); qe->chan->name, qe->parent->name, qe->pos);
res = play_file(qe->chan, qe->parent->sound_thanks); res = play_file(qe->chan, qe->parent->sound_thanks);
if (res && !valid_exit(qe, res)) if (res && !valid_exit(qe, res))
res = 0; res = 0;
playout: playout:
/* Set our last_pos indicators */ /* Set our last_pos indicators */
qe->last_pos = now; qe->last_pos = now;
qe->last_pos_said = qe->pos; qe->last_pos_said = qe->pos;
/* Don't restart music on hold if we're about to exit the caller from the queue */ /* Don't restart music on hold if we're about to exit the caller from the queue */
@ -1432,16 +1432,16 @@ static int update_status(struct call_queue *q, struct member *member, int status
cur->status = status; cur->status = status;
if (!q->maskmemberstatus) { if (!q->maskmemberstatus) {
manager_event(EVENT_FLAG_AGENT, "QueueMemberStatus", manager_event(EVENT_FLAG_AGENT, "QueueMemberStatus",
"Queue: %s\r\n" "Queue: %s\r\n"
"Location: %s\r\n" "Location: %s\r\n"
"Membership: %s\r\n" "Membership: %s\r\n"
"Penalty: %d\r\n" "Penalty: %d\r\n"
"CallsTaken: %d\r\n" "CallsTaken: %d\r\n"
"LastCall: %d\r\n" "LastCall: %d\r\n"
"Status: %d\r\n" "Status: %d\r\n"
"Paused: %d\r\n", "Paused: %d\r\n",
q->name, cur->interface, cur->dynamic ? "dynamic" : "static", q->name, cur->interface, cur->dynamic ? "dynamic" : "static",
cur->penalty, cur->calls, (int)cur->lastcall, cur->status, cur->paused); cur->penalty, cur->calls, (int)cur->lastcall, cur->status, cur->paused);
} }
} }
ast_mutex_unlock(&q->lock); ast_mutex_unlock(&q->lock);
@ -1660,8 +1660,8 @@ static struct callattempt *find_best(struct callattempt *outgoing)
for (cur = outgoing; cur; cur = cur->q_next) { for (cur = outgoing; cur; cur = cur->q_next) {
if (cur->stillgoing && /* Not already done */ if (cur->stillgoing && /* Not already done */
!cur->chan && /* Isn't already going */ !cur->chan && /* Isn't already going */
(!best || cur->metric < best->metric)) { /* We haven't found one yet, or it's better */ (!best || cur->metric < best->metric)) { /* We haven't found one yet, or it's better */
best = cur; best = cur;
} }
} }
@ -1790,12 +1790,12 @@ static void record_abandoned(struct queue_ent *qe)
{ {
ast_mutex_lock(&qe->parent->lock); ast_mutex_lock(&qe->parent->lock);
manager_event(EVENT_FLAG_AGENT, "QueueCallerAbandon", manager_event(EVENT_FLAG_AGENT, "QueueCallerAbandon",
"Queue: %s\r\n" "Queue: %s\r\n"
"Uniqueid: %s\r\n" "Uniqueid: %s\r\n"
"Position: %d\r\n" "Position: %d\r\n"
"OriginalPosition: %d\r\n" "OriginalPosition: %d\r\n"
"HoldTime: %d\r\n", "HoldTime: %d\r\n",
qe->parent->name, qe->chan->uniqueid, qe->pos, qe->opos, (int)(time(NULL) - qe->start)); qe->parent->name, qe->chan->uniqueid, qe->pos, qe->opos, (int)(time(NULL) - qe->start));
qe->parent->callsabandoned++; qe->parent->callsabandoned++;
ast_mutex_unlock(&qe->parent->lock); ast_mutex_unlock(&qe->parent->lock);
@ -1816,7 +1816,7 @@ static void rna(int rnatime, struct queue_ent *qe, char *membername)
ast_verbose( VERBOSE_PREFIX_3 "Failed to pause Queue Member %s in queue %s!\n", membername, qe->parent->name); ast_verbose( VERBOSE_PREFIX_3 "Failed to pause Queue Member %s in queue %s!\n", membername, qe->parent->name);
} }
} }
return; return;
} }
#define AST_MAX_WATCHERS 256 #define AST_MAX_WATCHERS 256
@ -1841,7 +1841,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
starttime = (long) time(NULL); starttime = (long) time(NULL);
while(*to && !peer) { while (*to && !peer) {
int numlines, retry, pos = 1; int numlines, retry, pos = 1;
struct ast_channel *watchers[AST_MAX_WATCHERS]; struct ast_channel *watchers[AST_MAX_WATCHERS];
watchers[0] = in; watchers[0] = in;
@ -1857,7 +1857,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
numlines++; numlines++;
} }
if (pos > 1 /* found */ || !stillgoing /* nobody listening */ || if (pos > 1 /* found */ || !stillgoing /* nobody listening */ ||
(qe->parent->strategy != QUEUE_STRATEGY_RINGALL) /* ring would not be delivered */) (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) /* ring would not be delivered */)
break; break;
/* On "ringall" strategy we only move to the next penalty level /* On "ringall" strategy we only move to the next penalty level
when *all* ringing phones are done in the current penalty level */ when *all* ringing phones are done in the current penalty level */
@ -1941,7 +1941,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
f = ast_read(winner); f = ast_read(winner);
if (f) { if (f) {
if (f->frametype == AST_FRAME_CONTROL) { if (f->frametype == AST_FRAME_CONTROL) {
switch(f->subclass) { switch (f->subclass) {
case AST_CONTROL_ANSWER: case AST_CONTROL_ANSWER:
/* This is our guy if someone answered. */ /* This is our guy if someone answered. */
if (!peer) { if (!peer) {
@ -2151,12 +2151,12 @@ static int wait_our_turn(struct queue_ent *qe, int ringing, enum queue_result *r
/* Make a position announcement, if enabled */ /* Make a position announcement, if enabled */
if (qe->parent->announcefrequency && !ringing && if (qe->parent->announcefrequency && !ringing &&
(res = say_position(qe))) (res = say_position(qe)))
break; break;
/* Make a periodic announcement, if enabled */ /* Make a periodic announcement, if enabled */
if (qe->parent->periodicannouncefrequency && !ringing && if (qe->parent->periodicannouncefrequency && !ringing &&
(res = say_periodic_announcement(qe))) (res = say_periodic_announcement(qe)))
break; break;
/* Wait a second before checking again */ /* Wait a second before checking again */
@ -2175,7 +2175,7 @@ static int update_queue(struct call_queue *q, struct member *member)
be sure it's still valid */ be sure it's still valid */
ast_mutex_lock(&q->lock); ast_mutex_lock(&q->lock);
cur = q->members; cur = q->members;
while(cur) { while (cur) {
if (member == cur) { if (member == cur) {
time(&cur->lastcall); time(&cur->lastcall);
cur->calls++; cur->calls++;
@ -2550,11 +2550,11 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
} }
/* Drop out of the queue at this point, to prepare for next caller */ /* 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)) { if (!ast_strlen_zero(url) && ast_channel_supports_html(peer)) {
if (option_debug) if (option_debug)
ast_log(LOG_DEBUG, "app_queue: sendurl=%s.\n", url); ast_log(LOG_DEBUG, "app_queue: sendurl=%s.\n", url);
ast_channel_sendurl(peer, url); ast_channel_sendurl(peer, url);
} }
if (qe->parent->setinterfacevar) if (qe->parent->setinterfacevar)
pbx_builtin_setvar_helper(qe->chan, "MEMBERINTERFACE", member->interface); pbx_builtin_setvar_helper(qe->chan, "MEMBERINTERFACE", member->interface);
if (!ast_strlen_zero(agi)) { if (!ast_strlen_zero(agi)) {
@ -2588,11 +2588,11 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
if (strcasecmp(oldcontext, qe->chan->context) || strcasecmp(oldexten, qe->chan->exten)) { if (strcasecmp(oldcontext, qe->chan->context) || strcasecmp(oldexten, qe->chan->exten)) {
ast_queue_log(queuename, qe->chan->uniqueid, peer->name, "TRANSFER", "%s|%s|%ld|%ld", ast_queue_log(queuename, qe->chan->uniqueid, peer->name, "TRANSFER", "%s|%s|%ld|%ld",
qe->chan->exten, qe->chan->context, (long) (callstart - qe->start), qe->chan->exten, qe->chan->context, (long) (callstart - qe->start),
(long) (time(NULL) - callstart)); (long) (time(NULL) - callstart));
} else if (qe->chan->_softhangup) { } else if (qe->chan->_softhangup) {
ast_queue_log(queuename, qe->chan->uniqueid, peer->name, "COMPLETECALLER", "%ld|%ld", ast_queue_log(queuename, qe->chan->uniqueid, peer->name, "COMPLETECALLER", "%ld|%ld",
(long) (callstart - qe->start), (long) (time(NULL) - callstart)); (long) (callstart - qe->start), (long) (time(NULL) - callstart));
if (qe->parent->eventwhencalled) if (qe->parent->eventwhencalled)
manager_event(EVENT_FLAG_AGENT, "AgentComplete", manager_event(EVENT_FLAG_AGENT, "AgentComplete",
"Queue: %s\r\n" "Queue: %s\r\n"
@ -2608,7 +2608,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : ""); qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
} else { } else {
ast_queue_log(queuename, qe->chan->uniqueid, peer->name, "COMPLETEAGENT", "%ld|%ld", ast_queue_log(queuename, qe->chan->uniqueid, peer->name, "COMPLETEAGENT", "%ld|%ld",
(long) (callstart - qe->start), (long) (time(NULL) - callstart)); (long) (callstart - qe->start), (long) (time(NULL) - callstart));
if (qe->parent->eventwhencalled) if (qe->parent->eventwhencalled)
manager_event(EVENT_FLAG_AGENT, "AgentComplete", manager_event(EVENT_FLAG_AGENT, "AgentComplete",
"Queue: %s\r\n" "Queue: %s\r\n"
@ -2680,8 +2680,8 @@ static void dump_queue_members(struct call_queue *pm_queue)
continue; continue;
res = snprintf(value + value_len, sizeof(value) - value_len, "%s;%d;%d%s", res = snprintf(value + value_len, sizeof(value) - value_len, "%s;%d;%d%s",
cur_member->interface, cur_member->penalty, cur_member->paused, cur_member->interface, cur_member->penalty, cur_member->paused,
cur_member->next ? "|" : ""); cur_member->next ? "|" : "");
if (res != strlen(value + value_len)) { if (res != strlen(value + value_len)) {
ast_log(LOG_WARNING, "Could not create persistent member string, out of space\n"); ast_log(LOG_WARNING, "Could not create persistent member string, out of space\n");
break; break;
@ -2725,9 +2725,9 @@ static int remove_from_queue(char *queuename, char *interface)
} }
} }
manager_event(EVENT_FLAG_AGENT, "QueueMemberRemoved", manager_event(EVENT_FLAG_AGENT, "QueueMemberRemoved",
"Queue: %s\r\n" "Queue: %s\r\n"
"Location: %s\r\n", "Location: %s\r\n",
q->name, last_member->interface); q->name, last_member->interface);
free(last_member); free(last_member);
if (queue_persistent_members) if (queue_persistent_members)
@ -2771,17 +2771,17 @@ static int add_to_queue(char *queuename, char *interface, int penalty, int pause
new_member->next = q->members; new_member->next = q->members;
q->members = new_member; q->members = new_member;
manager_event(EVENT_FLAG_AGENT, "QueueMemberAdded", manager_event(EVENT_FLAG_AGENT, "QueueMemberAdded",
"Queue: %s\r\n" "Queue: %s\r\n"
"Location: %s\r\n" "Location: %s\r\n"
"Membership: %s\r\n" "Membership: %s\r\n"
"Penalty: %d\r\n" "Penalty: %d\r\n"
"CallsTaken: %d\r\n" "CallsTaken: %d\r\n"
"LastCall: %d\r\n" "LastCall: %d\r\n"
"Status: %d\r\n" "Status: %d\r\n"
"Paused: %d\r\n", "Paused: %d\r\n",
q->name, new_member->interface, new_member->dynamic ? "dynamic" : "static", q->name, new_member->interface, new_member->dynamic ? "dynamic" : "static",
new_member->penalty, new_member->calls, (int) new_member->lastcall, new_member->penalty, new_member->calls, (int) new_member->lastcall,
new_member->status, new_member->paused); new_member->status, new_member->paused);
if (dump) if (dump)
dump_queue_members(q); dump_queue_members(q);
@ -3181,12 +3181,12 @@ static int queue_exec(struct ast_channel *chan, void *data)
int go_on = 0; int go_on = 0;
char *parse; char *parse;
AST_DECLARE_APP_ARGS(args, AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(queuename); AST_APP_ARG(queuename);
AST_APP_ARG(options); AST_APP_ARG(options);
AST_APP_ARG(url); AST_APP_ARG(url);
AST_APP_ARG(announceoverride); AST_APP_ARG(announceoverride);
AST_APP_ARG(queuetimeoutstr); AST_APP_ARG(queuetimeoutstr);
AST_APP_ARG(agi); AST_APP_ARG(agi);
); );
/* Our queue entry */ /* Our queue entry */
struct queue_ent qe; struct queue_ent qe;
@ -3260,7 +3260,7 @@ static int queue_exec(struct ast_channel *chan, void *data)
qe.last_periodic_announce_sound = 0; qe.last_periodic_announce_sound = 0;
if (!join_queue(args.queuename, &qe, &reason)) { if (!join_queue(args.queuename, &qe, &reason)) {
ast_queue_log(args.queuename, chan->uniqueid, "NONE", "ENTERQUEUE", "%s|%s", S_OR(args.url, ""), ast_queue_log(args.queuename, chan->uniqueid, "NONE", "ENTERQUEUE", "%s|%s", S_OR(args.url, ""),
S_OR(chan->cid.cid_num, "")); S_OR(chan->cid.cid_num, ""));
check_turns: check_turns:
if (ringing) { if (ringing) {
ast_indicate(chan, AST_CONTROL_RINGING); ast_indicate(chan, AST_CONTROL_RINGING);
@ -3276,7 +3276,7 @@ check_turns:
/* Record this abandoned call */ /* Record this abandoned call */
record_abandoned(&qe); record_abandoned(&qe);
ast_queue_log(args.queuename, chan->uniqueid, "NONE", "ABANDON", "%d|%d|%ld", ast_queue_log(args.queuename, chan->uniqueid, "NONE", "ABANDON", "%d|%d|%ld",
qe.pos, qe.opos, (long) time(NULL) - qe.start); qe.pos, qe.opos, (long) time(NULL) - qe.start);
if (option_verbose > 2) { if (option_verbose > 2) {
ast_verbose(VERBOSE_PREFIX_3 "User disconnected from queue %s while waiting their turn\n", args.queuename); ast_verbose(VERBOSE_PREFIX_3 "User disconnected from queue %s while waiting their turn\n", args.queuename);
} }
@ -3313,8 +3313,8 @@ check_turns:
if (makeannouncement) { if (makeannouncement) {
/* Make a position announcement, if enabled */ /* Make a position announcement, if enabled */
if (qe.parent->announcefrequency && !ringing && if (qe.parent->announcefrequency && !ringing &&
(res = say_position(&qe))) { (res = say_position(&qe))) {
ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%s|%d", qe.digits, qe.pos); ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%s|%d", qe.digits, qe.pos);
break; break;
} }
@ -3323,7 +3323,7 @@ check_turns:
/* Make a periodic announcement, if enabled */ /* Make a periodic announcement, if enabled */
if (qe.parent->periodicannouncefrequency && !ringing && if (qe.parent->periodicannouncefrequency && !ringing &&
(res = say_periodic_announcement(&qe))) { (res = say_periodic_announcement(&qe))) {
ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%c|%d", res, qe.pos); ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%c|%d", res, qe.pos);
break; break;
} }
@ -3335,12 +3335,12 @@ check_turns:
if (!qe.handled) { if (!qe.handled) {
record_abandoned(&qe); record_abandoned(&qe);
ast_queue_log(args.queuename, chan->uniqueid, "NONE", "ABANDON", ast_queue_log(args.queuename, chan->uniqueid, "NONE", "ABANDON",
"%d|%d|%ld", qe.pos, qe.opos, "%d|%d|%ld", qe.pos, qe.opos,
(long) time(NULL) - qe.start); (long) time(NULL) - qe.start);
} }
} else if (valid_exit(&qe, res)) { } else if (valid_exit(&qe, res)) {
ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHKEY", ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHKEY",
"%s|%d", qe.digits, qe.pos); "%s|%d", qe.digits, qe.pos);
} }
break; break;
} }
@ -3814,8 +3814,8 @@ static int __queues_show(struct mansession *s, int manager, int fd, int argc, ch
sl = 100 * ((float) q->callscompletedinsl / (float) q->callscompleted); sl = 100 * ((float) q->callscompletedinsl / (float) q->callscompleted);
if (s) if (s)
astman_append(s, "%-12.12s has %d calls (max %s) in '%s' strategy (%ds holdtime), W:%d, C:%d, A:%d, SL:%2.1f%% within %ds%s", astman_append(s, "%-12.12s has %d calls (max %s) in '%s' strategy (%ds holdtime), W:%d, C:%d, A:%d, SL:%2.1f%% within %ds%s",
q->name, q->count, max_buf, int2strat(q->strategy), q->holdtime, q->weight, q->name, q->count, max_buf, int2strat(q->strategy), q->holdtime, q->weight,
q->callscompleted, q->callsabandoned,sl,q->servicelevel, term); q->callscompleted, q->callsabandoned,sl,q->servicelevel, term);
else else
ast_cli(fd, "%-12.12s has %d calls (max %s) in '%s' strategy (%ds holdtime), W:%d, C:%d, A:%d, SL:%2.1f%% within %ds%s", ast_cli(fd, "%-12.12s has %d calls (max %s) in '%s' strategy (%ds holdtime), W:%d, C:%d, A:%d, SL:%2.1f%% within %ds%s",
q->name, q->count, max_buf, int2strat(q->strategy), q->holdtime, q->weight, q->callscompleted, q->callsabandoned,sl,q->servicelevel, term); q->name, q->count, max_buf, int2strat(q->strategy), q->holdtime, q->weight, q->callscompleted, q->callsabandoned,sl,q->servicelevel, term);
@ -3837,7 +3837,7 @@ static int __queues_show(struct mansession *s, int manager, int fd, int argc, ch
ast_build_string(&max, &max_left, " (%s)", devstate2str(mem->status)); ast_build_string(&max, &max_left, " (%s)", devstate2str(mem->status));
if (mem->calls) { if (mem->calls) {
ast_build_string(&max, &max_left, " has taken %d calls (last was %ld secs ago)", ast_build_string(&max, &max_left, " has taken %d calls (last was %ld secs ago)",
mem->calls, (long) (time(NULL) - mem->lastcall)); mem->calls, (long) (time(NULL) - mem->lastcall));
} else } else
ast_build_string(&max, &max_left, " has taken no calls yet"); ast_build_string(&max, &max_left, " has taken no calls yet");
if (s) if (s)
@ -3858,8 +3858,8 @@ static int __queues_show(struct mansession *s, int manager, int fd, int argc, ch
for (qe = q->head; qe; qe = qe->next) { for (qe = q->head; qe; qe = qe->next) {
if (s) if (s)
astman_append(s, " %d. %s (wait: %ld:%2.2ld, prio: %d)%s", astman_append(s, " %d. %s (wait: %ld:%2.2ld, prio: %d)%s",
pos++, qe->chan->name, (long) (now - qe->start) / 60, pos++, qe->chan->name, (long) (now - qe->start) / 60,
(long) (now - qe->start) % 60, qe->prio, term); (long) (now - qe->start) % 60, qe->prio, term);
else else
ast_cli(fd, " %d. %s (wait: %ld:%2.2ld, prio: %d)%s", pos++, ast_cli(fd, " %d. %s (wait: %ld:%2.2ld, prio: %d)%s", pos++,
qe->chan->name, (long) (now - qe->start) / 60, qe->chan->name, (long) (now - qe->start) / 60,
@ -3951,62 +3951,62 @@ static int manager_queues_status( struct mansession *s, struct message *m )
if (q->callscompleted > 0) if (q->callscompleted > 0)
sl = 100 * ((float) q->callscompletedinsl / (float) q->callscompleted); sl = 100 * ((float) q->callscompletedinsl / (float) q->callscompleted);
astman_append(s, "Event: QueueParams\r\n" astman_append(s, "Event: QueueParams\r\n"
"Queue: %s\r\n" "Queue: %s\r\n"
"Max: %d\r\n" "Max: %d\r\n"
"Calls: %d\r\n" "Calls: %d\r\n"
"Holdtime: %d\r\n" "Holdtime: %d\r\n"
"Completed: %d\r\n" "Completed: %d\r\n"
"Abandoned: %d\r\n" "Abandoned: %d\r\n"
"ServiceLevel: %d\r\n" "ServiceLevel: %d\r\n"
"ServicelevelPerf: %2.1f\r\n" "ServicelevelPerf: %2.1f\r\n"
"Weight: %d\r\n" "Weight: %d\r\n"
"%s" "%s"
"\r\n", "\r\n",
q->name, q->maxlen, q->count, q->holdtime, q->callscompleted, q->name, q->maxlen, q->count, q->holdtime, q->callscompleted,
q->callsabandoned, q->servicelevel, sl, q->weight, idText); q->callsabandoned, q->servicelevel, sl, q->weight, idText);
/* List Queue Members */ /* List Queue Members */
for (mem = q->members; mem; mem = mem->next) { for (mem = q->members; mem; mem = mem->next) {
if (ast_strlen_zero(memberfilter) || !strcmp(mem->interface, memberfilter)) { if (ast_strlen_zero(memberfilter) || !strcmp(mem->interface, memberfilter)) {
astman_append(s, "Event: QueueMember\r\n" astman_append(s, "Event: QueueMember\r\n"
"Queue: %s\r\n" "Queue: %s\r\n"
"Location: %s\r\n" "Location: %s\r\n"
"Membership: %s\r\n" "Membership: %s\r\n"
"Penalty: %d\r\n" "Penalty: %d\r\n"
"CallsTaken: %d\r\n" "CallsTaken: %d\r\n"
"LastCall: %d\r\n" "LastCall: %d\r\n"
"Status: %d\r\n" "Status: %d\r\n"
"Paused: %d\r\n" "Paused: %d\r\n"
"%s" "%s"
"\r\n", "\r\n",
q->name, mem->interface, mem->dynamic ? "dynamic" : "static", q->name, mem->interface, mem->dynamic ? "dynamic" : "static",
mem->penalty, mem->calls, (int)mem->lastcall, mem->status, mem->paused, idText); mem->penalty, mem->calls, (int)mem->lastcall, mem->status, mem->paused, idText);
} }
} }
/* List Queue Entries */ /* List Queue Entries */
pos = 1; pos = 1;
for (qe = q->head; qe; qe = qe->next) { for (qe = q->head; qe; qe = qe->next) {
astman_append(s, "Event: QueueEntry\r\n" astman_append(s, "Event: QueueEntry\r\n"
"Queue: %s\r\n" "Queue: %s\r\n"
"Position: %d\r\n" "Position: %d\r\n"
"Channel: %s\r\n" "Channel: %s\r\n"
"CallerID: %s\r\n" "CallerID: %s\r\n"
"CallerIDName: %s\r\n" "CallerIDName: %s\r\n"
"Wait: %ld\r\n" "Wait: %ld\r\n"
"%s" "%s"
"\r\n", "\r\n",
q->name, pos++, qe->chan->name, q->name, pos++, qe->chan->name,
S_OR(qe->chan->cid.cid_num, "unknown"), S_OR(qe->chan->cid.cid_num, "unknown"),
S_OR(qe->chan->cid.cid_name, "unknown"), S_OR(qe->chan->cid.cid_name, "unknown"),
(long) (now - qe->start), idText); (long) (now - qe->start), idText);
} }
} }
ast_mutex_unlock(&q->lock); ast_mutex_unlock(&q->lock);
} }
astman_append(s, astman_append(s,
"Event: QueueStatusComplete\r\n" "Event: QueueStatusComplete\r\n"
"%s" "%s"
"\r\n",idText); "\r\n",idText);
AST_LIST_UNLOCK(&queues); AST_LIST_UNLOCK(&queues);

Loading…
Cancel
Save