From a6aea858a1949cd5ab0a617bbcb964c3cc8020a0 Mon Sep 17 00:00:00 2001 From: Koushik-Ayila Date: Tue, 16 Mar 2021 15:47:41 +0530 Subject: [PATCH 1/3] Fixed bug on call stop Recording API --- lib/resources/call.js | 9 +++++---- lib/resources/recordings.js | 6 ++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/resources/call.js b/lib/resources/call.js index fc9a324..e046eb7 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, 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 +} From 7ee53ba63848a060a54c02afa3d3fe6b858825d2 Mon Sep 17 00:00:00 2001 From: huzaif Date: Wed, 24 Mar 2021 17:46:56 +0530 Subject: [PATCH 2/3] Fixed Isvoicerequest within voice api --- lib/resources/applications.js | 3 +++ lib/resources/call.js | 19 ++++++++----------- 2 files changed, 11 insertions(+), 11 deletions(-) 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 e046eb7..625c375 100644 --- a/lib/resources/call.js +++ b/lib/resources/call.js @@ -233,7 +233,7 @@ export class Call extends PlivoResource { * @fail {Error} return Error */ record(params= {}) { - params.isVoiceRequest = true; + params.isVoiceRequest = 'true'; return this.startRecording(params); } @@ -917,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 => { @@ -937,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 => { @@ -947,7 +946,7 @@ class LiveCallInterface extends PlivoResourceInterface { callUuid: callUuid })); }); - resolve(new ListAllLiveCallResponse(calls[0])); + resolve(calls); }) .catch(error => { reject(error); @@ -995,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 => { @@ -1014,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 => { @@ -1025,7 +1022,7 @@ class QueuedCallInterface extends PlivoResourceInterface { callUuid: callUuid })); }); - resolve(new ListAllQueuedCalls(calls[0])); + resolve(calls); }) .catch(error => { reject(error); From 48a227bee1a48c9b196a826830c5f07cb407ae8b Mon Sep 17 00:00:00 2001 From: Koushik-Ayila Date: Fri, 26 Mar 2021 11:44:37 +0530 Subject: [PATCH 3/3] Updated SDK versioning --- CHANGELOG.md | 3 +++ package.json | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) 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/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": [