[Asterisk-cvs] asterisk/channels chan_agent.c,1.79,1.80 chan_zap.c,1.318,1.319

markster at lists.digium.com markster at lists.digium.com
Sat Jul 31 22:53:30 CDT 2004


Update of /usr/cvsroot/asterisk/channels
In directory localhost.localdomain:/tmp/cvs-serv9707/channels

Modified Files:
	chan_agent.c chan_zap.c 
Log Message:
Uhm, that should be 0!


Index: chan_agent.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_agent.c,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -d -r1.79 -r1.80
--- chan_agent.c	17 Jul 2004 20:58:00 -0000	1.79
+++ chan_agent.c	1 Aug 2004 02:39:32 -0000	1.80
@@ -515,6 +515,17 @@
 	if (p->chan) {
 		/* If they're dead, go ahead and hang up on the agent now */
 		if (!ast_strlen_zero(p->loginchan)) {
+			/* Store last disconnect time */
+			if (p->wrapuptime) {
+				gettimeofday(&p->lastdisc, NULL);
+				p->lastdisc.tv_usec += (p->wrapuptime % 1000) * 1000;
+				if (p->lastdisc.tv_usec >= 1000000) {
+					p->lastdisc.tv_usec -= 1000000;
+					p->lastdisc.tv_sec++;
+				}
+				p->lastdisc.tv_sec += (p->wrapuptime / 1000);
+			} else
+				memset(&p->lastdisc, 0, sizeof(p->lastdisc));
 			if (p->chan) {
 				/* Recognize the hangup and pass it along immediately */
 				ast_hangup(p->chan);
@@ -1023,7 +1034,8 @@
 			if (!p->pending && ((groupmatch && (p->group & groupmatch)) || !strcmp(data, p->agent))) {
 				if (p->chan || !ast_strlen_zero(p->loginchan))
 					hasagent++;
-				if (!p->lastdisc.tv_sec) {
+				if (!p->lastdisc.tv_sec || (time(NULL) > p->lastdisc.tv_sec)) {
+					memset(&p->lastdisc, 0, sizeof(p->lastdisc));
 					/* Agent must be registered, but not have any active call, and not be in a waiting state */
 					if (!p->owner && p->chan) {
 						/* Could still get a fixed agent */

Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.318
retrieving revision 1.319
diff -u -d -r1.318 -r1.319
--- chan_zap.c	31 Jul 2004 20:43:24 -0000	1.318
+++ chan_zap.c	1 Aug 2004 02:39:32 -0000	1.319
@@ -1131,6 +1131,7 @@
 static int reset_conf(struct zt_pvt *p)
 {
 	ZT_CONFINFO zi;
+	memset(&zi, 0, sizeof(zi));
 	p->confno = -1;
 	if (p->subs[SUB_REAL].zfd > -1) {
 		if (ioctl(p->subs[SUB_REAL].zfd, ZT_SETCONF, &zi))




More information about the svn-commits mailing list