-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7ab0c20
Showing
22 changed files
with
451 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
source :rubygems | ||
|
||
gem "adhearsion", path: '/Users/ben/code/adhearsion' | ||
gem 'ahn_sidekiq', path: 'ahn_sidekiq' | ||
|
||
# | ||
# Here are some example plugins you might like to use. Simply | ||
# uncomment them and run `bundle install`. | ||
# | ||
|
||
# gem 'adhearsion-asterisk' | ||
# gem 'adhearsion-rails' | ||
# gem 'adhearsion-activerecord' | ||
# gem 'sqlite3' | ||
# gem 'adhearsion-ldap' | ||
# gem 'adhearsion-xmpp' | ||
# gem 'adhearsion-drb' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
PATH | ||
remote: /Users/ben/code/adhearsion | ||
specs: | ||
adhearsion (2.0.1) | ||
activesupport (>= 3.0.10) | ||
adhearsion-loquacious (>= 1.9.0) | ||
bundler (~> 1.0) | ||
celluloid (>= 0.10.0) | ||
countdownlatch | ||
deep_merge | ||
ffi (>= 1.0.11) | ||
future-resource (~> 1.0) | ||
girl_friday | ||
has-guarded-handlers (~> 1.1) | ||
logging (>= 1.6.1) | ||
pry | ||
punchblock (~> 1.2) | ||
rake | ||
ruby_speech (~> 1.0) | ||
thor | ||
|
||
PATH | ||
remote: ahn_sidekiq | ||
specs: | ||
ahn_sidekiq (0.0.1) | ||
adhearsion (~> 2.0) | ||
sidekiq (~> 2.1) | ||
|
||
GEM | ||
remote: http://rubygems.org/ | ||
specs: | ||
activesupport (3.2.6) | ||
i18n (~> 0.6) | ||
multi_json (~> 1.0) | ||
adhearsion-loquacious (1.9.3) | ||
blather (0.8.0) | ||
activesupport (>= 2.3.11) | ||
eventmachine (>= 0.12.6) | ||
girl_friday | ||
niceogiri (~> 1.0) | ||
nokogiri (~> 1.5.5) | ||
celluloid (0.11.1) | ||
timers (>= 1.0.0) | ||
celluloid-io (0.11.0) | ||
celluloid (~> 0.11.0) | ||
nio4r (>= 0.4.0) | ||
coderay (1.0.7) | ||
connection_pool (0.9.2) | ||
countdownlatch (1.0.0) | ||
deep_merge (1.0.0) | ||
eventmachine (0.12.10) | ||
ffi (1.1.0) | ||
future-resource (1.0.0) | ||
girl_friday (0.9.5) | ||
has-guarded-handlers (1.3.1) | ||
i18n (0.6.0) | ||
little-plugger (1.1.3) | ||
logging (1.7.2) | ||
little-plugger (>= 1.1.3) | ||
method_source (0.8) | ||
multi_json (1.3.6) | ||
niceogiri (1.0.2) | ||
nokogiri (~> 1.4) | ||
nio4r (0.4.0) | ||
nokogiri (1.5.5) | ||
pry (0.9.10) | ||
coderay (~> 1.0.5) | ||
method_source (~> 0.8) | ||
slop (~> 3.3.1) | ||
punchblock (1.3.0) | ||
activesupport (~> 3.0) | ||
blather (>= 0.7.0) | ||
celluloid (>= 0.10.0) | ||
future-resource (~> 1.0) | ||
has-guarded-handlers (~> 1.0) | ||
niceogiri (~> 1.0) | ||
ruby_ami (~> 1.2, >= 1.2.1) | ||
ruby_speech (~> 1.0) | ||
state_machine (~> 1.0) | ||
rake (0.9.2.2) | ||
redis (3.0.1) | ||
redis-namespace (1.2.0) | ||
redis (~> 3.0.0) | ||
ruby_ami (1.2.1) | ||
celluloid-io (~> 0.11.0) | ||
countdownlatch (~> 1.0) | ||
future-resource | ||
girl_friday | ||
ruby_speech (1.0.0) | ||
activesupport (>= 3.0.7) | ||
niceogiri (~> 1.0) | ||
sidekiq (2.1.0) | ||
celluloid (~> 0.11.1) | ||
connection_pool (~> 0.9.2) | ||
multi_json (~> 1) | ||
redis (~> 3) | ||
redis-namespace | ||
slop (3.3.2) | ||
state_machine (1.1.2) | ||
thor (0.15.4) | ||
timers (1.0.1) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
adhearsion! | ||
ahn_sidekiq! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ahn: bundle exec ahn start . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Welcome to Adhearsion | ||
|
||
You've got a fresh app and you're almost ready to get started. Firstly, you'll need to configure your VoIP platform: | ||
|
||
## Asterisk | ||
|
||
Edit `extensions.conf` to include the following: | ||
|
||
``` | ||
[your_context_name] | ||
exten => _.,1,AGI(agi:async) | ||
``` | ||
|
||
and setup a user in `manager.conf` with read/write access to `all`. | ||
|
||
If you are using Asterisk 1.8, you will need to add an additional context with the name `adhearsion-redirect`. On Asterisk 10 and above this is auto-provisioned. | ||
|
||
## Voxeo PRISM | ||
|
||
Install the [rayo-server](https://github.com/rayo/rayo-server) app into PRISM 11 and follow the [configuration guide](https://github.com/rayo/rayo-server/wiki/Single-node-and-cluster-configuration-reference). | ||
|
||
## Configure your app | ||
|
||
In `config/adhearsion.rb` you'll need to set the VoIP platform you're using, along with the correct credentials. You'll find example config there, so follow the comments. | ||
|
||
## Ready, set, go! | ||
|
||
Start your new app with "ahn start". You'll get a lovely console and should be presented with the SimonGame when you call in. | ||
|
||
### Running your app on heroku | ||
|
||
In order to run an adhearsion application on Heroku, you must create the application on the 'cedar' stack (`heroku apps:create --stack cedar`) and re-scale your processes like so: | ||
|
||
``` | ||
heroku ps:scale web=0 | ||
heroku ps:scale ahn=1 | ||
``` | ||
|
||
More detail is available in the [deployment documentation](http://adhearsion.com/docs/best-practices/deployment). | ||
|
||
Check out [the Adhearsion website](http://adhearsion.com) for more details of where to go from here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env rake | ||
|
||
require File.expand_path('../config/environment', __FILE__) | ||
|
||
require 'adhearsion/tasks' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
64261 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source "http://rubygems.org" | ||
|
||
# Specify your gem's dependencies in plugin-template.gemspec | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Ahn-sidekiq | ||
========================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require "bundler/gem_tasks" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# -*- encoding: utf-8 -*- | ||
$:.push File.expand_path("../lib", __FILE__) | ||
require "ahn_sidekiq/version" | ||
|
||
Gem::Specification.new do |s| | ||
s.name = "ahn_sidekiq" | ||
s.version = AhnSidekiq::VERSION | ||
s.authors = ["Plugin Author"] | ||
s.email = ["author@plugin.com"] | ||
s.homepage = "" | ||
s.summary = %q{TODO: Write a gem summary} | ||
s.description = %q{TODO: Write a gem description} | ||
|
||
s.rubyforge_project = "ahn_sidekiq" | ||
|
||
# Use the following if using Git | ||
# s.files = `git ls-files`.split("\n") | ||
# s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") | ||
s.files = Dir.glob("{lib}/**/*") + %w( README.md Rakefile Gemfile) | ||
s.test_files = Dir.glob("{spec}/**/*") | ||
s.require_paths = ["lib"] | ||
|
||
s.add_runtime_dependency %q<adhearsion>, ["~> 2.0"] | ||
s.add_runtime_dependency %q<sidekiq>, ["~> 2.1"] | ||
|
||
s.add_development_dependency %q<bundler>, ["~> 1.0"] | ||
s.add_development_dependency %q<rspec>, ["~> 2.5"] | ||
s.add_development_dependency %q<rake>, [">= 0"] | ||
s.add_development_dependency %q<mocha>, [">= 0"] | ||
s.add_development_dependency %q<guard-rspec> | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require 'ahn_sidekiq/version' | ||
require 'ahn_sidekiq/plugin' | ||
|
||
module AhnSidekiq | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
require 'sidekiq' | ||
require 'sidekiq/util' | ||
require 'sidekiq/manager' | ||
require 'sidekiq/scheduled' | ||
|
||
class AhnSidekiq::Plugin < Adhearsion::Plugin | ||
config :ahn_sidekiq do | ||
queues nil, desc: "Queue to process, with optional weight", transform: Proc.new { |v| | ||
q, weight = v.split "," | ||
AhnSidekiq::Plugin.parse_queues q, weight | ||
} | ||
|
||
environment nil, desc: "Application environment" | ||
|
||
timeout 0, desc: "Shutdown timeout" | ||
|
||
concurrency nil, desc: "processor threads to use" | ||
end | ||
|
||
init :ahn_sidekiq do | ||
Queue.new AhnSidekiq::Plugin.config.to_hash | ||
end | ||
|
||
def self.parse_queues(q, weight) | ||
[].tap do |queues| | ||
(weight || 1).to_i.times do | ||
queues << q | ||
end | ||
end | ||
end | ||
|
||
class Queue | ||
def initialize(options) | ||
Adhearsion::Events.shutdown { stop } | ||
Adhearsion::Events.after_initialized { run } | ||
@options = options | ||
@manager = Sidekiq::Manager.new @options | ||
@poller = Sidekiq::Scheduled::Poller.new | ||
end | ||
|
||
def run | ||
@manager.start! | ||
@poller.poll! true | ||
end | ||
|
||
def stop | ||
@poller.terminate! if @poller.alive? | ||
@manager.stop! shutdown: true, timeout: @options[:timeout] | ||
@manager.wait :shutdown | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module AhnSidekiq | ||
VERSION = '0.0.1' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
require 'spec_helper' | ||
|
||
module Ahn-sidekiq | ||
describe ControllerMethods do | ||
describe "mixed in to a CallController" do | ||
|
||
class TestController < Adhearsion::CallController | ||
include Ahn-sidekiq::ControllerMethods | ||
end | ||
|
||
let(:mock_call) { mock 'Call' } | ||
|
||
subject do | ||
TestController.new mock_call | ||
end | ||
|
||
describe "#greet" do | ||
it "greets with the correct parameter" do | ||
subject.expects(:play).once.with("Hello, Luca") | ||
subject.greet "Luca" | ||
end | ||
end | ||
|
||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require 'adhearsion' | ||
require 'ahn_sidekiq' | ||
|
||
RSpec.configure do |config| | ||
config.color_enabled = true | ||
config.tty = true | ||
|
||
config.mock_with :mocha | ||
config.filter_run :focus => true | ||
config.run_all_when_everything_filtered = true | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# encoding: utf-8 | ||
|
||
Adhearsion.config do |config| | ||
|
||
config.development do |dev| | ||
dev.platform.logging.level = :trace | ||
end | ||
|
||
## | ||
# Use with Rayo (eg Voxeo PRISM) | ||
# | ||
config.punchblock.username = "usera@blmbp.local" # Your XMPP JID for use with Rayo | ||
# config.punchblock.password = "" # Your XMPP password | ||
end | ||
|
||
Adhearsion.router do | ||
route 'foo' do | ||
logger.info Foo.new | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# encoding: utf-8 | ||
|
||
require 'bundler' | ||
Bundler.setup | ||
Bundler.require |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# -*- encoding: utf-8 -*- | ||
$:.push File.expand_path("../lib", __FILE__) | ||
require "foo/version" | ||
|
||
Gem::Specification.new do |s| | ||
s.name = "foo" | ||
s.version = Foo::VERSION | ||
s.authors = ["Plugin Author"] | ||
s.email = ["author@plugin.com"] | ||
s.homepage = "" | ||
s.summary = %q{TODO: Write a gem summary} | ||
s.description = %q{TODO: Write a gem description} | ||
|
||
s.rubyforge_project = "foo" | ||
|
||
# Use the following if using Git | ||
# s.files = `git ls-files`.split("\n") | ||
# s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") | ||
s.files = Dir.glob("{lib}/**/*") + %w( README.md Rakefile Gemfile) | ||
s.test_files = Dir.glob("{spec}/**/*") | ||
s.require_paths = ["lib"] | ||
|
||
s.add_runtime_dependency %q<adhearsion>, [">= 2.0.1"] | ||
s.add_runtime_dependency %q<activesupport>, [">= 3.0.10"] | ||
|
||
s.add_development_dependency %q<bundler>, ["~> 1.0.0"] | ||
s.add_development_dependency %q<rspec>, [">= 2.5.0"] | ||
s.add_development_dependency %q<ci_reporter>, [">= 1.6.3"] | ||
s.add_development_dependency %q<simplecov>, [">= 0"] | ||
s.add_development_dependency %q<simplecov-rcov>, [">= 0"] | ||
s.add_development_dependency %q<yard>, ["~> 0.6.0"] | ||
s.add_development_dependency %q<rake>, [">= 0"] | ||
s.add_development_dependency %q<mocha>, [">= 0"] | ||
s.add_development_dependency %q<guard-rspec> | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class OutboundCaller | ||
include Sidekiq::Worker | ||
|
||
def perform(*args) | ||
p args | ||
end | ||
end |
Oops, something went wrong.