Skip to content

Instantly share code, notes, and snippets.

@radralph
Last active December 4, 2015 05:54
Show Gist options
  • Select an option

  • Save radralph/8efaa98c424d9f9de079 to your computer and use it in GitHub Desktop.

Select an option

Save radralph/8efaa98c424d9f9de079 to your computer and use it in GitHub Desktop.
test script for voice extended
msisdn = $currentCall.getHeader("TO").split(" ").first
msisdn = msisdn[8..msisdn.length]
sesh = $currentCall.sessionId
#say "Please wait while we transfer your call. Press star to cancel the transfer."
##Insert 30sec AD Below:
##
#say ""
say "Hi! thank you for using this service"
result = ask "to get a free 3 minute call and listen to the ad press 1, to end this call press 2", {
:choices => "1,2",
:mode => "dtmf",
:timeout => 10.0,
:attempts => 2,
:onBadChoice => lambda { |event|
say "You have entered an invalid option"
},
:terminator => '#'
}
if result.value.eql? "1"
# say "you pressed 1"
say "Do you need A.P.I products to boost your business? Go with GlobeLabs! We deliver the best digital products that would suit your company's needs. Go to globelabs.com.ph for more info. Thank you!"
say "We are now connecting your call"
#trigger counter
# command = Thread.new do
# sleep(120)
# Kernel.system "curl -k 'https://54.251.177.176/sessions/#{sesh}/signals?action=signal&value=exit'"
# end
# command.join
transfer [msisdn.to_s,"sip:901111@sip.tropo.net"], {
:playvalue => "https://sheltered-meadow-7791.herokuapp.com/phone-calling-1.mp3",
:terminator => "*",
}
else result.value.eql? "2"
say "Thank you. Goodbye!"
end
hangup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment