Skip to content
Browse files

Tightened up the graphics on level 3, everything works!

  • Loading branch information...
1 parent afbf2b4 commit 22fc06abdb1bb6010f38faee482ba2cb32263f53 David H committed May 14, 2011
Showing with 21 additions and 21 deletions.
  1. +14 −14 web/cgi-bin/invoke_lulz.cgi
  2. +7 −7 web/cgi-bin/twiml.cgi
View
28 web/cgi-bin/invoke_lulz.cgi
@@ -6,30 +6,30 @@ require 'rubygems'
require 'twiliolib'
# Twilio bits, swap out with the ones for your account
-API_VERSION = '2010-04-01'
-ACCOUNT_SID = ''
-ACCOUNT_TOKEN = ''
-CALLER_ID = '5555555555'; # Number must be validated with Twilio before using.
+API_VERSION = "2010-04-01"
+ACCOUNT_SID = ""
+ACCOUNT_TOKEN = ""
+CALLER_ID = "5555555555"; # Number must be validated with Twilio before using.
# PROTIP: Buy a number from Twilio and set that up to prank them via robocall when they call back to RAEG at you
account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)
cgi = CGI.new
-soundClip = cgi['clip']
-phoneNumber = cgi['phone'][0,3] + "-" + cgi['phone'][3,3] + "-" + cgi['phone'][6,4]
+clip = cgi["clip"]
+phone = cgi["phone"] #[0,3] + "-" + cgi["phone"][3,3] + "-" + cgi["phone"][6,4]
# TODO: Check for valid phone format and clip
-requestDeets = {
- 'From' => CALLER_ID,
- 'To' => phoneNumber,
- #NOTE: This must be a fully qualified URL accesible from cybersauce
- 'Url' => 'http://whateveryourwebsiteis.com/loldialer/cgi-bin/twiml.cgi?clip=' + soundClip,
+request = {
+ "From" => CALLER_ID,
+ "To" => phone,
+ #NOTE: This must be a fully qualified URL accesible from cybersauce
+ "Url" => "http://whateveryourwebsiteis.com/loldialer/" + clip + ".xml"
}
-response = account.request("/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/Calls",'POST', requestDeets)
+response = account.request("/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/Calls","POST", request)
response.error! unless response.kind_of? Net::HTTPSuccess
puts "code: %s\nbody: %s" % [response.code, response.body]
-puts "Content-type: text/html \r\n\r\n"
-puts "<html><body>Calling...</body></html> \r\n"
+puts "Content-type: text/html \n\n"
+puts "<html><body>Calling...</body></html>"
View
14 web/cgi-bin/twiml.cgi
@@ -6,13 +6,13 @@ require 'rubygems'
require 'twiliolib'
cgi = CGI.new
-audioClip = cgi['clip'] + ".mp3" # assuming mp3, but can be .wav or other formats. See: http://www.twilio.com/docs/api/2010-04-01/twiml/play
-audioBaseUrl = "whateveryourwebsiteis.com/loldialer/"
+#NOTE: The Twilio Ruby gem does NOT support passing in POST parameters from a request call, and GET won't work, so this file is sort of not usable
+clip = cgi["clip"] + ".mp3" # Assuming mp3, but can be .wav or other formats. See: http://www.twilio.com/docs/api/2010-04-01/twiml/play
+url = "http://whateveryourwebsiteis.com/loldialer/"
@r = Twilio::Response.new
-@r.addSay "Hello, you just lost the game", :voice => "woman", :language => "en" # kick em' while they're down
-@r.addPlay audioBaseUrl + audioClip
+@r.addSay "Hello, you just lost the game", :voice => "woman", :language => "en" # Kick em' while they're down
+@r.addPlay url + clip
-puts "Content-type: text/html \r\n\r\n" # might be causing issues?
-
-puts @r.respond
+puts "Content-type: text/xml\n\n"
+puts @r.respond

0 comments on commit 22fc06a

Please sign in to comment.
Something went wrong with that request. Please try again.