Module: Adhearsion::IMS::CallControllerMethods

Defined in:
lib/adhearsion-ims/controller_methods.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method) ⇒ Object (private)

Used to create a convenience method for filtering out the to/from in a call header



142
# File 'lib/adhearsion-ims/controller_methods.rb', line 142

def method_missing(method); extract_user_from variables[method]; end

Instance Method Details

#initialize(params) ⇒ String, Hash #ims_dial_string(params, &block) ⇒ String, Hash

Creates an IMS dial string as a B2BUA or an Out of the Blue

Overloads:

  • #initialize(params) ⇒ String, Hash

    Parameters:

    • :b2bua (Required, Symbol)

      or :out_of_the_blue

    • :from (Optional, Hash)
  • #ims_dial_string(params, &block) ⇒ String, Hash

    Parameters:

    • :b2bua (Required, Symbol)

      or :out_of_the_blue

    • :from (Required, Hash)

      the tel uri the call will be placed on behalf of

    • :to (Required, Hash)

      the tel or SIP uri of the destination for the call

Returns:

  • (String)

    the dial string

  • (Hash)

    dial options generated



16
17
18
19
20
21
22
23
# File 'lib/adhearsion-ims/controller_methods.rb', line 16

def generate_ims_options(type, options={})
  validate_options type, options
  
  return { :sip_uri => build_to(options), 
           :options => { :from    => build_from(options),
                         :headers => generate_isc_headers(type) }
         }
end

#generate_isc_headers(type) ⇒ Hash

Creates the headers required for IMS B2BUA or Out of the Blue dialing

Parameters:

  • type (Symbol)

    should be :b2bua or :out_of_the_blue

Returns:

  • (Hash)

    header generated for the IMS



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/adhearsion-ims/controller_methods.rb', line 30

def generate_isc_headers(type)
  headers={}
  
  case type
  when :b2bua
    headers[:route] = process_b2bua_route_headers(call.variables[:route])
    headers.merge! call.variables.select { |k,v| k =~ /^P/i }
  when :out_of_the_blue
    if Adhearsion::IMS::Plugin.config[:sbc_address]
      headers[:route] = config[:sbc_address] + delimitter + config[:cscf_address]
    else
      headers[:route] = config[:cscf_address]
    end
  
    headers[:p_charging_vector] = "icid-value=#{uuid};orig-ioi=#{config[:originating_ims_identity]}"
  end
  
  headers
end