lib/adhearsion/router/route.rb in adhearsion-2.0.0.rc3 vs lib/adhearsion/router/route.rb in adhearsion-2.0.0.rc4

- old
+ new

@@ -20,17 +20,23 @@ def match?(call) !guarded? guards, call end def dispatcher - @dispatcher ||= lambda do |call| + @dispatcher ||= lambda do |call, callback = nil| controller = if target.respond_to?(:call) CallController.new call, &target else target.new call end - call.execute_controller controller + call.execute_controller controller, lambda { |call| + begin + call.hangup + rescue Call::Hangup + end + callback.call if callback + } end end def inspect "#<#{self.class}:#{object_id} name=#{name} target=#{target} guards=#{guards}>"