Pockethotline is a rails app that allows you to setup a "distributed hotline". This allows you to have a hotline number that is published and operators signup with their personal numbers. When someone calls the main number the operators will be called (depending on their on-call status) and connected to the main caller.
It was originally conceived as a business by Scott Magee and Chap Ambrose at the Austin Center for Design in the winter of 2011.
The software was open-sourced January 2014.
The minimum hosting costs are about $35 a month. This is because a background worker dyno is required. (Assuming you're using Heroku for hosting).
Twilio phone numbers cost $1/month for local numbers and $2/month for toll-free.
Twilio charges you by minutes used, $0.03/minute for local and $0.05/minute for toll-free.
Twilio's published rates are $0.01 / $0.03 but that is only for the incoming call, you also have to add another $0.02 to each call because of the outgoing connection to the operators.
- Twilio.com
- Heroku.com (or other rails capable host)
Start with the free trial number or purchase another toll-free or local number.
Find them under "Account Settings"
$ git clone [email protected]:chap/pockethotline.git
You must edit values for:
- config.x.hotline.name
- config.x.hotline.domain
- config.x.hotline.organizer
- config.x.hotline.organizer_email
- config.x.hotline.number
$ git commit config/initializers/hotline.rb -m "updated config"
$ heroku create myhotline-name
$ heroku addons:add sendgrid
Any SMTP provider should work. If you don't use Sendgrid, manually update settings at config/initializers/smtp_settings.rb
$ git push heroku master
$ heroku run rake db:schema:load
$ heroku ps:scale worker=1
Use Twilio API credentials from step 3.
$ heroku config:set TWILIO_AUTH_TOKEN=XXXXXXXXXXXXXX
First run
$ heroku run rake secret
Copy the output and use it here:
$ heroku config:set SESSION_SECRET=XXXXXXXXXXXXXX
$ heroku addons:add scheduler
$ heroku addons:open scheduler
- Click "Add Job"
- In the left-most field enter "rake oncall_scheduler"
- Change frequency to "Hourly"
- Set next run to "XX:00" (The XX will depend on the current time.)
- Click "Save"
$ heroku run rails console
$ u = User.new(
:name => 'my name',
:email => '[email protected]',
:phone => '215-359-5228',
:password => 'setyourpasswordhere'
)
u.admin = true
u.on_call = true
u.save!
$ heroku open
- Click on 'Numbers' in the nav bar
- Click on your phone number
- Change the 'Voice Request URL' to
https://myhotline-name.herokuapp.com/twilio/start
- Set request method to [POST]
- Don't call from the same number that you added for yourself
- If you're using your free demo Twilio account you'll hear a pre-roll message. That will go away when you upgrade your account.
- Your call should be connected after the greeting message is used.
- If calling via Gtalk fails to connect, try a real land or cell line.
===
Uncomment (remove leading '#') and edit values in config/hotline.rb
-
config.x.stripe.secret_key
-
config.x.stripe.publishable_key
-
config.x.stripe.publishable_key
$ heroku config:set STRIPE_SECRET_KEY=XXXXXXXXXXXXXX
$ git commit config/initializers/hotline.rb -m "add stripe details"
$ git push heroku
https://.../supporters/new
Stripe requires SSL to be enabled, if you're using your default heroku domain you will seemlessly piggy-back on the wildcard certificate at *.herokuapp.com.
If you want to use a different domain you may have to purchase and setup your own certificate.
===
$ heroku config:set S3_ACCESS_KEY_ID=XXXXXXXXXXXXXX S3_SECRET_ACCESS_KEY=XXXXXXXXXXXXXX
===
Look at all the options in /config/hotline.rb
- Install RVM.
- Install ruby 2.0.0-p648 (
rvm install 2.0.0-p648
). - Install bundler (
gem install bundler
). - Bundle the app (
bundle
). - Create the following file at
pockethotline/config/database.yml
:
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
- Generate the db (
rake db:schema:load
).
Run rake server
. The application will be accessible at localhost:3000.
rails console
> User.create({'email'=>'[email protected]', 'password'=>'password1!', 'name'=> 'name', 'phone'=>'0000000000'})
# To make that user an admin User
> user = User.find(2) # ID of the user you just created
> user.update_attribute(:admin, true)
rake db:test:prepare
rspec spec/[path_to_test]