Asterisk cmd 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.

Usage:

Asterisk 1.6.x

AGI(command,args)
DeadAGI(command,args)
EAGI(command,args)

Asterisk 1.4.x

AGI(command|args)
DeadAGI(command|args)
EAGI(command|args)

Example:


;
; extensions.conf
;

[a2billing]

exten => _X.,1,Answer
exten => _X.,n,Wait(1)
exten => _X.,n,AGI(a2billing.php,1)
exten => _X.,n,Hangup()

Return codes

Returns -1 on hangup or if application requested hangup, or 0 on non-hangup exit.

Requirements for applications

  • must be executable
  • must be located in /usr/share/asterisk/agi-bin (see astagidir variable in asterisk.conf)
  • must be specified in the dialplan complete with an extension

EAGI gives you a sound channel

Using 'EAGI' provides enhanced AGI, with audio available out of band on file descriptor 3

Use DeadAGI when you have no living channel

If you want to execute an AGI script in the 'h' hangup extension of a context, use the DeadAGI() application instead of AGI().

See also



Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ

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.

Usage:

Asterisk 1.6.x

AGI(command,args)
DeadAGI(command,args)
EAGI(command,args)

Asterisk 1.4.x

AGI(command|args)
DeadAGI(command|args)
EAGI(command|args)

Example:


;
; extensions.conf
;

[a2billing]

exten => _X.,1,Answer
exten => _X.,n,Wait(1)
exten => _X.,n,AGI(a2billing.php,1)
exten => _X.,n,Hangup()

Return codes

Returns -1 on hangup or if application requested hangup, or 0 on non-hangup exit.

Requirements for applications

  • must be executable
  • must be located in /usr/share/asterisk/agi-bin (see astagidir variable in asterisk.conf)
  • must be specified in the dialplan complete with an extension

EAGI gives you a sound channel

Using 'EAGI' provides enhanced AGI, with audio available out of band on file descriptor 3

Use DeadAGI when you have no living channel

If you want to execute an AGI script in the 'h' hangup extension of a context, use the DeadAGI() application instead of AGI().

See also



Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ

Created by: oej, Last modification: Thu 22 of Mar, 2012 (12:11 UTC) by sv7874
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+