Quantcast
Channel: VOIP-info.org Wiki Changes
Viewing all articles
Browse latest Browse all 5767

Asterisk Manager API Action Originate

$
0
0
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.

Sequence of events: first the Channel is rung. Then, when that answers, the Extension is dialled within the Context to initiate the other end of the call. 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)

See the ast_control_frame_type enum in frame.h for a complete (and up to date) list of possible reasons.
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: SIP/101test
Context: default
Exten: 8135551212
Priority: 1
Callerid: 3125551212
Timeout: 30000
Variable: var1=23|var2=24|var3=25
ActionID: ABC45678901234567890

Where Extension 8135551212 is a local an outbound number
The above example also shows how to set channel variables in an Originate request.

Note: You might have heard that in Asterisk 1.2 variables are no longer separated by |, rather each one has its own line. Well that is not true or maybe it has been that way for a while. Asterisk 1.2 current source code suggests that variable must be separated with | (check the function astman_get_variables). As of 1.6, variables are separated by commas.

The above example will also hangup if the SIP/101test channel is not picked up in 30 seconds. ...

Viewing all articles
Browse latest Browse all 5767

Trending Articles