Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion plivo/resources/calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_,
Expand All @@ -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)
Expand Down
15 changes: 15 additions & 0 deletions tests/resources/test_calls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-

import json

from tests.base import PlivoResourceTestCase
from tests.decorators import with_response

Expand All @@ -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()
Expand Down
Loading