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

Alex Balashov abalashov at evaristesys.com
Wed Jul 23 19:25:01 CDT 2008


AGI can wrap calls to any dial plan applications;  have you tried 
calling Background() and Read() that way?

Mike Diehl wrote:

> 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,


-- 
Alex Balashov
Evariste Systems
Web    : http://www.evaristesys.com/
Tel    : (+1) (678) 954-0670
Direct : (+1) (678) 954-0671
Mobile : (+1) (706) 338-8599



More information about the asterisk-users mailing list