Summary:ASTERISK-08861: [patch] Agent logoff soft not working
Reporter:Adolfo R. Brandes (arbrandes)Labels:
Date Opened:2007-02-22 11:56:37.000-0600Date Closed:2007-06-30 09:20:05
Versions:Frequency of
Environment:Attachments:( 0) chan_agent-56186.diff
( 1) chan_agent-56340-2.diff
Description:Issue 8088, titled "Agent logoff not working" was recently fixed by Mr. file (I can confirm it works).  However, the same fix (introduced in revision 55669) does nothing to improve "agent logoff soft", which continues to behave as it did before the fix, which is to say:

Login an agent with AgentCallbackLogin(), have it accept a call, and then run "agent logoff Agent/XXXX soft" from the CLI while the call is still up. One of the legs of the call (in my experience, the agent's leg) will get invariably hung after the call is terminated by either side.


Attached is a slight extrapolation to the fix in r55669 which ameliorates the problem with "agent logoff soft" in the following manner:

1) No channels get hung;
2) Things work as advertised as long as the CALLER hangs up, in which case the agent is logged off properly.

However, if the CALLEE (i.e. the Agent) hangs up, the latter is not logged off.

(Just to make things clear, this "additional information" block only applies to chan_agent.c as patched with the attached chan_agent-56186.diff, and when using "agent logoff soft".  Plain "agent logoff" works well).
Comments:By: Joshua C. Colp (jcolp) 2007-02-22 17:26:01.000-0600

Fixed in 1.2 as of revision 56279. Thanks!

By: Adolfo R. Brandes (arbrandes) 2007-02-23 07:26:02.000-0600

As noted in the "Additional Information" box, the patch I initially uploaded did not solve the problem completely, for if the agent channel hangs up (as opposed to the caller channel), the agent remains logged in.

I have another 4-liner that seems to finally fix the problem.

By: Adolfo R. Brandes (arbrandes) 2007-02-23 07:33:23.000-0600

The last patch is not a replacement for the previous one; it is to be used in conjunction with revision 56279.

However, as to the code itself, I am not 100% certain as to the placement of the additional resetting of the variables.  I tested it and it seems to have no side effects, but please review!

By: Adolfo R. Brandes (arbrandes) 2007-02-23 09:36:05.000-0600

It seems that agent persistency was also broken in "agent logoff" and "agent logoff soft".  "chan_agent-56340-2.diff" replaces "chan_agent-56340.diff" and takes a shot at fixing it.  It works here in the lab.

By: Joshua C. Colp (jcolp) 2007-02-26 14:36:50.000-0600

I agree with the first part of the patch but was just wondering why loginstart is checked a second time. If you remove it does it still work?

By: Adolfo R. Brandes (arbrandes) 2007-02-26 16:22:04.000-0600

If the second loginstart check is removed, then soft logoff won't work when the agent hangs up a call during which he was "soft logged-off".  I believe this is because p->chan doesn't exist in the latter case (as opposed to when the caller hangs up).

As I said, I'm not sure the placement is correct (maybe the second check should go somewhere less redundant-looking), but it worked fine in the few tests I conducted.

By: Joshua C. Colp (jcolp) 2007-02-28 13:00:38.000-0600

Fixed in 1.2 as of revision 57092, 1.4 as fo revision 57093, and trunk as of revision 57094.