Dear monks. I have been helped by you before but is stuck again.
Components: [asterisk server] [fastagi server] [perlscript running on fastagi server] [bash script running a gawk-script]
Dataflow: [asterisk server] reads and writes data on stdin and stdout via [fastagi server] back and forth to the [perlscript]. This connection works ok.
When [asterisk server] communicates directly with the [bash script running a gawk-script] via the built-in asterisk agi-facility, the [bash script running a gawk-script] works ok. THE [..gawk-script] USES fflush() when it writes to stdout.
Problem: What I want is the [perlscript..] to call [..gawk-script] and data on stdin and stdout in the [..gawk-script] to pass through [perlscript...] and [fastagi server] to reach/be sent from [asterisk..].
From debuglines sent to files inside [..gawk-script] I know it is running but from the debug/trace-facility in [asterisk..] no sign of activity can bee seen.
The code is very straight forward and I thought this would be easy but having no knowledge of Perl I cannot deduce what the trouble might be. What I suspect is that I lack some (trivial) code to "pump" the data back and forth. I have consulted (amongst other sources) perlipc and perlopentut but faild. What is it in theese descriptions that I have so far faild to understand.
Thanks / Bertil
The code looks like this:
package MyAGI; use strict; use base 'Asterisk::FastAGI'; sub agi_handler { my $self = shift; use IPC::Open2; local (*READ, *WRITE); my $pid = open2(\*READ, \*WRITE, "/path/and/bashscript.sh"); #here I tried various ways to "pump" data via *READ and *WRITE but + without success waitpid( $pid, 0 ); } 1;
In reply to Use of Open2() by wbook
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |