public class VoiceClient extends AbstractClient
NexmoClient.getVoiceClient().| Modifier and Type | Field and Description |
|---|---|
protected com.nexmo.client.voice.CallsEndpoint |
calls |
protected com.nexmo.client.voice.DownloadRecordingEndpoint |
downloadRecording |
protected DtmfEndpoint |
dtmf |
protected com.nexmo.client.voice.StreamsEndpoint |
streams |
protected TalkEndpoint |
talk |
httpWrapper| Constructor and Description |
|---|
VoiceClient(HttpWrapper httpWrapper)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
CallEvent |
createCall(Call callRequest)
Begin a call to a phone number.
|
Recording |
downloadRecording(java.lang.String recordingUrl)
Download a recording, given the recordingUrl provided from the webhook callback.
|
CallInfo |
getCallDetails(java.lang.String uuid)
Look up the status of a single call initiated by
createCall(Call). |
CallInfoPage |
listCalls()
Obtain the first page of CallInfo objects, representing the most recent calls initiated by
createCall(Call). |
CallInfoPage |
listCalls(CallsFilter filter)
Obtain the first page of CallInfo objects matching the query described by
filter, representing the most
recent calls initiated by createCall(Call). |
ModifyCallResponse |
modifyCall(CallModifier modifier)
Modify an ongoing call using a CallModifier object.
|
ModifyCallResponse |
modifyCall(java.lang.String uuid,
ModifyCallAction action)
Modify an ongoing call.
|
DtmfResponse |
sendDtmf(java.lang.String uuid,
java.lang.String digits)
Send DTMF codes to an ongoing call.
|
StreamResponse |
startStream(java.lang.String uuid,
java.lang.String streamUrl)
Stream audio to an ongoing call.
|
StreamResponse |
startStream(java.lang.String uuid,
java.lang.String streamUrl,
int loop)
Stream audio to an ongoing call.
|
TalkResponse |
startTalk(java.lang.String uuid,
java.lang.String text)
Send a synthesized speech message to an ongoing call.
|
TalkResponse |
startTalk(java.lang.String uuid,
java.lang.String text,
int loop)
Send a synthesized speech message to an ongoing call.
|
TalkResponse |
startTalk(java.lang.String uuid,
java.lang.String text,
VoiceName voiceName)
Send a synthesized speech message to an ongoing call.
|
TalkResponse |
startTalk(java.lang.String uuid,
java.lang.String text,
VoiceName voiceName,
int loop)
Send a synthesized speech message to an ongoing call.
|
StreamResponse |
stopStream(java.lang.String uuid)
Stop the audio being streamed into a call.
|
TalkResponse |
stopTalk(java.lang.String uuid)
Stop the message being spoken into a call.
|
ModifyCallResponse |
transferCall(java.lang.String uuid,
Ncco ncco)
Transfer a call to a different NCCO.
|
ModifyCallResponse |
transferCall(java.lang.String uuid,
java.lang.String nccoUrl)
Transfer a call to a different NCCO endpoint.
|
protected final com.nexmo.client.voice.CallsEndpoint calls
protected final com.nexmo.client.voice.StreamsEndpoint streams
protected final TalkEndpoint talk
protected final DtmfEndpoint dtmf
protected final com.nexmo.client.voice.DownloadRecordingEndpoint downloadRecording
public VoiceClient(HttpWrapper httpWrapper)
httpWrapper - (required) shared HTTP wrapper object used for making REST calls.public CallEvent createCall(Call callRequest) throws NexmoResponseParseException, NexmoClientException
callRequest - Describing the call to be made.uuid required to interact
with the ongoing phone call.NexmoClientException - if there was a problem with the Nexmo request or response objects.NexmoResponseParseException - if the response from the API could not be parsed.public CallInfoPage listCalls() throws NexmoResponseParseException, NexmoClientException
createCall(Call).NexmoClientException - if there was a problem with the Nexmo request or response objects.NexmoResponseParseException - if the response from the API could not be parsed.public CallInfoPage listCalls(CallsFilter filter) throws NexmoResponseParseException, NexmoClientException
filter, representing the most
recent calls initiated by createCall(Call).filter - (optional) A filter describing which calls to be listed.NexmoClientException - if there was a problem with the Nexmo request or response objects.NexmoResponseParseException - if the response from the API could not be parsed.public CallInfo getCallDetails(java.lang.String uuid) throws NexmoResponseParseException, NexmoClientException
createCall(Call).uuid - (required) The UUID of the call, obtained from the object returned by createCall(Call). This
value can be obtained with CallEvent.getUuid()NexmoClientException - if there was a problem with the Nexmo request or response objects.NexmoResponseParseException - if the response from the API could not be parsed.public DtmfResponse sendDtmf(java.lang.String uuid, java.lang.String digits) throws NexmoResponseParseException, NexmoClientException
uuid - (required) The UUID of the call, obtained from the object returned by createCall(Call).
This value can be obtained with CallEvent.getUuid()digits - (required) A string specifying the digits to be sent to the call. Valid characters are the digits
1-9</tt>, <tt>#</tt>, <tt>*</tt>, with the special character <tt>p indicating a short pause
between tones.NexmoClientException - if there was a problem with the Nexmo request or response objects.NexmoResponseParseException - if the response from the API could not be parsed.public ModifyCallResponse modifyCall(java.lang.String uuid, ModifyCallAction action) throws NexmoResponseParseException, NexmoClientException
This method modifies an ongoing call, identified by "uuid". Modifications to the call can be one of:
uuid - The UUID of the call, obtained from the object returned by createCall(Call). This value
can be obtained with CallEvent.getUuid()action - One of: "hangup", "mute", "unmute", "earmuff", "unearmuff"NexmoClientException - if there was a problem with the Nexmo request or response objects.NexmoResponseParseException - if the response from the API could not be parsed.public ModifyCallResponse modifyCall(CallModifier modifier) throws NexmoResponseParseException, NexmoClientException
In most cases, you will want to use modifyCall(String, ModifyCallAction) or transferCall(String,
String) instead of this method.
modifier - A CallModifier describing the modification to be made.NexmoClientException - if there was a problem with the Nexmo request or response objects.NexmoResponseParseException - if the response from the API could not be parsed.public ModifyCallResponse transferCall(java.lang.String uuid, java.lang.String nccoUrl) throws NexmoResponseParseException, NexmoClientException
uuid - The UUID of the call, obtained from the object returned by createCall(Call). This value
can be obtained with CallEvent.getUuid()nccoUrl - The URL of the NCCO endpoint the call should be transferred toNexmoClientException - if there was a problem with the Nexmo request or response objects.NexmoResponseParseException - if the response from the API could not be parsed.public ModifyCallResponse transferCall(java.lang.String uuid, Ncco ncco) throws NexmoResponseParseException, NexmoClientException
uuid - The UUID of the call, obtained from the object returned by createCall(Call). This value can
be obtained with CallEvent.getUuid()ncco - The new NCCO that will be used in the call.NexmoClientException - if there was a problem with the Nexmo request or response objects.NexmoResponseParseException - if the response from the API could not be parsed.public StreamResponse startStream(java.lang.String uuid, java.lang.String streamUrl, int loop) throws NexmoResponseParseException, NexmoClientException
uuid - The UUID of the call, obtained from the object returned by createCall(Call). This value
can be obtained with CallEvent.getUuid()streamUrl - A URL of an audio file in MP3 or 16-bit WAV format, to be streamed to the call.loop - The number of times to repeat the audio. The default value is 1, or you can use 0 to indicate that the audio should be repeated indefinitely.NexmoClientException - if there was a problem with the Nexmo request or response objects.NexmoResponseParseException - if the response from the API could not be parsed.public StreamResponse startStream(java.lang.String uuid, java.lang.String streamUrl) throws NexmoResponseParseException, NexmoClientException
uuid - The UUID of the call, obtained from the object returned by createCall(Call). This value
can be obtained with CallEvent.getUuid()streamUrl - A URL of an audio file in MP3 or 16-bit WAV format, to be streamed to the call.NexmoClientException - if there was a problem with the Nexmo request or response objects.NexmoResponseParseException - if the response from the API could not be parsed.public StreamResponse stopStream(java.lang.String uuid) throws NexmoResponseParseException, NexmoClientException
uuid - The UUID of the call, obtained from the object returned by createCall(Call). This value can
be obtained with CallEvent.getUuid()NexmoClientException - if there was a problem with the Nexmo request or response objects.NexmoResponseParseException - if the response from the API could not be parsed.public TalkResponse startTalk(java.lang.String uuid, java.lang.String text) throws NexmoResponseParseException, NexmoClientException
The message will only play once, spoken with the default voice of Kimberly.
uuid - The UUID of the call, obtained from the object returned by createCall(Call). This value can
be obtained with CallEvent.getUuid()text - The message to be spoken to the call participants.NexmoClientException - if there was a problem with the Nexmo request or response objects.NexmoResponseParseException - if the response from the API could not be parsed.public TalkResponse startTalk(java.lang.String uuid, java.lang.String text, VoiceName voiceName) throws NexmoResponseParseException, NexmoClientException
uuid - The UUID of the call, obtained from the object returned by createCall(Call). This value
can be obtained with CallEvent.getUuid()text - The message to be spoken to the call participants.voiceName - The voice to be used to speak the message.NexmoClientException - if there was a problem with the Nexmo request or response objects.NexmoResponseParseException - if the response from the API could not be parsed.public TalkResponse startTalk(java.lang.String uuid, java.lang.String text, int loop) throws NexmoResponseParseException, NexmoClientException
The message will be spoken with the default voice of Kimberly.
uuid - The UUID of the call, obtained from the object returned by createCall(Call). This value can
be obtained with CallEvent.getUuid()text - The message to be spoken to the call participants.loop - The number of times to repeat the message. The default value is 1, or you can use 0
to indicate that the message should be repeated indefinitely.NexmoClientException - if there was a problem with the Nexmo request or response objects.NexmoResponseParseException - if the response from the API could not be parsed.public TalkResponse startTalk(java.lang.String uuid, java.lang.String text, VoiceName voiceName, int loop) throws NexmoResponseParseException, NexmoClientException
uuid - The UUID of the call, obtained from the object returned by createCall(Call). This value
can be obtained with CallEvent.getUuid()text - The message to be spoken to the call participants.voiceName - The voice to be used to speak the message.loop - The number of times to repeat the message. The default value is 1, or you can use 0 to indicate that the message should be repeated indefinitely.NexmoClientException - if there was a problem with the Nexmo request or response objects.NexmoResponseParseException - if the response from the API could not be parsed.public TalkResponse stopTalk(java.lang.String uuid) throws NexmoResponseParseException, NexmoClientException
uuid - The UUID of the call, obtained from the object returned by createCall(Call). This value can
be obtained with CallEvent.getUuid()NexmoClientException - if there was a problem with the Nexmo request or response objects.NexmoResponseParseException - if the response from the API could not be parsed.public Recording downloadRecording(java.lang.String recordingUrl) throws NexmoResponseParseException, NexmoClientException
This returns a Recording object which can provide an InputStream of the byte data, or can be used to save
directly to file.
recordingUrl - The recordingUrl provided by the webhook callbackNexmoClientException - if there was a problem with the Nexmo request or response objects.NexmoResponseParseException - if the response from the API could not be parsed.