[asterisk-commits] anthonyl: branch anthonyl/patch-branch r45833 -
/team/anthonyl/patch-branch/a...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sat Oct 21 12:17:39 MST 2006
Author: anthonyl
Date: Sat Oct 21 14:17:38 2006
New Revision: 45833
URL: http://svn.digium.com/view/asterisk?rev=45833&view=rev
Log:
6910 partial commit: fixing this one up myself
Modified:
team/anthonyl/patch-branch/apps/app_queue.c
Modified: team/anthonyl/patch-branch/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/anthonyl/patch-branch/apps/app_queue.c?rev=45833&r1=45832&r2=45833&view=diff
==============================================================================
--- team/anthonyl/patch-branch/apps/app_queue.c (original)
+++ team/anthonyl/patch-branch/apps/app_queue.c Sat Oct 21 14:17:38 2006
@@ -165,6 +165,7 @@
"then it will then jump to this priority. Otherwise it will return an error\n"
"The option string may contain zero or more of the following characters:\n"
" 'j' -- jump to +101 priority when appropriate.\n"
+" 'A(agentnum)' -- set agentnum.\n"
" This application sets the following channel variable upon completion:\n"
" AQMSTATUS The status of the attempt to add a queue member as a \n"
" text string, one of\n"
@@ -610,6 +611,7 @@
if ((cur = ast_calloc(1, sizeof(*cur)))) {
cur->penalty = penalty;
+ cur->agentnum = agentnum;
cur->paused = paused;
ast_copy_string(cur->interface, interface, sizeof(cur->interface));
ast_copy_string(cur->membername, membername, sizeof(cur->membername));
@@ -642,6 +644,7 @@
q->maxlen = 0;
q->announcefrequency = 0;
q->announceholdtime = 0;
+ q->announceagentnum = 0;
q->roundingseconds = 0; /* Default - don't announce seconds */
q->servicelevel = 0;
q->ringinuse = 1;
@@ -654,6 +657,8 @@
q->monfmt[0] = '\0';
q->periodicannouncefrequency = 0;
ast_copy_string(q->sound_next, "queue-youarenext", sizeof(q->sound_next));
+ ast_copy_string(q->sound_announceagentnum1, "announceagentnum1", sizeof(q->sound_announceagentnum1));
+ ast_copy_string(q->sound_announceagentnum2, "announceagentnum2", sizeof(q->sound_announceagentnum2));
ast_copy_string(q->sound_thereare, "queue-thereare", sizeof(q->sound_thereare));
ast_copy_string(q->sound_calls, "queue-callswaiting", sizeof(q->sound_calls));
ast_copy_string(q->sound_holdtime, "queue-holdtime", sizeof(q->sound_holdtime));
@@ -776,6 +781,8 @@
ast_copy_string(q->moh, val, sizeof(q->moh));
} else if (!strcasecmp(param, "announce")) {
ast_copy_string(q->announce, val, sizeof(q->announce));
+ } else if(! strcasecmp(param, "announceagentnum")) {
+ q->announceagentnum = ast_true(val);
} else if (!strcasecmp(param, "context")) {
ast_copy_string(q->context, val, sizeof(q->context));
} else if (!strcasecmp(param, "timeout")) {
@@ -850,6 +857,10 @@
}
} else if (!strcasecmp(param, "periodic-announce-frequency")) {
q->periodicannouncefrequency = atoi(val);
+ } else if(! strcasecmp(param, "announceagentnum1")) {
+ ast_copy_string(q->sound_announceagentnum1, val, sizeof(q->sound_announceagentnum1));
+ } else if(! strcasecmp(param, "announceagentnum2")) {
+ ast_copy_string(q->sound_announceagentnum2, val, sizeof(q->sound_announceagentnum2));
} else if (!strcasecmp(param, "retry")) {
q->retry = atoi(val);
if (q->retry <= 0)
@@ -950,6 +961,7 @@
} else {
m->dead = 0; /* Do not delete this one. */
m->penalty = penalty;
+ m->agentnum = agentnum;
}
}
@@ -2420,6 +2432,47 @@
member = lpeer->member;
hangupcalls(outgoing, peer);
outgoing = NULL;
+ if (qe->parent->announceagentnum && member->agentnum) { //Announce agentnum here
+ int res2;
+ res2 = ast_autoservice_start(peer);
+ if(!res2) {
+ ast_log(LOG_DEBUG, "Announce agentnum %d", member->agentnum);
+ /* Stop music on hold */
+ ast_moh_stop(qe->chan);
+ if(!play_file(qe->chan, qe->parent->sound_announceagentnum1)) {
+ ast_say_digits(qe->chan, member->agentnum, AST_DIGIT_ANY, qe->chan->language);
+ play_file(qe->chan, qe->parent->sound_announceagentnum2);
+ } else
+ ast_log(LOG_WARNING, "Agentnum announcement file '%s' is unavailable, continuing anyway...\n",
+ qe->parent->sound_announceagentnum1);
+ // restart moh
+ ast_moh_start(qe->chan, qe->moh);
+ }
+ res2 |= ast_autoservice_stop(peer);
+ if (qe->chan->_softhangup) {
+ /* Caller must have hung up just before being connected*/
+ ast_log(LOG_NOTICE, "Caller was about to talk to agent on %s but the caller hungup.\n", peer->name);
+ ast_queue_log(queuename, qe->chan->uniqueid, peer->name, "ABANDON", "%d|%d|%ld", qe->pos, qe->opos, (long)time(NULL) - qe->start);
+ record_abandoned(qe);
+ ast_hangup(peer);
+ return -1;
+ } else if (res2) {
+ /* Agent must have hung up */
+ ast_log(LOG_WARNING, "Agent on %s hungup on the customer. They're going to be pissed.\n", peer->name);
+ ast_queue_log(queuename, qe->chan->uniqueid, peer->name, "AGENTDUMP", "%s", "");
+ record_abandoned(qe);
+ if (qe->parent->eventwhencalled) {
+ manager_event(EVENT_FLAG_AGENT, "AgentDump",
+ "Queue: %s\r\n"
+ "Uniqueid: %s\r\n"
+ "Channel: %s\r\n"
+ "Member: %s\r\n",
+ queuename, qe->chan->uniqueid, peer->name, member->interface);
+ }
+ ast_hangup(peer);
+ goto out;
+ }
+ }
if (announce || qe->parent->reportholdtime || qe->parent->memberdelay) {
int res2;
@@ -2477,6 +2530,7 @@
}
/* Stop music on hold */
ast_moh_stop(qe->chan);
+
/* If appropriate, log that we have a destination channel */
if (qe->chan->cdr)
ast_cdr_setdestchan(qe->chan->cdr, peer->name);
@@ -2891,6 +2945,8 @@
char *membername;
char *penalty_tok;
int penalty = 0;
+ char *agentnum_tok;
+ int agentnum = 0;
char *paused_tok;
int paused = 0;
struct ast_db_entry *db_tree;
@@ -2931,6 +2987,7 @@
interface = strsep(&member, ";");
penalty_tok = strsep(&member, ";");
+ agentnum_tok = strsep(&member, ";");
paused_tok = strsep(&member, ";");
membername = strsep(&member, ";");
@@ -2941,6 +2998,15 @@
penalty = strtol(penalty_tok, NULL, 10);
if (errno == ERANGE) {
ast_log(LOG_WARNING, "Error converting penalty: %s: Out of range.\n", penalty_tok);
+ break;
+ }
+ if (!agentnum_tok) {
+ ast_log(LOG_WARNING, "Error parsing persisent member string for '%s' (agentnum)\n", queue_name);
+ break;
+ }
+ agentnum = strtol(agentnum_tok, NULL, 10);
+ if (errno == ERANGE) {
+ ast_log(LOG_WARNING, "Error converting agentnum: %s: Out of range.\n", agentnum_tok);
break;
}
@@ -3156,6 +3222,8 @@
AST_APP_ARG(membername);
);
int penalty = 0;
+ int agentnum = 0;
+ char *agentnum_str = 0;
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "AddQueueMember requires an argument (queuename[|[interface]|[penalty][|options][|membername]])\n");
@@ -3930,6 +3998,8 @@
max_left = sizeof(max_buf);
if (mem->penalty)
ast_build_string(&max, &max_left, " with penalty %d", mem->penalty);
+ if(mem->agentnum)
+ ast_build_string(&max, &max_left, " with agentnum %d", mem->agentnum);
if (mem->dynamic)
ast_build_string(&max, &max_left, " (dynamic)");
if (mem->paused)
@@ -4131,6 +4201,7 @@
"Location: %s\r\n"
"Membership: %s\r\n"
"Penalty: %d\r\n"
+ "Agentnum: %d\r\n"
"CallsTaken: %d\r\n"
"LastCall: %d\r\n"
"Status: %d\r\n"
More information about the asterisk-commits
mailing list