[asterisk-commits] qwell: trunk r74382 - in /trunk: ./ channels/chan_agent.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jul 10 14:07:26 CDT 2007


Author: qwell
Date: Tue Jul 10 14:07:25 2007
New Revision: 74382

URL: http://svn.digium.com/view/asterisk?view=rev&rev=74382
Log:
Merged revisions 74379 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

(closes issue #10169)
................
r74379 | qwell | 2007-07-10 14:06:24 -0500 (Tue, 10 Jul 2007) | 12 lines

Merged revisions 74376 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r74376 | qwell | 2007-07-10 14:03:45 -0500 (Tue, 10 Jul 2007) | 4 lines

Fix an issue with wrapuptime not working when using AgentLogin.

Issue 10169, patch by makoto, with a minor mod by me to not re-break issue 9618

........

................

Modified:
    trunk/   (props changed)
    trunk/channels/chan_agent.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_agent.c?view=diff&rev=74382&r1=74381&r2=74382
==============================================================================
--- trunk/channels/chan_agent.c (original)
+++ trunk/channels/chan_agent.c Tue Jul 10 14:07:25 2007
@@ -794,7 +794,7 @@
 			/* Not dead -- check availability now */
 			ast_mutex_lock(&p->lock);
 			/* Store last disconnect time */
-			p->lastdisc = ast_tvnow();
+			p->lastdisc = ast_tvadd(ast_tvnow(), ast_samp2tv(p->wrapuptime, 1000));
 			ast_mutex_unlock(&p->lock);
 		}
 		/* Release ownership of the agent to other threads (presumably running the login app). */
@@ -814,7 +814,7 @@
 	ast_mutex_lock(&p->lock);
 	res = p->app_sleep_cond;
 	if (p->lastdisc.tv_sec) {
-		if (ast_tvdiff_ms(ast_tvnow(), p->lastdisc) > p->wrapuptime) 
+		if (ast_tvdiff_ms(ast_tvnow(), p->lastdisc) > 0) 
 			res = 1;
 	}
 	ast_mutex_unlock(&p->lock);
@@ -1260,7 +1260,9 @@
 		    ast_strlen_zero(p->loginchan)) {
 			if (p->chan)
 				hasagent++;
-			if (!p->lastdisc.tv_sec) {
+			tv = ast_tvnow();
+			if (!p->lastdisc.tv_sec || (tv.tv_sec >= p->lastdisc.tv_sec)) {
+				p->lastdisc = ast_tv(0, 0);
 				/* Agent must be registered, but not have any active call, and not be in a waiting state */
 				if (!p->owner && p->chan) {
 					/* Fixed agent */
@@ -1910,7 +1912,7 @@
 							AST_LIST_LOCK(&agents);
 							ast_mutex_lock(&p->lock);
 							if (p->lastdisc.tv_sec) {
-								if (ast_tvdiff_ms(ast_tvnow(), p->lastdisc) > p->wrapuptime) {
+								if (ast_tvdiff_ms(ast_tvnow(), p->lastdisc) > 0) {
 									ast_debug(1, "Wrapup time for %s expired!\n", p->agent);
 									p->lastdisc = ast_tv(0, 0);
 									if (p->ackcall > 1)




More information about the asterisk-commits mailing list