[Home]

Summary:ASTERISK-05880: [patch] agent not auto logoff
Reporter:Peng Yong (ppyy)Labels:
Date Opened:2005-12-21 09:20:58.000-0600Date Closed:2008-01-15 16:15:54.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Channels/chan_agent
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) autologoff_12_27.diff
( 1) autologoff_12_31.diff
( 2) autologoff.diff
( 3) patch.chan_agent.autologoffunavail
Description:autologoff in agent.conf can only logoff a sip agent that signed in (RING to him), but can't logoff a agent that not signed in (no route to him, and no ring).

if a agent forgot to logoff before shut off sip client(x-lite), it will stay only forever.
Comments:By: BJ Weschke (bweschke) 2005-12-21 13:02:49.000-0600

I understand what you're saying, but this might prove problematic based on the fact that chan_agent is a local channel proxy when using agents in callback mode and I don't know whether or not we receive the chan unavail status back from chan_sip to know that we should log them out immediately because the channel is no longer available. I'll have to check this out a little more.

By: Peng Yong (ppyy) 2005-12-21 20:11:40.000-0600

here is the CLI message, it shows that :

   -- outgoing agentcall, to agent '8086', on 'Local/8086@callcenter-331b,1'
   -- Called Agent/8086
   -- Executing Macro("Local/8086@callcenter-331b,2", "agent|SIP/8086") in new stack
   -- Executing Dial("Local/8086@callcenter-331b,2", "SIP/8086||t") in new stack
Dec 22 11:07:49 NOTICE[14482]: app_dial.c:1010 dial_exec_full: Unable to create channel of type 'SIP' (cause 3 - No route to destination)
 == Everyone is busy/congested at this time (1:0/0/1)
 == Auto fallthrough, channel 'Local/8086@callcenter-331b,2' status is 'CHANUNAVAIL'
   -- Agent/8086 is circuit-busy
Dec 22 11:07:49 WARNING[6802]: channel.c:784 channel_find_locked: Avoided initial deadlock for '0x8231e98', 10 retries!

By: Peng Yong (ppyy) 2005-12-25 08:13:01.000-0600

i checked the chan_local.c and chan_agent.c, found the local channel can't feed back CHANUNAVAIL to chan_agent. so i modify the code to resolve the problem, here is a patch.

By: Tilghman Lesher (tilghman) 2005-12-25 11:01:01.000-0600

Do you have a disclaimer on file?

By: Mark Spencer (markster) 2005-12-25 17:55:50.000-0600

That's a lot of overhead to add on every read.  What about using agentcallback login?

By: Peng Yong (ppyy) 2005-12-26 03:14:44.000-0600

disclaimer on the patch

By: Peng Yong (ppyy) 2005-12-26 03:26:42.000-0600

markster:
it's in read callback, but it will only be called when local channel is hangup.

By: Peng Yong (ppyy) 2005-12-26 05:43:13.000-0600

it also resolve following problem:

if you dial Local channel, you will got CONGESTION when the proxied channel got CHANUNAVAIL&ASTERISK-11713;

here is an example:

exten => 8863,1,Dial(Local/2000@callcenter)
exten => 8863,n,NoOp(${DIALSTATUS})

exten => 2000,1,Dial(SIP/3000)  #SIP/3000 is not aviarable

the message before patch:

   -- Executing Dial("Local/2000@callcenter-2f92,2", "SIP/3000") in new stack
Dec 26 20:31:35 WARNING[5032]: chan_sip.c:1966 create_addr: No such host: 3000
Dec 26 20:31:35 NOTICE[5032]: app_dial.c:1010 dial_exec_full: Unable to create channel of type 'SIP' (cause 3 - No route to destination)
 == Everyone is busy/congested at this time (1:0/0/1)
 == Auto fallthrough, channel 'Local/2000@callcenter-2f92,2' status is 'CHANUNAVAIL'
   -- Local/2000@callcenter-2f92,1 is circuit-busy
 == Everyone is busy/congested at this time (1:0/1/0)
   -- Executing NoOp("SIP/8000-081bf738", "CONGESTION") in new stack
 == Auto fallthrough, channel 'SIP/8000-081bf738' status is 'CONGESTION'
