From 70b3ab34a82ebae5fe23580de832088006f847fb Mon Sep 17 00:00:00 2001 From: Mark Spencer Date: Sun, 1 Aug 2004 02:39:32 +0000 Subject: Uhm, that should be 0! git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3556 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_agent.c | 14 +++++++++++++- channels/chan_zap.c | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'channels') diff --git a/channels/chan_agent.c b/channels/chan_agent.c index 6371e0727..8c66015ef 100755 --- a/channels/chan_agent.c +++ b/channels/chan_agent.c @@ -515,6 +515,17 @@ static int agent_hangup(struct ast_channel *ast) 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 @@ static struct ast_channel *agent_request(char *type, int format, void *data) 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 */ diff --git a/channels/chan_zap.c b/channels/chan_zap.c index 88780490b..a5b0f2bb3 100755 --- a/channels/chan_zap.c +++ b/channels/chan_zap.c @@ -1131,6 +1131,7 @@ static int isslavenative(struct zt_pvt *p, struct zt_pvt **out) 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)) -- cgit v1.2.3