From 9fe3a61bed098839dc6d33ea5971115bc43ccad7 Mon Sep 17 00:00:00 2001 From: Koushik-Ayila Date: Thu, 10 Jun 2021 11:20:11 +0530 Subject: [PATCH 01/20] added stirVerification as part of get CDR / live call APIs response --- lib/resources/call.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/resources/call.js b/lib/resources/call.js index 625c375..d4f4c01 100644 --- a/lib/resources/call.js +++ b/lib/resources/call.js @@ -75,6 +75,7 @@ export class GetLiveCallResponse { this.requestUuid = params.requestUuid; this.sessionStart = params.sessionStart; this.to = params.to; + this.stirVerification = params.stirVerification; } } export class RetrieveCallResponse { @@ -100,6 +101,7 @@ export class RetrieveCallResponse { this.toNumber = params.toNumber; this.totalAmount = params.totalAmount; this.totalRate = params.totalRate; + this.stirVerification = params.stirVerification; } } @@ -125,6 +127,7 @@ export class ListAllCallsResponse { this.toNumber = params.toNumber; this.totalAmount = params.totalAmount; this.totalRate = params.totalRate; + this.stirVerification = params.stirVerification; } } From 0b09ffd7143677cd3b029439eefb2b55f53c081f Mon Sep 17 00:00:00 2001 From: Koushik-Ayila Date: Tue, 15 Jun 2021 17:49:03 +0530 Subject: [PATCH 02/20] Added SDK version bump up --- CHANGELOG.md | 3 +++ package.json | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cad0dc0..ec229df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Change Log +## [4.18.0](https://github.com/plivo/plivo-node/releases/tag/v4.18.0)(2021-06-15) +- Added stir verification param as part of Get CDR and live call APIs + ## [4.17.1](https://github.com/plivo/plivo-node/releases/tag/v4.17.1)(2021-05-06) - Added Fix for Adaptive Powerpack Create & Update functions diff --git a/package.json b/package.json index 88272d2..a6ffb81 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plivo", - "version": "4.17.1", + "version": "4.18.0", "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": [ From cf5f4dfef97c08d8da46e874e4577131f9a2dc3b Mon Sep 17 00:00:00 2001 From: Narayana Shanubhogh Date: Fri, 25 Jun 2021 10:46:33 +0530 Subject: [PATCH 03/20] version upgrade --- CHANGELOG.md | 2 ++ lib/resources/media.js | 2 +- lib/rest/axios.js | 13 ++++++++++++- package.json | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec229df..428fc13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ # Change Log +## [4.18.1](https://github.com/plivo/plivo-node/releases/tag/v4.18.1)(2021-06-25) +- Fixed the mms media upload functionality ## [4.18.0](https://github.com/plivo/plivo-node/releases/tag/v4.18.0)(2021-06-15) - Added stir verification param as part of Get CDR and live call APIs diff --git a/lib/resources/media.js b/lib/resources/media.js index ad027a7..aa229ed 100644 --- a/lib/resources/media.js +++ b/lib/resources/media.js @@ -97,7 +97,7 @@ export class MediaInterface extends PlivoResourceInterface { params.file = files let client = this[clientKey]; - + params.multipart = true; return new Promise((resolve, reject) => { client('POST', action, params) .then(response => { diff --git a/lib/rest/axios.js b/lib/rest/axios.js index 61f8cde..5316274 100644 --- a/lib/rest/axios.js +++ b/lib/rest/axios.js @@ -46,7 +46,14 @@ export function Axios(config) { if (key != 'file') { multipartParams.append(key, params[key]); } else { - multipartParams.append(key, require('fs').createReadStream(params[key])); + // In case files are in array + if (Array.isArray(params.file)) { + for (let index = 0; index < params.file.length; index++) { + multipartParams.append(key, require('fs').createReadStream(params.file[index])); + } + }else{ + multipartParams.append(key, require('fs').createReadStream(params[key])); + } } } @@ -87,6 +94,10 @@ export function Axios(config) { }); }) .catch(function (error) { + //client side exception like file not found case + if (error.response == undefined){ + reject(error.stack ); + } const exceptionClass = { 400: Exceptions.InvalidRequestError, 401: Exceptions.AuthenticationError, diff --git a/package.json b/package.json index a6ffb81..7c9db7e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plivo", - "version": "4.18.0", + "version": "4.18.1", "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": [ From 787fa3be472a9a515c589c446ed45014af2c416e Mon Sep 17 00:00:00 2001 From: snehithkumar Date: Wed, 16 Jun 2021 15:19:28 +0530 Subject: [PATCH 04/20] removed total_count arguement in metadata of listmdr response --- CHANGELOG.md | 9 +++++++++ lib/rest/request-test.js | 3 +-- package.json | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cad0dc0..9808d5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Change Log +## [v4.18.2](https://github.com/plivo/plivo-node/tree/v4.18.2) (2021-06-18) +**WARNING**:- Removed the total_count parameter in meta data for list MDR response + +## [4.18.1](https://github.com/plivo/plivo-node/releases/tag/v4.18.1)(2021-06-25) +- Fixed the mms media upload functionality + +## [4.18.0](https://github.com/plivo/plivo-node/releases/tag/v4.18.0)(2021-06-15) +- Added stir verification param as part of Get CDR and live call APIs + ## [4.17.1](https://github.com/plivo/plivo-node/releases/tag/v4.17.1)(2021-05-06) - Added Fix for Adaptive Powerpack Create & Update functions diff --git a/lib/rest/request-test.js b/lib/rest/request-test.js index 9f60e97..18e1791 100644 --- a/lib/rest/request-test.js +++ b/lib/rest/request-test.js @@ -1158,8 +1158,7 @@ export function Request(config) { limit: 20, next: '/v1/Account/{auth_id}/Message/?limit=20&error_code=200&offset=20', offset: 0, - previous: null, - total_count: 22 + previous: null }, objects: [ { diff --git a/package.json b/package.json index 88272d2..ce62860 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plivo", - "version": "4.17.1", + "version": "4.18.2", "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": [ From 208a24f1b25168e049008e2026ac4a2457ed30af Mon Sep 17 00:00:00 2001 From: LSAITHARUN Date: Fri, 11 Jun 2021 00:35:22 +0530 Subject: [PATCH 05/20] Added Mpc enhancements like Callername, Delaydial, and Participant level recording --- lib/resources/multiPartyCall.js | 89 +++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/lib/resources/multiPartyCall.js b/lib/resources/multiPartyCall.js index 0ffe665..8e2ffdc 100644 --- a/lib/resources/multiPartyCall.js +++ b/lib/resources/multiPartyCall.js @@ -61,6 +61,11 @@ export class MultiPartyCall extends PlivoResource{ validParam('callUuid', params.callUuid, [String], false) } + if(params.callerName){ + validParam('callerName', params.callerName, [String], false) + validRange('callerName', params.callerName.length, false, 1, 50) + } + if(params.callStatusCallbackUrl){ validUrl('callStatusCallbackUrl', params.callStatusCallbackUrl, false) } @@ -104,6 +109,12 @@ export class MultiPartyCall extends PlivoResource{ else { params.ringTimeout = 45 } + if(params.delayDial){ + validRange('delayDial', params.delayDial, false, 0, 120) + } + else { + params.delayDial = 0 + } if(params.maxDuration || params.maxDuration === 0){ validRange('maxDuration', params.maxDuration, false, 300, 28800) @@ -283,6 +294,7 @@ export class MultiPartyCall extends PlivoResource{ params.exitSoundMethod = 'GET' } params.isVoiceRequest = 'true'; + params.callerName = params.callerName || params.from; return super.executeAction(this.id + '/Participant/', 'POST', params) } @@ -376,6 +388,39 @@ export class MultiPartyCallParticipant extends PlivoSecondaryResource{ getParticipant(){ return super.executeAction(this.id, this.secondaryId, 'GET',{'isVoiceRequest' : 'true'}) } + startParticipantRecording(params = {}){ + if(params.fileFormat){ + validParam('fileFormat', params.fileFormat, [String], false, ['mp3', 'wav']) + } + else { + params.fileFormat = 'mp3' + } + + if(params.statusCallbackUrl){ + validUrl('statusCallbackUrl', params.statusCallbackUrl, false) + } + + if(params.statusCallbackMethod){ + validParam('statusCallbackMethod', params.statusCallbackMethod.toUpperCase(), [String], false, ['GET', 'POST']) + } + else { + params.statusCallbackMethod = 'POST' + } + params.isVoiceRequest = 'true'; + return super.executeAction(this.id , this.secondaryId + '/Record', 'POST', params) + } + + stopParticipantRecording(){ + return super.executeAction(this.id , this.secondaryId +'/Record', 'DELETE',{'isVoiceRequest' : 'true'}) + } + + pauseParticipantRecording(){ + return super.executeAction(this.id , this.secondaryId + '/Record/Pause', 'POST',{'isVoiceRequest' : 'true'}) + } + + resumeParticipantRecording(){ + return super.executeAction(this.id , this.secondaryId + '/Record/Resume', 'POST',{'isVoiceRequest' : 'true'}) + } } @@ -542,6 +587,50 @@ export class MultiPartyCallInterface extends PlivoResourceInterface{ return new MultiPartyCall(this[clientKey], {id: mpcId[0] + mpcId[1]}).resumeRecording() } + startParticipantRecording(participantId, uuid = null, friendlyName = null, params){ + if(uuid){ + validParam('uuid', uuid, [String], false) + } + if(friendlyName){ + validParam('friendlyName', friendlyName, [String], false) + } + let mpcId = this.makeMpcId(uuid, friendlyName) + return new MultiPartyCallParticipant(this[clientKey], {id: mpcId[0] + mpcId[1], secondaryId: participantId}).startParticipantRecording(params) + } + + stopParticipantRecording(participantId, uuid = null, friendlyName = null){ + if(uuid){ + validParam('uuid', uuid, [String], false) + } + if(friendlyName){ + validParam('friendlyName', friendlyName, [String], false) + } + let mpcId = this.makeMpcId(uuid, friendlyName) + return new MultiPartyCallParticipant(this[clientKey], {id: mpcId[0] + mpcId[1], secondaryId: participantId}).stopParticipantRecording() + } + + pauseParticipantRecording(participantId, uuid = null, friendlyName = null){ + if(uuid){ + validParam('uuid', uuid, [String], false) + } + if(friendlyName){ + validParam('friendlyName', friendlyName, [String], false) + } + let mpcId = this.makeMpcId(uuid, friendlyName) + return new MultiPartyCallParticipant(this[clientKey], {id: mpcId[0] + mpcId[1], secondaryId: participantId}).pauseParticipantRecording() + } + + resumeParticipantRecording(participantId, uuid = null, friendlyName = null){ + if(uuid){ + validParam('uuid', uuid, [String], false) + } + if(friendlyName){ + validParam('friendlyName', friendlyName, [String], false) + } + let mpcId = this.makeMpcId(uuid, friendlyName) + return new MultiPartyCallParticipant(this[clientKey], {id: mpcId[0] + mpcId[1], secondaryId: participantId}).resumeParticipantRecording() + } + listParticipants(uuid = null, friendlyName = null, params){ if(uuid){ validParam('uuid', uuid, [String], false) From 3d54049e4b33258557be05c41597a6c93ae20e59 Mon Sep 17 00:00:00 2001 From: LSAITHARUN Date: Mon, 14 Jun 2021 14:01:29 +0530 Subject: [PATCH 06/20] Added Mpc enhancements like Callername,Parallel Behaviour for DelayDial and RingTimeout and Participant level recording. --- lib/resources/multiPartyCall.js | 17 +++++++++++++++-- lib/rest/utils.js | 20 ++++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/lib/resources/multiPartyCall.js b/lib/resources/multiPartyCall.js index 8e2ffdc..858a51f 100644 --- a/lib/resources/multiPartyCall.js +++ b/lib/resources/multiPartyCall.js @@ -7,6 +7,7 @@ import { validDateFormat, validRange, validMultipleDestinationNos, + validMultipleDestinationIntegers, isOneAmongStringUrl, multiValidParam } from '../rest/utils.js' @@ -104,13 +105,25 @@ export class MultiPartyCall extends PlivoResource{ } if(params.ringTimeout || params.ringTimeout === 0){ - validRange('ringTimeout', params.ringTimeout, false, 15, 120) + validParam('ringTimeout', params.ringTimeout, [String, Number], false) + if(Number.isInteger(params.ringTimeout)){ + validRange('RingTimeout', params.ringTimeout, false, 15, 120) + } + else{ + validMultipleDestinationIntegers('ringTimeout', params.ringTimeout) + } } else { params.ringTimeout = 45 } if(params.delayDial){ - validRange('delayDial', params.delayDial, false, 0, 120) + validParam('delayDial', params.delayDial, [String, Number], false) + if(Number.isInteger(params.delayDial)){ + validRange('DelayDial', params.delayDial, false, 1, 120) + } + else{ + validMultipleDestinationIntegers('delayDial', params.delayDial) + } } else { params.delayDial = 0 diff --git a/lib/rest/utils.js b/lib/rest/utils.js index 9facdc5..8a7538c 100644 --- a/lib/rest/utils.js +++ b/lib/rest/utils.js @@ -112,6 +112,26 @@ export function validMultipleDestinationNos(paramName, paramValue, options = {}) } } +export function validMultipleDestinationIntegers(paramName, paramValue){ + let val = paramValue.split("<"); + for (let i=0; i Date: Wed, 30 Jun 2021 12:54:29 +0530 Subject: [PATCH 07/20] Added Mpc enhancements like Callername,Parallel Behaviour for DelayDial and RingTimeout and Participant level recording. --- CHANGELOG.md | 5 +++++ package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 428fc13..63c03fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,9 @@ # Change Log +## [4.19.0](https://github.com/plivo/plivo-node/releases/tag/v4.19.0)(2021-06-30) +- Added CallerName param in AddParticpant +- Added support for Parallel behaviour of RingTimeout and Delaydial. +- Added support for Recording at Member Level + ## [4.18.1](https://github.com/plivo/plivo-node/releases/tag/v4.18.1)(2021-06-25) - Fixed the mms media upload functionality diff --git a/package.json b/package.json index 7c9db7e..4448c6f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plivo", - "version": "4.18.1", + "version": "4.19.0", "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": [ From 7fbb37436c0129da57f3cf20f9409d2749556ca9 Mon Sep 17 00:00:00 2001 From: LSAITHARUN Date: Thu, 1 Jul 2021 18:04:53 +0530 Subject: [PATCH 08/20] Updated the StartMpcOnEnter Param to take false as boolean value --- lib/resources/multiPartyCall.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/resources/multiPartyCall.js b/lib/resources/multiPartyCall.js index 0ffe665..e7460ee 100644 --- a/lib/resources/multiPartyCall.js +++ b/lib/resources/multiPartyCall.js @@ -234,7 +234,7 @@ export class MultiPartyCall extends PlivoResource{ params.hold = 'false' } - if(params.startMpcOnEnter){ + if(params.startMpcOnEnter!=null){ validParam('startMpcOnEnter', params.startMpcOnEnter, [Boolean, String], false) } else { From cea06a890211e4d57cd5c8056751245a2e9e27e8 Mon Sep 17 00:00:00 2001 From: huzaif-plivo Date: Fri, 2 Jul 2021 15:20:35 +0530 Subject: [PATCH 09/20] updated changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63c03fa..9df5281 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Change Log -## [4.19.0](https://github.com/plivo/plivo-node/releases/tag/v4.19.0)(2021-06-30) + +## [4.19.0](https://github.com/plivo/plivo-node/releases/tag/v4.19.0)(2021-07-02) - Added CallerName param in AddParticpant - Added support for Parallel behaviour of RingTimeout and Delaydial. - Added support for Recording at Member Level From cae03571714d3851184f83b10d071794a91c7886 Mon Sep 17 00:00:00 2001 From: neel-plivo Date: Mon, 5 Jul 2021 11:06:15 +0530 Subject: [PATCH 10/20] updated version --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b89aef9..d375ea6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Change Log +## [v4.19.1](https://github.com/plivo/plivo-node/tree/v4.19.1) (2021-07-05) +- **WARNING**: Removed the total_count parameter in meta data for list MDR response + ## [4.19.0](https://github.com/plivo/plivo-node/releases/tag/v4.19.0)(2021-07-02) - Added CallerName param in AddParticpant - Added support for Parallel behaviour of RingTimeout and Delaydial. @@ -11,9 +14,6 @@ ## [4.18.0](https://github.com/plivo/plivo-node/releases/tag/v4.18.0)(2021-06-15) - Added stir verification param as part of Get CDR and live call APIs -## [v4.18.2](https://github.com/plivo/plivo-node/tree/v4.18.2) (2021-06-18) -**WARNING**:- Removed the total_count parameter in meta data for list MDR response - ## [4.18.1](https://github.com/plivo/plivo-node/releases/tag/v4.18.1)(2021-06-25) - Fixed the mms media upload functionality From b4e255bd95e2e9a650075b7fdfef18f4eccd28eb Mon Sep 17 00:00:00 2001 From: neel-plivo Date: Mon, 5 Jul 2021 11:06:40 +0530 Subject: [PATCH 11/20] Update CHANGELOG.md --- CHANGELOG.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d375ea6..65a1554 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,12 +14,6 @@ ## [4.18.0](https://github.com/plivo/plivo-node/releases/tag/v4.18.0)(2021-06-15) - Added stir verification param as part of Get CDR and live call APIs -## [4.18.1](https://github.com/plivo/plivo-node/releases/tag/v4.18.1)(2021-06-25) -- Fixed the mms media upload functionality - -## [4.18.0](https://github.com/plivo/plivo-node/releases/tag/v4.18.0)(2021-06-15) -- Added stir verification param as part of Get CDR and live call APIs - ## [4.17.1](https://github.com/plivo/plivo-node/releases/tag/v4.17.1)(2021-05-06) - Added Fix for Adaptive Powerpack Create & Update functions From 7288d6409e2bfbb98f5a968e49405846428d2817 Mon Sep 17 00:00:00 2001 From: Narayana Shanubhogh Date: Tue, 6 Jul 2021 14:36:13 +0530 Subject: [PATCH 12/20] support powerpack id filter for list mdr --- CHANGELOG.md | 2 ++ lib/resources/messages.js | 2 ++ package.json | 2 +- types/resources/messages.d.ts | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65a1554..05ae842 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ # Change Log +## [v4.20.0](https://github.com/plivo/plivo-node/tree/v4.20.0) (2021-07-06) +- Powerpack ID filter for list MDR ## [v4.19.1](https://github.com/plivo/plivo-node/tree/v4.19.1) (2021-07-05) - **WARNING**: Removed the total_count parameter in meta data for list MDR response diff --git a/lib/resources/messages.js b/lib/resources/messages.js index 5788d21..2218d4a 100644 --- a/lib/resources/messages.js +++ b/lib/resources/messages.js @@ -42,6 +42,7 @@ export class MessageGetResponse { this.totalAmount = params.totalAmount; this.totalRate = params.totalRate; this.units = params.units; + this.powerpackID = params.powerpackId } } @@ -60,6 +61,7 @@ export class MessageListResponse { this.totalAmount = params.totalAmount; this.totalRate = params.totalRate; this.units = params.units; + this.powerpackID = params.powerpackId; } } diff --git a/package.json b/package.json index e40b1c5..d429fd9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plivo", - "version": "4.19.1", + "version": "4.20.0", "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": [ diff --git a/types/resources/messages.d.ts b/types/resources/messages.d.ts index 6d6b37d..c709edc 100644 --- a/types/resources/messages.d.ts +++ b/types/resources/messages.d.ts @@ -19,6 +19,7 @@ export class MessageGetResponse { totalAmount: string; totalRate: string; units: string; + powerpackId: string; } export class MessageListResponse { constructor(params: object); @@ -34,6 +35,7 @@ export class MessageListResponse { totalAmount: string; totalRate: string; units: string; + powerpackId: string; } export class MMSMediaResponse { constructor(params: object); From a19138db0f82b9e1f2d24e7856534053050f5541 Mon Sep 17 00:00:00 2001 From: Koushik-Ayila Date: Wed, 7 Jul 2021 12:31:06 +0530 Subject: [PATCH 13/20] Fix MPC functions to pass params in a user-friendly way --- lib/resources/multiPartyCall.js | 220 ++++++++++++++++++-------------- 1 file changed, 127 insertions(+), 93 deletions(-) diff --git a/lib/resources/multiPartyCall.js b/lib/resources/multiPartyCall.js index 7d6ee1a..68470a9 100644 --- a/lib/resources/multiPartyCall.js +++ b/lib/resources/multiPartyCall.js @@ -311,8 +311,8 @@ export class MultiPartyCall extends PlivoResource{ return super.executeAction(this.id + '/Participant/', 'POST', params) } - start(){ - return super.executeAction(this.id + '/', 'POST', {'status' : 'active', 'isVoiceRequest' : 'true'}) + start(params){ + return super.executeAction(this.id + '/', 'POST', {'status' : params.status, 'isVoiceRequest' : 'true'}) } stop(){ @@ -509,14 +509,16 @@ export class MultiPartyCallInterface extends PlivoResourceInterface{ return super.list(params); } - get(uuid = null, friendlyName = null){ - if(uuid){ - validParam('uuid', uuid, [String], false) + get(params={}){ + if(params.uuid){ + validParam('uuid', params.uuid, [String], false) } - if(friendlyName){ - validParam('friendlyName', friendlyName, [String], false) + if(params.friendlyName){ + validParam('friendlyName', params.friendlyName, [String], false) } - let mpcId = this.makeMpcId(uuid, friendlyName) + let mpcId = this.makeMpcId(params.uuid, params.friendlyName) + delete params.uuid + delete params.friendlyName return new MultiPartyCall(this[clientKey], {id: mpcId[0] + mpcId[1]}).get(); } @@ -534,160 +536,192 @@ export class MultiPartyCallInterface extends PlivoResourceInterface{ return new MultiPartyCall(this[clientKey], {id: mpcId[0] + mpcId[1]}).addParticipant(params) } - start(uuid = null, friendlyName = null){ - if(uuid){ - validParam('uuid', uuid, [String], false) + start(params = {}){ + if(params.uuid){ + validParam('uuid', params.uuid, [String], false) } - if(friendlyName){ - validParam('friendlyName', friendlyName, [String], false) + if(params.friendlyName){ + validParam('friendlyName', params.friendlyName, [String], false) } - let mpcId = this.makeMpcId(uuid, friendlyName) - return new MultiPartyCall(this[clientKey], {id: mpcId[0] + mpcId[1]}).start() + let mpcId = this.makeMpcId(params.uuid, params.friendlyName) + delete params.uuid + delete params.friendlyName + return new MultiPartyCall(this[clientKey], {id: mpcId[0] + mpcId[1]}).start(params) } - stop(uuid = null, friendlyName = null){ - if(uuid){ - validParam('uuid', uuid, [String], false) + stop(params = {}){ + if(params.uuid){ + validParam('uuid', params.uuid, [String], false) } - if(friendlyName){ - validParam('friendlyName', friendlyName, [String], false) + if(params.friendlyName){ + validParam('friendlyName', params.friendlyName, [String], false) } - let mpcId = this.makeMpcId(uuid, friendlyName) + let mpcId = this.makeMpcId(params.uuid, params.friendlyName) + delete params.uuid + delete params.friendlyName return new MultiPartyCall(this[clientKey], {id: mpcId[0] + mpcId[1]}).stop() } - startRecording(uuid = null, friendlyName = null, params){ - if(uuid){ - validParam('uuid', uuid, [String], false) + startRecording(params={}){ + if(params.uuid){ + validParam('uuid', params.uuid, [String], false) } - if(friendlyName){ - validParam('friendlyName', friendlyName, [String], false) + if(params.friendlyName){ + validParam('friendlyName', params.friendlyName, [String], false) } - let mpcId = this.makeMpcId(uuid, friendlyName) + let mpcId = this.makeMpcId(params.uuid, params.friendlyName) + delete params.uuid + delete params.friendlyName return new MultiPartyCall(this[clientKey], {id: mpcId[0] + mpcId[1]}).startRecording(params) } - stopRecording(uuid = null, friendlyName = null){ - if(uuid){ - validParam('uuid', uuid, [String], false) + stopRecording(params={}){ + if(params.uuid){ + validParam('uuid', params.uuid, [String], false) } - if(friendlyName){ - validParam('friendlyName', friendlyName, [String], false) + if(params.friendlyName){ + validParam('friendlyName', params.friendlyName, [String], false) } - let mpcId = this.makeMpcId(uuid, friendlyName) + let mpcId = this.makeMpcId(params.uuid, params.friendlyName) + delete params.uuid + delete params.friendlyName return new MultiPartyCall(this[clientKey], {id: mpcId[0] + mpcId[1]}).stopRecording() } - pauseRecording(uuid = null, friendlyName = null){ - if(uuid){ - validParam('uuid', uuid, [String], false) + pauseRecording(params={}){ + if(params.uuid){ + validParam('uuid', params.uuid, [String], false) } - if(friendlyName){ - validParam('friendlyName', friendlyName, [String], false) + if(params.friendlyName){ + validParam('friendlyName', params.friendlyName, [String], false) } - let mpcId = this.makeMpcId(uuid, friendlyName) + let mpcId = this.makeMpcId(params.uuid, params.friendlyName) + delete params.uuid + delete params.friendlyName return new MultiPartyCall(this[clientKey], {id: mpcId[0] + mpcId[1]}).pauseRecording() } - resumeRecording(uuid = null, friendlyName = null){ - if(uuid){ - validParam('uuid', uuid, [String], false) + resumeRecording(params={}){ + if(params.uuid){ + validParam('uuid', params.uuid, [String], false) } - if(friendlyName){ - validParam('friendlyName', friendlyName, [String], false) + if(params.friendlyName){ + validParam('friendlyName', params.friendlyName, [String], false) } - let mpcId = this.makeMpcId(uuid, friendlyName) + let mpcId = this.makeMpcId(params.uuid, params.friendlyName) + delete params.uuid + delete params.friendlyName return new MultiPartyCall(this[clientKey], {id: mpcId[0] + mpcId[1]}).resumeRecording() } - startParticipantRecording(participantId, uuid = null, friendlyName = null, params){ - if(uuid){ - validParam('uuid', uuid, [String], false) + startParticipantRecording(participantId, params={}){ + validParam('participantId', participantId, [String, Number], true) + if(params.uuid){ + validParam('uuid', params.uuid, [String], false) } - if(friendlyName){ - validParam('friendlyName', friendlyName, [String], false) + if(params.friendlyName){ + validParam('friendlyName', params.friendlyName, [String], false) } - let mpcId = this.makeMpcId(uuid, friendlyName) + let mpcId = this.makeMpcId(params.uuid, params.friendlyName) + delete params.uuid + delete params.friendlyName return new MultiPartyCallParticipant(this[clientKey], {id: mpcId[0] + mpcId[1], secondaryId: participantId}).startParticipantRecording(params) } - stopParticipantRecording(participantId, uuid = null, friendlyName = null){ - if(uuid){ - validParam('uuid', uuid, [String], false) + stopParticipantRecording(participantId, params={}){ + validParam('participantId', participantId, [String, Number], true) + if(params.uuid){ + validParam('uuid', params.uuid, [String], false) } - if(friendlyName){ - validParam('friendlyName', friendlyName, [String], false) + if(params.friendlyName){ + validParam('friendlyName', params.friendlyName, [String], false) } - let mpcId = this.makeMpcId(uuid, friendlyName) + let mpcId = this.makeMpcId(params.uuid, params.friendlyName) + delete params.uuid + delete params.friendlyName return new MultiPartyCallParticipant(this[clientKey], {id: mpcId[0] + mpcId[1], secondaryId: participantId}).stopParticipantRecording() } - pauseParticipantRecording(participantId, uuid = null, friendlyName = null){ - if(uuid){ - validParam('uuid', uuid, [String], false) + pauseParticipantRecording(participantId, params={}){ + validParam('participantId', participantId, [String, Number], true) + if(params.uuid){ + validParam('uuid', params.uuid, [String], false) } - if(friendlyName){ - validParam('friendlyName', friendlyName, [String], false) + if(params.friendlyName){ + validParam('friendlyName', params.friendlyName, [String], false) } - let mpcId = this.makeMpcId(uuid, friendlyName) + let mpcId = this.makeMpcId(params.uuid, params.friendlyName) + delete params.uuid + delete params.friendlyName return new MultiPartyCallParticipant(this[clientKey], {id: mpcId[0] + mpcId[1], secondaryId: participantId}).pauseParticipantRecording() } - resumeParticipantRecording(participantId, uuid = null, friendlyName = null){ - if(uuid){ - validParam('uuid', uuid, [String], false) + resumeParticipantRecording(participantId, params={}){ + validParam('participantId', participantId, [String, Number], true) + if(params.uuid){ + validParam('uuid', params.uuid, [String], false) } - if(friendlyName){ - validParam('friendlyName', friendlyName, [String], false) + if(params.friendlyName){ + validParam('friendlyName', params.friendlyName, [String], false) } - let mpcId = this.makeMpcId(uuid, friendlyName) + let mpcId = this.makeMpcId(params.uuid, params.friendlyName) + delete params.uuid + delete params.friendlyName return new MultiPartyCallParticipant(this[clientKey], {id: mpcId[0] + mpcId[1], secondaryId: participantId}).resumeParticipantRecording() } - listParticipants(uuid = null, friendlyName = null, params){ - if(uuid){ - validParam('uuid', uuid, [String], false) + listParticipants(params={}){ + if(params.uuid){ + validParam('uuid', params.uuid, [String], false) } - if(friendlyName){ - validParam('friendlyName', friendlyName, [String], false) + if(params.friendlyName){ + validParam('friendlyName', params.friendlyName, [String], false) } - let mpcId = this.makeMpcId(uuid, friendlyName) + let mpcId = this.makeMpcId(params.uuid, params.friendlyName) + delete params.uuid + delete params.friendlyName return new MultiPartyCall(this[clientKey], {id: mpcId[0] + mpcId[1]}).listParticipants(params) } - updateParticipant(participantId, uuid= null, friendlyName = null, params){ + updateParticipant(participantId, params={}){ validParam('participantId', participantId, [String, Number], true) - if(uuid){ - validParam('uuid', uuid, [String], false) + if(params.uuid){ + validParam('uuid', params.uuid, [String], false) } - if(friendlyName){ - validParam('friendlyName', friendlyName, [String], false) + if(params.friendlyName){ + validParam('friendlyName', params.friendlyName, [String], false) } - let mpcId = this.makeMpcId(uuid, friendlyName) + let mpcId = this.makeMpcId(params.uuid, params.friendlyName) + delete params.uuid + delete params.friendlyName return new MultiPartyCallParticipant(this[clientKey], {id: mpcId[0] + mpcId[1], secondaryId: participantId}).updateParticipant(params) } - kickParticipant(participantId, uuid = null, friendlyName = null){ + kickParticipant(participantId, params={}){ validParam('participantId', participantId, [String, Number], true) - if(uuid){ - validParam('uuid', uuid, [String], false) + if(params.uuid){ + validParam('uuid', params.uuid, [String], false) } - if(friendlyName){ - validParam('friendlyName', friendlyName, [String], false) + if(params.friendlyName){ + validParam('friendlyName', params.friendlyName, [String], false) } - let mpcId = this.makeMpcId(uuid, friendlyName) + let mpcId = this.makeMpcId(params.uuid, params.friendlyName) + delete params.uuid + delete params.friendlyName return new MultiPartyCallParticipant(this[clientKey], {id: mpcId[0] + mpcId[1], secondaryId: participantId}).kickParticipant() } - getParticipant(participantId, uuid = null, friendlyName = null){ + getParticipant(participantId, params={}){ validParam('participantId', participantId, [String, Number], true) - if(uuid){ - validParam('uuid', uuid, [String], false) + if(params.uuid){ + validParam('uuid', params.uuid, [String], false) } - if(friendlyName){ - validParam('friendlyName', friendlyName, [String], false) + if(params.friendlyName){ + validParam('friendlyName', params.friendlyName, [String], false) } - let mpcId = this.makeMpcId(uuid, friendlyName) + let mpcId = this.makeMpcId(params.uuid, params.friendlyName) + delete params.uuid + delete params.friendlyName return new MultiPartyCallParticipant(this[clientKey], {id: mpcId[0] + mpcId[1], secondaryId: participantId}).getParticipant() } From 324b283c5fd627d556320fc7d677ec2451715c76 Mon Sep 17 00:00:00 2001 From: Koushik-Ayila Date: Wed, 7 Jul 2021 13:31:23 +0530 Subject: [PATCH 14/20] Added validation for status param in start MPC API --- lib/resources/multiPartyCall.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/resources/multiPartyCall.js b/lib/resources/multiPartyCall.js index 68470a9..d7426e5 100644 --- a/lib/resources/multiPartyCall.js +++ b/lib/resources/multiPartyCall.js @@ -312,6 +312,7 @@ export class MultiPartyCall extends PlivoResource{ } start(params){ + validParam('status', params.status, [String], true, 'active') return super.executeAction(this.id + '/', 'POST', {'status' : params.status, 'isVoiceRequest' : 'true'}) } From d584e6ad26344422009ac2a3910260d22d83ccf8 Mon Sep 17 00:00:00 2001 From: Koushik-Ayila Date: Wed, 7 Jul 2021 15:34:10 +0530 Subject: [PATCH 15/20] convert status variable value to lowercase --- lib/resources/multiPartyCall.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/resources/multiPartyCall.js b/lib/resources/multiPartyCall.js index d7426e5..70b7ee7 100644 --- a/lib/resources/multiPartyCall.js +++ b/lib/resources/multiPartyCall.js @@ -313,7 +313,7 @@ export class MultiPartyCall extends PlivoResource{ start(params){ validParam('status', params.status, [String], true, 'active') - return super.executeAction(this.id + '/', 'POST', {'status' : params.status, 'isVoiceRequest' : 'true'}) + return super.executeAction(this.id + '/', 'POST', {'status' : params.status.toLowerCase(), 'isVoiceRequest' : 'true'}) } stop(){ From 9233c200d427f1fc19cc134311b964694940816b Mon Sep 17 00:00:00 2001 From: Koushik-Ayila Date: Wed, 7 Jul 2021 15:36:19 +0530 Subject: [PATCH 16/20] convert status variable value to lowercase --- lib/resources/multiPartyCall.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/resources/multiPartyCall.js b/lib/resources/multiPartyCall.js index 70b7ee7..3d3fca8 100644 --- a/lib/resources/multiPartyCall.js +++ b/lib/resources/multiPartyCall.js @@ -312,7 +312,7 @@ export class MultiPartyCall extends PlivoResource{ } start(params){ - validParam('status', params.status, [String], true, 'active') + validParam('status', params.statustoLowerCase(), [String], true, 'active') return super.executeAction(this.id + '/', 'POST', {'status' : params.status.toLowerCase(), 'isVoiceRequest' : 'true'}) } From 56c7e528f2bb45a21610839d6d2dec3d9ad6201d Mon Sep 17 00:00:00 2001 From: Koushik-Ayila Date: Wed, 7 Jul 2021 15:37:09 +0530 Subject: [PATCH 17/20] convert status variable value to lowercase --- lib/resources/multiPartyCall.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/resources/multiPartyCall.js b/lib/resources/multiPartyCall.js index 3d3fca8..bcb6616 100644 --- a/lib/resources/multiPartyCall.js +++ b/lib/resources/multiPartyCall.js @@ -312,7 +312,7 @@ export class MultiPartyCall extends PlivoResource{ } start(params){ - validParam('status', params.statustoLowerCase(), [String], true, 'active') + validParam('status', params.status.toLowerCase(), [String], true, 'active') return super.executeAction(this.id + '/', 'POST', {'status' : params.status.toLowerCase(), 'isVoiceRequest' : 'true'}) } From a674b9f465d3b2c7705ad21fb46c673b71786fe0 Mon Sep 17 00:00:00 2001 From: Koushik-Ayila Date: Wed, 7 Jul 2021 20:08:54 +0530 Subject: [PATCH 18/20] Fixed status mandatory param bug --- lib/resources/multiPartyCall.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/resources/multiPartyCall.js b/lib/resources/multiPartyCall.js index bcb6616..0fe35c6 100644 --- a/lib/resources/multiPartyCall.js +++ b/lib/resources/multiPartyCall.js @@ -8,7 +8,7 @@ import { validRange, validMultipleDestinationNos, validMultipleDestinationIntegers, - isOneAmongStringUrl, multiValidParam + isOneAmongStringUrl, multiValidParam, InvalidRequestError } from '../rest/utils.js' const clientKey = Symbol(); @@ -312,7 +312,12 @@ export class MultiPartyCall extends PlivoResource{ } start(params){ - validParam('status', params.status.toLowerCase(), [String], true, 'active') + if(params.status) { + validParam('status', params.status.toLowerCase(), [String], true, 'active') + } + else{ + throw new InvalidRequestError("status is a mandatory parameter"); + } return super.executeAction(this.id + '/', 'POST', {'status' : params.status.toLowerCase(), 'isVoiceRequest' : 'true'}) } From d54dd6436664f177f789a2357a438257f761c74f Mon Sep 17 00:00:00 2001 From: Koushik-Ayila Date: Thu, 8 Jul 2021 10:54:35 +0530 Subject: [PATCH 19/20] Version bump up --- CHANGELOG.md | 3 +++ package.json | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65a1554..9a3b868 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Change Log +## [v4.19.2](https://github.com/plivo/plivo-node/tree/v4.19.2) (2021-07-08) +- MPC SDK fixes to pass params in a user-friendly manner. + ## [v4.19.1](https://github.com/plivo/plivo-node/tree/v4.19.1) (2021-07-05) - **WARNING**: Removed the total_count parameter in meta data for list MDR response diff --git a/package.json b/package.json index e40b1c5..72a3236 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plivo", - "version": "4.19.1", + "version": "4.19.2", "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": [ From 0d1946039af6bc0d9a825ee8de1f6548ab450975 Mon Sep 17 00:00:00 2001 From: huzaif-plivo Date: Tue, 13 Jul 2021 18:18:11 +0530 Subject: [PATCH 20/20] update: changelog --- CHANGELOG.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe95e68..19c5b5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Change Log -## [v4.20.0](https://github.com/plivo/plivo-node/tree/v4.20.0) (2021-07-06) -- Powerpack ID filter for list MDR + +## [v4.20.0](https://github.com/plivo/plivo-node/tree/v4.20.0) (2021-07-13) +- Power pack ID has been included to the response for the [list all messages API](https://www.plivo.com/docs/sms/api/message/list-all-messages/) and the [get message details API](https://www.plivo.com/docs/sms/api/message#retrieve-a-message). +- Support for filtering messages by Power pack ID has been added to the [list all messages API](https://www.plivo.com/docs/sms/api/message#list-all-messages). ## [v4.19.2](https://github.com/plivo/plivo-node/tree/v4.19.2) (2021-07-08) - MPC SDK fixes to pass params in a user-friendly manner.