aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_agent.c
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-11-26 14:58:17 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-11-26 14:58:17 +0000
commitafe8f24ea978685fc7529c6f64497bc5e09af08f (patch)
tree7107809b91cb2775a6a1c2453bbcedf06e34f456 /channels/chan_agent.c
parentcda2e69d9aeb4a1ba009f4683803158a15320537 (diff)
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/trunk@159437 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_agent.c')
-rw-r--r--channels/chan_agent.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index 6f34e39b7..6c3b838c0 100644
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -225,6 +225,14 @@ 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),
+ AGENT_FLAG_ACCEPTDTMF = (1 << 3),
+ AGENT_FLAG_ENDDTMF = (1 << 4),
+};
+
/*! \brief Structure representing an agent. */
struct agent_pvt {
ast_mutex_t lock; /*!< Channel private lock */
@@ -254,6 +262,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. */
};
@@ -453,14 +462,22 @@ 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;
- p->acceptdtmf = acceptdtmf;
- p->enddtmf = enddtmf;
+ if (!ast_test_flag(p, AGENT_FLAG_ACKCALL)) {
+ p->ackcall = ackcall;
+ }
+ if (!ast_test_flag(p, AGENT_FLAG_AUTOLOGOFF)) {
+ p->autologoff = autologoff;
+ }
+ if (!ast_test_flag(p, AGENT_FLAG_ACCEPTDTMF)) {
+ p->acceptdtmf = acceptdtmf;
+ }
+ if (!ast_test_flag(p, AGENT_FLAG_ENDDTMF)) {
+ p->enddtmf = enddtmf;
+ }
/* 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 */
@@ -2093,6 +2110,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);
} else {
p->ackcall = ackcall;
}
@@ -2102,6 +2120,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);
} else {
p->autologoff = autologoff;
}
@@ -2111,6 +2130,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);
} else {
p->wrapuptime = wrapuptime;
}
@@ -2118,11 +2138,13 @@ static int login_exec(struct ast_channel *chan, void *data)
if (!ast_strlen_zero(tmpoptions)) {
p->acceptdtmf = *tmpoptions;
ast_verb(3, "Saw variable AGENTACCEPTDTMF=%s, setting acceptdtmf to: %c for Agent '%s'.\n", tmpoptions, p->acceptdtmf, p->agent);
+ ast_set_flag(p, AGENT_FLAG_ACCEPTDTMF);
}
tmpoptions = pbx_builtin_getvar_helper(chan, "AGENTENDDTMF");
if (!ast_strlen_zero(tmpoptions)) {
p->enddtmf = *tmpoptions;
ast_verb(3, "Saw variable AGENTENDDTMF=%s, setting enddtmf to: %c for Agent '%s'.\n", tmpoptions, p->enddtmf, p->agent);
+ ast_set_flag(p, AGENT_FLAG_ENDDTMF);
}
ast_channel_unlock(chan);
unlock_channel = 0;