[asterisk-users] Preferred language for Asterisk AGIs development ?

Steve Edwards asterisk.org at sedwards.com
Tue May 5 18:23:44 CDT 2009


> [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Matthew 
> Nicholson Sent: Tuesday, May 05, 2009 4:51 PM

> On Tue, 2009-05-05 at 12:41 -0700, Steve Edwards wrote:

>> AGI and AMI are only 2 "tools" at your disposal. In terms of "ease of 
>> implementation," I'd define the available set of tools and rank them in 
>> this order when considering how to solve a problem:
>>
>> ) Dialplan
>
> ) pbx_lua
> ) AEL
>
>> ) AGI
>> ) AMI
>> ) Asterisk applications
>
> I would add AEL and pbx_lua to the list above.

On Tue, 5 May 2009, Danny Nicholas wrote:

> Please elaborate;  obviously ?? the dialplan is the simplest route to 
> solve any problem.

Up to a point. I think of AGIs as little black boxes that hide complexity 
and allow the dialplan to remain simple and robust.

> Pbx_lua and ael are the next logical extensions to dialplan(?)

My guess would be AEL then lua, but it's just a guess. I'm starting to use 
AEL in 1.2 -- syntax checking sux and inconsistencies abound. I'm hoping 
AEL has gotten better.

> AGI can be simple custom code in PHP, Perl, C, etc. AMI is like AGI but 
> using Manager interface...

AMI is not like AGI.

They have similarities -- AGI talks to Asterisk via a pipe, AMI talks via 
a socket. Both can be written in any language. (Actually, both are just 
protocols, so using them as "nouns" is just a shorthand for "a process 
conforming to the [AGI|AMI] protocol."

But, they are different tools for a different set of problems. AGI focuses 
on a channel but can interact with Asterisk as a whole. AMI focuses on 
Asterisk as a whole, but can interact with a channel. AGI executes in 
response to a action in the dialplan (calling AGI()) and it's "lifespan" 
is (usually) a subset of the lifespan of a channel. AMI executes either as 
a daemon or in response to a process external to Asterisk -- like a web 
page or a program executed from cron.

I've never used AMI for anything other than simple stuff like "please 
reload" or "how many channels are active" so I could be all wet here.

> and Asterisk Applications is tweaking, patching or rewriting the native 
> C code??

Yes. This is where it gets fun -- a simple programming error can crash 
Asterisk -- taking all in-flight calls with it. If you're contemplating 
solving your problem with an application, contemplate adding another "0" 
or 2 to your development and maintenance costs :)

Thanks in advance,
------------------------------------------------------------------------
Steve Edwards      sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                             Fax: +1-760-731-3000



More information about the asterisk-users mailing list