The Asterisk dial-plan is a powerful tool for creating custom voice applications using its functions. The AEL (Asterisk Extension Language) provides a high-level view of standard expressions, similar to extensions.conf. With the dial-plan, you can manipulate database data through func_odbc, call Linux system scripts and process the results, send notifications to web applications using the curl function, and even send emails or jabber/google talk notifications.
However, there are situations where using AGI (Asterisk Gateway Interface) is preferred. Here are some reasons to consider using AGI:
- Complex dial-plan: If your dial-plan is becoming complex with a growing number of macros and contexts, using AGI can help simplify and manage the code.
- Hosting multiple customers: If your system is hosted or clustered with various customers, each with different needs and functions, AGI can provide a more flexible and customizable solution.
- Integration with other applications: If you need to integrate with another application or web app, and process inbound events and send outbound events, AGI can facilitate the communication and data processing.
- Creating an API: AGI can be used to create an API that supports third-party applications, allowing them to interact with your Asterisk system.
- Accessing a database: If your application heavily relies on a database and requires permanent access to data, AGI can provide the necessary functionality.
It’s important to keep in mind the “KISS principle” (Keep It Simple, Stupid). If a task can be resolved without using AGI, it’s recommended to use the dial-plan. However, if the dial-plan involves calling a lot of external shell scripts or requires more complex functionality, creating an AGI application may be a better approach.