aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--channels/chan_agent.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index e41ee0994..65a8fbef4 100644
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -795,14 +795,16 @@ static int agent_hangup(struct ast_channel *ast)
ast_mutex_lock(&p->chan->lock);
ast_softhangup(p->chan, AST_SOFTHANGUP_EXPLICIT);
ast_mutex_unlock(&p->chan->lock);
- } else {
+ } else if (p->loginstart) {
ast_mutex_lock(&p->chan->lock);
ast_moh_start(p->chan, p->moh);
ast_mutex_unlock(&p->chan->lock);
}
}
ast_mutex_unlock(&p->lock);
- ast_device_state_changed("Agent/%s", p->agent);
+ /* Only register a device state change if the agent is still logged in */
+ if (p->loginstart)
+ ast_device_state_changed("Agent/%s", p->agent);
if (p->pending) {
ast_mutex_lock(&agentlock);