Coder Social home page Coder Social logo

matrioska's Introduction

Build Status

Matrioska

Matrioska is an Adhearsion plugin for creating in-call voice apps.

Matrioska helps you do more asynchronous things than Adhearsion alone. For example, you can start a long phone call and have Matrioska listening in the background for keypresses. When a keypress is detected, it can execute application code, for example, to transfer the call or to start or stop a recording. You can think of Matrioska as “background apps for Adhearsion.”

By mapping controllers or blocks to the desired applications, a listener object waits for DTMF and reacts by executing the specified payload.

Usage Example

# inside your controller
runner = Matrioska::AppRunner.new call
runner.map_app 3 do
  logger.info "hi there!"
end
runner.map_app 5, AppController

runner.start

Using local and remote apps with at the same time with a parallel dial

# inside your controller
dial_with_apps ['user/userb'] do |dial|
  local do |runner|
    runner.map_app '1' do
      say 'Gosh you sound stunning today leg a'
    end
  end

  remote do |runner|
    runner.map_app '2' do
      say 'Gosh you sound stunning today leg b'
    end
  end
end

Links

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Commit, do not mess with Rakefile, version, or history.
    • If you want to have your own version, that is fine but bump version in a commit by itself so I can ignore when I pull
  • Send me a pull request. Bonus points for topic branches.

Credits

Original author: Luca Pradovera

Developed by Mojo Lingo in partnership with RingPlus.

Thanks to RingPlus for ongoing sponsorship of Matrioska.

Copyright

Copyright (c) 2013 Adhearsion Foundation Inc. MIT license (see LICENSE for details).

matrioska's People

Contributors

benlangfeld avatar lpradovera avatar bklang avatar justinaiken avatar vangberg avatar pungoyal avatar

Stargazers

Grzegorz Siehień avatar Tien Pham avatar Grégory Horion avatar Sergei Gema avatar ik5 avatar

Watchers

Neil L. Decapia avatar James Le Cuirot avatar Jamey Owens avatar  avatar Stephen George avatar  avatar  avatar Juan de Bravo avatar Evan McGee avatar James Cloos avatar Will Drexler avatar  avatar Rafael Garcia avatar  avatar

matrioska's Issues

Matrioska needs a state machine

There are two separate states within Matrioska that get conflated and cause trouble:

  • Activation status: whether or not the component should be running (valid states: activated, deactivated)
  • Running status: whether or not the component is running (valid states: listening, not listening)

For example, in the code we currently check for :started after an in-call app finishes. But the problem is that while we are already :started, the input component has completed and is not running. However, if I mark the Runner as :stopped after the input component completes, then it appears that the user has requested the runner to be stopped, so we never bother to restart the input component.

Does not work with adhearsion v2.3.5?

Hi,

I tried this out to listen for a keypress as shown in the example in the README. Here's the code that I tried:

  def run
    runner = Matrioska::AppRunner.new self
    runner.map_app 3 do
      say "three was pressed!"
    end
    call.on_end do
      runner.stop
    end
    runner.start
    answer
    say 'something' #a large amount of text so that the call keeps running and I can watch out
  end

I got an exception in the call controller when the keypress happens. Here's the stack trace from it.

18:58:50 ahn.1  | [2013-06-28 18:58:50] DEBUG Adhearsion::Call: aa2cb720-dff6-11e2-8811-ef3686dc17a6: Receiving message: #<Punchblock::Event::Answered target_call_id="aa2cb720-dff6-11e2-8811-ef3686dc17a6", target_mixer_name=nil, component_id=nil, headers={}>
18:58:53 ahn.1  | Start tag expected, '<' not found
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/nokogiri-1.6.0/lib/nokogiri/xml/document.rb:55:in `read_memory'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/nokogiri-1.6.0/lib/nokogiri/xml/document.rb:55:in `parse'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/nokogiri-1.6.0/lib/nokogiri/xml.rb:63:in `parse'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/bundler/gems/punchblock-72cc088342f0/lib/punchblock/component/input.rb:152:in `result_node'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/bundler/gems/punchblock-72cc088342f0/lib/punchblock/component/input.rb:145:in `inherit'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/bundler/gems/punchblock-72cc088342f0/lib/punchblock/rayo_node.rb:57:in `from_xml'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/bundler/gems/punchblock-72cc088342f0/lib/punchblock/rayo_node.rb:55:in `from_xml'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/bundler/gems/punchblock-72cc088342f0/lib/punchblock/event/complete.rb:14:in `inherit'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/bundler/gems/punchblock-72cc088342f0/lib/punchblock/rayo_node.rb:57:in `from_xml'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/bundler/gems/punchblock-72cc088342f0/lib/punchblock/rayo_node.rb:55:in `from_xml'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/bundler/gems/punchblock-72cc088342f0/lib/punchblock/core_ext/blather/stanza.rb:11:in `rayo_node'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/bundler/gems/punchblock-72cc088342f0/lib/punchblock/core_ext/blather/stanza/presence.rb:9:in `rayo_event?'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/bundler/gems/punchblock-72cc088342f0/lib/punchblock/connection/xmpp.rb:132:in `handle_presence'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/bundler/gems/punchblock-72cc088342f0/lib/punchblock/connection/xmpp.rb:173:in `block in register_handlers'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/blather-0.8.4/lib/blather/client/client.rb:295:in `call'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/blather-0.8.4/lib/blather/client/client.rb:295:in `call_handler'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/blather-0.8.4/lib/blather/client/client.rb:286:in `block (2 levels) in call_handler_for'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/blather-0.8.4/lib/blather/client/client.rb:286:in `catch'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/blather-0.8.4/lib/blather/client/client.rb:286:in `block in call_handler_for'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/blather-0.8.4/lib/blather/client/client.rb:285:in `each'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/blather-0.8.4/lib/blather/client/client.rb:285:in `find'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/blather-0.8.4/lib/blather/client/client.rb:285:in `call_handler_for'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/blather-0.8.4/lib/blather/client/client.rb:278:in `block in handle_stanza'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/blather-0.8.4/lib/blather/client/client.rb:277:in `each'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/blather-0.8.4/lib/blather/client/client.rb:277:in `handle_stanza'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/blather-0.8.4/lib/blather/client/client.rb:194:in `block in handle_data'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/blather-0.8.4/lib/blather/client/client.rb:192:in `catch'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/blather-0.8.4/lib/blather/client/client.rb:192:in `handle_data'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/blather-0.8.4/lib/blather/client/client.rb:63:in `block in initialize'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/girl_friday-0.11.2/lib/girl_friday/work_queue.rb:147:in `call'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/girl_friday-0.11.2/lib/girl_friday/work_queue.rb:147:in `block (2 levels) in start'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/girl_friday-0.11.2/lib/girl_friday/actor.rb:86:in `call'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/girl_friday-0.11.2/lib/girl_friday/actor.rb:86:in `block in spawn_link'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/girl_friday-0.11.2/lib/girl_friday/actor.rb:69:in `call'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/girl_friday-0.11.2/lib/girl_friday/actor.rb:69:in `block (2 levels) in spawn'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/girl_friday-0.11.2/lib/girl_friday/actor.rb:212:in `block in initialize'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/girl_friday-0.11.2/lib/girl_friday/actor.rb:377:in `watchdog'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/girl_friday-0.11.2/lib/girl_friday/actor.rb:212:in `initialize'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/girl_friday-0.11.2/lib/girl_friday/actor.rb:66:in `new'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/girl_friday-0.11.2/lib/girl_friday/actor.rb:66:in `block in spawn'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/logging-1.8.1/lib/logging/diagnostic_context.rb:323:in `call'
18:58:53 ahn.1  | /usr/local/opt/rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/logging-1.8.1/lib/logging/diagnostic_context.rb:323:in `block in create_with_logging_context'

Any idea what's wrong here?

`master` doesn't inclue a lot of the fixes from `develop`

Hi,

master doesn't include a lot of the fixes present in develop. Any chance to merge the two branches so that the version we get via bundle install is up to date?

More specifically this commit: 80f5939 that lets Matrioska use patterns longer than 1 digit.

Cheers,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.