Skip to content

Instantly share code, notes, and snippets.

View dougiebuckets's full-sized avatar

Doug Crescenzi dougiebuckets

  • United States
View GitHub Profile
@dougiebuckets
dougiebuckets / call_controller.rb
Created October 2, 2012 17:44
Twilio Happy Friday App
class CallsController < ApplicationController
def index
require 'rubygems'
require 'twilio-ruby'
account_sid = 'ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
auth_token = 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
@client = Twilio::REST::Client.new account_sid, auth_token
@dougiebuckets
dougiebuckets / authenticate.rb
Created October 4, 2012 15:08
Rails initializer with TelAPI credentials
Telapi.config do |config|
config.account_sid = 'ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
config.auth_token = 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
end
class CallsController < ApplicationController
def index
Telapi::Call.make
(
'+15555555555', # The client's number to call
'+19876543210', # The customized caller ID (i.e. your office's number that your clients will recognize)
'http://remind-my-clients.herokuapp.com/remind-my-clients.xml'
)
end
end
@dougiebuckets
dougiebuckets / Gemfile
Created October 4, 2012 17:12
Gemfile
gem 'telapi'
@dougiebuckets
dougiebuckets / command line
Created October 4, 2012 17:16
Command Line
$ bundle install
@dougiebuckets
dougiebuckets / remind-my-clients.xml
Created October 7, 2012 15:25
Remind my clients
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>
Hello there. This is a reminder of your upcoming appointment with our office.
</Say>
</Response>
@dougiebuckets
dougiebuckets / business-call-forwarding.xml
Created October 30, 2012 14:35
Business Call Forwarding
<!--
Inbound XML document to be stored on your server.
Ensure the Voice Request URL for your TelAPI number points to where this XML document is stored.
-->
<!-- An InboundXML document is made up of various XML elements nested in the response element.-->
<Response>
<!-- The <Dial> element starts an outgoing call from an existing call -->
<!-- This is the actual number of the phone you would like to receive the call -->
<Dial>15555555555</Dial>
@dougiebuckets
dougiebuckets / record-incoming-calls.xml
Created October 30, 2012 15:23
Record Incoming Calls
<Response>
<!-- The following <Say> element will notify the caller that the call is being recorded -->
<Say>The following call is being recorded.</Say>
<!--
The 'Record' element is used to record the audio during the call.
The 'action' URL is where the Record parameters will be sent.
The HTTP 'method' used to do so is a POST.
The 'transcribe' attribute boolean value is set to true so the call will be transcribed.
@dougiebuckets
dougiebuckets / irv.rb
Created October 30, 2012 16:18
Interactive Voice Response
class CallsController < ApplicationController
def ivr
xml = Telapi::InboundXml.new do # TelAPI inbound XML document
# Gather is used to obtain the digits callers submit in response to their IVR selection optioners options
Gather(
# URL where the gathered digits will be sent for further processing
:action => "http://ivrdemo.com/ivr-user-response.rb",
# HTTP method used to request the action URL
:method => "GET",
@dougiebuckets
dougiebuckets / sms-reminders.rb
Created November 1, 2012 17:37
SMS Reminders App
class RemindersController < ApplicationController
def reminder
if dateToRemind == Time.now
# Send SMS via TelAPI's REST API
Telapi::Message.create(number_to_send_to,
number_to_send_from,
'This is a reminder of your upcoming appointment tomorrow.' )
else
puts "It's not time to remind them yet."
end