Asterisk AMI API Action Orginate: Orginate Asterisk manager Action

Asterisk Manager API Action Originate

Action: Originate
Parameters:

  • Channel: Channel on which to originate the call (The same as you specify in the Dial application command)
  • Context: Context to use on connect (must use Exten & Priority with it)
  • Exten: Extension to use on connect (must use Context & Priority with it)
  • Priority: Priority to use on connect (must use Context & Exten with it)
  • Timeout: Timeout (in milliseconds) for the originating connection to happen(defaults to 30000 milliseconds)
  • CallerID: CallerID to use for the call
  • Variable: Channels variables to set (max 32). Variables will be set for both channels (local and connected).
  • Account: Account code for the call
  • Application: Application to use on connect (use Data for parameters)
  • Data : Data if Application parameter is used
  • Async: For the origination to be asynchronous (allows multiple calls to be generated without waiting for a response)
  • ActionID: The request identifier. It allows you to identify the response to this request. You may use a number or a string. Useful when you make several simultaneous requests.

How this action will perform:

First the Channel is rung. Then, when that answers, the Extension is dialled within the Context to initiate the other end of the call.

Also note that the Timeout only applies to the initial connection to the Channel; any timeout for the other end can be specified, for instance in a Dial command in the definition of the Context.

Using Async  leads to an OriginateResponse event which contains the failure reason if any. Reason may be one of the following:

0 = no such extension or number. Also bad dial tech ie. name of a sip trunk that deosn’t exist
1 = no answer
4 = answered
5 = busy
8 = congested or not available (Disconnected Number)

For complete list of the reason please see the ast_control_frame_type enum in frame.h
The fallowing was derived from the Asterisk 1.6.2.0 source:

1 = Other end has hungup
2 = Local ring
3 = Remote end is ringing
4 = Remote end has answered
5 = Remote end is busy
6 = Make it go off hook
7 = Line is off hook
8 = Congestion (circuits busy)

 

Example(Placing a call from a SIP channel to an extension, this will cause the outside call not to be placed until the SIP channel has picked up):

 

Action: Originate
Channel: Dahdi/g2/8135551212
Context: default
Exten: 101
Priority: 1
Timeout: 30000
Callerid: 01126368510

Where Extension 101 is a local SIP phone extension

 

Related Posts

  • 49
    What is command and how it works? One of Asterisk’s most valuable features is its ability to connect different callers to each other. This is especially useful when callers are using different methods of communication. For example, caller A might be communicating over the traditional analog telephone network, while user…
    Tags: call, channel, dial, will, set, exten, priority, extension, asterisk, application
  • 44
    Action: Redirect Synopsis: Redirect (transfer) a call Privilege: call,all Description: Redirect (transfer) a call. Variables: (Names marked with * are required) Channel: Channel to redirect ExtraChannel: Second call leg to transfer (optional) Exten: Extension to transfer to Context: Context to transfer to Priority: Priority to transfer to ActionID: Optional Action…
    Tags: action, call, context, priority, channel, asterisk, exten, extension, manager, api
  • 38
    Dial() is perhaps the most important application in Asterisk. Dial() accepts every valid channel type (e.g. SIP, IAX2, H.323, MGCP, Local, Zap, Dahdi), The allowable parameters are channel-specific; i.e., what parameters a channel requires or will accept depends on the nature of the channel technology. For example, a SIP channel will require an IP address…
    Tags: call, channel, set, dial, asterisk, exten, will, extension, context
  • 35
    Pre-dial handlers allow you to execute a dialplan subroutine on a channel before a call is placed but after the application performing a dial action is invoked. This means that the handlers are executed after the creation of the caller/callee channels, but before any actions have been taken to actually…
    Tags: channel, dial, call, application, channels, exten, action, asterisk

Satya Prakash

VOIP Expert: More than 8 years of experience in Asterisk Development and Call Center operation Management. Unique Combination of Skill Set as IT, Analytics and operation management.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: