Re: [asterisk-users] Help with perl AGI script

2006-08-06 Thread Roy Kidder
Russell Bryant wrote:
 On Sat, 2006-08-05 at 20:43 -0400, Roy Kidder wrote:
 Is there some way I can better control the execution of playbacks so that
 they take place as I expect them to?

 Yes, your script needs to read a line of input from stdin to wait for
Asterisk to send back the result code indicating that the application
execution is complete.  You'll get nack something like 200 result=0.

I tried it again, reading a single line from stdin and got the 200
result=0 message. Is there potential for there to be other messages? i.d.
200 result=1 or 404 file not found? Also, is there always going to be
a single line from stdin, or should I loop until I find the line I'm
looking for?

Thanks again,
Roy


___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Help with perl AGI script

2006-08-06 Thread Russell Bryant
On Sun, 2006-08-06 at 06:58 -0400, Roy Kidder wrote:
 I tried it again, reading a single line from stdin and got the 200
 result=0 message. Is there potential for there to be other messages? i.d.
 200 result=1 or 404 file not found? Also, is there always going to be
 a single line from stdin, or should I loop until I find the line I'm
 looking for?

It should always be a single line.  As long as the command you sent is
valid, the result will be 200 result=something, but it is possible for
the response to be different if there is a problem.

-- 
Russell Bryant
Software Developer
Digium, Inc.

___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


[asterisk-users] Help with perl AGI script

2006-08-05 Thread Roy Kidder
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

___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Help with perl AGI script

2006-08-05 Thread Russell Bryant
On Sat, 2006-08-05 at 20:43 -0400, Roy Kidder wrote:
 Is there some way I can better control the execution of playbacks so that
 they take place as I expect them to?

Yes, your script needs to read a line of input from stdin to wait for
Asterisk to send back the result code indicating that the application
execution is complete.  You'll get nack something like 200 result=0.

-- 
Russell Bryant
Software Developer
Digium, Inc.

___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users