Module: Adhearsion::Translator::Asterisk::AMIErrorConverter

Defined in:
lib/adhearsion/translator/asterisk/ami_error_converter.rb

Class Method Summary collapse

Class Method Details

.convert(result = ->(e) { raise ChannelGoneError, e.message }) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/adhearsion/translator/asterisk/ami_error_converter.rb', line 7

def self.convert(result = ->(e) { raise ChannelGoneError, e.message } )
  yield
rescue RubyAMI::Error => e
  case e.message
  when 'No such channel', /Channel (\S+) does not exist./
    result.call e if result
  else
    raise e
  end
end