[svn-commits] file: branch 1.2 r55669 - /branches/1.2/channels/chan_agent.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Tue Feb 20 15:39:15 MST 2007


Author: file
Date: Tue Feb 20 16:39:14 2007
New Revision: 55669

URL: http://svn.digium.com/view/asterisk?view=rev&rev=55669
Log:
Defer clearing callback information if channels are up until they are hung up. This ensures the hangup process goes smoothly and no channels get hung in limbo. (issue #8088 reported by kebl0155)

Modified:
    branches/1.2/channels/chan_agent.c

Modified: branches/1.2/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/chan_agent.c?view=diff&rev=55669&r1=55668&r2=55669
==============================================================================
--- branches/1.2/channels/chan_agent.c (original)
+++ branches/1.2/channels/chan_agent.c Tue Feb 20 16:39:14 2007
@@ -790,6 +790,9 @@
 				p->logincallerid[0] = '\0';
 				if (persistent_agents)
 					dump_agents();
+			} else if (!p->loginstart) {
+				p->loginchan[0] = '\0';
+				p->logincallerid[0] = '\0';
 			}
 		} else if (p->dead) {
 			ast_mutex_lock(&p->chan->lock);
@@ -1473,14 +1476,17 @@
 	struct agent_pvt *p;
 	long logintime;
 	int ret = -1; /* Return -1 if no agent if found */
+	int defer = 0;
 
 	for (p=agents; p; p=p->next) {
 		if (!strcasecmp(p->agent, agent)) {
 			if (!soft) {
 				if (p->owner) {
+					defer = 1;
 					ast_softhangup(p->owner, AST_SOFTHANGUP_EXPLICIT);
 				}
 				if (p->chan) {
+					defer = 1;
 					ast_softhangup(p->chan, AST_SOFTHANGUP_EXPLICIT);
 				}
 			}
@@ -1495,8 +1501,10 @@
 				      p->agent, p->loginchan, logintime);
 			ast_queue_log("NONE", "NONE", agent, "AGENTCALLBACKLOGOFF", "%s|%ld|%s", p->loginchan, logintime, "CommandLogoff");
 			set_agentbycallerid(p->logincallerid, NULL);
-			p->loginchan[0] = '\0';
-			p->logincallerid[0] = '\0';
+			if (!defer) {
+				p->loginchan[0] = '\0';
+				p->logincallerid[0] = '\0';
+			}
 			ast_device_state_changed("Agent/%s", p->agent);
 			if (persistent_agents)
 				dump_agents();



More information about the svn-commits mailing list