<s>
Asterisk	B-Protocol
Gateway	I-Protocol
Interface	I-Protocol
(	O
AGI	O
)	O
is	O
a	O
software	O
interface	O
and	O
communications	O
protocol	O
for	O
application	O
level	O
control	O
of	O
selected	O
features	O
of	O
the	O
Asterisk	B-Language
PBX	I-Language
.	O
</s>
<s>
AGI	O
allows	O
an	O
external	O
,	O
user-written	O
program	O
,	O
launched	O
from	O
the	O
Asterisk	B-Language
dial	O
plan	O
via	O
pipes	B-Operating_System
to	O
control	O
telephony	O
operations	O
on	O
its	O
associated	O
control	O
and	O
voice	O
channels	O
.	O
</s>
<s>
It	O
is	O
similar	O
to	O
the	O
CGI	B-Language
feature	O
of	O
web	B-Application
servers	I-Application
in	O
allowing	O
any	O
language	O
to	O
be	O
used	O
for	O
writing	O
the	O
external	O
program	O
which	O
communicates	O
with	O
Asterisk	B-Language
via	O
stdin	O
and	O
stdout	O
.	O
</s>
<s>
While	O
the	O
initial	O
feature	O
set	O
of	O
AGI	O
included	O
only	O
a	O
procedural	O
control	O
of	O
Asterisk	B-Language
operations	O
via	O
commands	O
and	O
response	O
handshake	O
,	O
Enhanced	O
AGI	O
(	O
EAGI	O
)	O
also	O
provided	O
out-of-band	O
access	O
to	O
the	O
incoming	O
audio	O
stream	O
.	O
</s>
<s>
FastAGI	B-Protocol
is	O
an	O
extension	O
to	O
AGI	O
which	O
allows	O
the	O
external	O
program	O
to	O
run	O
at	O
a	O
separate	O
network	O
host	O
to	O
avoid	O
the	O
overhead	O
of	O
creating	O
a	O
new	O
process	O
for	O
every	O
call	O
on	O
the	O
Asterisk	B-Language
server	O
.	O
</s>
<s>
It	O
uses	O
a	O
TCP	B-Protocol
socket	O
for	O
communication	O
to	O
the	O
external	O
host	O
which	O
provides	O
the	O
function	O
of	O
an	O
AGI	O
service	O
,	O
in	O
a	O
manner	O
of	O
the	O
client	B-Operating_System
–	I-Operating_System
server	I-Operating_System
model	I-Operating_System
.	O
</s>
<s>
The	O
default	O
TCP	B-Protocol
port	I-Protocol
for	O
FastAGI	B-Protocol
is	O
4573	B-Protocol
.	O
</s>
<s>
Similar	O
to	O
HTTP	B-Protocol
uniform	B-Protocol
resource	I-Protocol
identifiers	I-Protocol
(	O
URIs	B-Protocol
)	O
,	O
FastAGI	B-Protocol
employs	O
a	O
URI	B-Protocol
format	O
of	O
.	O
</s>
<s>
The	O
AGI	O
feature	O
set	O
of	O
Asterisk	B-Language
is	O
implemented	O
as	O
an	O
Asterisk	B-Language
loadable	O
module	O
(	O
res_agi	O
)	O
.	O
</s>
