From 166b5de9a473f9d0b460c552bf83eac16f169eef Mon Sep 17 00:00:00 2001 From: ajay-plivo Date: Fri, 22 Apr 2022 09:44:11 +0530 Subject: [PATCH 1/3] VT-4182_1 --- lib/plivo/resources/multipartycalls.rb | 6 +++++- spec/resource_multipartycalls_spec.rb | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/plivo/resources/multipartycalls.rb b/lib/plivo/resources/multipartycalls.rb index f5fa307e..80621904 100644 --- a/lib/plivo/resources/multipartycalls.rb +++ b/lib/plivo/resources/multipartycalls.rb @@ -35,6 +35,7 @@ def add_participant(role, delay_dial=0, max_duration=14400, max_participants=10, + record_min_member_count=1, wait_music_url=nil, wait_music_method='GET', agent_hold_music_url=nil, @@ -95,6 +96,7 @@ def add_participant(role, valid_multiple_destination_integers?(:delay_dial, delay_dial) valid_range?(:max_duration, max_duration, false, 300, 28800) valid_range?(:max_participants, max_participants, false, 2, 10) + valid_range?(:record_min_member_count, record_min_member_count, false, 1, 2) valid_url?(:wait_music_url, wait_music_url, false ) unless wait_music_url.nil? valid_param?(:wait_music_method, wait_music_method.upcase, String, false , %w[GET POST]) valid_url?(:agent_hold_music_url, agent_hold_music_url, false) unless agent_hold_music_url.nil? @@ -150,6 +152,7 @@ def add_participant(role, params[:delay_dial] = delay_dial unless delay_dial.nil? params[:max_duration] = max_duration unless max_duration.nil? params[:max_participants] = max_participants unless max_participants.nil? + params[:record_min_member_count] = record_min_member_count unless record_min_member_count.nil? params[:wait_music_url] = wait_music_url unless wait_music_url.nil? params[:wait_music_method] = wait_music_method.upcase unless wait_music_method.nil? params[:agent_hold_music_url] = agent_hold_music_url unless agent_hold_music_url.nil? @@ -426,6 +429,7 @@ def add_participant(options = {}) options[:delay_dial] = 0 unless options.key?(:delay_dial) options[:max_duration] = 14400 unless options.key?(:max_duration) options[:max_participants] = 10 unless options.key?(:max_participants) + options[:record_min_member_count] = 1 unless options.key?(:record_min_member_count) options[:wait_music_method] = 'GET' unless options.key?(:wait_music_method) options[:agent_hold_music_method] = 'GET' unless options.key?(:agent_hold_music_method) options[:customer_hold_music_method] = 'GET' unless options.key?(:customer_hold_music_method) @@ -453,7 +457,7 @@ def add_participant(options = {}) mpc_id = make_mpc_id(options[:uuid], options[:friendly_name]) MultiPartyCall.new(@_client, resource_id: mpc_id[1], multi_party_prefix: mpc_id[0]).add_participant(options[:role],options[:from],options[:to],options[:call_uuid],options[:caller_name],options[:call_status_callback_url],options[:call_status_callback_method],options[:sip_headers],options[:confirm_key], - options[:confirm_key_sound_url],options[:confirm_key_sound_method],options[:dial_music],options[:ring_timeout],options[:delay_dial],options[:max_duration], options[:max_participants],options[:wait_music_url], + options[:confirm_key_sound_url],options[:confirm_key_sound_method],options[:dial_music],options[:ring_timeout],options[:delay_dial],options[:max_duration], options[:max_participants],options[:record_min_member_count],options[:wait_music_url], options[:wait_music_method],options[:agent_hold_music_url],options[:agent_hold_music_method],options[:customer_hold_music_url],options[:customer_hold_music_method], options[:recording_callback_url],options[:recording_callback_method],options[:status_callback_url],options[:status_callback_method],options[:on_exit_action_url], options[:on_exit_action_method], options[:record],options[:record_file_format],options[:status_callback_events],options[:stay_alone], options[:coach_mode],options[:mute],options[:hold],options[:start_mpc_on_enter],options[:end_mpc_on_exit], diff --git a/spec/resource_multipartycalls_spec.rb b/spec/resource_multipartycalls_spec.rb index 2d8082d1..d38b96aa 100644 --- a/spec/resource_multipartycalls_spec.rb +++ b/spec/resource_multipartycalls_spec.rb @@ -77,6 +77,7 @@ def to_json_MPC_start_play(mpc) 'agent_hold_music_method': 'GET', 'wait_music_method': 'GET', 'max_participants': 10, + 'record_min_member_count': 1, 'max_duration': 14400, 'ring_timeout': 45, 'dial_music': 'Real', From 6ce37e11dcb6da92a80c56db2757650fa34c36ff Mon Sep 17 00:00:00 2001 From: ajay-plivo Date: Fri, 22 Apr 2022 09:59:26 +0530 Subject: [PATCH 2/3] VT-4182_1 --- lib/plivo/xml/multipartycall.rb | 8 +++++++- makeCall.rb | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 makeCall.rb diff --git a/lib/plivo/xml/multipartycall.rb b/lib/plivo/xml/multipartycall.rb index a3307807..d9fe597a 100644 --- a/lib/plivo/xml/multipartycall.rb +++ b/lib/plivo/xml/multipartycall.rb @@ -2,7 +2,7 @@ module Plivo module XML class MultiPartyCall < Element @nestables = [] - @valid_attributes = %w[role maxDuration maxParticipants waitMusicUrl + @valid_attributes = %w[role maxDuration maxParticipants recordMinMemberCount waitMusicUrl waitMusicMethod agentHoldMusicUrl agentHoldMusicMethod customerHoldMusicUrl customerHoldMusicMethod record recordFileFormat recordingCallbackUrl recordingCallbackMethod @@ -37,6 +37,12 @@ def initialize(body, attributes = {}) attributes[:maxParticipants] = 10 end + if attributes[:recordMinMemberCount] && (attributes[:recordMinMemberCount]<1 || attributes[:recordMinMemberCount]>2) + raise PlivoXMLError, "invalid attribute value #{attributes[:recordMinMemberCount]} for recordMinMemberCount" + elsif !attributes[:recordMinMemberCount] + attributes[:recordMinMemberCount] = 10 + end + if attributes[:waitMusicMethod] && !VALID_METHOD_VALUES.include?(attributes[:waitMusicMethod].upcase) raise PlivoXMLError, "invalid attribute value #{attributes[:waitMusicMethod]} for waitMusicMethod" elsif !attributes[:waitMusicMethod] diff --git a/makeCall.rb b/makeCall.rb new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/makeCall.rb @@ -0,0 +1 @@ + From 028e703f357a18aba91b8551972f54adeb1a982d Mon Sep 17 00:00:00 2001 From: ajay-plivo Date: Fri, 22 Apr 2022 10:01:56 +0530 Subject: [PATCH 3/3] VT-4182_1 --- spec/xml_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/xml_spec.rb b/spec/xml_spec.rb index 8f0e15ec..d0add5f2 100644 --- a/spec/xml_spec.rb +++ b/spec/xml_spec.rb @@ -111,6 +111,6 @@ xml = Plivo::XML::PlivoXML.new(resp) puts xml.to_xml - expect(xml.to_xml).to eql("My room18217654321sip:john1234@phone.plivo.com182176543211567123456712345Enter PIN number.Input not recieved.Tell us more about your experience.Statement not recieved.Call will hangup after a min.Hi, message from Plivo.https://amazonaws.com/Trumpet.mp3This call will cost $2 a min.Thanks for dropping by.15551234567Leave message after the beep.Recording not received.Your call is being transferred.http://foo.com/redirect/Go green, go plivo.I will wait 7 seconds starting now!I just waited 7 seconds.https://s3.amazonaws.com/abc.mp3HelloHello, welcome to the Jungle.Nairobi") + expect(xml.to_xml).to eql("My room18217654321sip:john1234@phone.plivo.com182176543211567123456712345Enter PIN number.Input not recieved.Tell us more about your experience.Statement not recieved.Call will hangup after a min.Hi, message from Plivo.https://amazonaws.com/Trumpet.mp3This call will cost $2 a min.Thanks for dropping by.15551234567Leave message after the beep.Recording not received.Your call is being transferred.http://foo.com/redirect/Go green, go plivo.I will wait 7 seconds starting now!I just waited 7 seconds.https://s3.amazonaws.com/abc.mp3HelloHello, welcome to the Jungle.Nairobi") end end