mirror of
https://github.com/donl/plivo-node.git
synced 2026-06-30 06:12:08 -06:00
Merge pull request #197 from plivo/VT-3282
VT-3282: Removed range validation for ringtimeout and delaydial
This commit is contained in:
commit
ff94ce2428
5 changed files with 25 additions and 20 deletions
|
|
@ -1,5 +1,11 @@
|
|||
# Change Log
|
||||
|
||||
## [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).
|
||||
- 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).
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -115,17 +115,7 @@ export function validMultipleDestinationNos(paramName, paramValue, options = {})
|
|||
export function validMultipleDestinationIntegers(paramName, paramValue){
|
||||
let val = paramValue.split("<");
|
||||
for (let i=0; i<val.length; i++){
|
||||
if (!isNaN(val[i]) && Number.isInteger(parseFloat(val[i]))){
|
||||
if(paramName=="delayDial"){
|
||||
if(val[i]!='0'){
|
||||
validRange('DelayDial Destination Value', parseInt(val[i]), false, 1, 120);
|
||||
}
|
||||
}
|
||||
else if (paramName=="ringTimeout"){
|
||||
validRange('RingTimeout Destination Value', parseInt(val[i]), false, 15, 120);
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (!(/^-?\d+$/.test(val[i]))){
|
||||
throw new InvalidRequestError( paramName + " Destination value must be integer");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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": [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue