I am going to transfer call. Exactly, Exactly, VONAGE_PHONE and CLIENT1 is calling now, and I need to connect CLIENT1 to CLIENT2.
vonage.voice.transferCallWithNCCO(this.call_id, [
{
action: 'talk',
text: 'Hello, you are being connected, please wait...'
},
{
"action": "connect",
"from": CLIENT1,
"endpoint": [{
"type": "phone",
"number": CLIENT2,
"dtmfAnswer": "auto"
}]
}
]
But it is not working.
Following is log.
throw new vetch_1.VetchError(`Request failed with status code ${response.status}`, request, response);
^
VetchError: Request failed with status code 400
at Voice.parseResponse (/root/VoiceBot/vonage/node_modules/@vonage/server-client/dist/client.js:302:19)
at Voice.sendRequest (/root/VoiceBot/vonage/node_modules/@vonage/server-client/dist/client.js:221:31)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Voice.sendRequestWithData (/root/VoiceBot/vonage/node_modules/@vonage/server-client/dist/client.js:196:16)
at async Voice.callAction (/root/VoiceBot/vonage/node_modules/@vonage/voice/dist/voice.js:476:9) {
config: {
url: 'https://api.nexmo.com/v1/calls/60ce05e1-7c69-4281-b2f4-37e0586eeb39',
method: 'PUT',
type: 'application/json',
data: {
action: 'transfer',
destination: {
type: 'ncco',
ncco: [
{
action: 'talk',
text: 'Hello, you are being connected, please wait...'
},
{ action: 'connect', endpoint: [Array] }
]
}
},
headers: {
'user-agent': '@vonage/server-sdk/3.0.0, node/18.17.1,',
'content-type': 'application/json',
Authorization: 'Bearer <My token>'
}
},
response: Response {
size: 0,
timeout: 0,
[Symbol(Body internals)]: {
body: PassThrough {
_readableState: ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: [Object], tail: [Object], length: 1 },
length: 146,
pipes: [],
flowing: null,
ended: true,
endEmitted: false,
reading: false,
constructed: true,
sync: false,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
destroyed: false,
errored: null,
closed: false,
closeEmitted: false,
defaultEncoding: 'utf8',
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: false,
dataEmitted: false,
decoder: null,
encoding: null,
[Symbol(kPaused)]: null
},
_events: [Object: null prototype] {
prefinish: [Function: prefinish],
error: [Function (anonymous)]
},
_eventsCount: 2,
_maxListeners: undefined,
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: true,
needDrain: false,
ending: true,
ended: true,
finished: true,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
afterWriteTickInfo: null,
buffered: [],
bufferedIndex: 0,
allBuffers: true,
allNoop: true,
pendingcb: 0,
constructed: true,
prefinished: true,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
errored: null,
closed: false,
closeEmitted: false,
[Symbol(kOnFinished)]: []
},
allowHalfOpen: true,
[Symbol(kCapture)]: false,
[Symbol(kCallback)]: null
},
disturbed: false,
error: null
},
[Symbol(Response internals)]: {
url: 'https://api.nexmo.com/v1/calls/60ce05e1-7c69-4281-b2f4-37e0586eeb39',
status: 400,
statusText: 'Bad Request',
headers: Headers {
[Symbol(map)]: [Object: null prototype] {
date: [ 'Thu, 08 Feb 2024 20:11:53 GMT' ],
'content-type': [ 'application/json' ],
'content-length': [ '146' ],
connection: [ 'close' ],
server: [ 'envoy' ],
'x-nexmo-trace-id': [ '7624fee7-a0f4-4dd6-babf-05136976e6fd' ],
'x-vonage-region': [ 'us-3' ],
'x-envoy-upstream-service-time': [ '63' ],
'content-disposition': [ 'attachment; filename="api.txt"' ],
'x-frame-options': [ 'deny' ],
'x-xss-protection': [ '1; mode=block' ],
'strict-transport-security': [ 'max-age=31536000; includeSubdomains' ],
'x-content-type-options': [ 'nosniff' ],
'x-ratelimit-limit': [
'200, 200;w=1;name="crd|account_id|generic_key^nexmo-vapi.vapi|generic_key^solo.setDescriptor.uniqueValue"'
],
'x-ratelimit-remaining': [ '199' ],
'x-ratelimit-reset': [ '1' ]
}
},
counter: 0
}
}
}
Please help me.