B.32. EAGI()

Calls an AGI-compliant application.
EAGI(program[,arguments])
(Similar to AGI(), FastAGI(), DeadAGI())
Runs an Asterisk Gateway Interface compliant program called program on the current channel. AGI scripts or programs can be implemented in almost any conceivable language (e.g. Perl, PHP) and may be used to manipulate the channel, play sound files, interpret DTMF tones, and so on. Asterisk communicates with the AGI program over stdin and stdout. The arguments are passed directly to the AGI program at execution time.
The AGI program must be flagged as executable in the filesystem. The path is relative to the Asterisk AGI directory, which is at /var/lib/asterisk/agi-bin/ by default.
To run AGI programs on inactive channels (as in the case of an h-extension, where the channel is on-hook), used DeadAGI() instead. To run AGI programs on another server in the network, use FastAGI().
Use EAGI() when you need access to the incoming audio stream. The incoming audio stream is provided on file descriptor 3.
[62]Returns -1 on hang-up or if the AGI program requests a hang-up; returns 0 if no hang-up is requested.
; call my AGI script:
exten => 123,1,AGI(agi-script)
exten => 123,n,EAGI(eagi-script)

Note

Internal help for this application in Asterisk 1.4:
  -= Info about application 'EAGI' =- 

[Synopsis]
Executes an EAGI compliant application

[Description]
  [E|Dead]AGI(command|args): Executes an Asterisk Gateway Interface compliant
program on a channel. AGI allows Asterisk to launch external programs
written in any language to control a telephony channel, play audio,
read DTMF digits, etc. by communicating with the AGI protocol on stdin
and stdout.
  This channel will stop dialplan execution on hangup inside of this
application, except when using DeadAGI.  Otherwise, dialplan execution
will continue normally.
  A locally executed AGI script will receive SIGHUP on hangup from the channel
except when using DeadAGI. This can be disabled by setting the AGISIGHUP channel
variable to "no" before executing the AGI application.
  Using 'EAGI' provides enhanced AGI, with incoming audio available out of band
on file descriptor 3

  Use the CLI command 'agi show' to list available agi commands
  This application sets the following channel variable upon completion:
     AGISTATUS      The status of the attempt to the run the AGI script
                    text string, one of SUCCESS | FAILED | HANGUP
diff output to internal help in Asterisk 1.2:
13,19c13,15
<   This channel will stop dialplan execution on hangup inside of this
< application, except when using DeadAGI.  Otherwise, dialplan execution
< will continue normally.
<   A locally executed AGI script will receive SIGHUP on hangup from the channel
< except when using DeadAGI. This can be disabled by setting the AGISIGHUP channel
< variable to "no" before executing the AGI application.
<   Using 'EAGI' provides enhanced AGI, with incoming audio available out of band
---
> Returns -1 on hangup (except for DeadAGI) or if application requested
>  hangup, or 0 on non-hangup exit. 
> Using 'EAGI' provides enhanced AGI, with incoming audio available out of band
22,25c18
<   Use the CLI command 'agi show' to list available agi commands
<   This application sets the following channel variable upon completion:
<      AGISTATUS      The status of the attempt to the run the AGI script
<                     text string, one of SUCCESS | FAILED | HANGUP
---
> Use the CLI command 'show agi' to list available agi commands


[62] a reminder: 0: stdin, 1: stdout, 2:stderr. File descriptor 3 is freely assignable.