Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed code changes of start recording and stop recording announcement on MPC #163

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
19 changes: 2 additions & 17 deletions lib/plivo/resources/multipartycalls.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,7 @@ def add_participant(role,
enter_sound='beep:1',
enter_sound_method='GET',
exit_sound='beep:2',
exit_sound_method='GET',
start_recording_audio=nil,
start_recording_audio_method='GET',
stop_recording_audio=nil,
stop_recording_audio_method='GET')
exit_sound_method='GET')
if (from and to) and call_uuid
raise_invalid_request('cannot specify call_uuid when (from, to) is provided')
end
Expand Down Expand Up @@ -121,10 +117,6 @@ def add_participant(role,
valid_param?(:enter_sound_method, enter_sound_method.upcase, String, false, %w[GET POST])
is_one_among_string_url?(:exit_sound, exit_sound, false , %w[beep:1 beep:2 none])
valid_param?(:exit_sound_method, exit_sound_method.upcase, String, false, %w[GET POST])
valid_param?(:start_recording_audio_method, start_recording_audio_method.upcase, String, false, %w[GET POST])
valid_url?(:start_recording_audio, start_recording_audio, false ) unless start_recording_audio.nil?
valid_param?(:stop_recording_audio_method, stop_recording_audio_method.upcase, String, false, %w[GET POST])
valid_url?(:stop_recording_audio, stop_recording_audio, false ) unless stop_recording_audio.nil?
if (to!=nil) && (ring_timeout.is_a?(String)) && (to.split('<').size < ring_timeout.split('<').size)
raise_invalid_request("RingTimeout:number of ring_timout(s) should be same as number of destination(s)")
end
Expand Down Expand Up @@ -176,10 +168,6 @@ def add_participant(role,
params[:enter_sound_method] = enter_sound_method.upcase unless exit_sound_method.nil?
params[:exit_sound] = exit_sound unless exit_sound.nil?
params[:exit_sound_method] = exit_sound_method.upcase unless exit_sound_method.nil?
params[:start_recording_audio] = start_recording_audio unless start_recording_audio.nil?
params[:start_recording_audio_method] = start_recording_audio_method.upcase unless start_recording_audio_method.nil?
params[:stop_recording_audio] = stop_recording_audio unless stop_recording_audio.nil?
params[:stop_recording_audio_method] = stop_recording_audio_method.upcase unless stop_recording_audio_method.nil?
perform_action_apiresponse('Participant', 'POST', params, true )
end

Expand Down Expand Up @@ -446,8 +434,6 @@ def add_participant(options = {})
options[:enter_sound_method] = 'GET' unless options.key?(:enter_sound_method)
options[:exit_sound] = 'beep:2' unless options.key?(:exit_sound)
options[:exit_sound_method] = 'GET' unless options.key?(:exit_sound_method)
options[:start_recording_audio_method] = 'GET' unless options.key?(:start_recording_audio_method)
options[:stop_recording_audio_method] = 'GET' unless options.key?(:stop_recording_audio_method)
valid_param?(:friendly_name, options[:friendly_name], String, false) unless options[:friendly_name].nil?
valid_param?(:uuid, options[:uuid], String, false) unless options[:uuid].nil?
mpc_id = make_mpc_id(options[:uuid], options[:friendly_name])
Expand All @@ -457,8 +443,7 @@ def add_participant(options = {})
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],
options[:relay_dtmf_inputs],options[:enter_sound],options[:enter_sound_method],options[:exit_sound],options[:exit_sound_method], options[:start_recording_audio], options[:start_recording_audio_method],
options[:stop_recording_audio], options[:stop_recording_audio_method])
options[:relay_dtmf_inputs],options[:enter_sound],options[:enter_sound_method],options[:exit_sound],options[:exit_sound_method])
end

def start(options = {})
Expand Down
26 changes: 2 additions & 24 deletions lib/plivo/xml/multipartycall.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ class MultiPartyCall < Element
statusCallbackEvents statusCallbackUrl statusCallbackMethod
stayAlone coachMode mute hold startMpcOnEnter endMpcOnExit
enterSound enterSoundMethod exitSound exitSoundMethod
onExitActionUrl onExitActionMethod relayDTMFInputs
startRecordingAudio startRecordingAudioMethod
stopRecordingAudio stopRecordingAudioMethod]
onExitActionUrl onExitActionMethod relayDTMFInputs]

VALID_ROLE_VALUES = %w[agent supervisor customer]
VALID_METHOD_VALUES = %w[GET POST]
Expand Down Expand Up @@ -180,27 +178,7 @@ def initialize(body, attributes = {})
if attributes[:customerHoldMusicUrl] && !valid_url?(:customerHoldMusicUrl, attributes[:customerHoldMusicUrl], false)
raise PlivoXMLError, "invalid attribute value #{attributes[:customerHoldMusicUrl]} for customerHoldMusicUrl"
end

if attributes[:startRecordingAudio] && !valid_url?(:startRecordingAudio, attributes[:startRecordingAudio], false)
raise PlivoXMLError, "invalid attribute value #{attributes[:startRecordingAudio]} for startRecordingAudio"
end

if attributes[:stopRecordingAudio] && !valid_url?(:stopRecordingAudio, attributes[:stopRecordingAudio], false)
raise PlivoXMLError, "invalid attribute value #{attributes[:stopRecordingAudio]} for stopRecordingAudio"
end

if attributes[:startRecordingAudioMethod] && !VALID_METHOD_VALUES.include?(attributes[:startRecordingAudioMethod].upcase)
raise PlivoXMLError, "invalid attribute value #{attributes[:startRecordingAudioMethod]} for startRecordingAudioMethod"
elsif !attributes[:startRecordingAudioMethod]
attributes[:startRecordingAudioMethod] = 'GET'
end

if attributes[:stopRecordingAudioMethod] && !VALID_METHOD_VALUES.include?(attributes[:stopRecordingAudioMethod].upcase)
raise PlivoXMLError, "invalid attribute value #{attributes[:stopRecordingAudioMethod]} for stopRecordingAudioMethod"
elsif !attributes[:stopRecordingAudioMethod]
attributes[:stopRecordingAudioMethod] = 'GET'
end


raise PlivoXMLError, 'No MPC name set for the MPC' unless body
super(body, attributes)
end
Expand Down
4 changes: 1 addition & 3 deletions spec/resource_multipartycalls_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ def to_json_MPC_start_play(mpc)
'call_uuid': '1234-5678-4321-0987',
'role': 'Agent',
'caller_name': nil,
'delay_dial': 0,
'start_recording_audio_method': 'GET',
'stop_recording_audio_method': 'GET'
'delay_dial': 0
})
end

Expand Down
2 changes: 1 addition & 1 deletion spec/xml_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,6 @@
xml = Plivo::XML::PlivoXML.new(resp)
puts xml.to_xml

