Merge pull request #179 from plivo/SUP-2124

Fixed bug on call stop Recording API
This commit is contained in:
Mohammed Huzaif 2021-03-26 12:33:30 +05:30 committed by GitHub
commit 7a640a43ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 17 deletions

View file

@ -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.

View file

@ -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)

View file

@ -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);

View file

@ -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);
}
}
}

View file

@ -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": [