Skip to content

Instantly share code, notes, and snippets.

View marks's full-sized avatar

Mark Silverberg marks

View GitHub Profile
#!/usr/bin/env python
# A github post-receive hook handler, runs some shell command on each HTTP POST to PORT.
# github-listener.py PORT 'SOME SHELL COMMAND'
import sys
from subprocess import *
from flask import Flask
def system(cmd):
print ''.join(Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE, close_fds=True).communicate())
puts 'What is your name?'
name = gets.chomp
puts 'What is your age?'
age = gets.chomp
puts "Well, #{name}, next year you will be #{age.to_i+1}"
answer()
say("<?xml version="1.0" encoding="UTF-8"?><speak>One potato, two potato, three potato, four.<prosody rate="-10%">One potato, two potato, three potato, four.</prosody><prosody rate="-30%">One potato, two potato, three potato, four.</prosody><prosody rate="-50%">One potato, two potato, three potato, four.</prosody></speak>")
answer()
result = ask("What's your destination?", [
choices: "http://gist.github.com/raw/559213/c83cf025a22acab46ec9e5691c69deff76ce3b7b/grammar.grxml"])
say("You chose $result.value")
answer()
say("Welcome to the geek singles hotline!")
conference("1337", [terminator: "*"])
say("We hope you had fun, call back soon!")
hangup()
answer()
ask("What's your four digit pin?", [
choices: "[4 DIGITS]",
mode: "voice",
recognizer: "en-us", // will recognize 'one two three four'
onChoice: {event -> say("You said $event.value")}
])
answer()
ask("¿Cuál es su número de identificación?", [
<?xml version= "1.0"?>
<grammar xmlns="http://www.w3.org/2001/06/grammar"
     xml:lang="en-US" root = "MYRULE">
 <rule id="MYRULE" scope="public">
   <one-of>
     <item>james brown </item>    </one-of>
 </rule>
</grammar>
<?xml version= "1.0"?>
answer()
say("Please wait while we transfer your call")
transfer("tel:+14075551212", [
playvalue: "http://myServer.com/ElevatorMusic.wav",
onTimeout: { event->
say "Sorry, but nobody answered" }
])
answer()
startCallRecording("http://myServer.com/recordings/testfile.wave", [
transcriptionOutURI: "mailto:[email protected]"])
//continue with your script here
stopCallRecording()
hangup()
answer()
record("Please leave your message at the beep.", [
beep: true,
timeout: 10,
silenceTimeout: 7,
maxTime: 60,
onRecord: { event->
log("Recording result = " + event.recordURI)
say("You said " + event.recordURI)}
])