aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authorqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-10 19:06:24 +0000
committerqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-10 19:06:24 +0000
commit78c20a03eff65725094986b38e741bd405309274 (patch)
tree8b4305f5bbf5cc1a63cade1dd828593ddad21d0f /channels
parent2652eec7f411f51c0aa5956bfe4cb599d58df2fb (diff)
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 ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@74379 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_agent.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index ec5805fff..15a096cd3 100644
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -821,7 +821,7 @@ static int agent_hangup(struct ast_channel *ast)
/* 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). */
@@ -841,7 +841,7 @@ static int agent_cont_sleep( void *data )
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);
@@ -1323,7 +1323,9 @@ static struct ast_channel *agent_request(const char *type, int format, void *dat
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 */
@@ -2080,7 +2082,7 @@ static int __login_exec(struct ast_channel *chan, void *data, int callbackmode)
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) {
if (option_debug)
ast_log(LOG_DEBUG, "Wrapup time for %s expired!\n", p->agent);
p->lastdisc = ast_tv(0, 0);