From f27cfc0be1dce0e15f93e934856aeb7ebad4aaf1 Mon Sep 17 00:00:00 2001 From: LSAITHARUN Date: Mon, 12 Jul 2021 23:50:23 +0530 Subject: [PATCH 1/6] Removed range validation for ringtimeout and delaydial --- lib/resources/multiPartyCall.js | 16 ++++++++-------- lib/rest/utils.js | 12 +----------- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/lib/resources/multiPartyCall.js b/lib/resources/multiPartyCall.js index 0fe35c6..31cce28 100644 --- a/lib/resources/multiPartyCall.js +++ b/lib/resources/multiPartyCall.js @@ -106,24 +106,24 @@ export class MultiPartyCall extends PlivoResource{ if(params.ringTimeout || params.ringTimeout === 0){ validParam('ringTimeout', params.ringTimeout, [String, Number], false) - if(Number.isInteger(params.ringTimeout)){ - validRange('RingTimeout', params.ringTimeout, false, 15, 120) - } - else{ + if(typeof(params.ringTimeout) === 'string'){ validMultipleDestinationIntegers('ringTimeout', params.ringTimeout) } + else if (!Number.isInteger(params.ringTimeout) && typeof(params.ringTimeout) !== 'string'){ + throw new InvalidRequestError("RingTimeout must be of type int or string") + } } else { params.ringTimeout = 45 } if(params.delayDial){ validParam('delayDial', params.delayDial, [String, Number], false) - if(Number.isInteger(params.delayDial)){ - validRange('DelayDial', params.delayDial, false, 1, 120) - } - else{ + if(typeof(params.delayDial) === 'string'){ validMultipleDestinationIntegers('delayDial', params.delayDial) } + else if(!Number.isInteger(params.delayDial) && typeof(params.delayDial) !== 'string'){ + throw new InvalidRequestError("Dealydial must be of type int or string") + } } else { params.delayDial = 0 diff --git a/lib/rest/utils.js b/lib/rest/utils.js index 8a7538c..934836c 100644 --- a/lib/rest/utils.js +++ b/lib/rest/utils.js @@ -115,17 +115,7 @@ export function validMultipleDestinationNos(paramName, paramValue, options = {}) export function validMultipleDestinationIntegers(paramName, paramValue){ let val = paramValue.split("<"); for (let i=0; i Date: Thu, 15 Jul 2021 14:54:43 +0530 Subject: [PATCH 2/6] Added validations for number of destinations specified in delaydial and ringtimeout --- lib/resources/multiPartyCall.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/resources/multiPartyCall.js b/lib/resources/multiPartyCall.js index 31cce28..3fee3f8 100644 --- a/lib/resources/multiPartyCall.js +++ b/lib/resources/multiPartyCall.js @@ -306,6 +306,12 @@ export class MultiPartyCall extends PlivoResource{ else { params.exitSoundMethod = 'GET' } + if(params.to && (String(params.ringTimeout).split('<').length > params.to.split('<').length)){ + throw new MPCError("RingTimeout:number of ring_timeout(s) should be same as number of destination(s)") + } + if(params.to && (String(params.delayDial).split('<').length > params.to.split('<').length)){ + throw new MPCError("DelayDial:number of delay_dial(s) should be same as number of destination(s)") + } params.isVoiceRequest = 'true'; params.callerName = params.callerName || params.from; return super.executeAction(this.id + '/Participant/', 'POST', params) From e50d38b4d9fee1e39815f621865b6d91beea217f Mon Sep 17 00:00:00 2001 From: LSAITHARUN Date: Mon, 19 Jul 2021 10:56:02 +0530 Subject: [PATCH 3/6] Added Version Bump up --- CHANGELOG.md | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19c5b5d..bd1bbb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## [v4.20.1](https://github.com/plivo/plivo-node/tree/v4.20.1) (2021-07-19) +- Removed range validation for ringtimeout and delaydial params in MPC. +- Added validatons for multiple destination values in ringtimeout and delaydial params when lesser number of 'to' values are specified in MPC + ## [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). diff --git a/package.json b/package.json index d429fd9..a287d5d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plivo", - "version": "4.20.0", + "version": "4.20.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 347d60acfed2b1fe6ed757641fa1da1b0a5ddfe1 Mon Sep 17 00:00:00 2001 From: LSAITHARUN Date: Mon, 19 Jul 2021 16:04:55 +0530 Subject: [PATCH 4/6] Changed request timeout default value to 5 --- lib/rest/axios.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/rest/axios.js b/lib/rest/axios.js index 5316274..ba74448 100644 --- a/lib/rest/axios.js +++ b/lib/rest/axios.js @@ -175,6 +175,9 @@ export function Axios(config) { if (typeof config.timeout !== 'undefined') { options.timeout = config.timeout; } + else if(typeof config.timeout === 'undefined'){ + options.timeout = 5000; + } return new Promise((resolve, reject) => { if (isVoiceReq) { From a572821293fb42f7faa1252b8fe9dc0a8db02d4f Mon Sep 17 00:00:00 2001 From: LSAITHARUN Date: Mon, 19 Jul 2021 16:13:25 +0530 Subject: [PATCH 5/6] Updated Changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd1bbb7..5b6cc80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [v4.20.1](https://github.com/plivo/plivo-node/tree/v4.20.1) (2021-07-19) - Removed range validation for ringtimeout and delaydial params in MPC. - Added validatons for multiple destination values in ringtimeout and delaydial params when lesser number of 'to' values are specified in MPC +- Change default request timeout value to 5 ## [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). From f043d6c01728738bcec4f9177e2a2891f4f88241 Mon Sep 17 00:00:00 2001 From: huzaif-plivo Date: Tue, 27 Jul 2021 14:39:09 +0530 Subject: [PATCH 6/6] updated changelog --- CHANGELOG.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b6cc80..b32fdd7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,10 @@ # Change Log -## [v4.20.1](https://github.com/plivo/plivo-node/tree/v4.20.1) (2021-07-19) -- Removed range validation for ringtimeout and delaydial params in MPC. -- Added validatons for multiple destination values in ringtimeout and delaydial params when lesser number of 'to' values are specified in MPC -- Change default request timeout value to 5 +## [v4.20.1](https://github.com/plivo/plivo-node/tree/v4.20.1) (2021-07-27) +- Updates to [add a member a multi-party call API](https://www.plivo.com/docs/voice/api/multiparty-call/participants#add-a-participant). + - Remove validation range for `delay` and `ringtimeout` parameters. + - Add appropriate error message for multiple `ringtimeout` and `delaydial` values. +- Updated default HTTP client request timeout to 5 seconds. ## [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).