DeadAGI()

Führt ein AGI-konformes Skript auf einem toten (aufgelegten) Channel aus.

DeadAGI(Programm,Argumente)

Führt ein AGI-konformes Skript auf einem toten (aufgelegten) Channel aus. Mit Hilfe von AGI kann Asterisk externe Programme in nahezu jeder beliebigen Sprache ausführen (starten), um einen Telefonkanal zu steuern, Audio abzuspielen, DTMF-Ziffern auszulesen usw., indem es nach dem AGI-Protokoll auf STDIN und STDOUT mit diesen kommuniziert. Die übergebenen Argumente werden an das AGI-Programm durchgereicht.

Diese Anwendung wurde speziell für tote Kanäle entwickelt, weil das Standard AGI-Interface nicht funktioniert, nachdem der Channel aufgelegt wurde. Dass der Channel „tot“ ist, ist allerdings keine Voraussetzung für den Start eines DeadAGI-Skripts!

Benutzen Sie den Befehl show agi auf der Kommandozeilen-Schnittstelle, um eine Liste aller verfügbaren AGI-Befehle zu erhalten.

Liefert -1 zurück, falls die Anwendung ein Auflegen angefordert hat, oder 0 beim Austritt ohne Auflegen.

; mit einem bereits aufgelegten (h) Kanal noch ein AGI-Skript ausführen:
exten => h,1,DeadAGI(agi-test)
[Wichtig]Wichtig

Der Channel wird solange als aktiv angesehen wird, bis das Skript beendet wird, was z.B. für CDRs von Bedeutung sein kann.

Beachten Sie, dass auch DeadAGI-Skripte beim Auflegen des Channels ein SIGHUP-Signal erhalten, was ggf. ignoriert werden muss:

Perl
$SIG{HUP} = "IGNORE";
PHP
pcntl_signal(SIGHUP, SIG_IGN);
(PHP muss mit --enable-pcntl kompiliert worden sein, was per Default nicht der Fall ist!)
Ruby
trap('SIGHUP','IGNORE')

Es ist auch wichtig, dass Sie nach dem Auflegen nicht mehr mit Asterisk kommunizieren, sonst erhält das Skript ein SIGPIPE, was das Skript beendet, sofern Sie es nicht ignorieren.

[Anmerkung]Anmerkung

Interner Hilfetext zu dieser Applikation in Asterisk 1.4: 

  -= Info about application 'DeadAGI' =- 

[Synopsis]
Executes AGI on a hungup channel

[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

Differenz zum internen Hilfetext 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

Siehe auch. AGI(), FastAGI()


Version 1.2, November 2002

Neue Version verfügbar

Sie betrachten gerade die alte Version des Buches (Version 1.0). Wir empfehlen Ihnen für Asterisk 1.4 und 1.6 die neue Version des Buches.

Asterisk-Tag 2008

Lernen Sie Mark Spencer (den Erfinder von Asterisk) kennen! Viele Vorträge, Case-Studies und Workshops rund um das Thema VoIP. Asterisk-Tag.org

Das gedruckte Buch