Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
callOptions = { :channel => "VOICE",
:answerOnMedia => false,
:timeout => 30.0,
:callerID => applicationCallerID
}
sayOptions = {:voice => "kate"}
conferenceOptions = { :mute => false,
:playTones => false,
:terminator => "*",
:joinPrompt => "Connecting now.",
:leavePrompt => "We hope you enjoyed your call!"
}
# Create conference ID
conferenceID = get_conference_id()
# Call First Leg (Bandmember)
call('tel:+1' + $bandmemberNumberToDial, {
:onAnswer => lambda{|event|
log "@"*5 + "User has answered"
#Create second thread for second leg (Fan)
Thread.new do
log "@"*5 + "Start second tread: call to Fan"
call('tel:+1'+ $fanNumberToDial,{
:onAnswer=>lambda{|event|
log "@"*5 + "Fan answered join conference"
newCall = event.value
# announce caller (Bandmember)
wait(2000)
newCall.say("You have a call from the rolling stones!")
# join Fan to conference
newCall.conference(conferenceID,conferenceOptions)
}.merge(callOptions))
}.merge(callOptions))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment