Created
April 25, 2010 00:29
-
-
Save johntdyer/378064 to your computer and use it in GitHub Desktop.
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
#Define Gloal Options | |
operatorNumber = "4074740214" | |
applicationCallerID = "8008675309" | |
#Method to create timeStamp as our conferenceID | |
def get_conference_id() | |
timeVar = Time.new | |
returnValue = timeVar.strftime("%Y%H%M%S") | |
return returnValue | |
end | |
conferenceOptions={ | |
:mute=>false, | |
:playTones=>true, | |
:leaveprompt=>"beep" | |
} | |
begin | |
#Create conference ID | |
conferenceID = get_conference_id() | |
#Call First Leg (User) | |
call 'tel:+1'+$numberToCall, { | |
:callerID=>applicationCallerID, | |
:onAnswer=>lambda{|event| | |
log "@"*5 + "User has answered" | |
#Create second thread for second leg (Operator) | |
Thread.new do | |
log "@"*5 + "Start second tread" | |
call 'tel:+1'+operatorNumber, { | |
:callerID=>applicationCallerID, | |
:onAnswer=>lambda{|event| | |
log "@"*5 + "Operator has answered, join to conference" | |
newCall = event.value | |
#announce caller | |
newCall.say("You have a call from " + $callerName) | |
#join operator to conference | |
newCall.conference(conferenceID,conferenceOptions) | |
} | |
} | |
end | |
newCall = event.value | |
# prompt user | |
newCall.say("Please hold while we connect you") | |
newCall.conference(conferenceID,conferenceOptions) | |
} | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment