# frozen_string_literal: true module TwilioBase module Protocols module Voice module Default module_function def init(params: {}, protocol: nil, to:) protocol ||= ENV.fetch('VOICE_PROTOCOL') klass = { 'pstn' => Protocols::Voice::Pstn, 'sip' => Protocols::Voice::Sip }.fetch(protocol.to_s, Protocols::Voice::Pstn) klass.new( params: params, to: to ) end end end end end