net.sf.asterisk.manager.action
Class OriginateAction

java.lang.Object
  extended by net.sf.asterisk.manager.action.AbstractManagerAction
      extended by net.sf.asterisk.manager.action.OriginateAction
All Implemented Interfaces:
java.io.Serializable, EventGeneratingAction, ManagerAction

public class OriginateAction
extends AbstractManagerAction
implements EventGeneratingAction

The OriginateAction generates an outgoing call to the extension in the given context with the given priority or to a given application with optional parameters.
If you want to connect to an extension use the properties context, exten and priority. If you want to connect to an application use the properties application and data if needed. Note that no call detail record will be written when directly connecting to an application, so it may be better to connect to an extension that starts the application you wish to connect to.
The response to this action is sent when the channel has been answered and asterisk starts connecting it to the given extension. So be careful not to choose a too short timeout when waiting for the response.
If you set async to true Asterisk reports an OriginateSuccess- and OriginateFailureEvents. The action id of these events equals the action id of this OriginateAction.

Version:
$Id: OriginateAction.java,v 1.9 2005/10/29 12:00:11 srt Exp $
Author:
srt
See Also:
OriginateSuccessEvent, OriginateFailureEvent, Serialized Form

Constructor Summary
OriginateAction()
           
 
Method Summary
 java.lang.String getAccount()
          Returns the account code to use for the originated call.
 java.lang.String getAction()
          Returns the name of this action, i.e.
 java.lang.Class getActionCompleteEventClass()
          Returns the event type that indicates that Asterisk is finished sending response events for this action.
 java.lang.String getApplication()
          Returns the name of the application to connect to.
 java.lang.Boolean getAsync()
          Returns true if this is a fast origination.
 java.lang.String getCallerId()
          Returns the caller id to set on the outgoing channel.
 java.lang.Boolean getCallingPres()
          Returns true if Caller ID presentation is set on the outgoing channel.
 java.lang.String getChannel()
          Returns the name of the channel to connect to the outgoing call.
 java.lang.String getContext()
          Returns the name of the context of the extension to connect to.
 java.lang.String getData()
          Returns the parameters to pass to the application.
 java.lang.String getExten()
          Returns the extension to connect to.
 java.lang.Integer getPriority()
          Returns the priority of the extension to connect to.
 java.lang.Long getTimeout()
          Returns the timeout for the origination.
 java.util.Map getVariables()
          Returns the variables to set on the originated call.
 void setAccount(java.lang.String account)
          Sets the account code to use for the originated call.
The account code is included in the call detail record generated for this call and will be used for billing.
 void setApplication(java.lang.String application)
          Sets the name of the application to connect to.
 void setAsync(java.lang.Boolean async)
          Set to true for fast origination.
 void setCallerId(java.lang.String callerId)
          Sets the caller id to set on the outgoing channel.
 void setCallingPres(java.lang.Boolean callingPres)
          Set to true if you want Caller ID presentation to be set on the outgoing channel.
 void setChannel(java.lang.String channel)
          Sets the name of the channel to connect to the outgoing call.
This property is required.
 void setContext(java.lang.String context)
          Sets the name of the context of the extension to connect to.
If you set the context you also have to set the exten and priority properties.
 void setData(java.lang.String data)
          Sets the parameters to pass to the application.
 void setExten(java.lang.String exten)
          Sets the extension to connect to.
If you set the extension you also have to set the context and priority properties.
 void setPriority(java.lang.Integer priority)
          Sets the priority of the extension to connect to.
 void setTimeout(java.lang.Integer timeout)
          Deprecated. use setTimeout(Long) instead.
 void setTimeout(java.lang.Long timeout)
          Sets the timeout (in milliseconds) for the origination.
The channel must be answered within this time, otherwise the origination is considered to have failed and an OriginateFailureEvent is generated.
If not set, Asterisk assumes a default value of 30000 meaning 30 seconds.
 void setVariable(java.lang.String variable)
          Deprecated. use setVariables(Map) instead.
 void setVariables(java.util.Map variables)
          Sets the variables to set on the originated call.
 
Methods inherited from class net.sf.asterisk.manager.action.AbstractManagerAction
getActionId, setActionId, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.asterisk.manager.action.ManagerAction
getActionId, setActionId
 

Constructor Detail

OriginateAction

public OriginateAction()
Method Detail

getAction

