diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d197b5..ca41f8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Change Log +## [7.2.2](https://github.com/plivo/plivo-go/tree/v7.2.2) (2021-07-29) +- Removed validation for `ringtimeout` and `delaydial` params in [Start a multi party call](https://www.plivo.com/docs/voice/api/multiparty-call#start-a-new-multiparty-call). + ## [7.2.1](https://github.com/plivo/plivo-go/tree/v7.2.1) (2021-07-22) - Updated default HTTP client request timeout to 5 seconds. diff --git a/baseclient.go b/baseclient.go index 649a58b..d4d10f5 100644 --- a/baseclient.go +++ b/baseclient.go @@ -13,7 +13,7 @@ import ( "github.com/google/go-querystring/query" ) -const sdkVersion = "7.2.1" +const sdkVersion = "7.2.2" const lookupBaseUrl = "lookup.plivo.com" diff --git a/multipartycall.go b/multipartycall.go index 7063c6c..574046f 100644 --- a/multipartycall.go +++ b/multipartycall.go @@ -225,12 +225,12 @@ func (service *MultiPartyCallService) AddParticipant(basicParams MultiPartyCallB if params.RingTimeout == nil { params.RingTimeout = 45 } else { - MultipleValidIntegers("RingTimeout", params.RingTimeout, 15, 120) + MultipleValidIntegers("RingTimeout", params.RingTimeout) } if params.DelayDial == nil { params.DelayDial = 0 } else { - MultipleValidIntegers("DelayDial", params.DelayDial, 0, 120) + MultipleValidIntegers("DelayDial", params.DelayDial) } req, err := service.client.NewRequest("POST", params, "MultiPartyCall/%s/Participant", mpcId) if err != nil { diff --git a/validators.go b/validators.go index f2187c8..f1238f8 100644 --- a/validators.go +++ b/validators.go @@ -7,28 +7,17 @@ import ( "strings" ) -func MultipleValidIntegers(paramname string, paramvalue interface{}, lowerbound int, upperbound int) { - if reflect.TypeOf(paramvalue).Kind() == reflect.Int { - paramvalue := paramvalue.(int) - if paramvalue < lowerbound || paramvalue > upperbound { - error := paramname + " values must be in the range [" + strconv.Itoa(lowerbound) + " , " + strconv.Itoa(upperbound) + "]" - logrus.Fatal(error) - } - } else if reflect.TypeOf(paramvalue).Kind() == reflect.String { +func MultipleValidIntegers(paramname string, paramvalue interface{}) { + if reflect.TypeOf(paramvalue).Kind() == reflect.String { paramvalue := paramvalue.(string) values := strings.SplitN(paramvalue, "<", -1) for i := 0; i < len(values); i++ { - val, err := strconv.Atoi(values[i]) + _, err := strconv.Atoi(values[i]) if err != nil { logrus.Fatal(paramname + " Destination values in the string must be integers") - } else { - if val < lowerbound || val > upperbound { - error := paramname + " Destination values must be in the range [" + strconv.Itoa(lowerbound) + " , " + strconv.Itoa(upperbound) + "]" - logrus.Fatal(error) - } } } - } else { + } else if reflect.TypeOf(paramvalue).Kind() != reflect.Int && reflect.TypeOf(paramvalue).Kind() != reflect.String { logrus.Fatal(paramname + " must be either string or integer") } }