Created
May 27, 2009 17:51
-
-
Save wwalker/118777 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
methods_for :rpc do | |
def async_call_into_context(channel, context, options={}) | |
ahn_log.info "async_call_into_context channel: <#{channel}>" | |
ahn_log.info "async_call_into_context channel: <#{context}>" | |
ahn_log.info "async_call_into_context channel: <#{options.inspect}>" | |
#action = send_action_asynchronously "Login", "Username" => @username, "Secret" => @password, "Events" => "Off" | |
options[:variable] = options[:variables].map {|pair| pair.join('=')}.join('|') | |
action = VoIP::Asterisk.manager_interface.send_action_asynchronously "Originate", options.merge("Context" => context, "Channel" => channel) | |
response = action.response | |
if response.kind_of? VoIP::Asterisk::Manager::ManagerInterfaceError | |
ahn_log.error "AMI ERROR! #{response.message}" | |
else | |
ahn_log.info "Originate response:" | |
ahn_log.debug response.inspect | |
pp response | |
response | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment