diff --git a/plivo/resources/calls.py b/plivo/resources/calls.py index 55d3972e..a8dd6b1d 100644 --- a/plivo/resources/calls.py +++ b/plivo/resources/calls.py @@ -176,6 +176,7 @@ class Calls(PlivoResourceInterface): ], callback_url=[optional(is_url())], callback_method=[optional(of_type(six.text_type))], + retry_on=[optional(of_type(six.text_type))], ) def create(self, from_, @@ -202,7 +203,8 @@ def create(self, parent_call_uuid=None, error_if_parent_not_found=False, callback_url=None, - callback_method=None): + callback_method=None, + retry_on=None): if from_ in to_.split('<'): raise ValidationError('src and destination cannot overlap') return self.client.request('POST', ('Call',), to_param_dict(self.create, locals()), is_voice_request=True) diff --git a/tests/resources/test_calls.py b/tests/resources/test_calls.py index 043afbf9..d1da1d6e 100644 --- a/tests/resources/test_calls.py +++ b/tests/resources/test_calls.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- +import json + from tests.base import PlivoResourceTestCase from tests.decorators import with_response @@ -19,6 +21,19 @@ def test_create(self): self.assertUrlEqual( self.get_voice_url('Call'), self.client.current_request.url) + @with_response(201, method_name='create') + def test_create_with_retry_on(self): + self.client.calls.create( + from_='1231231230', + to_='3213213210', + answer_url='http://www.example.com', + retry_on='busy_line,no_answer') + self.assertEqual(self.client.current_request.method, 'POST') + self.assertUrlEqual( + self.get_voice_url('Call'), self.client.current_request.url) + request_body = json.loads(self.client.current_request.body) + self.assertEqual('busy_line,no_answer', request_body['retry_on']) + @with_response(200) def test_list(self): self.client.calls.list()