# Asterisk Project : Asterisk 13 Application_AGI

Created by wikibot on Aug 08, 2014

# AGI()

### Synopsis

Executes an AGI compliant application.

### Description

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. As of `1.6.0`, this channel will not stop dialplan execution on hangup inside of this application. Dialplan execution will continue normally, even upon hangup until the AGI application signals a desire to stop (either by exiting or, in the case of a net script, by closing the connection). A locally executed AGI script will receive SIGHUP on hangup from the channel except when using DeadAGI. A fast AGI server will correspondingly receive a HANGUP inline with the command dialog. Both of theses signals may be disabled by setting the `AGISIGHUP` channel variable to `no` before executing the AGI application. Alternatively, if you would like the AGI application to exit immediately after a channel hangup is detected, set the `AGIEXITONHANGUP` variable to `yes`.

Use the CLI command `agi show commands` 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
  - FAILURE
  - NOTFOUND
  - HANGUP

### Syntax

    AGI(command,arg1,[arg2[,...]])

##### Arguments

- `command`
- `args`
  - `arg1`
  - `arg2`

### See Also

- Asterisk 13 Application_EAGI
- Asterisk 13 Application_DeadAGI

### Import Version

This documentation was imported from Asterisk Version SVN-branch-13-r420538