Upgrade 3CX to v18 and get it hosted free!

Asterisk cmd AGI

Author image

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

  • Adhearsion – Ruby Dialplan via AGI
  • EAGI: Same as AGI except it makes available file descriptors for audio streams
  • FastAGI: Run AGI remotely over TCP socket: agi://
  • OrderlyCalls (successor to JAGIServer) offers full support for FastAGI and Manager in an easy-to-use Named Service environment. Includes Web Deployer for developing integrated VOIP-HTML applications.
  • Asterisk-java now also supports FastAGI in addition to the Manager API
  • DeadAGI
  • Asterisk AGI
  • libagi
  • res_php, res_perl, res_python (PyAsterisk) if you don’t want to load the interpreter with every AGI call
  • http://martin.hinner.info/voip/ AGI perl script which sends e-mail or notification message with information who is calling (lookup in NANPA or intl. code database)
  • SafiServer and SafiWorkshop: Graphically design callflows and a server that uses FastAGI to execute them through Asterisk

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


Article Reviews

Write a Review

Your email address will not be published. Required fields are marked *

Required Field. Minimum 5 characters.

Required Field. Minimum 5 characters, maximum 50.

Required field.There is an error with this field.

Required Field.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

There are no reviews for this article. Be the first one to write a review.

Related Posts:

Get 3CX - Absolutely Free!
Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.