+                               status = pbx_builtin_getvar_helper(p->chan, 
"CHANLOCALSTATUS");
+                               if (autologoffunavail && status && !strcasecmp(status, 
"CHANUNAVAIL")) {
+                                       char agent[AST_MAX_AGENT] = "";
+                                       long logintime = time(NULL) - 
p->loginstart;
+                                       p->loginstart = 0;
+                                       ast_log(LOG_NOTICE, "Agent read: '%s' is not 
available now, auto logoff\n", p->name);
+                                       manager_event(EVENT_FLAG_AGENT, 
"Agentcallbacklogoff",
+                                                     "Agent: %s\r\n"
+                                                     "Loginchan: %s\r\n"
+                                                     "Logintime: %ld\r\n"
+                                                     "Reason: Chanunavail\r\n"
+                                                     "Uniqueid: %s\r\n",
+                                                     p->agent, p->loginchan, 
logintime, ast->uniqueid);
+                                       snprintf(agent, sizeof(agent), "Agent/%s", 
p->agent);
+                                       ast_queue_log("NONE", ast->uniqueid, agent, 
"AGENTCALLBACKLOGOFF", "%s|%ld|%s", p->loginchan, logintime, "Chanunavail");
+                                       set_agentbycallerid(p->logincallerid, 
NULL);
+                                       p->loginchan[0] = '\0';
+                                       p->logincallerid[0] = '\0';
+                               }

First, this patch adds two more copies of the identical callback-logoff code. This is very clearly the wrong thing to do. There are now at least 5 or 6 places in the code that construct and send the identical manager event, the log entry, and other bits.

Second, it does _not_ include the recent changes to the callback-autologoff code to send a device state update and to dump agent persistence information if it is enabled.

In summary, this commit should _not_ have been made in this form. I will not go back into the bug to see who reviewed and approved it; you should know who you are.
_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Dev mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-dev

Reply via email to