Making Calls with Asterisk Ami
This time we are going to do something a bit more excited with the Asterisk Ami. We are going to make a call through the Asterisk Ami.
Asterisk Ami Commands
Before we are getting started with the originate function, let's take a look at all the Asterisk AMI commands that are available within Asterisk.
Let's login into the Asterisk CLI and use the following command:
$ manager show commands
This will bring up a list view of all the available Asterisk AMI commands:
AbsoluteTimeout Set Absolute Timeout
AgentCallbackLo Sets an agent as logged in by callback
AgentLogoff Sets an agent as no longer logged in
Agents Lists agents and their status
ChangeMonitor Change monitoring filename of a channel
Command Execute Asterisk CLI Command
DBGet Get DB Entry
DBPut Put DB Entry
Events Control Event Flow
ExtensionState Check Extension Status
GetConfig Retrieve configuration
Getvar Gets a Channel Variable
Hangup Hangup Channel
IAXnetstats Show IAX Netstats
IAXpeers List IAX Peers
ListCommands List available manager commands
Logoff Logoff Manager
MailboxCount Check Mailbox Message Count
MailboxStatus Check Mailbox
Monitor Monitor a channel
Originate Originate Call
Park Park a channel
ParkedCalls List parked calls
PauseMonitor Pause monitoring of a channel
Ping Keepalive command
PlayDTMF Play DTMF signal on a specific channel.
QueueAdd Add interface to queue.
QueuePause Makes a queue member temporarily unavailable
QueueRemove Remove interface from queue.
QueueStatus Queue Status
Redirect Redirect (transfer) a call
SetCDRUserField Set the CDR UserField
Setvar Set Channel Variable
SIPpeers List SIP peers (text format)
SIPshowpeer Show SIP peer (text format)
Status Lists channel status
StopMonitor Stop monitoring a channel
UnpauseMonitor Unpause monitoring of a channel
UpdateConfig Update basic configuration
UserEvent Send an arbitrary event
WaitEvent Wait for an event to occur
Asterisk AMI Originate Dial
In order to use the Asterisk originate Ami Dial action, you first need to understand the required syntax which can be found with the following Asterisk Ami Command.
$ manager show command Originate
This will open the documentation for the Originate command and provide an overview of the relevant options available:
ActionID for this transaction. Will be returned.
Channel name to call.
Extension to use (requires 'Context' and 'Priority')
Context to use (requires 'Exten' and 'Priority')
Priority to use (requires 'Exten' and 'Context')
Application to execute.
Data to use (requires 'Application').
How long to wait for call to be answered (in ms.).
Caller ID to be set on the outgoing channel.
Channel variable to set, multiple Variable: headers are allowed.
Set to 'true' to force call bridge on early media..
Set to 'true' for fast origination.
Comma-separated list of codecs to use for this call.
Channel UniqueId to be set on the channel.
Channel UniqueId to be set on the second local channel.
The next step is to try it out.
To do this, connect to the Asterisk Ami and start with authenticating yourself. Once connected and authenticated, you will be able to start using the Originate Dial command.
This can be done by writing the following command.
Now extension 101 will be dialed, after the user picks up, extension 100 will be dialed.