AVR-AMI is a Node.js application that provides a seamless integration with Asterisk Manager Interface (AMI) for call control operations. It enables the management of calls through a simple API interface, allowing for call transfers, hangups, and new call origination. This service is designed to work in conjunction with Agent Voice Response's Large Language Models (LLMs) to provide intelligent call handling capabilities.
- Call Control Operations:
- Transfer active calls to different extensions
- Hang up ongoing calls
- Originate new outbound calls
- UUID-based Call Tracking: Each call is tracked using a unique UUID generated before the Asterisk AudioSocket Application is invoked
- Simple REST API: Easy-to-use endpoints for call management
- LLM Integration: Seamless integration with Agent Voice Response's Large Language Models for intelligent call handling
- Node.js
- Asterisk server with Manager Interface enabled
-
Clone the repository:
git clone https://github.com/agentvoiceresponse/avr-ami.git cd avr-ami -
Install dependencies:
npm install
-
Configure your environment variables in
.env:PORT=6006 AMI_HOST=127.0.0.1 AMI_PORT=5038 AMI_USERNAME=avr AMI_PASSWORD=avr
These endpoints are primarily used by Agent Voice Response's Large Language Models to control calls through natural language processing:
Transfer an active call to a different extension.
Request Body:
{
"uuid": "call-uuid",
"exten": "1234",
"context": "from-internal",
"priority": 1
}Hang up an active call.
Request Body:
{
"uuid": "call-uuid"
}Initiate a new outbound call.
Request Body:
{
"channel": "SIP/trunk/1234567890",
"exten": "1234",
"context": "from-internal",
"priority": 1,
"callerid": "Agent Voice Response <avr>"
}-
Call Identification:
- Each call is assigned a unique UUID before the AudioSocket Application is invoked in the Asterisk dialplan
- The UUID is used to track and manage the call throughout its lifecycle
-
AMI Connection:
- The application maintains a persistent connection to Asterisk Manager Interface
- All call control operations are executed through AMI actions
-
Call Management:
- Calls can be transferred between extensions
- Active calls can be terminated
- New outbound calls can be initiated
- All operations are performed using the call's UUID for identification
-
LLM Integration:
- Agent Voice Response's Large Language Models process natural language commands
- The LLMs determine the appropriate call control action based on the conversation context
- Actions are executed through the API endpoints to control the call flow
- The system provides real-time feedback to the LLMs about the success or failure of operations
The application includes robust error handling:
- Validates all incoming requests
- Provides clear error messages for failed operations
- Ensures proper cleanup of resources
- Maintains connection stability with Asterisk