public java.lang.String getAction()
Returns the name of this action, i.e. "Originate".

Specified by:
getAction in interface ManagerAction
Specified by:
getAction in class AbstractManagerAction

getAccount

public java.lang.String getAccount()
Returns the account code to use for the originated call.


setAccount

public void setAccount(java.lang.String account)
Sets the account code to use for the originated call.
The account code is included in the call detail record generated for this call and will be used for billing.


getCallerId

public java.lang.String getCallerId()
Returns the caller id to set on the outgoing channel.


setCallerId

public void setCallerId(java.lang.String callerId)
Sets the caller id to set on the outgoing channel.


getCallingPres

public java.lang.Boolean getCallingPres()
Returns true if Caller ID presentation is set on the outgoing channel.


setCallingPres

public void setCallingPres(java.lang.Boolean callingPres)
Set to true if you want Caller ID presentation to be set on the outgoing channel.


getChannel

public java.lang.String getChannel()
Returns the name of the channel to connect to the outgoing call.


setChannel

public void setChannel(java.lang.String channel)
Sets the name of the channel to connect to the outgoing call.
This property is required.


getContext

public java.lang.String getContext()
Returns the name of the context of the extension to connect to.


setContext

public void setContext(java.lang.String context)
Sets the name of the context of the extension to connect to.
If you set the context you also have to set the exten and priority properties.


getExten

public java.lang.String getExten()
Returns the extension to connect to.


setExten

public void setExten(java.lang.String exten)
Sets the extension to connect to.
If you set the extension you also have to set the context and priority properties.


getPriority

public java.lang.Integer getPriority()
Returns the priority of the extension to connect to.


setPriority

public void setPriority(java.lang.Integer priority)
Sets the priority of the extension to connect to. If you set the priority you also have to set the context and exten properties.


getApplication

public java.lang.String getApplication()
Returns the name of the application to connect to.


setApplication

public void setApplication(java.lang.String application)
Sets the name of the application to connect to.


getData

public java.lang.String getData()
Returns the parameters to pass to the application.


setData

public void setData(java.lang.String data)
Sets the parameters to pass to the application.


getTimeout

public java.lang.Long getTimeout()
Returns the timeout for the origination.


setTimeout

public void setTimeout(java.lang.Integer timeout)
Deprecated. use setTimeout(Long) instead.

Sets the timeout (in milliseconds) for the origination.
The channel must be answered within this time, otherwise the origination is considered to have failed and an OriginateFailureEvent is generated.
If not set, Asterisk assumes a default value of 30000 meaning 30 seconds.

Parameters:
timeout - the timeout in milliseconds

setTimeout

public void setTimeout(java.lang.Long timeout)
Sets the timeout (in milliseconds) for the origination.
The channel must be answered within this time, otherwise the origination is considered to have failed and an OriginateFailureEvent is generated.
If not set, Asterisk assumes a default value of 30000 meaning 30 seconds.

Parameters:
timeout - the timeout in milliseconds

setVariable

public void setVariable(java.lang.String variable)
Deprecated. use setVariables(Map) instead.

Sets the variables to set on the originated call.
Variable assignments are of the form "VARNAME=VALUE". You can specify multiple variable assignments separated by the '|' character.
Example: "VAR1=abc|VAR2=def" sets the channel variables VAR1 to "abc" and VAR2 to "def".


getVariables

public java.util.Map getVariables()
Returns the variables to set on the originated call.

Parameters:
variables - a Map containing the variable names as key and their values as value.
Since:
0.2

setVariables

public void setVariables(java.util.Map variables)
Sets the variables to set on the originated call.

Parameters:
variables - a Map containing the variable names as key and their values as value.
Since:
0.2

getAsync

public java.lang.Boolean getAsync()
Returns true if this is a fast origination.


setAsync

public void setAsync(java.lang.Boolean async)
Set to true for fast origination. Only with fast origination Asterisk will send OriginateSuccess- and OriginateFailureEvents.


getActionCompleteEventClass

public java.lang.Class getActionCompleteEventClass()
Description copied from interface: EventGeneratingAction
Returns the event type that indicates that Asterisk is finished sending response events for this action.

Specified by:
getActionCompleteEventClass in interface EventGeneratingAction
Returns:
a Class that is an instance of ResponseEvent.
See Also:
ResponseEvent


Copyright © 2004-2005 Stefan Reuter. All Rights Reserved.