@datafire/nexmo_voice
Client library for Voice API
Installation and Usage
npm install --save @datafire/nexmo_voice
let nexmo_voice = require('@datafire/nexmo_voice').create({
bearerAuth: ""
});
.then(data => {
console.log(data);
});
Description
The Voice API lets you create outbound calls, control in-progress calls and get information about historical calls. More information about the Voice API can be found at https://developer.nexmo.com/voice/voice-api/overview.
Actions
getCalls
Get details of your calls
nexmo_voice.getCalls({}, context)
Input
- input
object
- status
string
(values: started, ringing, answered, machine, completed, busy, cancelled, failed, rejected, timeout, unanswered): Filter by call status - date_start
string
: Return the records that occurred after this point in time - date_end
string
: Return the records that occurred before this point in time - page_size
integer
: Return this amount of records in the response - record_index
integer
: Return calls from this index in the response - order
string
(values: asc, desc): Either ascending or descending order. - conversation_uuid
string
: Return all the records associated with a specific conversation.
- status
Output
- output GetCallsResponse
createCall
Create an outbound Call
nexmo_voice.createCall({}, context)
Input
- input
object
Output
- output CreateCallResponse
getCall
Get detail of a specific call
nexmo_voice.getCall({
"uuid": ""
}, context)
Input
- input
object
- uuid required
string
: UUID of the Call
- uuid required
Output
- output GetCallResponse
updateCall
Modify an in progress call
nexmo_voice.updateCall({
"body": null,
"uuid": ""
}, context)
Input
- input
object
- uuid required
string
: UUID of the Call
- uuid required
Output
Output schema unknown
startDTMF
Play DTMF tones into a call
nexmo_voice.startDTMF({
"body": {},
"uuid": ""
}, context)
Input
- input
object
- body required DTMFRequest
- uuid required
string
: UUID of the Call Leg
Output
- output DTMFResponse
stopStream
Stop playing an audio file into a call
nexmo_voice.stopStream({
"uuid": ""
}, context)
Input
- input
object
- uuid required
string
: UUID of the Call Leg
- uuid required
Output
- output StopStreamResponse
startStream
Play an audio file into a call
nexmo_voice.startStream({
"body": {
"stream_url": []
},
"uuid": ""
}, context)
Input
- input
object
- body required StartStreamRequest
- uuid required
string
: UUID of the Call Leg
Output
- output StartStreamResponse
stopTalk
Stop text to speech in a call
nexmo_voice.stopTalk({
"uuid": ""
}, context)
Input
- input
object
- uuid required
string
: UUID of the Call Leg
- uuid required
Output
- output StopTalkResponse
startTalk
Play text to speech into a call
nexmo_voice.startTalk({
"uuid": ""
}, context)
Input
- input
object
- body StartTalkRequest
- uuid required
string
: UUID of the Call Leg
Output
- output StartTalkResponse
Definitions
AddressE164
- AddressE164
string
: The phone number to connect to
AddressSip
- AddressSip
string
: The SIP URI to connect to
AddressWebsocket
- AddressWebsocket
string
CreateCallRequestAnswerUrl
- CreateCallRequestAnswerUrl
- answer_method
string
(values: POST, GET): The HTTP method used to send event information to answer_url. - answer_url
array
: The webhook endpoint where you provide the Nexmo Call Control Object that governs this call.- items
string
- items
- event_method
string
(values: POST, GET): The HTTP method used to send event information toevent_url
. - event_url
array
: Required unlessevent_url
is configured at the application- items
string
- items
- from required EndpointPhoneFrom
- length_timer
integer
: Set the number of seconds that elapse before Vonage hangs up after the call state changes to answered. - machine_detection
string
(values: continue, hangup): Configure the behavior when Vonage detects that the call is answered by voicemail. Ifcontinue
, Vonage sends an HTTP request toevent_url
with the Call event machine. Ifhangup
, Vonage ends the call. - ringing_timer
integer
: Set the number of seconds that elapse before Vonage hangs up after the call state changes to ‘ringing’. - to required
array
- answer_method
CreateCallRequestBase
- CreateCallRequestBase
object
- event_method
string
(values: POST, GET): The HTTP method used to send event information toevent_url
. - event_url
array
: Required unlessevent_url
is configured at the application- items
string
- items
- from required EndpointPhoneFrom
- length_timer
integer
: Set the number of seconds that elapse before Vonage hangs up after the call state changes to answered. - machine_detection
string
(values: continue, hangup): Configure the behavior when Vonage detects that the call is answered by voicemail. Ifcontinue
, Vonage sends an HTTP request toevent_url
with the Call event machine. Ifhangup
, Vonage ends the call. - ringing_timer
integer
: Set the number of seconds that elapse before Vonage hangs up after the call state changes to ‘ringing’. - to required
array
- event_method
CreateCallRequestNcco
- CreateCallRequestNcco
- ncco
array
: The Nexmo Call Control Object to use for this call.- items
object
- items
- event_method
string
(values: POST, GET): The HTTP method used to send event information toevent_url
. - event_url
array
: Required unlessevent_url
is configured at the application- items
string
- items
- from required EndpointPhoneFrom
- length_timer
integer
: Set the number of seconds that elapse before Vonage hangs up after the call state changes to answered. - machine_detection
string
(values: continue, hangup): Configure the behavior when Vonage detects that the call is answered by voicemail. Ifcontinue
, Vonage sends an HTTP request toevent_url
with the Call event machine. Ifhangup
, Vonage ends the call. - ringing_timer
integer
: Set the number of seconds that elapse before Vonage hangs up after the call state changes to ‘ringing’. - to required
array
- ncco
CreateCallResponse
- CreateCallResponse
object
- conversation_uuid conversation_uuid
- direction direction
- status status
- uuid uuid
DTMFRequest
- DTMFRequest
object
- digits
string
: The digits to send
- digits
DTMFResponse
- DTMFResponse
object
- message
string
: Description of the action taken - uuid uuid
- message
EndpointApp
- EndpointApp
object
: Connect to an App User- type required
string
: The type of connection. Must beapp
- user required
string
: The username to connect to
- type required
EndpointPhoneFrom
- EndpointPhoneFrom
object
: Connect to a Phone (PSTN) number- number required AddressE164
- type required
string
: The type of connection. Must bephone
EndpointPhoneTo
- EndpointPhoneTo
object
: Connect to a Phone (PSTN) number- dtmfAnswer
string
: Provide DTMF digits to send when the call is answered - number required AddressE164
- type required
string
: The type of connection. Must bephone
- dtmfAnswer
EndpointSip
- EndpointSip
object
: Connect to a SIP Endpoint- type required
string
: The type of connection. Must besip
- uri AddressSip
- type required
EndpointVBCExtension
- EndpointVBCExtension
object
: Connect to a VBC extension- extension required
string
- type required
string
: The type of connection. Must bevbc
- extension required
EndpointWebsocket
- EndpointWebsocket
object
: Connect to a Websocket- content-type required
string
(values: audio/l16;rate=8000, audio/l16;rate=16000) - headers
object
: Details of the Websocket you want to connect to- customer_id
string
: This is an example header. You can provide any headers you may need
- customer_id
- type required
string
: The type of connection. Must bewebsocket
- uri AddressWebsocket
- content-type required
GetCallResponse
- GetCallResponse
object
GetCallsResponse
- GetCallsResponse
object
- _embedded
object
: A list of call objects. See the get details of a specific call response fields for a description of the nested objects- calls
array
- items GetCallResponse
- calls
- _links
object
- self
object
- href
string
- href
- self
- count
integer
- page_size
integer
- record_index
integer
- _embedded
RequestTransferActionParam
- RequestTransferActionParam
string
(values: transfer): Transfer the call to a new NCCO
StartStreamRequest
- StartStreamRequest
object
- level
string
: Set the audio level of the stream in the range-1 >= level <= 1
with a precision of 0.1. The default value is 0. - loop
integer
: the number of times to play the file, 0 for infinite - stream_url required
array
- items
string
- items
- level
StartStreamResponse
- StartStreamResponse
object
- message
string
: Description of the action taken - uuid uuid
- message
StartTalkRequest
- StartTalkRequest
object
- language language
- level
string
: The volume level that the speech is played. This can be any value between-1
to1
in0.1
increments, with0
being the default. - loop
integer
: The number of times to repeat the text the file, 0 for infinite - style style
- text required
string
: The text to read - voice_name voice_name
StartTalkResponse
- StartTalkResponse
object
- message
string
: Description of the action taken - uuid uuid
- message
StopStreamResponse
- StopStreamResponse
object
- message
string
: Description of the action taken - uuid uuid
- message
StopTalkResponse
- StopTalkResponse
object
- message
string
: Description of the action taken - uuid uuid
- message
UpdateCallRequestEarmuff
- Earmuff
object
- action
string
(values: earmuff): Prevent the specified UUID from hearing audio
- action
UpdateCallRequestHangup
- Hangup
object
- action
string
(values: hangup): End the call for the specified UUID
- action
UpdateCallRequestMute
- Mute
object
- action
string
(values: mute): Mute the specified UUID
- action
UpdateCallRequestTransferAnswerUrl
- Transfer with Answer URL
object
- action required RequestTransferActionParam
- destination required
object
- type required
string
: Alwaysncco
- url required
array
: The URL that Vonage makes a request to. Must return an NCCO.- items
string
- items
- type required
UpdateCallRequestTransferNcco
- Transfer with NCCO
object
- action required RequestTransferActionParam
- destination required
object
- ncco required
array
: Refer to the NCCO Guide for a description of possible NCCO parameters.- items
object
- items
- type required
string
: Alwaysncco
- ncco required
UpdateCallRequestUnearmuff
- Unearmuff
object
- action
string
(values: unearmuff): Allow the specified UUID to hear audio
- action
UpdateCallRequestUnmute
- Unmute
object
- action
string
(values: mute): Unmute the specified UUID
- action
conversation_uuid
- The UUID of the Conversation
string
: The unique identifier for the conversation this call leg is part of.
direction
- direction
string
(values: outbound, inbound): Possible values areoutbound
orinbound
duration
- The Duration of the call
string
: The time elapsed for the call to take place in seconds. This is only sent ifstatus
iscompleted
.
end_time
- The End Time of the call
string
: The time the call started in the following format:YYYY-MM-DD HH:MM:SS
. For xample,2020-01-01 12:00:00
. This is only sent ifstatus
iscompleted
.
from
- from
object
: The endpoint you called from. Possible values are the same asto
.- number
string
- type
string
- number
language
- language
string
(values: ar, ca-ES, cmn-CN, cmn-TW, cs-CZ, cy-GB, da-DK, de-DE, el-GR, en-AU, en-GB, en-GB-WLS, en-IN, en-US, en-ZA, es-ES, es-MX, es-US, eu-ES, fi-FI, fil-PH, fr-CA, fr-FR, he-IL, hi-IN, hu-HU, id-ID, is-IS, it-IT, ja-JP, ko-KR, nb-NO, nl-NL, no-NO, pl-PL, pt-BR, pt-PT, ro-RO, ru-RU, sk-SK, sv-SE, th-TH, tr-TR, uk-UA, vi-VN, yue-CN): The language to use
network
- The Network ID of the destination
string
: The Mobile Country Code Mobile Network Code (MCCMNC) for the carrier network used to make this call.
price
- The total price of the call
string
: The total price charged for this call. This is only sent ifstatus
iscompleted
.
rate
- The Price per minute of the called destination
string
: The price per minute for this call. This is only sent ifstatus
iscompleted
.
start_time
- The Start Time of the call
string
: The time the call started in the following format:YYYY-MM-DD HH:MM:SS
. For example,2020-01-01 12:00:00
. This is only sent ifstatus
iscompleted
.
status
- The State of the call
string
: The status of the call. See possible values
style
- style
integer
: The vocal style (vocal range, tessitura, and timbre) to use
to
- to
object
: The single or mixed collection of endpoint types you connected to- number
string
- type
string
- number
uuid
- The UUID of the Call Leg
string
: The unique identifier for this call leg. The UUID is created when your call request is accepted by Vonage. You use the UUID in all requests for individual live calls
voice_name
- voice_name
string
(values: Aditi, Agnieszka, Alva, Amy, Astrid, Bianca, Brian, Carla, Carmen, Carmit, Catarina, Celine, Cem, Chantal, Chipmunk, Conchita, Cristiano, Damayanti, Dora, Emma, Empar, Enrique, Eric, Ewa, Felipe, Filiz, Geraint, Giorgio, Gwyneth, Hans, Henrik, Ines, Ioana, Iveta, Ivy, Jacek, Jan, Jennifer, Joana, Joanna, Joey, Jordi, Justin, Kanya, Karl, Kendra, Kimberly, Laila, Laura, Lea, Lekha, Liv, Lotte, Lucia, Luciana, Mads, Maged, Maja, Mariska, Marlene, Mathieu, Matthew, Maxim, Mei-Jia, Melina, Mia, Miguel, Miren, Mizuki, Montserrat, Naja, Nicole, Nikos, Nora, Oskar, Penelope, Raveena, Ricardo, Ruben, Russell, Salli, Satu, Seoyeon, Sin-Ji, Sora, Takumi, Tarik, Tatyana, Tessa, Tian-Tian, Vicki, Vitoria, Yelda, Zeina, Zhiyu, Zuzana): DEPRECATED The voice & language to use