public class OriginateAction extends AbstractManagerAction implements EventGeneratingAction
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.
OriginateResponseEvent
,
Serialized FormConstructor and Description |
---|
OriginateAction() |
Modifier and Type | Method and Description |
---|---|
void |
addPjSipHeader(VariableInheritance inheritance,
String header) |
void |
addSipHeader(VariableInheritance inheritance,
String header) |
String |
getAccount()
Returns the account code to use for the originated call.
|
String |
getAction()
Returns the name of this action, i.e.
|
Class<? extends ResponseEvent> |
getActionCompleteEventClass()
Returns the event type that indicates that Asterisk is finished sending
response events for this action.
|
String |
getApplication()
Returns the name of the application to connect to.
|
Boolean |
getAsync()
Returns true if this is a fast origination.
|
String |
getCallerId()
Returns the caller id to set on the outgoing channel.
|
Integer |
getCallingPres()
Returns the calling presentation for the outgoing channel.
|
String |
getChannel()
Returns the name of the channel to connect to the outgoing call.
|
String |
getChannelId() |
String |
getCodecs()
Returns the codecs to use for the call.
|
String |
getContext()
Returns the name of the context of the extension to connect to.
|
String |
getData()
Returns the parameters to pass to the application.
|
Boolean |
getEarlyMedia() |
String |
getExten()
Returns the extension to connect to.
|
String |
getOtherChannelId() |
Integer |
getPriority()
Returns the priority of the extension to connect to.
|
Long |
getTimeout()
Returns the timeout for the origination.
|
Map<String,String> |
getVariables()
Returns the variables to set on the originated call.
|
void |
setAccount(String account)
Sets the account code to use for the originated call.
|
void |
setApplication(String application)
Sets the name of the application to connect to.
|
void |
setAsync(Boolean async)
Set to true for fast origination.
|
void |
setCallerId(String callerId)
Sets the caller id to set on the outgoing channel.
|
void |
setCallingPres(Integer callingPres)
Sets the calling presentation for the outgoing channel.
|
void |
setChannel(String channel)
Sets the name of the channel to connect to the outgoing call.
|
void |
setChannelId(String channelId)
this will be the channels uniqueID
|
void |
setCodecs(List<String> codecs)
Sets the codecs to use for the call.
|
void |
setCodecs(String codecs)
Sets the codecs to use for the call.
|
void |
setContext(String context)
Sets the name of the context of the extension to connect to.
|
void |
setData(String data)
Sets the parameters to pass to the application.
|
void |
setEarlyMedia(Boolean earlyMedia) |
void |
setExten(String exten)
Sets the extension to connect to.
|
void |
setOtherChannelId(String otherChannelId) |
void |
setPriority(Integer priority)
Sets the priority of the extension to connect to.
|
void |
setTimeout(Integer timeout)
Deprecated.
use
setTimeout(Long) instead. |
void |
setTimeout(Long timeout)
Sets the timeout (in milliseconds) for the origination.
|
void |
setVariable(String variable)
Deprecated.
use
setVariables(Map) instead. |
void |
setVariable(String name,
String value)
Sets an variable on the originated call.
|
void |
setVariables(Map<String,String> variables)
Sets the variables to set on the originated call.
|
getActionId, setActionId, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getActionId, setActionId
public String getAction()
getAction
in interface ManagerAction
getAction
in class AbstractManagerAction
public String getAccount()
public void setAccount(String account)
The account code is included in the call detail record generated for this call and will be used for billing.
account
- the account code to use for the originated call.public String getCallerId()
public void setCallerId(String callerId)
This includes both the Caller*Id Number and Caller*Id Name in the form "Jon Doe <1234>".
callerId
- the caller id to set on the outgoing channel.public Integer getCallingPres()
This property is only available on BRIstuffed Asterisk servers.
setCallingPres(Integer)
public void setCallingPres(Integer callingPres)
The number is an octet and the only bits you need worry about are bits 1,2,6 and 7.
Bits 1 and 2 define the screening indicator and bits 6 and 7 define the presentation indicator.
In essence, it says, 'Is the person who has been called allowed to see the callers number?' (presentation) and 'What authority was used to verify that this is a genuine number?' (screening).
Presentation indicator (Bits 6 and 7):
Bits Meaning 7 6 0 0 Presentation allowed 0 1 Presentation restricted 1 0 Number not available due to interworking 1 1 ReservedScreening indicator (Bits 1 and 2):
Bits Meaning 2 1 0 0 User-provided, not screened 0 1 User-provided, verified and passed 1 0 User-provided, verified and failed 1 1 Network providedExamples for some general settings:
Presentation Allowed, Network Provided: 3 (00000011) Presentation Restricted, User-provided, not screened: 32 (00100000) Presentation Restricted, User-provided, verified, and passed: 33 (00100001) Presentation Restricted, Network Provided: 35 (00100011)This property is only available on BRIstuffed Asterisk servers.
callingPres
- the calling presentation for the outgoing channel.public String getChannel()
public void setChannel(String channel)
This property is mandatory.
public String getContext()
public void setContext(String context)
If you set the context you also have to set the exten and priority properties.
public String getExten()
public void setExten(String exten)
If you set the extension you also have to set the context and priority properties.
public Integer getPriority()
public void setPriority(Integer priority)
public String getApplication()
public void setApplication(String application)
public String getData()
public void setData(String data)
public Long getTimeout()
@Deprecated public void setTimeout(Integer timeout)
setTimeout(Long)
instead.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.
timeout
- the timeout in millisecondspublic void setTimeout(Long timeout)
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.
timeout
- the timeout in milliseconds@Deprecated public void setVariable(String variable)
setVariables(Map)
instead.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".
public void setVariable(String name, String value)
name
- the name of the variable to set.value
- the value of the variable to set.public Map<String,String> getVariables()
public void setVariables(Map<String,String> variables)
variables
- a Map containing the variable names as key and their
values as value.public Boolean getAsync()
public void setAsync(Boolean async)
public void setEarlyMedia(Boolean earlyMedia)
earlyMedia
- the earlyMedia to setpublic Boolean getEarlyMedia()
public String getCodecs()
public void setCodecs(String codecs)
Available since Asterisk 1.6.
codecs
- comma separated list of codecs to use for the call.public void setCodecs(List<String> codecs)
Available since Asterisk 1.6.
codecs
- list of codecs to use for the call.public Class<? extends ResponseEvent> getActionCompleteEventClass()
EventGeneratingAction
getActionCompleteEventClass
in interface EventGeneratingAction
ResponseEvent
public void addSipHeader(VariableInheritance inheritance, String header)
public void addPjSipHeader(VariableInheritance inheritance, String header)
public void setChannelId(String channelId)
channelId
- public String getChannelId()
public void setOtherChannelId(String otherChannelId)
public String getOtherChannelId()
Copyright © 2004–2022. All rights reserved.