Blogs
Take a look at the things that interest us.
Making Calls with Asterisk Ami
Today its time for us to do something that is a bit more exciting. We are going to make a call with the Asterisk AMI Manager Interface. It's time to take a look at the Asterisk Ami Actions and more specifically the Asterisk Ami Originate Dail Action.
Asterisk AMI Actions
Before we start with the Originate Dail Action we first want to talk about the Asterisk Ami and which other AMI commands are available for your version of Asterisk. Did you know that the Asterisk Ami has more than 40 commands available that can be used? With these commands, you can easily manage your whole Asterisk Management system. Rather than searching through Google to find the list, there is a simpler way which also has the benefit of being specific to your Asterisk phone system. All you need to do is simply use the following command in the Asterisk CLI:
manager show commands
This will bring up a list view of all the available AMI actions as shown below:
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. Queues Queues 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
The Originate dial action is probably one of the most used commands for the Asterisk Ami next to the login command. In order to use the Asterisk originate Ami Dail 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 Action and provide an overview of the relevant options available:
[Arguments] ActionID ActionID for this transaction. Will be returned. Channel Channel name to call. Exten Extension to use (requires 'Context' and 'Priority') Context Context to use (requires 'Exten' and 'Priority') Priority Priority to use (requires 'Exten' and 'Context') Application Application to execute. Data Data to use (requires 'Application'). Timeout How long to wait for call to be answered (in ms.). CallerID Caller ID to be set on the outgoing channel. Variable Channel variable to set, multiple Variable: headers are allowed. Account Account code. EarlyMedia Set to 'true' to force call bridge on early media.. Async Set to 'true' for fast origination. Codecs Comma-separated list of codecs to use for this call. ChannelId Channel UniqueId to be set on the channel. OtherChannelId 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 AMI perform to do actions.
After you have authenticated yourself its time to do the originate command. This can be done by writing the following command.
Action:Originate Channel:SIP/Wesley Contect:phones Exten:100 Priority:1
The result is that the Asterisk phone system will call Wesley and when Wesley answeres the fine he will be automatically connected to extension number 100. That’s it on the Asterisk AMI and for the Introducing of the Asterisk Ami Originate function.
In the last couple of weeks, we have created a free Customer Relationship Management system that uses the Asterisk Ami function to make calls between customers and extensions. This system can be download on our GitHub page [click here] and used. For more information about our free Customer Relationship Management system for Asterisk, give us a call on 06-6131-1267 or send us an email via our contact form to arrange a meeting. We can also customize the system for every kind of business.
5001 is queue number. Action: Originate Channel: Local/yourNumber@from-internal Exten: 5001 Context: from-internal Priority: 1 CallerID: yourNumber Variable: ID_CAMPAIGN=1,ID_CALL=1,NUMBER=yourNumber,QUEUE=5001,CONTEXT=from-internal Async: true ActionID: someNumber