diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-11-26 15:01:27 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-11-26 15:01:27 +0000 |
commit | 0b8b0db32ee865d838a32fc59d072c976531fd1e (patch) | |
tree | 482fa25553b3aeea32fe21afdf8895951c01e302 /channels | |
parent | ef241af39726a93ab3b5a2cbcae94a1bed7fab8d (diff) |
Merged revisions 159437 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r159437 | mmichelson | 2008-11-26 08:58:17 -0600 (Wed, 26 Nov 2008) | 10 lines
Don't allow for configuration options to overwrite options
set via channel variables on a reload.
(closes issue #13921)
Reported by: davidw
Patches:
13921.patch uploaded by putnopvut (license 60)
Tested by: davidw
........
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@159439 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_agent.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c index f0d913ff3..9e93d9d08 100644 --- a/channels/chan_agent.c +++ b/channels/chan_agent.c @@ -147,6 +147,12 @@ struct ast_event_sub *agent_devicestate_sub = NULL; #define GETAGENTBYCALLERID "AGENTBYCALLERID" +enum { + AGENT_FLAG_ACKCALL = (1 << 0), + AGENT_FLAG_AUTOLOGOFF = (1 << 1), + AGENT_FLAG_WRAPUPTIME = (1 << 2), +}; + /*! \brief Structure representing an agent. */ struct agent_pvt { ast_mutex_t lock; /*!< Channel private lock */ @@ -174,6 +180,7 @@ struct agent_pvt { char loginchan[80]; /**< channel they logged in from */ char logincallerid[80]; /**< Caller ID they had when they logged in */ struct ast_channel *chan; /**< Channel we use */ + unsigned int flags; /**< Flags show if settings were applied with channel vars */ AST_LIST_ENTRY(agent_pvt) list; /**< Next Agent in the linked list. */ }; @@ -373,12 +380,16 @@ static struct agent_pvt *add_agent(const char *agent, int pending) ast_copy_string(p->password, password ? password : "", sizeof(p->password)); ast_copy_string(p->name, name ? name : "", sizeof(p->name)); ast_copy_string(p->moh, moh, sizeof(p->moh)); - p->ackcall = ackcall; - p->autologoff = autologoff; + if (!ast_test_flag(p, AGENT_FLAG_ACKCALL)) { + p->ackcall = ackcall; + } + if (!ast_test_flag(p, AGENT_FLAG_AUTOLOGOFF)) { + 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) { + if (!ast_test_flag(p, AGENT_FLAG_WRAPUPTIME) && p->wrapuptime > wrapuptime) { struct timeval now = ast_tvnow(); /* XXX check what is this exactly */ @@ -1987,6 +1998,7 @@ static int login_exec(struct ast_channel *chan, void *data) p->ackcall = 0; tmpoptions=pbx_builtin_getvar_helper(chan, "AGENTACKCALL"); ast_verb(3, "Saw variable AGENTACKCALL=%s, setting ackcall to: %d for Agent '%s'.\n",tmpoptions,p->ackcall,p->agent); + ast_set_flag(p, AGENT_FLAG_ACKCALL); } if (!ast_strlen_zero(pbx_builtin_getvar_helper(chan, "AGENTAUTOLOGOFF"))) { p->autologoff = atoi(pbx_builtin_getvar_helper(chan, "AGENTAUTOLOGOFF")); @@ -1994,6 +2006,7 @@ static int login_exec(struct ast_channel *chan, void *data) p->autologoff = 0; tmpoptions=pbx_builtin_getvar_helper(chan, "AGENTAUTOLOGOFF"); ast_verb(3, "Saw variable AGENTAUTOLOGOFF=%s, setting autologff to: %d for Agent '%s'.\n",tmpoptions,p->autologoff,p->agent); + ast_set_flag(p, AGENT_FLAG_AUTOLOGOFF); } if (!ast_strlen_zero(pbx_builtin_getvar_helper(chan, "AGENTWRAPUPTIME"))) { p->wrapuptime = atoi(pbx_builtin_getvar_helper(chan, "AGENTWRAPUPTIME")); @@ -2001,6 +2014,7 @@ static int login_exec(struct ast_channel *chan, void *data) p->wrapuptime = 0; tmpoptions=pbx_builtin_getvar_helper(chan, "AGENTWRAPUPTIME"); ast_verb(3, "Saw variable AGENTWRAPUPTIME=%s, setting wrapuptime to: %d for Agent '%s'.\n",tmpoptions,p->wrapuptime,p->agent); + ast_set_flag(p, AGENT_FLAG_WRAPUPTIME); } ast_channel_unlock(chan); unlock_channel = 0; |