[Asterisk-cvs] asterisk/channels chan_agent.c,1.80,1.81
markster at lists.digium.com
markster at lists.digium.com
Wed Aug 11 15:16:51 CDT 2004
Update of /usr/cvsroot/asterisk/channels
In directory localhost.localdomain:/tmp/cvs-serv5978/channels
Modified Files:
chan_agent.c
Log Message:
Fix agentcallbacklogin wrapup time
Index: chan_agent.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_agent.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -d -r1.80 -r1.81
--- chan_agent.c 1 Aug 2004 02:39:32 -0000 1.80
+++ chan_agent.c 11 Aug 2004 19:02:46 -0000 1.81
@@ -1,11 +1,11 @@
/*
* Asterisk -- A telephony toolkit for Linux.
*
- * Implementation of Session Initiation Protocol
+ * Implementation of Agents
*
- * Copyright (C) 1999, Mark Spencer
+ * Copyright (C) 1999-2004, Digium Inc.
*
- * Mark Spencer <markster at linux-support.net>
+ * Mark Spencer <markster at digium.com>
*
* This program is free software, distributed under the terms of
* the GNU General Public License
@@ -323,8 +323,18 @@
if (p->chan) {
/* Note that we don't hangup if it's not a callback because Asterisk will do it
for us when the PBX instance that called login finishes */
- if (!ast_strlen_zero(p->loginchan))
+ if (!ast_strlen_zero(p->loginchan)) {
ast_hangup(p->chan);
+ 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);
+ }
+ }
p->chan = NULL;
p->acknowledged = 0;
}
@@ -993,6 +1003,7 @@
unsigned int groupmatch;
int waitforagent=0;
int hasagent = 0;
+ struct timeval tv;
s = data;
if ((s[0] == '@') && (sscanf(s + 1, "%d", &groupmatch) == 1)) {
groupmatch = (1 << groupmatch);
@@ -1034,7 +1045,11 @@
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 || (time(NULL) > p->lastdisc.tv_sec)) {
+ gettimeofday(&tv, NULL);
+#if 0
+ ast_log(LOG_NOTICE, "Time now: %ld, Time of lastdisc: %ld\n", tv.tv_sec, p->lastdisc.tv_sec);
+#endif
+ if (!p->lastdisc.tv_sec || (tv.tv_sec > 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) {
More information about the svn-commits
mailing list