lib/adhearsion/call_controller/dial.rb in adhearsion-2.1.3 vs lib/adhearsion/call_controller/dial.rb in adhearsion-2.2.0
- old
+ new
@@ -30,10 +30,11 @@
#
# @option options [Numeric] :for this option can be thought of best as a timeout.
# i.e. timeout after :for if no one answers the call
#
# @option options [CallController] :confirm the controller to execute on answered outbound calls to give an opportunity to screen the call. The calls will be joined if the outbound call is still active after this controller completes.
+ # @option options [Hash] :confirm_metadata Metadata to set on the confirmation controller before executing it.
#
# @example Make a call to the PSTN using my SIP provider for VoIP termination
# dial "SIP/19095551001@my.sip.voip.terminator.us"
#
# @example Make 3 simulataneous calls to the SIP extensions, try for 15 seconds and use the callerid for this call specified by the variable my_callerid
@@ -71,10 +72,11 @@
_for = @options.delete :for
@options[:timeout] ||= _for if _for
@confirmation_controller = @options.delete :confirm
+ @confirmation_metadata = @options.delete :confirm_metadata
end
def run
track_originating_call
prep_calls
@@ -110,10 +112,10 @@
@latch.countdown!
end
if @confirmation_controller
status.unconfirmed!
- new_call.execute_controller @confirmation_controller.new(new_call), lambda { |call| call.signal :confirmed }
+ new_call.execute_controller @confirmation_controller.new(new_call, @confirmation_metadata), lambda { |call| call.signal :confirmed }
new_call.wait :confirmed
end
if new_call.alive? && new_call.active?
logger.debug "#dial joining call #{new_call.id} to #{@call.id}"