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