Skip to content

Instantly share code, notes, and snippets.

View radralph's full-sized avatar
😮

Ralph Sutacio radralph

😮
View GitHub Profile
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
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"
call $caller, {:callerID => 'sip:63917111@sip.tropo.net'}
say "Hello, this is a test call from Globe Labs"
hangup
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"}
}
say "joining conference"
conference "1337", {
:terminator => "*",
:playTones => true,
:onChoice => lambda { |event|
say("Disconnecting")
}}
say "goodbye"
hangup
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
*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
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("")
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("")
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
},