Giter Site home page Giter Site logo

adhearsion-asterisk's Introduction

Gem Version Build Code Climate Coverage Status Inline docs

Adhearsion

Adhearsion is an open-source voice application development framework. Adhearsion users write applications atop the framework with Ruby and call into their code.

Adhearsion rests above a lower-level telephony platform, for example Asterisk, FreeSWITCH or Voxeo PRISM, and provides a framework for integrating with various resources, such as SQL, LDAP and XMPP (Jabber).

Features

  • Simple Ruby code
  • Flexible CallControllers to handle calls
  • High-level media handling constructs
  • Simple interaction between calls
  • Self-documenting configuration engine
  • Support for plugins and other code reuse
  • Integration with databases, web APIs, etc
  • Event monitoring, async communication

Requirements

  • Ruby 2.2.0+ or JRuby 9.0.0.0+
  • ruby_speech dependencies
  • A VoIP platform:
    • Asterisk 11+
    • FreeSWITCH 1.4+
  • An interest in building cool new things

Ruby 1.9 is no longer supported by Adhearsion or the Ruby core team. You should upgrade to Ruby 2.2 as a matter of urgency in order to continue receiving security fixes.

Install

gem install adhearsion

Examples

An Adhearsion application can be as simple as this:

answer
say 'Hello, and thank you for your call. We will put you through to the front desk now...'
dial 'tel:+18005550199'
hangup

For more examples, check out the website.

Documentation

Visit Adhearsion's website for code examples and more information about the project. Also checkout the Adhearsion wiki on Github for community documentation.

If you're having trouble, you may want to try asking your question on the IRC channel (#adhearsion on irc.freenode.net), mailing list or, if you've found a bug, report it on the bug tracker.

Related Projects

These Open Source projects are also maintained by members of the Adhearsion team and may be useful when developing Adhearsion apps:

  • Telephony-Dev-Box is a system for creating virtual machines that will preconfigure Adhearsion, Asterisk, FreeSWITCH and PRISM together. Just add a SIP client and start calling your app!
  • SippyCup makes generating SIPp profiles and RTP media easy. Useful for load testing your apps and telephony infrastructure.

Authors

Core team:

Contributors: https://github.com/adhearsion/adhearsion/contributors

Original author: Jay Phillips

Contributions

Adhearsion has a set of contribution guidelines which help to smooth the contribution process. There is a pre-commit hook that runs encoding checks available in pre-commit. To use it, please copy it to .git/hooks/pre-commit and make it executable.

Copyright

Copyright (c) 2011-2014 Adhearsion Foundation Inc. MIT LICENSE (see LICENSE for details).

adhearsion-asterisk's People

Contributors

benlangfeld avatar bklang avatar chewi avatar guss77 avatar justinaiken avatar lpradovera avatar olleolleolle avatar taylor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adhearsion-asterisk's Issues

Authentication option in VoicemailMain

In voicemail_main authentication option doesn't sends into AGI properly.
With
voicemail_main(:mailbox => 500, :authenticate => false)
we have in adhearsion log
… :command=>"EXEC VoiceMailMain \"500\" \"s\""}, …
and in asterisk log
[Dec 14 11:45:27] -- AGI Script Executing Application: (RINGING) Options: () [Dec 14 11:45:27] -- AGI Script Executing Application: (VoiceMailMain) Options: (500)

Temporarily i solved this by
execute 'VoiceMailMain', '500,s'

Adhearsion::Asterisk.execute_ami_action is asynchronous in adhearsion >= 2.4

While upgrading an Adhearsion application from 2.3 to 2.4 I noticed that my code which interrogates the status of Asterisk queues would ntermittently return everything, nothing, or only some of the entries.

After a bit of debugging, I found that if I run the following in the ahn console:

Adhearsion::Asterisk.execute_ami_action('QueueStatus') do |x|
   puts x.inspect
end; puts "DONE!"

This will print DONE! intermixed with the events in Adhearsion 2.4, while it will print DONE! after all the events in 2.3. I think the new behaviour is a bug, because the documentation for adhearsion-asterisk indicates that
execute_ami_action() is (intended to be) synchronous.

I've tried to debug this but the Punchblock code is extremely abstract, and difficult to follow. Any help would be appreciated!

Asterisk PJSIP Support in adhearsion-asterisk

Summary

Asterisk's chan_sip SIP driver is deprecated in favor of chan_pjsip. Adhearsion should be updated to support both drivers.

In an ideal world, Adhearsion could automatically detect which driver incoming calls are based on (based on agi_type: "SIP" or "PJSIP"). But outbound calls at minimum, we're going to need to introduce a configuration option to allow one to choose between the two.

While Asterisk allows a mixed-mode in which it can handle some calls on chan_sip with other calls on chan_pjsip at the same time – I propose that we do not support co-operating sip/pjsip modes in Adhearsion for the sake of API simplicity. Rather, I suggest a single global sip/pjsip option in Adhearsion Configuration.

What Needs to Change

I've spotted only a few places that need to change to be able to support PJSIP.

Related Docs

<NoMethodError> undefined method `code' on execute 'SendDTMF'

line 12 of modem.rb:

      execute 'SendDTMF', '#12345', 125

Causes this error:

[2012-06-21 18:32:22] ERROR Adhearsion::Call: f947beee-d548-4b1b-b573-45e6a58c173c: <NoMethodError> undefined method `code' for #<Punchblock::Event::Complete::Hangup:0x007ff6eb52d020>
    /Users/doug/.rvm/gems/ruby-1.9.3-p194@adhearsion/gems/adhearsion-asterisk-1.2.0/lib/adhearsion/asterisk/call_controller_methods.rb:21:in `block in agi'
    /Users/doug/.rvm/gems/ruby-1.9.3-p194@adhearsion/gems/adhearsion-asterisk-1.2.0/lib/adhearsion/asterisk/call_controller_methods.rb:21:in `map'
    /Users/doug/.rvm/gems/ruby-1.9.3-p194@adhearsion/gems/adhearsion-asterisk-1.2.0/lib/adhearsion/asterisk/call_controller_methods.rb:21:in `agi'
    /Users/doug/.rvm/gems/ruby-1.9.3-p194@adhearsion/gems/adhearsion-asterisk-1.2.0/lib/adhearsion/asterisk/call_controller_methods.rb:37:in `execute'
    /Users/doug/Projects/adhearsion/test/lib/modem.rb:12:in `run'
    /Users/doug/.rvm/gems/ruby-1.9.3-p194@adhearsion/gems/adhearsion-2.0.1/lib/adhearsion/call_controller.rb:83:in `execute!'
    /Users/doug/.rvm/gems/ruby-1.9.3-p194@adhearsion/gems/adhearsion-2.0.1/lib/adhearsion/call_controller.rb:45:in `block in exec'
    /Users/doug/.rvm/gems/ruby-1.9.3-p194@adhearsion/gems/adhearsion-2.0.1/lib/adhearsion/call_controller.rb:44:in `catch'
    /Users/doug/.rvm/gems/ruby-1.9.3-p194@adhearsion/gems/adhearsion-2.0.1/lib/adhearsion/call_controller.rb:44:in `exec'
    /Users/doug/.rvm/gems/ruby-1.9.3-p194@adhearsion/gems/adhearsion-2.0.1/lib/adhearsion/call.rb:295:in `block (2 levels) in execute_controller'
    /Users/doug/.rvm/gems/ruby-1.9.3-p194@adhearsion/gems/adhearsion-2.0.1/lib/adhearsion/foundation/exception_handler.rb:6:in `catching_standard_errors'
    /Users/doug/.rvm/gems/ruby-1.9.3-p194@adhearsion/gems/adhearsion-2.0.1/lib/adhearsion/call.rb:293:in `block in execute_controller'

