Quantcast
Viewing all articles
Browse latest Browse all 5767

Perl EAGI

 #!/usr/bin/perl
 #
 # Note that this example doesn't check the results of AGI calls, and doesn't use
 # Asterisk::AGI in an attempt to keep it simple and dependency free.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the same terms as Perl itself.
 #
 # Author: Simon P. Ditner / http://uc.org/simon
 #
 # Usage:
 #    - Create an AGI in /var/lib/asterisk/agi-bin, i.e.: perl.eagi
 #    - Call using EAGI from your dialplan: exten => 100,1,EAGI(perl.eagi)
 #
 use warnings;
 use strict;
 
 use IO::Handle;
 
 $| = 1; # Turn of I/O Buffering
 my $buffer = undef;
 my $result = undef;
 my $AUDIO_FD = 3;    # Audio is delivered on file descriptor 3
 my $audio_fh = new IO::Handle;
 $audio_fh->fdopen( $AUDIO_FD, "r" );           # Open the audio file descriptor for reading
 
 # Skip over the preamble that Asterisk sends this AGI
 while( <STDIN> ) {
   chomp;
   last if length == 0;
 }
 
 # Playback beep
 

Viewing all articles
Browse latest Browse all 5767

Trending Articles