Created
August 21, 2009 18:22
-
-
Save howethomas/172275 to your computer and use it in GitHub Desktop.
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
# ----------- | |
# connecting the call to another number () | |
# ----------- | |
answer | |
options = { :choices => 'sales( 1, sales), support( 2, support)', | |
:repeat => 3 } | |
result = ask 'For sales, just say sales or press 1. For support, say support or press 2.', options | |
if result.name == 'choice' | |
case result.value | |
when 'sales' | |
say 'Ok, let me transfer you to sales.' | |
recipient = '+15083649972' | |
when 'support' | |
say 'Sure, let me get support. Please hold.' | |
recipient = '+15088153428' | |
end | |
end | |
hangup | |
# If this script is called via HTTP, the initial "answer();" can be | |
# removed. | |
options = { :answerOnMedia => false, | |
:callerID => '+15083750743', | |
:timeout => 12.123, | |
:onAnswer => lambda { |event| log '******************** Answered from ' + event.inspect.to_s }, | |
:onError => lambda { |event| log '******************** oops , error*********************' + event.inspect.to_s }, | |
:onTimeout => lambda { |event| log '******************** timeout *********************' + event.inspect.to_s }, | |
:onCallFailure => lambda { |event| log '******************** call failed *********************' + event.inspect.to_s } | |
} | |
event = call "tel:#{recipient}", options | |
if event.name == 'answer' | |
log 'Outgoing call gets answered by ' + event.value.calledID | |
end | |
say "Hello. Hello. Hello. Hi. Hello. Hello. Hello. Hi. Hello. Hello. Hello. Hi. Hello. Hello. Hello. Hi. Hello. Hello. Hello. Hi." | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment