class Plivo::Resources::MultiPartyCallInterface

Public Class Methods

new(client, resource_list_json = nil) click to toggle source
Calls superclass method Plivo::Base::ResourceInterface::new
# File lib/plivo/resources/multipartycalls.rb, line 370
def initialize(client, resource_list_json = nil)
  @_name = 'MultiPartyCall'
  @_resource_type = MultiPartyCall
  @_identifier_string = 'mpc_uuid'
  super
  @_is_voice_request = true
end

Public Instance Methods

add_participant(options = {}) click to toggle source
# File lib/plivo/resources/multipartycalls.rb, line 420
def add_participant(options = {})
  valid_param?(:options, options, Hash, false)
  if not options[:role ]
    raise_invalid_request("Role is mandatory")
  end
  options[:call_status_callback_method] = 'POST' unless options.key?(:call_status_callback_method)
  options[:confirm_key_sound_method] = 'GET' unless options.key?(:confirm_key_sound_method)
  options[:dial_music] = 'Real' unless options.key?(:dial_music)
  options[:ring_timeout] = 45 unless options.key?(:ring_timeout)
  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)
  options[:recording_callback_method] ='GET' unless options.key?(:recording_callback_method)
  options[:status_callback_method] = 'GET' unless options.key?(:status_callback_method)
  options[:on_exit_action_method] = 'POST' unless options.key?(:on_exit_action_method)
  options[:record] = false  unless options.key?(:record)
  options[:record_file_format] = 'mp3' unless options.key?(:record_file_format)
  options[:status_callback_events] = 'mpc-state-changes,participant-state-changes' unless options.key?(:status_callback_events)
  options[:stay_alone] = false unless options.key?(:stay_alone)
  options[:coach_mode] = true unless options.key?(:coach_mode)
  options[:mute] = false unless options.key?(:mute)
  options[:hold] = false unless options.key?(:hold)
  options[:start_mpc_on_enter] = true unless options.key?(:start_mpc_on_enter)
  options[:end_mpc_on_exit] = false unless options.key?(:end_mpc_on_exit)
  options[:relay_dtmf_inputs] = false unless options.key?(:relay_dtmf_inputs)
  options[:enter_sound] = 'beep:1' unless options.key?(:enter_sound)
  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])

  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[: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],
                                                                                                      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])
end
get(options = {}) click to toggle source
# File lib/plivo/resources/multipartycalls.rb, line 412
def get(options = {})
  valid_param?(:options, options, Hash, false)
  valid_param?(:uuid, options[:uuid], String, false) unless options[:uuid].nil?
  valid_param?(:friendly_name, options[:friendly_name], String, false) unless options[:friendly_name].nil?
  mpc_id = make_mpc_id(options[:uuid], options[:friendly_name])
  MultiPartyCall.new(@_client, resource_id: mpc_id[1], multi_party_prefix: mpc_id[0]).get
end
get_participant(options = {}) click to toggle source
# File lib/plivo/resources/multipartycalls.rb, line 600
def get_participant(options = {})
  valid_param?(:options, options, Hash, false)
  if not options[:member_id]
    raise_invalid_request("Member Id is mandatory")
  end
  valid_param?(:member_id, options[:member_id], [String, Integer], true)
  valid_param?(:uuid, options[:uuid], String, false) unless options[:uuid].nil?
  valid_param?(:friendly_name, options[:friendly_name], String, false) unless options[:friendly_name].nil?
  mpc_id = make_mpc_id(options[:uuid], options[:friendly_name])
  MultiPartyCallParticipant.new(@_client, resource_id: mpc_id[1], multi_party_prefix: mpc_id[0], member_id: options[:member_id]).get_participant
end
kick_participant(options = {}) click to toggle source
# File lib/plivo/resources/multipartycalls.rb, line 588
def kick_participant(options = {})
  valid_param?(:options, options, Hash, false)
  if not options[:member_id]
    raise_invalid_request("Member Id is mandatory")
  end
  valid_param?(:member_id, options[:member_id], [String, Integer], true)
  valid_param?(:uuid, options[:uuid], String, false) unless options[:uuid].nil?
  valid_param?(:friendly_name, options[:friendly_name], String, false) unless options[:friendly_name].nil?
  mpc_id = make_mpc_id(options[:uuid], options[:friendly_name])
  MultiPartyCallParticipant.new(@_client, resource_id: mpc_id[1], multi_party_prefix: mpc_id[0], member_id: options[:member_id]).kick_participant
end
list(options={}) click to toggle source
# File lib/plivo/resources/multipartycalls.rb, line 393
def list(options={})
  valid_param?(:options, options, Hash, false)
  valid_subaccount?(options[:sub_account], true) unless options[:sub_account].nil?
  valid_param?(:friendly_name, options[:friendly_name], String, false) unless options[:friendly_name].nil?
  valid_param?(:status, options[:status].downcase, String, false, %w[initialized active ended]) unless options[:status].nil?
  valid_param?(:termination_cause_code, options[:termination_cause_code], Integer, false) unless options[:termination_cause_code].nil?
  valid_date_format?(:end_time__gt, options[:end_time__gt], false ) unless options[:end_time__gt].nil?
  valid_date_format?(:end_time__gte, options[:end_time__gte], false ) unless options[:end_time__gte].nil?
  valid_date_format?(:end_time__lt, options[:end_time__lt], String) unless options[:end_time__lt].nil?
  valid_date_format?(:end_time__lte, options[:end_time__lte], false) unless options[:end_time__lte].nil?
  valid_date_format?(:creation_time__gt, options[:creation_time__gt], false) unless options[:creation_time__gt].nil?
  valid_date_format?(:creation_time__gte, options[:creation_time__gte], false) unless options[:creation_time__gte].nil?
  valid_date_format?(:creation_time__lt, options[:creation_time__lt], false) unless options[:creation_time__lt].nil?
  valid_date_format?(:creation_time__lte, options[:creation_time__lte], false) unless options[:creation_time__lte].nil?
  valid_range?(:limit, options[:limit], false, 1, 20)
  valid_range?(:offset, options[:offset], false, 0)
  perform_action(nil ,'GET', options ,true )
end
list_participants(options = {}) click to toggle source
# File lib/plivo/resources/multipartycalls.rb, line 568
def list_participants(options = {})
  valid_param?(:options, options, Hash, false)
  valid_param?(:uuid, options[:uuid], String, false) unless options[:uuid].nil?
  valid_param?(:friendly_name, options[:friendly_name], String, false) unless options[:friendly_name].nil?
  mpc_id = make_mpc_id(options[:uuid], options[:friendly_name])
  MultiPartyCall.new(@_client, resource_id: mpc_id[1], multi_party_prefix: mpc_id[0]).list_participants(options[:call_uuid])
end
make_mpc_id(uuid=nil, friendly_name=nil) click to toggle source
# File lib/plivo/resources/multipartycalls.rb, line 378
def make_mpc_id(uuid=nil, friendly_name=nil)
  if not uuid and not friendly_name
    raise_invalid_request('specify either multi party call friendly name or uuid')
  end
  if uuid and friendly_name
    raise_invalid_request('cannot specify both multi party call friendly name or uuid')
  end
  if uuid
    identifier =  ['uuid', uuid]
  else
    identifier = ['name', friendly_name]
  end
  return identifier
end
pause_participant_recording(options = {}) click to toggle source
# File lib/plivo/resources/multipartycalls.rb, line 544
def pause_participant_recording(options = {})
  valid_param?(:options, options, Hash, false)
  if not options[:member_id]
    raise_invalid_request("Member Id is mandatory")
  end
  valid_param?(:member_id, options[:member_id], [String, Integer], true)
  valid_param?(:uuid, options[:uuid], String, false) unless options[:uuid].nil?
  valid_param?(:friendly_name, options[:friendly_name], String, false) unless options[:friendly_name].nil?
  mpc_id = make_mpc_id(options[:uuid], options[:friendly_name])
  MultiPartyCallParticipant.new(@_client, resource_id: mpc_id[1], multi_party_prefix: mpc_id[0], member_id: options[:member_id]).pause_participant_recording
end
pause_recording(options = {}) click to toggle source
# File lib/plivo/resources/multipartycalls.rb, line 502
def pause_recording(options = {})
  valid_param?(:options, options, Hash, false)
  valid_param?(:uuid, options[:uuid], String, false) unless options[:uuid].nil?
  valid_param?(:friendly_name, options[:friendly_name], String, false) unless options[:friendly_name].nil?
  mpc_id = make_mpc_id(options[:uuid], options[:friendly_name])
  MultiPartyCall.new(@_client, resource_id: mpc_id[1], multi_party_prefix: mpc_id[0]).pause_recording
end
resume_participant_recording(options = {}) click to toggle source
# File lib/plivo/resources/multipartycalls.rb, line 556
def resume_participant_recording(options = {})
  valid_param?(:options, options, Hash, false)
  if not options[:member_id]
    raise_invalid_request("Member Id is mandatory")
  end
  valid_param?(:member_id, options[:member_id], [String, Integer], true)
  valid_param?(:uuid, options[:uuid], String, false) unless options[:uuid].nil?
  valid_param?(:friendly_name, options[:friendly_name], String, false) unless options[:friendly_name].nil?
  mpc_id = make_mpc_id(options[:uuid], options[:friendly_name])
  MultiPartyCallParticipant.new(@_client, resource_id: mpc_id[1], multi_party_prefix: mpc_id[0], member_id: options[:member_id]).resume_participant_recording
end
resume_recording(options = {}) click to toggle source
# File lib/plivo/resources/multipartycalls.rb, line 510
def resume_recording(options = {})
  valid_param?(:options, options, Hash, false)
  valid_param?(:uuid, options[:uuid], String, false) unless options[:uuid].nil?
  valid_param?(:friendly_name, options[:friendly_name], String, false) unless options[:friendly_name].nil?
  mpc_id = make_mpc_id(options[:uuid], options[:friendly_name])
  MultiPartyCall.new(@_client, resource_id: mpc_id[1], multi_party_prefix: mpc_id[0]).resume_recording
end
start(options = {}) click to toggle source
# File lib/plivo/resources/multipartycalls.rb, line 468
def start(options = {})
  valid_param?(:options, options, Hash, false)
  valid_param?(:uuid, options[:uuid], String, false)
  valid_param?(:friendly_name, options[:friendly_name], String, false)
  mpc_id = make_mpc_id(options[:uuid], options[:friendly_name])
  MultiPartyCall.new(@_client,resource_id: mpc_id[1], multi_party_prefix: mpc_id[0]).start
end
start_participant_recording(options = {}) click to toggle source
# File lib/plivo/resources/multipartycalls.rb, line 518
def start_participant_recording(options = {})
  valid_param?(:options, options, Hash, false)
  if not options[:member_id]
    raise_invalid_request("Member Id is mandatory")
  end
  options[:file_format] = 'mp3' unless options.key?(:file_format)
  options[:recording_callback_method] = 'POST' unless options.key?(:recording_callback_method)
  valid_param?(:member_id, options[:member_id], [String, Integer], true)
  valid_param?(:uuid, options[:uuid], String, false) unless options[:uuid].nil?
  valid_param?(:friendly_name, options[:friendly_name], String, false) unless options[:friendly_name].nil?
  mpc_id = make_mpc_id(options[:uuid], options[:friendly_name])
  MultiPartyCallParticipant.new(@_client, resource_id: mpc_id[1], multi_party_prefix: mpc_id[0], member_id: options[:member_id]).start_participant_recording(options[:file_format], options[:recording_callback_url], options[:recording_callback_method])
end
start_play_audio(options = {}) click to toggle source
# File lib/plivo/resources/multipartycalls.rb, line 612
def start_play_audio(options = {})
  valid_param?(:options, options, Hash, false)
  if not options[:member_id]
    raise_invalid_request("Member Id is mandatory")
  end
  valid_param?(:member_id, options[:member_id], [String, Integer], true)
  valid_param?(:uuid, options[:uuid], String, false) unless options[:uuid].nil?
  valid_param?(:friendly_name, options[:friendly_name], String, false) unless options[:friendly_name].nil?
  mpc_id = make_mpc_id(options[:uuid], options[:friendly_name])
  MultiPartyCallMember.new(@_client, resource_id: mpc_id[1], multi_party_prefix: mpc_id[0], member_id: options[:member_id]).start_play_audio(options[:url])
end
start_recording(options = {}) click to toggle source
# File lib/plivo/resources/multipartycalls.rb, line 484
def start_recording(options = {})
  valid_param?(:options, options, Hash, false)
  options[:file_format] = 'mp3' unless options.key?(:file_format)
  options[:recording_callback_method] = 'POST' unless options.key?(:recording_callback_method)
  valid_param?(:uuid, options[:uuid], String, false) unless options[:uuid].nil?
  valid_param?(:friendly_name, options[:friendly_name], String, false) unless options[:friendly_name].nil?
  mpc_id = make_mpc_id(options[:uuid], options[:friendly_name])
  MultiPartyCall.new(@_client, resource_id: mpc_id[1], multi_party_prefix: mpc_id[0]).start_recording(options[:file_format], options[:recording_callback_url], options[:recording_callback_method])
end
stop(options = {}) click to toggle source
# File lib/plivo/resources/multipartycalls.rb, line 476
def stop(options = {})
  valid_param?(:options, options, Hash, false)
  valid_param?(:uuid, options[:uuid], String, false) unless options[:uuid].nil?
  valid_param?(:friendly_name, options[:friendly_name], String, false) unless options[:friendly_name].nil?
  mpc_id = make_mpc_id(options[:uuid], options[:friendly_name])
  MultiPartyCall.new(@_client, resource_id: mpc_id[1], multi_party_prefix: mpc_id[0]).stop
end
stop_participant_recording(options = {}) click to toggle source
# File lib/plivo/resources/multipartycalls.rb, line 532
def stop_participant_recording(options = {})
  valid_param?(:options, options, Hash, false)
  if not options[:member_id]
    raise_invalid_request("Member Id is mandatory")
  end
  valid_param?(:member_id, options[:member_id], [String, Integer], true)
  valid_param?(:uuid, options[:uuid], String, false) unless options[:uuid].nil?
  valid_param?(:friendly_name, options[:friendly_name], String, false) unless options[:friendly_name].nil?
  mpc_id = make_mpc_id(options[:uuid], options[:friendly_name])
  MultiPartyCallParticipant.new(@_client, resource_id: mpc_id[1], multi_party_prefix: mpc_id[0], member_id: options[:member_id]).stop_participant_recording
end
stop_play_audio(options = {}) click to toggle source
# File lib/plivo/resources/multipartycalls.rb, line 624
def stop_play_audio(options = {})
  valid_param?(:options, options, Hash, false)
  if not options[:member_id]
    raise_invalid_request("Member Id is mandatory")
  end
  valid_param?(:member_id, options[:member_id], [String, Integer], true)
  valid_param?(:uuid, options[:uuid], String, false) unless options[:uuid].nil?
  valid_param?(:friendly_name, options[:friendly_name], String, false) unless options[:friendly_name].nil?
  mpc_id = make_mpc_id(options[:uuid], options[:friendly_name])
  MultiPartyCallMember.new(@_client, resource_id: mpc_id[1], multi_party_prefix: mpc_id[0], member_id: options[:member_id]).stop_play_audio
end
stop_recording(options = {}) click to toggle source
# File lib/plivo/resources/multipartycalls.rb, line 494
def stop_recording(options = {})
  valid_param?(:options, options, Hash, false)
  valid_param?(:uuid, options[:uuid], String, false) unless options[:uuid].nil?
  valid_param?(:friendly_name, options[:friendly_name], String, false) unless options[:friendly_name].nil?
  mpc_id = make_mpc_id(options[:uuid], options[:friendly_name])
  MultiPartyCall.new(@_client, resource_id: mpc_id[1], multi_party_prefix: mpc_id[0]).stop_recording
end
update_participant(options = {}) click to toggle source
# File lib/plivo/resources/multipartycalls.rb, line 576
def update_participant(options =  {})
  valid_param?(:options, options, Hash, false)
  if not options[:member_id]
    raise_invalid_request("Member Id is mandatory")
  end
  valid_param?(:member_id, options[:member_id], [String, Integer], true)
  valid_param?(:uuid, options[:uuid], String, false) unless options[:uuid].nil?
  valid_param?(:friendly_name, options[:friendly_name], String, false) unless options[:friendly_name].nil?
  mpc_id = self.make_mpc_id(options[:uuid], options[:friendly_name])
  MultiPartyCallParticipant.new(@_client, resource_id: mpc_id[1], multi_party_prefix: mpc_id[0], member_id: options[:member_id]).update_participant(options[:coach_mode], options[:mute], options[:hold])
end