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

 

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.

2 thoughts on “Asterisk AMI API Action Orginate: Orginate Asterisk manager Action

Leave a Reply