Merged revisions 37212 via svnmerge from
authorBJ Weschke <bweschke@btwtech.com>
Fri, 7 Jul 2006 16:16:41 +0000 (16:16 +0000)
committerBJ Weschke <bweschke@btwtech.com>
Fri, 7 Jul 2006 16:16:41 +0000 (16:16 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r37212 | bweschke | 2006-07-06 15:38:45 -0500 (Thu, 06 Jul 2006) | 3 lines

 Don't do wierd things on a callback agent that has attempted logoff while still on the phone.

........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@37301 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_agent.c

index 2e26d7c..1c440f3 100644 (file)
@@ -771,14 +771,16 @@ static int agent_hangup(struct ast_channel *ast)
                        ast_channel_lock(p->chan);
                        ast_softhangup(p->chan, AST_SOFTHANGUP_EXPLICIT);
                        ast_channel_unlock(p->chan);
-               } else {
+               } else if (p->loginstart) {
                        ast_channel_lock(p->chan);
                        ast_moh_start(p->chan, p->moh);
                        ast_channel_unlock(p->chan);
                }
        }
        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_LIST_LOCK(&agents);