From cb768f42a3e178f2070a88babe6c572d09b93347 Mon Sep 17 00:00:00 2001 From: lokiNK Date: Tue, 21 May 2019 21:52:59 +0530 Subject: [PATCH] fixed transfer API validation --- plivo/resources/calls.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/plivo/resources/calls.py b/plivo/resources/calls.py index 2884291e..b68d6973 100755 --- a/plivo/resources/calls.py +++ b/plivo/resources/calls.py @@ -234,7 +234,7 @@ def get(self, call_uuid): ) def update(self, call_uuid, - legs=None, + legs, aleg_url=None, aleg_method=None, bleg_url=None, @@ -249,6 +249,21 @@ def transfer(self, aleg_method=None, bleg_url=None, bleg_method=None): + if legs is None: + raise ValidationError( + 'Which leg of the call should be transfered? aleg,bleg or both?') + elif (legs == 'aleg' and aleg_url is None): + raise ValidationError( + 'aleg is mentioned. Please mention aleg_url as well' + ) + elif (legs == 'bleg' and bleg_url is None): + raise ValidationError( + 'bleg is mentioned. Please mention bleg_url as well' + ) + elif (legs == 'both' and (aleg_url is None and bleg_url is None)): + raise ValidationError( + 'both legs are mentioned. Please mention both aleg_url and bleg_url' + ) return self.update( call_uuid, legs=legs,