Dec 26 20:31:35 WARNING[4750]: channel.c:784 channel_find_locked: Avoided initial deadlock for '0x81bb3b8', 10 retries!


the message after patch:
   -- Executing Dial("Local/2000@callcenter-82fe,2", "SIP/3000") in new stack
Dec 26 20:32:42 WARNING[7521]: chan_sip.c:1966 create_addr: No such host: 3000
Dec 26 20:32:42 NOTICE[7521]: app_dial.c:1010 dial_exec_full: Unable to create channel of type 'SIP' (cause 3 - No route to destination)
 == Everyone is busy/congested at this time (1:0/0/1)
 == Auto fallthrough, channel 'Local/2000@callcenter-82fe,2' status is 'CHANUNAVAIL'
   -- Local/2000@callcenter-82fe,1 is circuit-busy
 == Everyone is busy/congested at this time (1:0/1/0)
   -- Executing NoOp("SIP/8000-081bdea0", "CONGESTION") in new stack
 == Auto fallthrough, channel 'SIP/8000-081bdea0' status is 'CONGESTION'
Dec 26 20:32:42 WARNING[7506]: channel.c:784 channel_find_locked: Avoided initial deadlock for '0x81c3b50', 10 retries!
 == Setting global variable 'DIALSTATUS' to 'CHANUNAVAIL'

By: BJ Weschke (bweschke) 2005-12-26 19:04:24.000-0600

markster: I think this is a good patch. ppyy is right. Although it's within the read method, it's only getting executed when the bridged channels are getting broken down. And, it does solve some prior problems mentioned in earlier bugs where chan_local wasn't catching/returning the real status returned by the proxied channel.
ppyy: Have you faxed/sent a disclaimer to Digium? This is more than a "trivial" change. I think you need to have a disclaimer in for it. Also, I think it might be good to have this setup as an "option" in agents.conf where people can turn this behavior on/off. Your thoughts?

By: Peng Yong (ppyy) 2005-12-26 21:12:36.000-0600

minor change for spell.

add documents to manager.txt and queuelog.txt

By: BJ Weschke (bweschke) 2005-12-26 21:18:01.000-0600

worked with ppyy on irc. disclaimer is now on file for him.

By: Tilghman Lesher (tilghman) 2005-12-26 22:43:59.000-0600

Small nitpick, but I'd prefer if you used a variable other than DIALSTATUS:  that is supposed to be a status variable set only by the Dial application.  Since it's being set by the Local channel, perhaps CHANLOCALSTATUS would be a better name?

By: Peng Yong (ppyy) 2005-12-26 23:14:59.000-0600

Corydon76:
if we use other variable, then we still can not got real status of local channel returned by the proxied channel.

By: BJ Weschke (bweschke) 2005-12-27 05:58:26.000-0600

ppyy: What Corydon76 is saying here makes sense. Let's change that variable name in your existing patch to CHANLOCALSTATUS because a Dial() on a Local/ channel is going to set DIALSTATUS regardless. What we may want to do is actually modify app_dial.c as well to read the value of CHANLOCALSTATUS to set DIALSTATUS when the channel technology is Local.

By: Peng Yong (ppyy) 2005-12-27 22:31:03.000-0600

[12:40] <pengyong> i am wrong in my bug note: 0038366
[12:41] <pengyong> even if i set CHANUNAVAIL in local channel, the dialstatus of local channel still is busy
[12:42] <pengyong> and i debug the code, find the local channel return before the outbound channel of local channel hangup
[12:42] <Corydon76-home> Okay, so notate that in the bug report
[12:42] <pengyong> i am figure out a way to got real state of local channel, but it will change many code
[12:43] <pengyong> the state is set by a control frame from out bound channel
[12:44] <pengyong> please see: pbx.c
[12:44] <pengyong> else if (!strcasecmp(status, "CHANUNAVAIL"))
[12:44] <pengyong> res = pbx_builtin_congestion(c, "10");
[12:45] <pengyong> all channel cause CHANUNAVAIL is replased by congestion and send a congestion control frame
[12:45] <pengyong> and there is no CHANUNAVAIL frame
[12:45] <pengyong> should i add CHANUNAVAIL control frame?
[12:46] <Corydon76-home> Ask kpfleming
[12:46] <pengyong> Ok, thks

By: Peng Yong (ppyy) 2005-12-31 08:28:04.000-0600

1. DIALSTATUS -> CHANLOCALSTATUS
2. add auto logoff in agent_hangup

By: Peng Yong (ppyy) 2006-01-13 09:41:49.000-0600

add autologoffunavail option

By: BJ Weschke (bweschke) 2006-01-13 11:24:49.000-0600

Committed to /trunk. Thanks!

By: Digium Subversion (svnbot) 2008-01-15 16:15:33.000-0600

Repository: asterisk
Revision: 8063

U   trunk/channels/chan_agent.c
U   trunk/channels/chan_local.c
U   trunk/configs/agents.conf.sample
U   trunk/doc/manager.txt
U   trunk/doc/queuelog.txt

------------------------------------------------------------------------
r8063 | bweschke | 2008-01-15 16:15:33 -0600 (Tue, 15 Jan 2008) | 3 lines

Implement the autologoffunavail option in chan_agent (ASTERISK-5880 with some minor mods)


------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=8063

By: Digium Subversion (svnbot) 2008-01-15 16:15:54.000-0600

Repository: asterisk
Revision: 8086

_U  team/russell/autoconf_and_menuselect/
U   team/russell/autoconf_and_menuselect/app.c
U   team/russell/autoconf_and_menuselect/apps/app_dial.c
U   team/russell/autoconf_and_menuselect/apps/app_directed_pickup.c
U   team/russell/autoconf_and_menuselect/apps/app_festival.c
U   team/russell/autoconf_and_menuselect/apps/app_macro.c
U   team/russell/autoconf_and_menuselect/apps/app_meetme.c
U   team/russell/autoconf_and_menuselect/apps/app_milliwatt.c
U   team/russell/autoconf_and_menuselect/apps/app_mixmonitor.c
U   team/russell/autoconf_and_menuselect/apps/app_morsecode.c
U   team/russell/autoconf_and_menuselect/apps/app_page.c
U   team/russell/autoconf_and_menuselect/apps/app_parkandannounce.c
U   team/russell/autoconf_and_menuselect/apps/app_queue.c
U   team/russell/autoconf_and_menuselect/apps/app_rpt.c
U   team/russell/autoconf_and_menuselect/apps/app_voicemail.c
U   team/russell/autoconf_and_menuselect/asterisk.c
U   team/russell/autoconf_and_menuselect/channel.c
U   team/russell/autoconf_and_menuselect/channels/chan_agent.c
U   team/russell/autoconf_and_menuselect/channels/chan_local.c
U   team/russell/autoconf_and_menuselect/channels/chan_sip.c
U   team/russell/autoconf_and_menuselect/configs/agents.conf.sample
U   team/russell/autoconf_and_menuselect/configs/features.conf.sample
U   team/russell/autoconf_and_menuselect/configs/queues.conf.sample
U   team/russell/autoconf_and_menuselect/doc/CODING-GUIDELINES
U   team/russell/autoconf_and_menuselect/doc/README.variables
U   team/russell/autoconf_and_menuselect/doc/manager.txt
U   team/russell/autoconf_and_menuselect/doc/queuelog.txt
U   team/russell/autoconf_and_menuselect/funcs/func_strings.c
U   team/russell/autoconf_and_menuselect/include/asterisk/app.h
U   team/russell/autoconf_and_menuselect/include/asterisk/frame.h
U   team/russell/autoconf_and_menuselect/include/asterisk/monitor.h
U   team/russell/autoconf_and_menuselect/include/asterisk/utils.h
U   team/russell/autoconf_and_menuselect/manager.c
U   team/russell/autoconf_and_menuselect/pbx.c
U   team/russell/autoconf_and_menuselect/res/res_monitor.c
U   team/russell/autoconf_and_menuselect/udptl.c

------------------------------------------------------------------------
r8086 | russell | 2008-01-15 16:15:53 -0600 (Tue, 15 Jan 2008) | 222 lines

Merged revisions 8019-8024,8030,8034,8037-8038,8042,8044-8045,8048-8051,8056-8060,8063-8066,8068-8073,8075-8076,8078-8080 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
r8019 | russell | 2006-01-12 13:35:03 -0500 (Thu, 12 Jan 2006) | 2 lines

fix breakage from new feature committed in r7995

........
r8020 | bweschke | 2006-01-12 14:01:35 -0500 (Thu, 12 Jan 2006) | 3 lines

Remove an unneccessary unlock and do away with the error msg about not being able to unlock the lock. ASTERISK-6044


........
r8021 | mogorman | 2006-01-12 14:07:18 -0500 (Thu, 12 Jan 2006) | 4 lines

Added option for limiting a user from logging in
as multiple agents at same time. bug 6046 thanks
ppyy

........
r8022 | mogorman | 2006-01-12 14:09:36 -0500 (Thu, 12 Jan 2006) | 2 lines

Minor revisions from bug 6090

........
r8023 | mogorman | 2006-01-12 14:15:20 -0500 (Thu, 12 Jan 2006) | 2 lines

Oops... need to keep my trunk folder clean...

........
r8024 | mogorman | 2006-01-12 14:28:47 -0500 (Thu, 12 Jan 2006) | 3 lines

More cosmetic changes. thanks qwell and everyone
else.

........
r8030 | mogorman | 2006-01-12 14:45:38 -0500 (Thu, 12 Jan 2006) | 3 lines

some error checking added into g and a option
if there is no parens.

........
r8034 | mogorman | 2006-01-12 15:04:52 -0500 (Thu, 12 Jan 2006) | 3 lines

I will never touch VM again...
thanks qwell for spotting mistakes.

........
r8037 | tilghman | 2006-01-12 16:12:25 -0500 (Thu, 12 Jan 2006) | 2 lines

Fix typos that caused voicemail not to compile.

........
r8038 | tilghman | 2006-01-12 16:18:46 -0500 (Thu, 12 Jan 2006) | 2 lines

Bug 6223 - Remove unnecessary header that caused FreeBSD not to compile

........
r8042 | mogorman | 2006-01-12 21:34:10 -0500 (Thu, 12 Jan 2006) | 3 lines

forgot to take out createlink sample along with
other part.

........
r8044 | bweschke | 2006-01-12 22:25:23 -0500 (Thu, 12 Jan 2006) | 3 lines

More memory wrapper and cleanup work. ASTERISK-6068 w/one very minor compile fix mod in app_rpt.c


........
r8045 | bweschke | 2006-01-12 22:34:31 -0500 (Thu, 12 Jan 2006) | 3 lines

More memory wrapper cleanup. ASTERISK-6067


........
r8048 | russell | 2006-01-13 01:11:41 -0500 (Fri, 13 Jan 2006) | 2 lines

fix spelling errors (issue ASTERISK-6069)

........
r8049 | mogorman | 2006-01-13 01:43:27 -0500 (Fri, 13 Jan 2006) | 2 lines

added some minor changes from bug 6046 thanks ppyy

........
r8050 | mogorman | 2006-01-13 01:49:23 -0500 (Fri, 13 Jan 2006) | 2 lines

adding more output for shutdown. as per 6102

........
r8051 | tilghman | 2006-01-13 02:14:42 -0500 (Fri, 13 Jan 2006) | 2 lines

Somebody complained the that length of the dah wasn't quite up to spec...

........
r8056 | bweschke | 2006-01-13 11:01:40 -0500 (Fri, 13 Jan 2006) | 3 lines

Range should be inclusive, not exclusive, of the end of the range.


........
r8057 | mogorman | 2006-01-13 12:02:15 -0500 (Fri, 13 Jan 2006) | 5 lines

allow app_directed_pickup to try to pickup
multiple channels at the same time. however it
does not work in cases where dial was called
with multiple devices.  bug 5694.

........
r8058 | bweschke | 2006-01-13 12:28:22 -0500 (Fri, 13 Jan 2006) | 3 lines

Address the condition where X-ClientCode could be NULL or an empty string - from a -dev posting.


........
r8059 | bweschke | 2006-01-13 12:35:12 -0500 (Fri, 13 Jan 2006) | 3 lines

Another patch against this code (the right one now) to deal with cyclic ranges. ASTERISK-6072


........
r8060 | mogorman | 2006-01-13 12:39:56 -0500 (Fri, 13 Jan 2006) | 3 lines

added two new features to meetme, autofill and
autopause.  thanks twisted from 5577

........
r8063 | bweschke | 2006-01-13 13:23:30 -0500 (Fri, 13 Jan 2006) | 3 lines

Implement the autologoffunavail option in chan_agent (ASTERISK-5880 with some minor mods)


........
r8064 | mogorman | 2006-01-13 13:30:49 -0500 (Fri, 13 Jan 2006) | 3 lines

Made chan_agent code parsing more robust and
implemented new macro code. from 6228.

........
r8065 | russell | 2006-01-13 13:38:55 -0500 (Fri, 13 Jan 2006) | 9 lines

Various cleanups from comments in an email from Luigi Rizzo.  Thank you!
- Use a cleaner syntax for declaring the allocation macros
- Fix return value for ast_strdup/ast_strndup
- remove safe_strdup from app_macro, since ast_strup does the same thing
- fix a place in app_queue where ast_calloc+strncpy was used instead of
 ast_strdup.  If you are helping out with these conversions, please watch out
 for other places where this is done.
- add a note to the coding guidelines about the fix to app_queue

........
r8066 | mogorman | 2006-01-13 14:09:05 -0500 (Fri, 13 Jan 2006) | 2 lines

Added forward context option from 5497

........
r8068 | mogorman | 2006-01-13 17:05:46 -0500 (Fri, 13 Jan 2006) | 4 lines

make voicemail files group writable and uses a
nicer function for creating dirs as described in
5929

........
r8069 | mogorman | 2006-01-13 17:59:19 -0500 (Fri, 13 Jan 2006) | 3 lines

Added QUEUE_MEMBER_COUNT and  QUEUE_MEMBER_LIST
from bug 5451

........
r8070 | mogorman | 2006-01-13 19:32:30 -0500 (Fri, 13 Jan 2006) | 4 lines

added feature for pausing and unpausing the
monitor app from manager and in the call through
features.conf bug 5395 for the patch

........
r8071 | bweschke | 2006-01-13 22:25:38 -0500 (Fri, 13 Jan 2006) | 3 lines

Code cleanup spawned from an earlier commit today r8063. Standardize manager event responses and queue_log behavior on callbacklogoff.


........
r8072 | mattf | 2006-01-14 11:18:03 -0500 (Sat, 14 Jan 2006) | 2 lines

Add mission options to agents.conf sample file (ASTERISK-6076)

........
r8073 | mattf | 2006-01-14 13:53:10 -0500 (Sat, 14 Jan 2006) | 2 lines

Small documentation update for new AST_FRAME_MODEM type

........
r8075 | tilghman | 2006-01-14 14:08:03 -0500 (Sat, 14 Jan 2006) | 3 lines

Merged revisions 8074 via svnmerge from
/branches/1.2

........
r8076 | tilghman | 2006-01-14 14:30:37 -0500 (Sat, 14 Jan 2006) | 2 lines

Bug 6238 - Janitor - update to app_args macros

........
r8078 | tilghman | 2006-01-15 00:50:19 -0500 (Sun, 15 Jan 2006) | 2 lines

Prepare for removal of DBGet/DBPut manager commands, by allowing Getvar to get functions (Setvar can already set functions)

........
r8079 | tilghman | 2006-01-15 13:02:46 -0500 (Sun, 15 Jan 2006) | 2 lines

Allow application arguments to be quoted, allowing '|' characters inside arguments

........
r8080 | tilghman | 2006-01-15 13:08:04 -0500 (Sun, 15 Jan 2006) | 2 lines

Clarify description of ARRAY function

........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=8086