Skip to content

Instantly share code, notes, and snippets.

@marks
Created August 19, 2013 15:41
Show Gist options
  • Save marks/6270552 to your computer and use it in GitHub Desktop.
Save marks/6270552 to your computer and use it in GitHub Desktop.
Open-sourced Tropo scripting app code for CheckQM.com Blog post: http://socialhealthinsights.com/2013/08/checkqm-support-powered-by-tropo/
wait(1500)
answer
say "Thank you for calling Check Q M support."
# if time's hour is between 13 and 21 UTC (9a and 5pm EST) and not on Saturday or Sunday, attempt to transfer to an agent.
# (otherwise, play a recording and suggest they email support@checkqm.com)
day_of_week = Time.now.strftime('%a')
if Time.now.utc.hour >= 13 && Time.now.utc.hour <= 21 && day_of_week != "Sun" && day_of_week != "Sat"
sorry_no_available_agents = "Sorry, but all of our employees are busy at the moment. Please try calling back later. You can also open a ticket by emailing support at check qm dot com and ask for a call back. Thank you."
# adapted from 'Whisper on Transfer' example
say "Please wait while I transfer your call."
transfer ["+1##########","+1##########""], { # phone numbers to call, whoever accepts first gets to talk to the customer
:playvalue => "http://www.phono.com/audio/holdmusic.mp3",
:playrepeat => 2,
:timeout => 30, #in seconds,
:callerID => $currentCall.calledID,
:onConnect => lambda { |event|
ask "Support call from #{$currentCall.callerID.split(//).join(" ")}. Press 1 to accept or any other key to reject the call.", {
:choices => "1",
:mode => "dtmf",
:onChoice => lambda { |event|
say "Connecting you now."
},
:onBadChoice => lambda { |event|
say "Rejecting the call."
hangup
}
}
},
:onTimeout => lambda { |event|
say sorry_no_available_agents
hangup
}
}
say sorry_no_available_agents
else
say "Unfortunately, you called us outside of our normal business hours."
say "We are based in Indiana and answer support calls from 9am to 5pm Eastern Standard Time, Monday through Friday."
say ",," # pause
say "For the quickest response, please email support at check q m dot com. We do monitor support emails during non-business hours but cannot guarantee a response time."
say "Thank you again for calling us. We look forward to talking to you soon!"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment