text stringlengths 0 152 |
|---|
Pros of Enhanced AGI |
It has the simplicity of process-based AGI, with the addition of a simple read- |
only stream of the channel’s audio. This is the only variant that offers this feature. |
Cons of Enhanced AGI |
Since a new process must be spawned to run your application for every call, it has |
the same efficiency concerns as regular, process-based AGI. |
For an alternative way of gaining access to the audio outside |
Asterisk, consider using JACK. Asterisk has a module for |
JACK integration, called app_jack. It provides the JACK() |
dialplan application and the JACK_HOOK() dialplan function. |
FastAGI—AGI over TCP |
FastAGI is the term used for AGI call control over a TCP connection. With process- |
based AGI, an instance of an AGI application is executed on the system for every call, |
and communication with that application is done over stdin and stdout. With |
FastAGI, a TCP connection is made to a FastAGI server. Call control is done using |
the same AGI protocol, but the communication is over the TCP connection and does |
not require a new process to be started for every call. The AGI protocol is discussed |
in more detail in “AGI Communication Overview” on page 319. Using FastAGI is |
much more scalable than process-based AGI, though it is also more complex to |
implement. |
To use FastAGI you invoke the AGI() application in the Asterisk dialplan, but instead |
of providing the name of the application to execute, you provide an agi:// URL. For |
example: |
exten => 238,1,AGI(agi://127.0.0.1) |
AGI Variants |
| |
317 |
The default port number for a FastAGI connection is 4573. A different port number |
can be appended to the URL after a colon. For example: |
exten => 238,1,AGI(agi://127.0.0.1:4574) |
Just as with process-based AGI, arguments can be passed to a FastAGI application. To |
do so, add them as additional arguments to the AGI() application, delimited by |
commas: |
exten => 238,1,AGI(agi://192.168.1.199,arg1,arg2,arg3) |
FastAGI also supports the usage of DNS SRV records, if you provide a URL in the |
form of hagi://. By using SRV records, your DNS servers can return multiple hosts |
that Asterisk can attempt to connect to. This can be used for high availability and |
load balancing. In the following example, to find a FastAGI server to connect to, |
Asterisk will perform a DNS lookup for _agi._tcp.shifteight.org: |
exten => 238,1,AGI(hagi://shifteight.org) |
In this example, the DNS servers for the shifteight.org domain would need at least |
one SRV record configured for _agi._tcp.shifteight.org. |
Pros of FastAGI |
It’s more efficient than process-based AGI. Rather than spawning a process per |
call, a FastAGI server can be built to handle many calls. |
DNS can be used to achieve high availability and load balancing among FastAGI |
servers to further enhance scalability. |
Cons of FastAGI |
It is more complex to implement a FastAGI server than to implement a process- |
based AGI application. |
Async AGI—AMI-Controlled AGI |
Async AGI allows an application that uses the Asterisk Manager Interface (AMI) to |
asynchronously queue up AGI commands to be executed on a channel. This can be |
especially useful if you are already making extensive use of the AMI and would like to |
enhance your application to handle call control, rather than writing a detailed Aster‐ |
isk dialplan or developing a separate FastAGI server. |
More information on the Asterisk Manager Interface can be found |
in Chapter 17. |
318 |
| |
Chapter 18: Asterisk Gateway Interface |
Async AGI is invoked by the AGI() application in the Asterisk dialplan. The argu‐ |
ment to AGI() should be agi:async, as shown in the following example: |
exten => 239,AGI(agi:async) |
Additional information on how to use async AGI over the AMI can be found in the |
next section. |
Pros of async AGI |
An existing AMI application can be used to control calls using AGI commands. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.