diff --git a/CHANGELOG.md b/CHANGELOG.md index 1052162..8a7c67c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Change Log +## [4.14.3](https://github.com/plivo/plivo-node/releases/tag/v4.14.3)(2021-03-26) +- Fix bug on stopRecording and all voice API flows post Typescript changes. + ## [4.14.2](https://github.com/plivo/plivo-node/releases/tag/v4.14.2)(2021-02-17) - Fix duplicate call issue for make call API. diff --git a/lib/resources/applications.js b/lib/resources/applications.js index d8895dd..7d653f5 100644 --- a/lib/resources/applications.js +++ b/lib/resources/applications.js @@ -143,6 +143,7 @@ export class Application extends PlivoResource { */ delete(params, id) { let client = this[clientKey]; + params.isVoiceRequest = 'true'; return new Promise((resolve, reject) => { client('DELETE', action + id + '/', params) .then(() => { @@ -205,6 +206,7 @@ export class ApplicationInterface extends PlivoResourceInterface { */ list(params = {}) { let client = this[clientKey]; + params.isVoiceRequest = true; return new Promise((resolve, reject) => { client('GET', action, params) .then(response => { @@ -258,6 +260,7 @@ export class ApplicationInterface extends PlivoResourceInterface { return errors; } params.app_name = appName; + params.isVoiceRequest = 'true'; let client = this[clientKey]; return new Promise((resolve, reject) => { console.log(action, params) diff --git a/lib/resources/call.js b/lib/resources/call.js index fc9a324..625c375 100644 --- a/lib/resources/call.js +++ b/lib/resources/call.js @@ -232,7 +232,8 @@ export class Call extends PlivoResource { * @promise {object} return PlivoGenericResponse Object * @fail {Error} return Error */ - record(params) { + record(params= {}) { + params.isVoiceRequest = 'true'; return this.startRecording(params); } @@ -262,7 +263,7 @@ export class Call extends PlivoResource { * @promise {object} return PlivoGenericResponse Object * @fail {Error} return Error */ - stopRecording(params) { + stopRecording(params= {}) { params.isVoiceRequest = 'true'; return super.executeAction(this.id + '/Record/', 'DELETE', params); } @@ -642,7 +643,7 @@ export class CallInterface extends PlivoResourceInterface { * @promise {object} returns PlivoGenericResponse Object * @fail {Error} returns Error */ - record(callUUID, optionalParams) { + record(callUUID, optionalParams = {}) { let errors = validate([{ field: 'call_uuid', value: callUUID, @@ -665,7 +666,7 @@ export class CallInterface extends PlivoResourceInterface { * @promise {object} returns PlivoGenericResponse Object * @fail {Error} returns Error */ - stopRecording(callUUID, optionalParams) { + stopRecording(callUUID, optionalParams= {}) { let errors = validate([{ field: 'call_uuid', value: callUUID, @@ -916,8 +917,7 @@ class LiveCallInterface extends PlivoResourceInterface { if (action !== '' && !id) { reject(new Error(this[idKey] + ' must be set')); } - client('GET', action + (id ? id + '/' : ''), { - status: 'live', + client('GET', action + (id ? id + '/?status=live' : '') , { isVoiceRequest: 'true' }) .then(response => { @@ -936,9 +936,9 @@ class LiveCallInterface extends PlivoResourceInterface { params = {} } params.status = 'live' - params.isVoiceRequest = 'true' + params.isVoiceRequest = 'true'; return new Promise((resolve, reject) => { - client('GET', action, params) + client('GET', action+'?status=live', params) .then(response => { let calls = []; response.body.calls.forEach(callUuid => { @@ -946,7 +946,7 @@ class LiveCallInterface extends PlivoResourceInterface { callUuid: callUuid })); }); - resolve(new ListAllLiveCallResponse(calls[0])); + resolve(calls); }) .catch(error => { reject(error); @@ -994,8 +994,7 @@ class QueuedCallInterface extends PlivoResourceInterface { reject(new Error(this[idKey] + ' must be set')); } - client('GET', action + (id ? id + '/' : ''), { - status: 'queued', + client('GET', action + (id ? id + '/?status=queued' : ''), { isVoiceRequest: 'true' }) .then(response => { @@ -1013,8 +1012,7 @@ class QueuedCallInterface extends PlivoResourceInterface { let client = this[clientKey]; return new Promise((resolve, reject) => { - client('GET', action, { - status: 'queued', + client('GET', action+'?status=queued', { isVoiceRequest: 'true' }) .then(response => { @@ -1024,7 +1022,7 @@ class QueuedCallInterface extends PlivoResourceInterface { callUuid: callUuid })); }); - resolve(new ListAllQueuedCalls(calls[0])); + resolve(calls); }) .catch(error => { reject(error); diff --git a/lib/resources/recordings.js b/lib/resources/recordings.js index 81dc158..f9294fe 100644 --- a/lib/resources/recordings.js +++ b/lib/resources/recordings.js @@ -73,9 +73,11 @@ export class Recording extends PlivoResource { * @fail {Error} return Error */ delete(id) { + let params = {}; + params.isVoiceRequest = 'true'; let client = this[clientKey]; return new Promise((resolve, reject) => { - client('DELETE', action + id + '/') + client('DELETE', action + id + '/', params) .then(() => { resolve(true); }) @@ -191,4 +193,4 @@ export class RecordingInterface extends PlivoResourceInterface { id: id }).delete(id); } -} \ No newline at end of file +} diff --git a/package.json b/package.json index c4d3189..d8ff1dd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plivo", - "version": "4.14.2", + "version": "4.14.3", "description": "A Node.js SDK to make voice calls and send SMS using Plivo and to generate Plivo XML", "homepage": "https://github.com/plivo/plivo-node", "files": [