Giorgio Incantalupo
2006-Sep-20 03:09 UTC
[asterisk-users] Channel kept busy when creating ssh tunnel via AGI
Hi, I have a problem with Asterisk AGI command. I wrote a script which launches a shell command. If I launch a normal command for example like "ll > /tmp/tmp.txt", the AGI command launches the shell commands and then exits. The problem is when I launch THIS command to create an ssh tunnel in background: *ssh -f -N -l asterisk -R 2050:localhost:22 192.168.0.1* The tunnel command above works well if launched via shell but if I launch it using the AGI script, it opens the tunnel but leaves a (SIP or ZAP) channel in use (I checked it typing SIP/ZAP SHOW CHANNELS). The channel closes only when I kill the tunnel process. After killing the process Asterisk console shows: -- AGI Script tunnel.py completed, returning 0 Is there anybody who knows why the channel remains busy? TIA Giorgio Incantalupo
BJ Weschke
2006-Sep-20 03:26 UTC
[asterisk-users] Channel kept busy when creating ssh tunnel via AGI
On 9/20/06, Giorgio Incantalupo <gincantalupo@fgasoftware.com> wrote:> Hi, > I have a problem with Asterisk AGI command. > I wrote a script which launches a shell command. > If I launch a normal command for example like "ll > /tmp/tmp.txt", the > AGI command launches the shell commands and then exits. > > The problem is when I launch THIS command to create an ssh tunnel in > background: > *ssh -f -N -l asterisk -R 2050:localhost:22 192.168.0.1* > > The tunnel command above works well if launched via shell but if I > launch it using the AGI script, it opens the tunnel but leaves a (SIP or > ZAP) channel in use (I checked it typing SIP/ZAP SHOW CHANNELS). > The channel closes only when I kill the tunnel process. After killing > the process Asterisk console shows: > > -- AGI Script tunnel.py completed, returning 0 > > Is there anybody who knows why the channel remains busy? >The intent of an AGI script is to have a script/executable that interacts with the channel. As such, the channel will hang around waiting for input from, providing feedback to, and the eventual completion of such script/executable. If you don't want such behavior, you might want to take a look at monitoring a specific channel event in the Asterisk manager and then starting off your script upon the receipt of such an event through the manager. -- Bird's The Word Technologies, Inc. http://www.btwtech.com/