mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-15 06:18:38 +00:00
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: https://origsvn.digium.com/svn/asterisk/branches/1.6.1@159438 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -152,6 +152,14 @@ struct ast_event_sub *agent_devicestate_sub = NULL;
|
|||||||
|
|
||||||
#define GETAGENTBYCALLERID "AGENTBYCALLERID"
|
#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. */
|
/*! \brief Structure representing an agent. */
|
||||||
struct agent_pvt {
|
struct agent_pvt {
|
||||||
ast_mutex_t lock; /*!< Channel private lock */
|
ast_mutex_t lock; /*!< Channel private lock */
|
||||||
@@ -181,6 +189,7 @@ struct agent_pvt {
|
|||||||
char loginchan[80]; /**< channel they logged in from */
|
char loginchan[80]; /**< channel they logged in from */
|
||||||
char logincallerid[80]; /**< Caller ID they had when they logged in */
|
char logincallerid[80]; /**< Caller ID they had when they logged in */
|
||||||
struct ast_channel *chan; /**< Channel we use */
|
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. */
|
AST_LIST_ENTRY(agent_pvt) list; /**< Next Agent in the linked list. */
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -380,14 +389,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->password, password ? password : "", sizeof(p->password));
|
||||||
ast_copy_string(p->name, name ? name : "", sizeof(p->name));
|
ast_copy_string(p->name, name ? name : "", sizeof(p->name));
|
||||||
ast_copy_string(p->moh, moh, sizeof(p->moh));
|
ast_copy_string(p->moh, moh, sizeof(p->moh));
|
||||||
|
if (!ast_test_flag(p, AGENT_FLAG_ACKCALL)) {
|
||||||
p->ackcall = ackcall;
|
p->ackcall = ackcall;
|
||||||
|
}
|
||||||
|
if (!ast_test_flag(p, AGENT_FLAG_AUTOLOGOFF)) {
|
||||||
p->autologoff = autologoff;
|
p->autologoff = autologoff;
|
||||||
|
}
|
||||||
|
if (!ast_test_flag(p, AGENT_FLAG_ACCEPTDTMF)) {
|
||||||
p->acceptdtmf = acceptdtmf;
|
p->acceptdtmf = acceptdtmf;
|
||||||
|
}
|
||||||
|
if (!ast_test_flag(p, AGENT_FLAG_ENDDTMF)) {
|
||||||
p->enddtmf = enddtmf;
|
p->enddtmf = enddtmf;
|
||||||
|
}
|
||||||
|
|
||||||
/* If someone reduces the wrapuptime and reloads, we want it
|
/* If someone reduces the wrapuptime and reloads, we want it
|
||||||
* to change the wrapuptime immediately on all calls */
|
* 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();
|
struct timeval now = ast_tvnow();
|
||||||
/* XXX check what is this exactly */
|
/* XXX check what is this exactly */
|
||||||
|
|
||||||
@@ -2007,6 +2024,7 @@ static int login_exec(struct ast_channel *chan, void *data)
|
|||||||
p->ackcall = 0;
|
p->ackcall = 0;
|
||||||
tmpoptions=pbx_builtin_getvar_helper(chan, "AGENTACKCALL");
|
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_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 {
|
} else {
|
||||||
p->ackcall = ackcall;
|
p->ackcall = ackcall;
|
||||||
}
|
}
|
||||||
@@ -2016,6 +2034,7 @@ static int login_exec(struct ast_channel *chan, void *data)
|
|||||||
p->autologoff = 0;
|
p->autologoff = 0;
|
||||||
tmpoptions=pbx_builtin_getvar_helper(chan, "AGENTAUTOLOGOFF");
|
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_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 {
|
} else {
|
||||||
p->autologoff = autologoff;
|
p->autologoff = autologoff;
|
||||||
}
|
}
|
||||||
@@ -2025,6 +2044,7 @@ static int login_exec(struct ast_channel *chan, void *data)
|
|||||||
p->wrapuptime = 0;
|
p->wrapuptime = 0;
|
||||||
tmpoptions=pbx_builtin_getvar_helper(chan, "AGENTWRAPUPTIME");
|
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_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 {
|
} else {
|
||||||
p->wrapuptime = wrapuptime;
|
p->wrapuptime = wrapuptime;
|
||||||
}
|
}
|
||||||
@@ -2032,11 +2052,13 @@ static int login_exec(struct ast_channel *chan, void *data)
|
|||||||
if (!ast_strlen_zero(tmpoptions)) {
|
if (!ast_strlen_zero(tmpoptions)) {
|
||||||
p->acceptdtmf = *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_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");
|
tmpoptions = pbx_builtin_getvar_helper(chan, "AGENTENDDTMF");
|
||||||
if (!ast_strlen_zero(tmpoptions)) {
|
if (!ast_strlen_zero(tmpoptions)) {
|
||||||
p->enddtmf = *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_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);
|
ast_channel_unlock(chan);
|
||||||
unlock_channel = 0;
|
unlock_channel = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user