public class ManagerResponse extends Object implements Serializable
The response can be linked with the action that caused it by looking the action id attribute that will match the action id of the corresponding action.
ManagerAction
,
Serialized FormConstructor and Description |
---|
ManagerResponse() |
Modifier and Type | Method and Description |
---|---|
String |
getActionId()
Returns the user provided action id of the ManagerAction that caused this
response.
|
String |
getAttribute(String key)
Returns the value of the attribute with the given key.
|
Map<String,Object> |
getAttributes()
Returns a Map with all attributes of this response.
|
Date |
getDateReceived()
Returns the point in time this response was received from the asterisk
server.
|
String |
getEventList()
Sent for manager events that reply with a list of events.
|
String |
getEvents() |
String |
getMessage()
Returns the message received with this response.
|
String |
getOutput() |
String |
getResponse()
Returns the value of the "Response:" line.
|
String |
getServer()
Returns the name of the Asterisk server from which this response has been
received.
|
String |
getUniqueId()
Returns the unique id received with this response.
|
void |
setActionId(String actionId)
Sets the action id of the ManagerAction that caused this response.
|
void |
setAttributes(Map<String,Object> attributes)
Sets the Map with all attributes.
|
void |
setDateReceived(Date dateReceived)
Sets the point in time this response was received from the asterisk
server.
|
void |
setEventList(String eventList)
Sets the eventList.
|
void |
setEvents(String events) |
void |
setMessage(String message)
Sets the message.
|
void |
setOutput(String output) |
void |
setResponse(String response)
Sets the response.
|
void |
setServer(String server)
Sets the name of the Asterisk server from which this response has been
received.
|
void |
setUniqueId(String uniqueId)
Sets the unique id received with this response.
|
protected Integer |
stringToInteger(String s,
String suffix) |
protected Long |
stringToLong(String s,
String suffix) |
String |
toString() |
public Map<String,Object> getAttributes()
The keys are all lower case!
getAttribute(String)
public void setAttributes(Map<String,Object> attributes)
attributes
- Map with containing the attributes with all lower case
keys.public String getAttribute(String key)
This is particulary important when a response contains special attributes that are dependent on the action that has been sent.
An example of this is the response to the GetVarAction. It contains the value of the channel variable as an attribute stored under the key of the variable name.
Example:
GetVarAction action = new GetVarAction(); action.setChannel("SIP/1310-22c3"); action.setVariable("ALERT_INFO"); ManagerResponse response = connection.sendAction(action); String alertInfo = response.getAttribute("ALERT_INFO");As all attributes are internally stored in lower case the key is automatically converted to lower case before lookup.
key
- the key to lookup.null
if there is no such attribute.public Date getDateReceived()
public void setDateReceived(Date dateReceived)
public String getActionId()
null
.null
if none was set.ManagerAction.setActionId(String)
public final String getServer()
null
when directly connected to an
Asterisk server instead of AstManProxy.public final void setServer(String server)
server
- the name of the Asterisk server from which this response
has been received.public String getEventList()
public void setEventList(String eventList)
eventList
- the eventList.public void setActionId(String actionId)
actionId
- the action id of the ManagerAction that caused this
response.public String getMessage()
public void setMessage(String message)
public String getResponse()
public void setResponse(String response)
public String getUniqueId()
public void setUniqueId(String uniqueId)
protected Integer stringToInteger(String s, String suffix) throws NumberFormatException
NumberFormatException
protected Long stringToLong(String s, String suffix) throws NumberFormatException
NumberFormatException
public String getEvents()
public void setEvents(String events)
public String getOutput()
public void setOutput(String output)
Copyright © 2004–2017. All rights reserved.