expect(xml.to_xml).to eql("<?xml version=\"1.0\" encoding=\"utf-8\" ?><Response><Conference callbackMethod='POST' callbackUrl='http://foo.com/confevents/' digitsMatch='#0,90,000'>My room</Conference><Dial confirmKey='3' confirmSound='http://foo.com/sound/'><Number sendDigits='wwww2410'>18217654321</Number><User sendDigits='wwww2410'>sip:[email protected]</User></Dial><Dial action='http://foo.com/dial_action/' timeout='20'><Number>18217654321</Number></Dial><Dial><Number>15671234567</Number></Dial><DTMF>12345</DTMF><GetDigits action='http://ww.foo.com/gather_pin/' method='POST'><Speak>Enter PIN number.</Speak></GetDigits><Speak>Input not recieved.</Speak><GetInput action='http://ww.foo.com/gather_feedback/' method='POST'><Speak>Tell us more about your experience.</Speak></GetInput><Speak>Statement not recieved.</Speak><Hangup reason='rejected' schedule='60'/><Speak loop='0'>Call will hangup after a min.</Speak><Message callbackMethod='POST' callbackUrl='http://foo.com/sms_status/' dst='15671234567' src='12023222222' type='sms'>Hi, message from Plivo.</Message><Play>https://amazonaws.com/Trumpet.mp3</Play><PreAnswer><Speak>This call will cost $2 a min.</Speak></PreAnswer><Speak>Thanks for dropping by.</Speak><Record action='http://foo.com/get_recording/' redirect='false' startOnDialAnswer='true'/><Dial><Number>15551234567</Number></Dial><Speak>Leave message after the beep.</Speak><Record action='http://foo.com/get_recording/' finishOnKey='*' maxLength='30'/><Speak>Recording not received.</Speak><Speak>Your call is being transferred.</Speak><Redirect>http://foo.com/redirect/</Redirect><Speak loop='3'>Go green, go plivo.</Speak><Speak>I will wait 7 seconds starting now!</Speak><Wait length='7'/><Speak>I just waited 7 seconds.</Speak><Wait beep='true' length='120'/><Play>https://s3.amazonaws.com/abc.mp3</Play><Wait length='10'/><Speak>Hello</Speak><Wait length='10' minSilence='3000' silence='true'/><Speak>Hello, welcome to the Jungle.</Speak><MultiPartyCall agentHoldMusicMethod='GET' coachMode='true' customerHoldMusicMethod='GET' endMpcOnExit='false' enterSound='beep:1' enterSoundMethod='GET' exitSound='beep:2' exitSoundMethod='GET' hold='false' maxDuration='1000' maxParticipants='10' mute='false' onExitActionMethod='POST' record='false' recordFileFormat='mp3' recordingCallbackMethod='GET' relayDTMFInputs='false' role='Agent' startMpcOnEnter='true' startRecordingAudioMethod='GET' statusCallbackEvents='participant-speak-events, participant-digit-input-events, add-participant-api-events, participant-state-changes, mpc-state-changes' statusCallbackMethod='POST' stayAlone='false' stopRecordingAudioMethod='GET' waitMusicMethod='GET'>Nairobi</MultiPartyCall></Response>")
expect(xml.to_xml).to eql("<?xml version=\"1.0\" encoding=\"utf-8\" ?><Response><Conference callbackMethod='POST' callbackUrl='http://foo.com/confevents/' digitsMatch='#0,90,000'>My room</Conference><Dial confirmKey='3' confirmSound='http://foo.com/sound/'><Number sendDigits='wwww2410'>18217654321</Number><User sendDigits='wwww2410'>sip:[email protected]</User></Dial><Dial action='http://foo.com/dial_action/' timeout='20'><Number>18217654321</Number></Dial><Dial><Number>15671234567</Number></Dial><DTMF>12345</DTMF><GetDigits action='http://ww.foo.com/gather_pin/' method='POST'><Speak>Enter PIN number.</Speak></GetDigits><Speak>Input not recieved.</Speak><GetInput action='http://ww.foo.com/gather_feedback/' method='POST'><Speak>Tell us more about your experience.</Speak></GetInput><Speak>Statement not recieved.</Speak><Hangup reason='rejected' schedule='60'/><Speak loop='0'>Call will hangup after a min.</Speak><Message callbackMethod='POST' callbackUrl='http://foo.com/sms_status/' dst='15671234567' src='12023222222' type='sms'>Hi, message from Plivo.</Message><Play>https://amazonaws.com/Trumpet.mp3</Play><PreAnswer><Speak>This call will cost $2 a min.</Speak></PreAnswer><Speak>Thanks for dropping by.</Speak><Record action='http://foo.com/get_recording/' redirect='false' startOnDialAnswer='true'/><Dial><Number>15551234567</Number></Dial><Speak>Leave message after the beep.</Speak><Record action='http://foo.com/get_recording/' finishOnKey='*' maxLength='30'/><Speak>Recording not received.</Speak><Speak>Your call is being transferred.</Speak><Redirect>http://foo.com/redirect/</Redirect><Speak loop='3'>Go green, go plivo.</Speak><Speak>I will wait 7 seconds starting now!</Speak><Wait length='7'/><Speak>I just waited 7 seconds.</Speak><Wait beep='true' length='120'/><Play>https://s3.amazonaws.com/abc.mp3</Play><Wait length='10'/><Speak>Hello</Speak><Wait length='10' minSilence='3000' silence='true'/><Speak>Hello, welcome to the Jungle.</Speak><MultiPartyCall agentHoldMusicMethod='GET' coachMode='true' customerHoldMusicMethod='GET' endMpcOnExit='false' enterSound='beep:1' enterSoundMethod='GET' exitSound='beep:2' exitSoundMethod='GET' hold='false' maxDuration='1000' maxParticipants='10' mute='false' onExitActionMethod='POST' record='false' recordFileFormat='mp3' recordingCallbackMethod='GET' relayDTMFInputs='false' role='Agent' startMpcOnEnter='true' statusCallbackEvents='participant-speak-events, participant-digit-input-events, add-participant-api-events, participant-state-changes, mpc-state-changes' statusCallbackMethod='POST' stayAlone='false' waitMusicMethod='GET'>Nairobi</MultiPartyCall></Response>")
end
end