The Asterisk dial plan is a powerful tool for creating custom voice applications using its built-in functions. The Asterisk Extension Language (AEL) offers a high-level syntax, similar to extensions.conf
, for defining dial plan logic. With the dial plan, you can manipulate database data via func_odbc
, execute Linux system scripts and process their results, send notifications to web applications using the curl
function, and even send email or Jabber/Google Talk notifications.
Despite the capabilities of the dial plan, there are situations where using the Asterisk Gateway Interface (AGI) is more advantageous. Consider using AGI for the following reasons:
- Complex Dial Plan Logic: If your dial plan becomes overly complex with numerous macros and contexts, AGI can help simplify code management and improve readability.
- Multi-Tenant Hosting: For systems hosting multiple customers, each with distinct needs and functionalities, AGI offers a more flexible and customizable solution.
- Application Integration: When integration with external applications or web services is required, particularly for processing inbound and outbound events, AGI can facilitate seamless communication and data exchange.
- API Development: AGI can be used to create an API, enabling third-party applications to interact with your Asterisk system.
- Intensive Database Interaction: If your application relies heavily on a database and requires persistent or complex data access, AGI can provide the necessary capabilities more effectively than dial plan functions alone.
It is important to adhere to the “KISS principle” (Keep It Simple, Stupid). If a task can be accomplished effectively using only the dial plan, that is generally the recommended approach. However, if the dial plan would require extensive calls to external shell scripts or involves significantly complex logic, developing an AGI application is often a more robust and maintainable solution.