[asterisk-commits] mmichelson: branch 1.4 r74998 - /branches/1.4/channels/chan_agent.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 12 18:00:32 CDT 2007


Author: mmichelson
Date: Thu Jul 12 18:00:32 2007
New Revision: 74998

URL: http://svn.digium.com/view/asterisk?view=rev&rev=74998
Log:
Change to my previous fix regarding agent logoff soft. Now uses deferlogoff instead of loginstart
since loginstart is used after logoff. Thanks to makoto for pointing this out and suggesting the fix.

(closes issue #10178, reported and patched by makoto, with modification by me)


Modified:
    branches/1.4/channels/chan_agent.c

Modified: branches/1.4/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_agent.c?view=diff&rev=74998&r1=74997&r2=74998
==============================================================================
--- branches/1.4/channels/chan_agent.c (original)
+++ branches/1.4/channels/chan_agent.c Thu Jul 12 18:00:32 2007
@@ -1528,18 +1528,18 @@
 		if (!strcasecmp(p->agent, agent)) {
 			ret = 0;
 			if (p->owner || p->chan) {
-				p->deferlogoff = 1;
 				if (!soft) {
 					if (p->owner)
 						ast_softhangup(p->owner, AST_SOFTHANGUP_EXPLICIT);
 					if (p->chan)
 						ast_softhangup(p->chan, AST_SOFTHANGUP_EXPLICIT);
-				}
+				} else
+					p->deferlogoff = 1;
 			} else {
 				logintime = time(NULL) - p->loginstart;
+				p->loginstart = 0;
 				agent_logoff_maintenance(p, p->loginchan, logintime, NULL, "CommandLogoff");
 			}
-			p->loginstart = 0;
 			break;
 		}
 	}
@@ -2071,8 +2071,10 @@
 						ast_device_state_changed("Agent/%s", p->agent);
 						while (res >= 0) {
 							ast_mutex_lock(&p->lock);
-							if (!p->loginstart && p->chan)
+							if (p->deferlogoff && p->chan) {
 								ast_softhangup(p->chan, AST_SOFTHANGUP_EXPLICIT);
+								p->deferlogoff = 0;
+							}
 							if (p->chan != chan)
 								res = -1;
 							ast_mutex_unlock(&p->lock);




More information about the asterisk-commits mailing list