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
1 change: 1 addition & 0 deletions lib/plivo/resources/calls.rb
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ def initialize(client, resource_list_json = nil)
# @option options [String] :sip_headers- List of SIP headers in the form of 'key=value' pairs, separated by commas. E.g. head1=val1,head2=val2,head3=val3,...,headN=valN. The SIP headers are always prefixed with X-PH-. The SIP headers are present for every HTTP request made by the outbound call. Only [A-Z], [a-z] and [0-9] characters are allowed for the SIP headers key and value. Additionally, the '%' character is also allowed for the SIP headers value so that you can encode this value in the URL.
# @option options [Int] :ring_timeout - Determines the time in seconds the call should ring. If the call is not answered within the ring_timeout value or the default value of 120s, it is canceled.
# @option options [String] :parent_call_uuid - The call_uuid of the first leg in an ongoing conference call. It is recommended to use this parameter in scenarios where a member who is already present in the conference intends to add new members by initiating outbound API calls. This minimizes the delay in adding a new memeber to the conference.
# @option options [String] :retry_on - Comma-separated list of failure reasons that should trigger the HA Secondary-Number Retry for this call. Valid values are busy_line, no_answer, rejected and ring_timeout. When set, it overrides the account-level retry reasons configuration.
# @option options [Boolean] :error_parent_not_found - if set to true and the parent_call_uuid cannot be found, the API request would return an error. If set to false, the outbound call API request will be executed even if the parent_call_uuid is not found. Defaults to false.
# @return [Call] Call
def create(from, to, answer_url, options = nil)
Expand Down
19 changes: 19 additions & 0 deletions spec/resource_calls_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,25 @@ def to_json_list_live(list_object)
})
end

it 'creates a call with retry_on' do
contents = File.read(Dir.pwd + '/spec/mocks/callCreateResponse.json')
mock(201, JSON.parse(contents))
expect(JSON.parse(to_json_create(@api.calls
.create('+919090909090',
['+919898989898'],
'http://www.answer.url',
{retry_on: 'busy_line,no_answer'}))))
.to eql(JSON.parse(contents))
compare_requests(uri: '/v1/Account/MAXXXXXXXXXXXXXXXXXX/Call/',
method: 'POST',
data: {
from: '+919090909090',
to: '+919898989898',
answer_url: 'http://www.answer.url',
retry_on: 'busy_line,no_answer'
})
end

it 'fetches details of a call' do
contents = File.read(Dir.pwd + '/spec/mocks/callGetResponse.json')
mock(200, JSON.parse(contents))
Expand Down
Loading