Index: channels/chan_agent.c =================================================================== RCS file: /usr/cvsroot/asterisk/channels/chan_agent.c,v retrieving revision 1.72 diff -u -r1.72 chan_agent.c --- channels/chan_agent.c 9 May 2004 07:51:44 -0000 1.72 +++ channels/chan_agent.c 10 May 2004 17:54:16 -0000 @@ -518,8 +518,16 @@ } ast_log(LOG_DEBUG, "Hungup, howlong is %d, autologoff is %d\n", howlong, p->autologoff); if (howlong && p->autologoff && (howlong > p->autologoff)) { + char agent[AST_MAX_AGENT] = ""; ast_log(LOG_NOTICE, "Agent '%s' didn't answer/confirm within %d seconds (waited %d)\n", p->name, p->autologoff, howlong); strcpy(p->loginchan, ""); + manager_event(EVENT_FLAG_AGENT, "Agentcallbacklogoff", + "Agent: %s\r\n" + "Autologoff: %d\r\n" + "Uniqueid: %s\r\n", + p->agent, p->autologoff, ast->uniqueid); + snprintf(agent, sizeof(agent), "Agent/%s", p->agent); + ast_queue_log("NONE", ast->uniqueid, agent, "AGENTCALLBACKLOGOFF", "%s", "Autologoff"); } } else if (p->dead) { ast_mutex_lock(&p->chan->lock); @@ -1196,9 +1204,10 @@ if (!strcmp(p->agent, user) && !strcmp(p->password, pass) && !p->pending) { if (!p->chan) { + snprintf(agent, sizeof(agent), "Agent/%s", p->agent); + char tmpchan[AST_MAX_BUF] = ""; + int pos = 0; if (callbackmode) { - char tmpchan[AST_MAX_BUF] = ""; - int pos = 0; /* Retrieve login chan */ for (;;) { if (exten) { @@ -1279,6 +1288,21 @@ res = -1; if (callbackmode && !res) { /* Just say goodbye and be done with it */ + if (!ast_strlen_zero(p->loginchan)) { + manager_event(EVENT_FLAG_AGENT, "Agentcallbacklogin", + "Agent: %s\r\n" + "Extension: %s\r\n" + "Context: %s\r\n" + "Uniqueid: %s\r\n", + p->agent, tmpchan, ast_strlen_zero(context) ? "default" : context, chan->uniqueid); + ast_queue_log("NONE", chan->uniqueid, agent, "AGENTCALLBACKLOGIN", "%s", p->loginchan); + } else { + manager_event(EVENT_FLAG_AGENT, "Agentcallbacklogoff", + "Agent: %s\r\n" + "Uniqueid: %s\r\n", + p->agent, chan->uniqueid); + ast_queue_log("NONE", chan->uniqueid, agent, "AGENTCALLBACKLOGOFF", "%s", ""); + } ast_mutex_unlock(&agentlock); if (!res) res = ast_safe_sleep(chan, 500); @@ -1297,10 +1321,10 @@ ast_moh_start(chan, p->moh); manager_event(EVENT_FLAG_AGENT, "Agentlogin", "Agent: %s\r\n" - "Channel: %s\r\n", - p->agent, chan->name); + "Channel: %s\r\n" + "Uniqueid: %s\r\n", + p->agent, chan->name, chan->uniqueid); time(&start); - snprintf(agent, sizeof(agent), "Agent/%s", p->agent); if (updatecdr && chan->cdr) snprintf(chan->cdr->channel, sizeof(chan->cdr->channel), "Agent/%s", p->agent); ast_queue_log("NONE", chan->uniqueid, agent, "AGENTLOGIN", "%s", chan->name); @@ -1375,8 +1399,9 @@ ast_verbose(VERBOSE_PREFIX_3 "Agent '%s' logged out\n", p->agent); ast_queue_log("NONE", chan->uniqueid, agent, "AGENTLOGOFF", "%s|%ld", chan->name, (long)(time(NULL) - start)); manager_event(EVENT_FLAG_AGENT, "Agentlogoff", - "Agent: %s\r\n", - p->agent); + "Agent: %s\r\n" + "Uniqueid: %s\r\n", + p->agent, chan->uniqueid); /* If there is no owner, go ahead and kill it now */ if (p->dead && !p->owner) free(p);