[Asterisk-cvs] asterisk/channels chan_agent.c,1.129,1.130

mattf at lists.digium.com mattf at lists.digium.com
Wed Apr 6 11:13:26 CDT 2005


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv15421/channels

Modified Files:
	chan_agent.c 
Log Message:
If an agent still has "wrapuptime" left after he finishes a call and the
wrapuptime is changed on a reload, he still waits his former wrapuptime (instead of
the new wrapuptime).  This reduces his "de facto" wrapuptime immediately to
the new value even if he has wrapuptime remaining from a previous call.


Index: chan_agent.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_agent.c,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -d -r1.129 -r1.130
--- chan_agent.c	5 Apr 2005 21:30:24 -0000	1.129
+++ chan_agent.c	6 Apr 2005 16:06:05 -0000	1.130
@@ -294,7 +294,21 @@
 	strncpy(p->moh, moh, sizeof(p->moh) - 1);
 	p->ackcall = ackcall;
 	p->autologoff = autologoff;
+
+	/* If someone reduces the wrapuptime and reloads, we want it
+	 * to change the wrapuptime immediately on all calls */
+	if (p->wrapuptime > wrapuptime) {
+		struct timeval now;
+		gettimeofday(&now, NULL);
+
+		/* We won't be pedantic and check the tv_usec val */
+		if (p->lastdisc.tv_sec > (now.tv_sec + wrapuptime/1000)) {
+			p->lastdisc.tv_sec = now.tv_sec + wrapuptime/1000;
+			p->lastdisc.tv_usec = now.tv_usec;
+		}
+	}
 	p->wrapuptime = wrapuptime;
+
 	if (pending)
 		p->dead = 1;
 	else
@@ -1724,7 +1738,7 @@
 								ast_log(LOG_WARNING, "Unable to set read format to %d\n", ast_best_codec(chan->nativeformats));
 						}
 						if (!res) {
-							ast_set_write_format(chan, ast_best_codec(chan->nativeformats));
+							res = ast_set_write_format(chan, ast_best_codec(chan->nativeformats));
 							if (res)
 								ast_log(LOG_WARNING, "Unable to set write format to %d\n", ast_best_codec(chan->nativeformats));
 						}




More information about the svn-commits mailing list