Merged revisions 74722 via svnmerge from
authorMark Michelson <mmichelson@digium.com>
Wed, 11 Jul 2007 21:15:47 +0000 (21:15 +0000)
committerMark Michelson <mmichelson@digium.com>
Wed, 11 Jul 2007 21:15:47 +0000 (21:15 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r74722 | mmichelson | 2007-07-11 16:14:09 -0500 (Wed, 11 Jul 2007) | 13 lines

Merged revisions 74719 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r74719 | mmichelson | 2007-07-11 16:12:30 -0500 (Wed, 11 Jul 2007) | 5 lines

The cli command "agent logoff Agent/x soft" did not work...at all. Now it does.

(closes issue #10178, reported and patched by makoto, with slight modification for 1.4 and trunk by me)

........

................

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

channels/chan_agent.c

index 3a5def1..2970735 100644 (file)
@@ -1474,9 +1474,9 @@ static int agent_logoff(const char *agent, int soft)
                                }
                        } else {
                                logintime = time(NULL) - p->loginstart;
-                               p->loginstart = 0;
                                agent_logoff_maintenance(p, p->loginchan, logintime, NULL, "CommandLogoff");
                        }
+                       p->loginstart = 0;
                        break;
                }
        }
@@ -1901,6 +1901,8 @@ static int login_exec(struct ast_channel *chan, void *data)
                                                ast_device_state_changed("Agent/%s", p->agent);
                                                while (res >= 0) {
                                                        ast_mutex_lock(&p->lock);
+                                                       if (!p->loginstart && p->chan)
+                                                               ast_softhangup(p->chan, AST_SOFTHANGUP_EXPLICIT);
                                                        if (p->chan != chan)
                                                                res = -1;
                                                        ast_mutex_unlock(&p->lock);