[asterisk-users] Help with perl AGI script

Roy Kidder asterisk at jehster.net
Sat Aug 5 17:43:06 MST 2006


I'm new to Asterisk and am trying to write an AGI script in perl and need
some pointers. The script simply plays a few gsm files in succession
before doing a database insert (using perl's DBI in a sub). In a nutshell,
it looks like this:

  print "EXEC Playback foo1\n";
  print "EXEC Playback foo2\n";
  print "EXEC Playback foo3\n";
  print "HANGUP\n";
  &dbinsert();

The problem I'm seeing is that the call to the sub dbinsert is taking
place before the audio of foo2 even starts (not to mention foo3 or the
HANGUP). I'm assuming that the "EXEC Playback" forks and plays the audio
file when the channel is clear, allowing the script to continue.

Is there some way I can better control the execution of playbacks so that
they take place as I expect them to?

Thanks in advance,
Roy




More information about the asterisk-users mailing list