From 3980b7772926bf6f3aac4fa2ed946370e60e7511 Mon Sep 17 00:00:00 2001 From: LSAITHARUN Date: Tue, 6 Jul 2021 12:48:29 +0530 Subject: [PATCH] Fixed the issue to allow only agent role for paralleldial and set the limit to 20 --- plivo/resources/multipartycall.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plivo/resources/multipartycall.py b/plivo/resources/multipartycall.py index e6c80eab..77fbdef3 100644 --- a/plivo/resources/multipartycall.py +++ b/plivo/resources/multipartycall.py @@ -295,6 +295,10 @@ def add_participant(self, raise ValidationError('specify either call_uuid or (from, to)') if call_uuid is None and (not from_ or not to_): raise ValidationError('specify (from, to) when not adding an existing call_uuid to multi party participant') + if len(to_.split('<')) > 1 and role.lower() != "agent": + raise ValidationError('Multiple to_ values given for role ' + role) + elif len(to_.split('<')) > 20: + raise ValidationError('No of to_ values provided should be lesser than 20') return self.client.request('POST', ('MultiPartyCall', mpc_id, 'Participant'), self.__clean_identifiers(to_param_dict(self.add_participant, locals())), is_voice_request=True)