[asterisk-users] Trouble Playing message file via Perl AGI

Mike Diehl mdiehl at diehlnet.com
Wed Jul 23 07:49:07 CDT 2008


Hi all,

I'm trying to build an IVR using the Perl AGI module at 
http://search.cpan.org/~jamesgol/asterisk-perl-0.10/lib/Asterisk/AGI.pm

But, I'm having trouble getting my program to play a message and wait for a 
keystroke.

I am able to use this code to play the file, so I know that the $msg variable 
points to a valid sound file:

$result = $agi->exec("background $msg");

But of course, this doesn't allow me to capture any keypresses.  So I tried 
this:

$agi->stream_file($msg, "0123456789", 0);

The console indicates that it's playing the message, but it then skips to the 
next AGI instruction and nothing gets played.

Then I tried to use the get_data() method.  It turns out that I had to put two 
of them in my code, but then the timeout doesn't work and it doesn't capture 
any keypresses:

$result = $agi->get_data($msg, 120000, 1);
$result = $agi->get_data($msg, 120000, 1);

Finally, I tried to use the get_option() method that was documented in the 
module POD file; Perl complains that the method isn't defined:

$result = $agi->get_option($msg, "12345", 10000);

So, what am I missing?  I know this works; too many people are doing it.  Any 
ideas?

TIA,
-- 
Mike Diehl



More information about the asterisk-users mailing list