Skip to content

Commit

Permalink
Merge branch 'master' of github.com:mbarton/shout.js
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarton committed Apr 14, 2012
2 parents f2dbe7d + d5d976a commit 57ec15c
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions server/shout-twilio.py
Expand Up @@ -13,12 +13,6 @@

app.p = pusher.Pusher()

callers = {
"+14158675309": "Curious George",
"+14158675310": "Boots",
"+14158675311": "Virgil",
}

data = {
"count": 0
}
Expand Down Expand Up @@ -89,22 +83,21 @@ def handle_recording():
count = increment_count()

recording_url = request.form.get("RecordingUrl", None)

call_sid = request.form.get('CallSid', None)

print "handle-recording. url: " + str( recording_url )

from_number = phones[call_sid]
print "from_number: " + str( from_number )

filename = from_number + "_" + str(count)
filename = call_sid + ".mp3"

rec_file = "static/%s.mp3" % filename;
rec_file = "static/" + filename;
print "rec file: " + str( rec_file )

if recording_url:
urllib.urlretrieve( recording_url, rec_file )
samples[call_sid] = recording_url
samples[call_sid] = url_for('static', filename=filename)

resp = twilio.twiml.Response()
resp.say("Thanks for shouting... take a listen to what you shouted.")
Expand All @@ -122,7 +115,6 @@ def push_to_pusher(room, phone_nr, sample_id, sample_url):
app.p[room].trigger( 'twilio_event', { 'id': sample_id, 'url': sample_url, 'phone': phone_nr } )
return ""


def increment_count():
data["count"] = data["count"] + 1
return data["count"]
Expand Down

0 comments on commit 57ec15c

Please sign in to comment.