[asterisk-gui] executecommand script
David Kerr
David at kerr.net
Fri Dec 19 12:39:31 CST 2008
Here is some data from my system... Two open channels in "Ring" state. One
stuck in System call to echo, other in System call to gui_sysinfo. Below is
output from core show channel(s) and also output from linux ps command,
which as far as I can tell shows that neither process is still running.
Attempting a "soft hangup" from CLI or from GUI fails to close the channels.
Regards,
David
pbx*CLI> core show channels
Channel Location State
Application(Data)
Local/executecommand executecommand at aster Ring System(sh
/var/lib/asterisk/sc
Local/executecommand executecommand at aster Ring System(echo 26690 >
/var/lib/a
2 active channels
2 active calls
pbx*CLI> core show channel Local/executecommand at asterisk_guitools-c92e,2
-- General --
Name: Local/executecommand at asterisk_guitools-c92e,2
Type: Local
UniqueID: 1229638681.159
Caller ID: (N/A)
Caller ID Name: (N/A)
DNID Digits: (N/A)
State: Ring (4)
Rings: 0
NativeFormats: 0x40 (slin)
WriteFormat: 0x40 (slin)
ReadFormat: 0x40 (slin)
WriteTranscode: No
ReadTranscode: No
1st File Descriptor: -1
Frames in: 1
Frames out: 0
Time to Hangup: 1229638711
Elapsed Time: 20h12m7s
Direct Bridge: <none>
Indirect Bridge: <none>
-- PBX --
Context: asterisk_guitools
Extension: executecommand
Priority: 2
Call Group: 0
Pickup Group: 0
Application: System
Data: sh /var/lib/asterisk/scripts/gui_sysinfo
Blocking in: (Not Blocking)
Variables:
command=sh /var/lib/asterisk/scripts/gui_sysinfo
CDR Variables:
level 1: dst=executecommand
level 1: dcontext=asterisk_guitools
level 1: channel=Local/executecommand at asterisk_guitools-c92e,2
level 1: lastapp=System
level 1: lastdata=sh /var/lib/asterisk/scripts/gui_sysinfo
level 1: start=2008-12-18 17:18:01
level 1: duration=0
level 1: billsec=0
level 1: disposition=NO ANSWER
level 1: amaflags=DOCUMENTATION
level 1: uniqueid=1229638681.159
pbx*CLI> core show channel Local/executecommand at asterisk_guitools-7d68,2
-- General --
Name: Local/executecommand at asterisk_guitools-7d68,2
Type: Local
UniqueID: 1229307417.2
Caller ID: (N/A)
Caller ID Name: (N/A)
DNID Digits: (N/A)
State: Ring (4)
Rings: 0
NativeFormats: 0x40 (slin)
WriteFormat: 0x40 (slin)
ReadFormat: 0x40 (slin)
WriteTranscode: No
ReadTranscode: No
1st File Descriptor: -1
Frames in: 1
Frames out: 0
Time to Hangup: 0
Elapsed Time: 112h15m53s
Direct Bridge: <none>
Indirect Bridge: <none>
-- PBX --
Context: asterisk_guitools
Extension: executecommand
Priority: 1
Call Group: 0
Pickup Group: 0
Application: System
Data: echo 26690 >
/var/lib/asterisk/static-http/config/sysinfo_output.html
Blocking in: (Not Blocking)
Variables:
command=echo 26690 >
/var/lib/asterisk/static-http/config/sysinfo_output.html
CDR Variables:
level 1: dst=executecommand
level 1: dcontext=asterisk_guitools
level 1: channel=Local/executecommand at asterisk_guitools-7d68,2
level 1: lastapp=System
level 1: lastdata=echo 26690 >
/var/lib/asterisk/static-http/config/sysinfo_output.html
level 1: start=2008-12-14 21:16:57
level 1: end=2008-12-14 21:17:57
level 1: duration=60
level 1: billsec=0
level 1: disposition=NO ANSWER
level 1: amaflags=DOCUMENTATION
level 1: uniqueid=1229307417.2
pbx ~ # ps
PID Uid VSZ Stat Command
1 root 1040 S
init
2 root SWN [ksoftirqd/0]
3 root SW< [events/0]
4 root SW< [khelper]
5 root SW< [kthread]
38 root SW< [kblockd/0]
39 root SW< [ata/0]
40 root SW< [ata_aux]
41 root SW< [ksuspend_usbd]
44 root SW< [khubd]
46 root SW< [kseriod]
78 root SW [pdflush]
79 root SW [pdflush]
80 root SW< [kswapd0]
81 root SW< [aio/0]
82 root SW< [unionfs_siod/0]
927 root 620 S < /sbin/udevd --daemon
1308 root 1060 S udhcpc -b -s /etc/udhcpc.script -H pbx -p
/var/run/udhcpc-eth0.pid -i eth0
1350 root 1040 S /sbin/syslogd -s 1024 -m 60 -b 2 -L -R 192.168.1.2
1352 root 1040 S klogd
1357 root 1036 S crond
1581 nobody 600 S dnsmasq
1595 root 1152 S ntpd -c /etc/ntpd.conf
1610 root 1836 S /usr/sbin/sshd
1613 root 1048 S inetd
1637 root 11024 S asterisk -p -I
1638 root 11024 S asterisk -p -I
1641 root 11024 S asterisk -p -I
1642 root 11024 S asterisk -p -I
1643 root 11024 S asterisk -p -I
1644 root 11024 S asterisk -p -I
1649 root 11024 S asterisk -p -I
1650 root 11024 S asterisk -p -I
1651 root 11024 S asterisk -p -I
1652 root 11024 S asterisk -p -I
1653 root 11024 S asterisk -p -I
1654 root 11024 S asterisk -p -I
1655 root 11024 S asterisk -p -I
1669 root 1696 S mini_httpd -C /etc/mini_httpd.conf
1674 nobody 1656 S mini_httpd -C /tmp/etc/mini_httpd-http.conf
1677 -1 496 S inadyn
1688 root 1040 S /sbin/getty -L 19200 /dev/ttyS0 vt100
1689 root 11024 S asterisk -p -I
1690 root 11024 S asterisk -p -I
1691 root 11024 S asterisk -p -I
1692 root 11024 S asterisk -p -I
1693 root 11024 S asterisk -p -I
1694 root 11024 S asterisk -p -I
1695 root 11024 S asterisk -p -I
1696 root 11024 S asterisk -p -I
1697 root 11024 S asterisk -p -I
1773 root 11024 S asterisk -p -I
1774 root 11024 S asterisk -p -I
1775 root 10540 S asterisk -p -I
3195 root 11024 S asterisk -p -I
3196 root 11024 S asterisk -p -I
3197 root 10980 S asterisk -p -I
3198 root Z [bash]
3304 root 11024 S asterisk -p -I
3305 root 11144 S asterisk -p -I
9910 root 4452 S /usr/sbin/sshd: root at pts/0
9914 root 1240 S -sh
10061 root 1040 R ps
On Fri, Dec 19, 2008 at 10:55 AM, David Kerr <David at kerr.net> wrote:
> Doesn't seam to be related to the command... I have one channel open
> on the 'echo' command you use to test that you have write permission
> the the config directory! When I get home I'll capture some asterisk
> console and linux process info for you to see what I mean.
>
> David.
>
> On 12/18/08, Brandon Kruse <bkruse at digium.com> wrote:
> > Interesting.
> >
> > Could you tell me what commands?
> >
> > Obviously the channel stays open if the command is still running, but I
> am
> > not sure what command is in that kind of loop.
> >
> > You rock, and I will look into this tomorrow. Great research!
> >
> > Let me know if you have any more discoveries.
> >
> > -Brandon
> >
> > ----- Original Message -----
> > From: "David Kerr" <David at kerr.net>
> > To: "Asterisk GUI project discussion" <asterisk-gui at lists.digium.com>
> > Sent: Thursday, December 18, 2008 4:53:31 PM GMT -06:00 Central America
> > Subject: [asterisk-gui] executecommand script
> >
> >
> > Brandon, et al.
> > One issue I have been seeing a lot of is a channel remaining open in the
> > asterisk_guitools context, executecommand "extension". Invariably if I
> look
> > at the open channels I will see one or more channels in "Ring" state
> often
> > with a duration in the thousands, if not tens or hundreds of thousands of
> > seconds. They just never go away, and clicking on "hangup" in the active
> > channels page does nothing.
> >
> >
> > I have been investigating this for some time to try and find a solution,
> but
> > rather than finding a solution I just find one gotcha after another.
> First
> > the context (as built by pbx.js) looks like...
> >
> >
> >
> > exten=executecommand,1,System(${command})
> >
> > exten=executecommand,n,Hangup
> >
> >
> >
> > The parameters to the System() call being setup in astman.js. First thing
> I
> > observed is that there is no timeout condition... there is a timeout set
> on
> > the call to the AMI in astman.js (for 60 seconds!) but that timeout is
> only
> > for until control is passed to the context? (
> > http://www.voip-info.org/wiki/view/Asterisk+Manager+API+Action+Originate)
> > and not a timeout for the System() command inside the context. So I
> > considered adding a timeout(absolute) to the script. But find that this
> only
> > works after an Answer (
> > http://www.voip-info.org/wiki/view/Asterisk+cmd+AbsoluteTimeout). ..
> which
> > is when I realized that the "call" is never answered... maybe that is why
> it
> > sometimes gets stuck on "Ring". So I tried...
> >
> >
> >
> > exten=executecommand,1,Answer
> > exten=executecommand,n,Set(TIMEOUT(absolute)=30)
> > exten=executecommand,n,System(${command})
> > exten=executecommand,n,Hangup
> >
> > exten=T,1,Hangup
> >
> >
> >
> > But on testing this I find that while it works when the command being
> > executed is VERY quick, it fails when the command is slow (I'm doing some
> > other enhancements that execute a wget, which needs time (1 or 2 seconds)
> to
> > pull results from the network). It fails because as soon as the call is
> > "answered" control returns to the callback function set in astman.js...
> > which then attempts to read the result from the command (as saved in
> > sysinfo_output.html), which may not have completed yet. If I move the
> Answer
> > statement to after the System call, then it works again... but then the
> > behavior of Timeout(absolute) is undefined (according to
> > http://www.voip-info.org/wiki/view/Asterisk+cmd+AbsoluteTimeout ) which
> > states that extension "T" will never get called.
> >
> >
> > So I am in a catch 22 situation.
> >
> >
> > I also tried changing astman.js in the systemCmd() function... rather
> than
> > make a request with a "noop" application, I told it to use "System" and
> > passed some data into it (also modifying the context not to call System).
> > Same problem... because of the asynchronous nature of the request,
> control
> > passes to the callback before the command I want to execute completes. I
> > have not tried making a synchronous request on the asterisk manager API
> > because I don't want to hang the user interface while the command
> executes
> > on the server.
> >
> >
> > So... any ideas. I'd like a way to stop these phantom channels remaining
> > open?
> >
> >
> > Thanks,
> > David
> >
> >
> >
> >
> >
> >
> > _______________________________________________
> > --Bandwidth and Colocation Provided by http://www.api-digital.com--
> >
> > asterisk-gui mailing list
> > To UNSUBSCRIBE or update options visit:
> > http://lists.digium.com/mailman/listinfo/asterisk-gui
> >
> > --
> > ******************************
> > Brandon Kruse
> > Software Technician
> > Digium, Inc.
> > 150 West Park Loop, Suite 100
> > Huntsville, AL 35806
> > Phone: +1-256-428-6115
> > 877.546.8963
> > 877.linux.me!
> > www.digium.com
> > www.asterisk.org
> > ******************************
> >
> >
>
> --
> Sent from my mobile device
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-gui/attachments/20081219/99572cb4/attachment.htm
More information about the asterisk-gui
mailing list