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
require 'pp' | |
def handle_originate_response | |
ahn_log "Looking for a matching OriginateResponses key: #{event.headers['ActionID']}" | |
attempt_id = OriginateResponses[event.headers['ActionID']] | |
ahn_log "attempt_id is #{attempt_id}" | |
if attempt_id |
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('|') |
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
# we get a PIN, here's the last DTMF of the pin (#): | |
DEBUG agi: >>> WAIT FOR DIGIT 6000 | |
DEBUG agi: <<< 200 result=35 | |
DEBUG agi: >>> EXEC playback 247_messages/4 | |
DEBUG agi: <<< 200 result=0 | |
# pressed 1 | |
DEBUG agi: >>> EXEC BACKGROUND 247/are_you_able_to_respond | |
DEBUG agi: <<< 200 result=0 |
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
def initial_question(voice_message, query, retries = 3) | |
response = nil | |
while retries > 0 do | |
response = input 1, | |
:timeout => DTMF_TIMEOUT_SECONDS, | |
:play => [ query, '247/press_one_for_yes', '247/press_two_for_no', '247/press_three_to_hear_this_message_again'] | |
break if ((response == '1') || (response == '2')) | |
play voice_message | |
retries -= 1 | |
end |
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
-- Executing [s@deliver_voice_message:2] NoOp("SIP/tsi-00cb1040", "inboundRecordMessageCall starts") in new stack | |
-- Executing [s@deliver_voice_message:3] NoOp("SIP/tsi-00cb1040", "AMDStatus = MACHINE") in new stack | |
-- Executing [s@deliver_voice_message:4] AGI("SIP/tsi-00cb1040", "agi://127.0.0.1/") in new stack | |
-- AGI Script Executing Application: (BACKGROUND) Options: (247/our_system_identified_this_as_an_answering_machine_if_you_are_human_press_one) | |
-- <SIP/tsi-00cb1040> Playing '247/our_system_identified_this_as_an_answering_machine_if_you_are_human_press_one' (language 'en') | |
[May 29 00:45:38] DEBUG[6894]: res_agi.c:1916 run_agi: SIP/tsi-00cb1040 hungup |
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
# set time zone as early as possible | |
ENV['TZ']='UTC' | |
require 'rubygems' | |
require 'activesupport' | |
# set the time zone for Active Support (it monkey patches Time) | |
Time.zone = 'Etc/UTC' | |
require 'logger' |
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
require 'rubygems' | |
require 'adhearsion' | |
require 'adhearsion/voip/asterisk/manager_interface' | |
begin | |
asterisk = Adhearsion::VoIP::Asterisk::Manager::ManagerInterface.connect :host => "127.0.0.1", :username => "manager", :password => "password", :events => true | |
result = asterisk.send_action_synchronously "core show channels" | |
puts result.inspect | |
result.headers | |
rescue Adhearsion::VoIP::Asterisk::Manager::ManagerInterfaceError => error |
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
require 'pp' | |
require 'drb' | |
require 'rubygems' | |
require 'adhearsion' | |
require 'adhearsion/voip/asterisk/manager_interface' | |
begin | |
asterisk = Adhearsion::VoIP::Asterisk::Manager::ManagerInterface.connect :host => "127.0.0.1", :username => "247_manager", :password => "b0n3h34d", :events => true | |
result = asterisk.send_action_synchronously 'COMMAND', :command => "core show channels" |
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
DEBUG ami: Sending AMI action: | |
>>> Action: login | |
>>> ActionID: jyOCouM7-l97L-B4Px-9hAc-j7gUYULeH14K | |
>>> Username: 247_manager | |
>>> Secret: b0n3h34d | |
>>> Events: Off | |
>>> | |
INFO ami: Successful AMI actions-only connection into [email protected] | |
INFO ami: Successful AMI events-only connection into [email protected] | |
DEBUG ami: Sending AMI action: |
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
[msgdemon@app1 tools]$ telnet localhost 5038 | |
Trying 127.0.0.1... | |
Connected to localhost.localdomain (127.0.0.1). | |
Escape character is '^]'. | |
Asterisk Call Manager/1.0 | |
Action: login | |
ActionID: jyOCouM7-l97L-B4Px-9hAc-j7gUYULeH14u | |
Username: 247_manager | |
Secret: b0n3h34d | |
Events: Off |
OlderNewer