This file contains 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
call $caller, {:callerID => 'sip:21587180@sip.tropo.net'} | |
say "Please wait while we connect your call..." | |
conference "1337", { | |
:terminator => "*", | |
:playTones => true, | |
:onChoice => lambda { |event| | |
say("Disconnecting") | |
}} | |
say "goodbye" | |
hangup |
This file contains 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
call $caller, {:callerID => 'sip:639062897444@sip.tropo.net'} | |
say "Hello" | |
say "Please wait while we connect your call..." | |
conference "1337", { | |
:terminator => "*", | |
:playTones => true, | |
:onChoice => lambda { |event| | |
say("Disconnecting") | |
}} | |
say "goodbye" |
This file contains 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
call $caller, {:callerID => 'sip:63917111@sip.tropo.net'} | |
say "Hello, this is a test call from Globe Labs" | |
hangup |
This file contains 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
ask "Who would you like to call? Just say Joe or Jane", { | |
:choices => "Joe, Jane", | |
:mode => "speech", | |
:recognizer => "en-PH", | |
:minConfidence => 0.6, | |
:onChoice => lambda { |event| say "You said" + event.value}, | |
:onBadChoice => lambda { |event| say "I'm sorry, I didn't understand what you said."}, | |
:onTimeout => lambda { |event| say "I'm sorry, I didn't hear anything"}, | |
:onHangup => lambda { |event| log "Caller disconnected"} | |
} |
This file contains 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
say "joining conference" | |
conference "1337", { | |
:terminator => "*", | |
:playTones => true, | |
:onChoice => lambda { |event| | |
say("Disconnecting") | |
}} | |
say "goodbye" | |
hangup |
This file contains 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
say "Please wait while we transfer your call. Press star to cancel the transfer." | |
transfer ["sip:9175744034@sip.tropo.net"], { | |
:callerID => 'sip:917111@sip.tropo.net', | |
:playvalue => "http://www.phono.com/audio/holdmusic.mp3", | |
:terminator => "*", | |
:onTimeout => lambda { |event| | |
say "Sorry, but nobody answered"} | |
} | |
say "goodbye" | |
hangup |
This file contains 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
*test_spec.rb | |
require 'test.rb' | |
describe "Result" do | |
it "should be a 5 digit number" | |
expect(solution.split(//).size).eql? 5 | |
end | |
it "should be in included in the number given" | |
expect(givenNumber).include? solution |
This file contains 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 solution(digits) | |
puts digits | |
digits = digits.to_s.split(//) | |
mSize, allResult = digits.size, [] | |
digits.each_with_index do |x, index| | |
temp = [] | |
index.to_i.upto(mSize) do |y| | |
temp << digits[y].to_i | |
if temp.size.eql? 5 | |
allResult << temp.join("") |
This file contains 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
task :solution do | |
digits = rand(100000..100000000).to_s.split(//) | |
#digits = "283910".to_s.split(//) | |
mSize, allResult = digits.size, [] | |
digits.each_with_index do |x, index| | |
temp = [] | |
index.to_i.upto(mSize) do |y| | |
temp << digits[y].to_i | |
if temp.size.eql? 5 | |
allResult << temp.join("") |
This file contains 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
wait(1500) | |
ask "Please press 1 to play an mp3, press 2 to transfer", { | |
:choices => "1,2", | |
:terminator => '#', | |
:timeout => 15.0, | |
:mode => "dtmf", | |
:interdigitTimeout => 5 , | |
:onChoice => lambda { |event| | |
@answer = event.value | |
}, |
NewerOlder