Class: Adhearsion::Calls::Supervisor

Inherits:
Object
  • Object
show all
Includes:
Celluloid
Defined in:
lib/adhearsion/calls.rb

Instance Method Summary collapse

Methods included from Celluloid

logger

Constructor Details

#initialize(collection) ⇒ Supervisor


86
87
88
# File 'lib/adhearsion/calls.rb', line 86

def initialize(collection)
  @collection = collection
end

Instance Method Details

#call_died(call, reason) ⇒ Object


90
91
92
93
94
95
96
97
98
99
# File 'lib/adhearsion/calls.rb', line 90

def call_died(call, reason)
  catching_standard_errors do
    call_id = @collection.key call
    @collection.remove_inactive_call call
    return unless reason
    Adhearsion::Events.trigger :exception, reason
    logger.error "Call #{call_id} terminated abnormally due to #{reason}. Forcing hangup."
    PunchblockPlugin.client.execute_command Punchblock::Command::Hangup.new, :async => true, :call_id => call_id
  end
end