undefined method `code' for #<Punchblock::Event::Complete::Hangup>

Prematurely hanging up a call intermittently results in the error below. I'm not sure of the exact conditions required to reproduce.

[2012-05-16 14:21:19] DEBUG Adhearsion::Call: 1b19d201-1db8-4f68-aad6-7c9c5224f39a: Executing command #<Punchblock::Component::Asterisk::AGI::Command name="EXEC SayDigits", params_array=["2600"], target_call_id=nil, component_id=nil, target_mixer_name=nil, state_name=:new>
[2012-05-16 14:21:19] DEBUG Punchblock::Translator::Asterisk::Call: 1b19d201-1db8-4f68-aad6-7c9c5224f39a: Executing command: #<Punchblock::Component::Asterisk::AGI::Command name="EXEC SayDigits", params_array=["2600"], target_call_id="1b19d201-1db8-4f68-aad6-7c9c5224f39a", component_id=nil, target_mixer_name=nil, state_name=:requested>
[2012-05-16 14:21:19] DEBUG Punchblock::Translator::Asterisk::Component::Asterisk::AGICommand: Call ID: 1b19d201-1db8-4f68-aad6-7c9c5224f39a, Component ID: e8c84fdb-1bee-495e-bb02-11bd148737ab: Starting up...
[2012-05-16 14:21:19] DEBUG Punchblock::Translator::Asterisk::Component::Asterisk::AGICommand: Call ID: 1b19d201-1db8-4f68-aad6-7c9c5224f39a, Component ID: e8c84fdb-1bee-495e-bb02-11bd148737ab: Handling response: #<RubyAMI::Response:0x00000003fd0388 @headers={"ActionID"=>"ac57991e-f726-41bf-9499-dfd17c67c23c", "Message"=>"Added AGI command to queue"}, @action=Action: agi
ActionID: ac57991e-f726-41bf-9499-dfd17c67c23c
Channel: SIP/gigaset-00000014
Command: EXEC SayDigits "2600"
CommandID: e8c84fdb-1bee-495e-bb02-11bd148737ab

>
[2012-05-16 14:21:19] DEBUG Punchblock::Translator::Asterisk::Component::Asterisk::AGICommand: Call ID: 1b19d201-1db8-4f68-aad6-7c9c5224f39a, Component ID: e8c84fdb-1bee-495e-bb02-11bd148737ab: Setting response on component node to #<Punchblock::Ref id="e8c84fdb-1bee-495e-bb02-11bd148737ab", target_call_id=nil, component_id=nil, target_mixer_name=nil>
[2012-05-16 14:21:21] WARN  Punchblock::Translator::Asterisk::Call: 1b19d201-1db8-4f68-aad6-7c9c5224f39a: Could not find component for AMI event: #<RubyAMI::Event:0x007fb1742599c8 @headers={"Privilege"=>"agi,all", "SubEvent"=>"End", "Channel"=>"SIP/gigaset-00000014"}, @name="AsyncAGI">
[2012-05-16 14:21:21] DEBUG Punchblock::Translator::Asterisk::Component::Asterisk::AGICommand: Call ID: 1b19d201-1db8-4f68-aad6-7c9c5224f39a, Component ID: e8c84fdb-1bee-495e-bb02-11bd148737ab: Handling AMI event: #<RubyAMI::Event:0x007fb1741ad290 @headers={"Privilege"=>"agi,all", "SubEvent"=>"Exec", "Channel"=>"SIP/gigaset-00000014", "CommandID"=>"e8c84fdb-1bee-495e-bb02-11bd148737ab", "Result"=>"200%20result%3D-1%0A"}, @name="AsyncAGI">
[2012-05-16 14:21:21] DEBUG Punchblock::Translator::Asterisk::Component::Asterisk::AGICommand: Call ID: 1b19d201-1db8-4f68-aad6-7c9c5224f39a, Component ID: e8c84fdb-1bee-495e-bb02-11bd148737ab: Received AsyncAGI:Exec event, sending complete event.
[2012-05-16 14:21:21] DEBUG Punchblock::Translator::Asterisk::Component::Asterisk::AGICommand: Call ID: 1b19d201-1db8-4f68-aad6-7c9c5224f39a, Component ID: e8c84fdb-1bee-495e-bb02-11bd148737ab: Sending event #<Punchblock::Event::Complete reason=#<Punchblock::Event::Complete::Hangup name=:hangup, target_call_id="1b19d201-1db8-4f68-aad6-7c9c5224f39a", component_id="e8c84fdb-1bee-495e-bb02-11bd148737ab", target_mixer_name=nil>, recording=nil, target_call_id="1b19d201-1db8-4f68-aad6-7c9c5224f39a", component_id="e8c84fdb-1bee-495e-bb02-11bd148737ab", target_mixer_name=nil>
[2012-05-16 14:21:21] DEBUG Adhearsion::Call: 1b19d201-1db8-4f68-aad6-7c9c5224f39a: Receiving message: #<Punchblock::Event::Complete reason=#<Punchblock::Event::Complete::Hangup name=:hangup, target_call_id="1b19d201-1db8-4f68-aad6-7c9c5224f39a", component_id="e8c84fdb-1bee-495e-bb02-11bd148737ab", target_mixer_name=nil>, recording=nil, target_call_id="1b19d201-1db8-4f68-aad6-7c9c5224f39a", component_id="e8c84fdb-1bee-495e-bb02-11bd148737ab", target_mixer_name=nil>
[2012-05-16 14:21:21] ERROR Adhearsion::Call: 1b19d201-1db8-4f68-aad6-7c9c5224f39a: <NoMethodError> undefined method `code' for #<Punchblock::Event::Complete::Hangup:0x007fb138164450>
    /home/jlecuirot/.rvm/gems/ruby-1.9.3-p194/gems/adhearsion-2.0.0/lib/adhearsion/foundation/object.rb:22:in `method_missing'
    /home/jlecuirot/.rvm/gems/ruby-1.9.3-p194/bundler/gems/adhearsion-asterisk-20b8cd7cff63/lib/adhearsion/asterisk/call_controller_methods.rb:21:in `block in agi'
    /home/jlecuirot/.rvm/gems/ruby-1.9.3-p194/bundler/gems/adhearsion-asterisk-20b8cd7cff63/lib/adhearsion/asterisk/call_controller_methods.rb:21:in `map'
    /home/jlecuirot/.rvm/gems/ruby-1.9.3-p194/bundler/gems/adhearsion-asterisk-20b8cd7cff63/lib/adhearsion/asterisk/call_controller_methods.rb:21:in `agi'
    /home/jlecuirot/.rvm/gems/ruby-1.9.3-p194/bundler/gems/adhearsion-asterisk-20b8cd7cff63/lib/adhearsion/asterisk/call_controller_methods.rb:37:in `execute'
    /home/jlecuirot/.rvm/gems/ruby-1.9.3-p194/bundler/gems/adhearsion-asterisk-20b8cd7cff63/lib/adhearsion/asterisk/call_controller_methods.rb:376:in `play_digits'
    /home/jlecuirot/ctnv/app/call_controllers/inbound_requests_call_controller.rb:24:in `run'
    /home/jlecuirot/.rvm/gems/ruby-1.9.3-p194/gems/adhearsion-2.0.0/lib/adhearsion/call_controller.rb:83:in `execute!'
    /home/jlecuirot/.rvm/gems/ruby-1.9.3-p194/gems/adhearsion-2.0.0/lib/adhearsion/call_controller.rb:45:in `block in exec'
    /home/jlecuirot/.rvm/gems/ruby-1.9.3-p194/gems/adhearsion-2.0.0/lib/adhearsion/call_controller.rb:44:in `catch'
    /home/jlecuirot/.rvm/gems/ruby-1.9.3-p194/gems/adhearsion-2.0.0/lib/adhearsion/call_controller.rb:44:in `exec'
    /home/jlecuirot/.rvm/gems/ruby-1.9.3-p194/gems/adhearsion-2.0.0/lib/adhearsion/call.rb:296:in `block (2 levels) in execute_controller'
    /home/jlecuirot/.rvm/gems/ruby-1.9.3-p194/gems/adhearsion-2.0.0/lib/adhearsion/foundation/exception_handler.rb:6:in `catching_standard_errors'
    /home/jlecuirot/.rvm/gems/ruby-1.9.3-p194/gems/adhearsion-2.0.0/lib/adhearsion/call.rb:294:in `block in execute_controller'
[2012-05-16 14:21:21] DEBUG Adhearsion::Call: 1b19d201-1db8-4f68-aad6-7c9c5224f39a: Receiving message: #<Punchblock::Event::End reason=:hangup, headers_hash={}, target_call_id="1b19d201-1db8-4f68-aad6-7c9c5224f39a", component_id=nil, target_mixer_name=nil>
[2012-05-16 14:21:21] INFO  Adhearsion::Call: 1b19d201-1db8-4f68-aad6-7c9c5224f39a: Call ended
[2012-05-16 14:21:21] DEBUG Adhearsion::Call: 1b19d201-1db8-4f68-aad6-7c9c5224f39a: Finished executing controller #<InboundRequestsCallController call=1b19d201-1db8-4f68-aad6-7c9c5224f39a, metadata={}>
[2012-05-16 14:21:26] DEBUG Punchblock::Translator::Asterisk::Call: 1b19d201-1db8-4f68-aad6-7c9c5224f39a: Shutting down

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.