diff options
author | mattf <mattf@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-04-06 16:06:05 +0000 |
---|---|---|
committer | mattf <mattf@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-04-06 16:06:05 +0000 |
commit | 90b4a22fa766b5104b0cc39c8d2ebd4618917bbc (patch) | |
tree | 06e9a87ce5e6b3813bb335921614e18ebd00a0ff /channels/chan_agent.c | |
parent | ce84c9b17d473d7745efa4d3f6ebf4319fb59c71 (diff) |
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.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5423 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_agent.c')
-rwxr-xr-x | channels/chan_agent.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c index 1ef0ec7c4..89fc396e4 100755 --- a/channels/chan_agent.c +++ b/channels/chan_agent.c @@ -294,7 +294,21 @@ static struct agent_pvt *add_agent(char *agent, int pending) 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 @@ static int __login_exec(struct ast_channel *chan, void *data, int callbackmode) 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)); } |