Why create AGI?


Asterisk dial-plan is powerful, and possible to create a number of custom voice applications only with its functions... AEL looks like high-level language, of course, it is just a view of standard expressions, same as in extensions.conf, but.
You can manipulate database data through func_odbc, you can call a Linux system script and process result, in case if you want to send a notice about event to a web application, you can use a curl function.
No problem to send out email or jabber/google talk notification...

So, why and when you should use AGI? I believe, correct answers are:
  • Dial-plan is complex, you have a growing amount of huge macros and contexts;
  • System are hosted or cluster with various customers with different needs and functions;
  • You do integration with another application or web app and have to process inbound events (and send outbound);
  • Want to create an API to support 3rd apps;
  • Application API of another application;
  • And most important – database is a core part of application and should access data permanently.
There are many reasons too, but basically it is good to always keep in mind a KISS principle. If task can be resolved without using AGI, do that and use dial-plan. If dial-plan call a lot of external shell scripts – create AGI app.