adhearsion 1.2.6 → 2.0.0.alpha1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. data/.gitignore +17 -10
  2. data/CHANGELOG.md +273 -0
  3. data/Gemfile +1 -1
  4. data/Guardfile +17 -0
  5. data/README.markdown +61 -9
  6. data/Rakefile +16 -48
  7. data/adhearsion.gemspec +21 -7
  8. data/bin/ahn +3 -1
  9. data/cucumber.yml +4 -0
  10. data/features/app_generator.feature +42 -0
  11. data/features/cli.feature +108 -0
  12. data/features/step_definitions/app_generator_steps.rb +6 -0
  13. data/features/step_definitions/cli_steps.rb +74 -0
  14. data/features/support/aruba_helper.rb +22 -0
  15. data/features/support/env.rb +37 -0
  16. data/features/support/utils.rb +8 -0
  17. data/lib/adhearsion.rb +85 -41
  18. data/lib/adhearsion/call.rb +176 -0
  19. data/lib/adhearsion/call_controller.rb +134 -0
  20. data/lib/adhearsion/call_controller/dial.rb +70 -0
  21. data/lib/adhearsion/call_controller/input.rb +173 -0
  22. data/lib/adhearsion/call_controller/menu.rb +124 -0
  23. data/lib/adhearsion/call_controller/output.rb +267 -0
  24. data/lib/adhearsion/call_controller/record.rb +42 -0
  25. data/lib/adhearsion/call_controller/utility.rb +60 -0
  26. data/lib/adhearsion/calls.rb +81 -0
  27. data/lib/adhearsion/cli.rb +1 -3
  28. data/lib/adhearsion/cli_commands.rb +142 -0
  29. data/lib/adhearsion/configuration.rb +149 -0
  30. data/lib/adhearsion/console.rb +19 -8
  31. data/lib/adhearsion/dialplan_controller.rb +9 -0
  32. data/lib/adhearsion/events.rb +84 -0
  33. data/lib/adhearsion/foundation/all.rb +0 -7
  34. data/lib/adhearsion/foundation/custom_daemonizer.rb +4 -6
  35. data/lib/adhearsion/foundation/exception_handler.rb +9 -0
  36. data/lib/adhearsion/foundation/object.rb +26 -8
  37. data/lib/adhearsion/foundation/synchronized_hash.rb +3 -6
  38. data/lib/adhearsion/foundation/thread_safety.rb +17 -1
  39. data/lib/adhearsion/generators/app/app_generator.rb +4 -13
  40. data/lib/adhearsion/generators/app/templates/Gemfile +10 -5
  41. data/lib/adhearsion/generators/app/templates/Procfile +1 -0
  42. data/lib/adhearsion/generators/app/templates/README.md +28 -0
  43. data/lib/adhearsion/generators/app/templates/config/adhearsion.rb +41 -0
  44. data/lib/adhearsion/generators/app/templates/{components/simon_game → lib}/simon_game.rb +6 -18
  45. data/lib/adhearsion/generators/app/templates/script/ahn +2 -2
  46. data/lib/adhearsion/initializer.rb +151 -293
  47. data/lib/adhearsion/initializer/logging.rb +33 -0
  48. data/lib/adhearsion/logging.rb +65 -69
  49. data/lib/adhearsion/menu_dsl.rb +15 -0
  50. data/lib/adhearsion/menu_dsl/calculated_match.rb +39 -0
  51. data/lib/adhearsion/menu_dsl/calculated_match_collection.rb +41 -0
  52. data/lib/adhearsion/menu_dsl/fixnum_match_calculator.rb +18 -0
  53. data/lib/adhearsion/menu_dsl/match_calculator.rb +36 -0
  54. data/lib/adhearsion/{voip/menu_state_machine/menu_class.rb → menu_dsl/menu.rb} +38 -40
  55. data/lib/adhearsion/menu_dsl/menu_builder.rb +69 -0
  56. data/lib/adhearsion/menu_dsl/range_match_calculator.rb +55 -0
  57. data/lib/adhearsion/menu_dsl/string_match_calculator.rb +21 -0
  58. data/lib/adhearsion/outbound_call.rb +64 -0
  59. data/lib/adhearsion/plugin.rb +319 -0
  60. data/lib/adhearsion/plugin/collection.rb +19 -0
  61. data/lib/adhearsion/plugin/initializer.rb +37 -0
  62. data/lib/adhearsion/plugin/methods_container.rb +6 -0
  63. data/lib/adhearsion/process.rb +94 -0
  64. data/lib/adhearsion/punchblock_plugin.rb +29 -0
  65. data/lib/adhearsion/punchblock_plugin/initializer.rb +137 -0
  66. data/lib/adhearsion/router.rb +30 -0
  67. data/lib/adhearsion/router/route.rb +42 -0
  68. data/lib/adhearsion/script_ahn_loader.rb +2 -2
  69. data/lib/adhearsion/tasks.rb +14 -9
  70. data/lib/adhearsion/tasks/configuration.rb +26 -0
  71. data/lib/adhearsion/tasks/plugins.rb +17 -0
  72. data/lib/adhearsion/version.rb +8 -14
  73. data/spec/adhearsion/call_controller/dial_spec.rb +138 -0
  74. data/spec/adhearsion/call_controller/input_spec.rb +278 -0
  75. data/spec/adhearsion/call_controller/menu_spec.rb +120 -0
  76. data/spec/adhearsion/call_controller/output_spec.rb +466 -0
  77. data/spec/adhearsion/call_controller/record_spec.rb +125 -0
  78. data/spec/adhearsion/call_controller_spec.rb +395 -0
  79. data/spec/adhearsion/call_spec.rb +438 -0
  80. data/spec/adhearsion/calls_spec.rb +47 -0
  81. data/spec/adhearsion/configuration_spec.rb +308 -0
  82. data/spec/adhearsion/dialplan_controller_spec.rb +26 -0
  83. data/spec/adhearsion/events_spec.rb +112 -0
  84. data/spec/adhearsion/initializer/logging_spec.rb +58 -0
  85. data/spec/adhearsion/initializer_spec.rb +209 -122
  86. data/spec/adhearsion/logging_spec.rb +58 -47
  87. data/spec/adhearsion/menu_dsl/calculated_match_collection_spec.rb +56 -0
  88. data/spec/adhearsion/menu_dsl/calculated_match_spec.rb +57 -0
  89. data/spec/adhearsion/menu_dsl/fixnum_match_calculator_spec.rb +33 -0
  90. data/spec/adhearsion/menu_dsl/match_calculator_spec.rb +13 -0
  91. data/spec/adhearsion/menu_dsl/menu_builder_spec.rb +118 -0
  92. data/spec/adhearsion/menu_dsl/menu_spec.rb +210 -0
  93. data/spec/adhearsion/menu_dsl/range_match_calculator_spec.rb +28 -0
  94. data/spec/adhearsion/menu_dsl/string_match_calculator_spec.rb +36 -0
  95. data/spec/adhearsion/menu_dsl_spec.rb +12 -0
  96. data/spec/adhearsion/outbound_call_spec.rb +174 -0
  97. data/spec/adhearsion/plugin_spec.rb +489 -0
  98. data/spec/adhearsion/process_spec.rb +34 -0
  99. data/spec/adhearsion/punchblock_plugin/initializer_spec.rb +294 -0
  100. data/spec/adhearsion/router/route_spec.rb +99 -0
  101. data/spec/adhearsion/router_spec.rb +106 -0
  102. data/spec/adhearsion_spec.rb +46 -0
  103. data/spec/spec_helper.rb +14 -14
  104. data/spec/support/call_controller_test_helpers.rb +48 -0
  105. data/spec/support/initializer_stubs.rb +8 -13
  106. data/spec/support/punchblock_mocks.rb +6 -0
  107. metadata +255 -253
  108. data/CHANGELOG +0 -174
  109. data/bin/ahnctl +0 -68
  110. data/bin/jahn +0 -43
  111. data/examples/asterisk_manager_interface/standalone.rb +0 -51
  112. data/lib/adhearsion/commands.rb +0 -302
  113. data/lib/adhearsion/component_manager.rb +0 -278
  114. data/lib/adhearsion/component_manager/component_tester.rb +0 -54
  115. data/lib/adhearsion/component_manager/spec_framework.rb +0 -18
  116. data/lib/adhearsion/events_support.rb +0 -65
  117. data/lib/adhearsion/foundation/blank_slate.rb +0 -3
  118. data/lib/adhearsion/foundation/event_socket.rb +0 -205
  119. data/lib/adhearsion/foundation/future_resource.rb +0 -36
  120. data/lib/adhearsion/foundation/metaprogramming.rb +0 -17
  121. data/lib/adhearsion/foundation/numeric.rb +0 -13
  122. data/lib/adhearsion/foundation/pseudo_guid.rb +0 -10
  123. data/lib/adhearsion/foundation/relationship_properties.rb +0 -42
  124. data/lib/adhearsion/foundation/string.rb +0 -26
  125. data/lib/adhearsion/generators/app/templates/.ahnrc +0 -34
  126. data/lib/adhearsion/generators/app/templates/README +0 -8
  127. data/lib/adhearsion/generators/app/templates/components/ami_remote/ami_remote.rb +0 -15
  128. data/lib/adhearsion/generators/app/templates/components/disabled/HOW_TO_ENABLE +0 -7
  129. data/lib/adhearsion/generators/app/templates/components/disabled/stomp_gateway/README.markdown +0 -47
  130. data/lib/adhearsion/generators/app/templates/components/disabled/stomp_gateway/stomp_gateway.rb +0 -34
  131. data/lib/adhearsion/generators/app/templates/components/disabled/stomp_gateway/stomp_gateway.yml +0 -12
  132. data/lib/adhearsion/generators/app/templates/components/disabled/xmpp_gateway/README.markdown +0 -3
  133. data/lib/adhearsion/generators/app/templates/components/disabled/xmpp_gateway/xmpp_gateway.rb +0 -11
  134. data/lib/adhearsion/generators/app/templates/components/disabled/xmpp_gateway/xmpp_gateway.yml +0 -0
  135. data/lib/adhearsion/generators/app/templates/config/startup.rb +0 -81
  136. data/lib/adhearsion/generators/app/templates/dialplan.rb +0 -3
  137. data/lib/adhearsion/generators/app/templates/events.rb +0 -33
  138. data/lib/adhearsion/host_definitions.rb +0 -67
  139. data/lib/adhearsion/initializer/asterisk.rb +0 -86
  140. data/lib/adhearsion/initializer/configuration.rb +0 -324
  141. data/lib/adhearsion/initializer/database.rb +0 -60
  142. data/lib/adhearsion/initializer/drb.rb +0 -31
  143. data/lib/adhearsion/initializer/freeswitch.rb +0 -22
  144. data/lib/adhearsion/initializer/ldap.rb +0 -57
  145. data/lib/adhearsion/initializer/rails.rb +0 -41
  146. data/lib/adhearsion/initializer/xmpp.rb +0 -42
  147. data/lib/adhearsion/tasks/components.rb +0 -32
  148. data/lib/adhearsion/tasks/database.rb +0 -5
  149. data/lib/adhearsion/tasks/deprecations.rb +0 -59
  150. data/lib/adhearsion/tasks/generating.rb +0 -20
  151. data/lib/adhearsion/tasks/lint.rb +0 -4
  152. data/lib/adhearsion/voip/asterisk.rb +0 -4
  153. data/lib/adhearsion/voip/asterisk/agi_server.rb +0 -121
  154. data/lib/adhearsion/voip/asterisk/commands.rb +0 -1966
  155. data/lib/adhearsion/voip/asterisk/config_generators/agents.conf.rb +0 -140
  156. data/lib/adhearsion/voip/asterisk/config_generators/config_generator.rb +0 -102
  157. data/lib/adhearsion/voip/asterisk/config_generators/queues.conf.rb +0 -250
  158. data/lib/adhearsion/voip/asterisk/config_generators/voicemail.conf.rb +0 -240
  159. data/lib/adhearsion/voip/asterisk/config_manager.rb +0 -64
  160. data/lib/adhearsion/voip/asterisk/manager_interface.rb +0 -697
  161. data/lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb +0 -1681
  162. data/lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb +0 -341
  163. data/lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb +0 -78
  164. data/lib/adhearsion/voip/asterisk/manager_interface/ami_protocol_lexer_machine.rl +0 -87
  165. data/lib/adhearsion/voip/asterisk/special_dial_plan_managers.rb +0 -80
  166. data/lib/adhearsion/voip/call.rb +0 -521
  167. data/lib/adhearsion/voip/call_routing.rb +0 -64
  168. data/lib/adhearsion/voip/commands.rb +0 -17
  169. data/lib/adhearsion/voip/constants.rb +0 -39
  170. data/lib/adhearsion/voip/conveniences.rb +0 -18
  171. data/lib/adhearsion/voip/dial_plan.rb +0 -252
  172. data/lib/adhearsion/voip/dsl/dialing_dsl.rb +0 -151
  173. data/lib/adhearsion/voip/dsl/dialing_dsl/dialing_dsl_monkey_patches.rb +0 -37
  174. data/lib/adhearsion/voip/dsl/dialplan/control_passing_exception.rb +0 -27
  175. data/lib/adhearsion/voip/dsl/dialplan/dispatcher.rb +0 -124
  176. data/lib/adhearsion/voip/dsl/dialplan/parser.rb +0 -69
  177. data/lib/adhearsion/voip/dsl/dialplan/thread_mixin.rb +0 -16
  178. data/lib/adhearsion/voip/dsl/numerical_string.rb +0 -128
  179. data/lib/adhearsion/voip/freeswitch/basic_connection_manager.rb +0 -48
  180. data/lib/adhearsion/voip/freeswitch/event_handler.rb +0 -58
  181. data/lib/adhearsion/voip/freeswitch/freeswitch_dialplan_command_factory.rb +0 -129
  182. data/lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb +0 -38
  183. data/lib/adhearsion/voip/freeswitch/oes_server.rb +0 -195
  184. data/lib/adhearsion/voip/menu_state_machine/calculated_match.rb +0 -80
  185. data/lib/adhearsion/voip/menu_state_machine/matchers.rb +0 -123
  186. data/lib/adhearsion/voip/menu_state_machine/menu_builder.rb +0 -57
  187. data/lib/adhearsion/xmpp/connection.rb +0 -61
  188. data/lib/theatre.rb +0 -147
  189. data/lib/theatre/README.markdown +0 -64
  190. data/lib/theatre/callback_definition_loader.rb +0 -86
  191. data/lib/theatre/guid.rb +0 -23
  192. data/lib/theatre/invocation.rb +0 -131
  193. data/lib/theatre/namespace_manager.rb +0 -153
  194. data/lib/theatre/version.rb +0 -2
  195. data/spec/adhearsion/cli_spec.rb +0 -306
  196. data/spec/adhearsion/component_manager_spec.rb +0 -292
  197. data/spec/adhearsion/constants_spec.rb +0 -8
  198. data/spec/adhearsion/drb_spec.rb +0 -65
  199. data/spec/adhearsion/fixtures/dialplan.rb +0 -3
  200. data/spec/adhearsion/foundation/event_socket_spec.rb +0 -168
  201. data/spec/adhearsion/host_definitions_spec.rb +0 -79
  202. data/spec/adhearsion/initializer/configuration_spec.rb +0 -291
  203. data/spec/adhearsion/initializer/loading_spec.rb +0 -154
  204. data/spec/adhearsion/initializer/paths_spec.rb +0 -74
  205. data/spec/adhearsion/relationship_properties_spec.rb +0 -54
  206. data/spec/adhearsion/voip/asterisk/agi_server_spec.rb +0 -473
  207. data/spec/adhearsion/voip/asterisk/ami/ami_spec.rb +0 -550
  208. data/spec/adhearsion/voip/asterisk/ami/lexer/ami_fixtures.yml +0 -30
  209. data/spec/adhearsion/voip/asterisk/ami/lexer/lexer_story +0 -291
  210. data/spec/adhearsion/voip/asterisk/ami/lexer/lexer_story.rb +0 -241
  211. data/spec/adhearsion/voip/asterisk/ami/lexer/story_helper.rb +0 -124
  212. data/spec/adhearsion/voip/asterisk/commands_spec.rb +0 -3241
  213. data/spec/adhearsion/voip/asterisk/config_file_generators/agents_spec.rb +0 -251
  214. data/spec/adhearsion/voip/asterisk/config_file_generators/queues_spec.rb +0 -323
  215. data/spec/adhearsion/voip/asterisk/config_file_generators/voicemail_spec.rb +0 -306
  216. data/spec/adhearsion/voip/asterisk/config_manager_spec.rb +0 -127
  217. data/spec/adhearsion/voip/asterisk/menu_command/calculated_match_spec.rb +0 -109
  218. data/spec/adhearsion/voip/asterisk/menu_command/matchers_spec.rb +0 -97
  219. data/spec/adhearsion/voip/call_routing_spec.rb +0 -125
  220. data/spec/adhearsion/voip/dialplan_manager_spec.rb +0 -468
  221. data/spec/adhearsion/voip/dsl/dialing_dsl_spec.rb +0 -270
  222. data/spec/adhearsion/voip/dsl/dispatcher_spec.rb +0 -82
  223. data/spec/adhearsion/voip/dsl/dispatcher_spec_helper.rb +0 -45
  224. data/spec/adhearsion/voip/dsl/parser_spec.rb +0 -69
  225. data/spec/adhearsion/voip/freeswitch/basic_connection_manager_spec.rb +0 -39
  226. data/spec/adhearsion/voip/freeswitch/inbound_connection_manager_spec.rb +0 -39
  227. data/spec/adhearsion/voip/freeswitch/oes_server_spec.rb +0 -9
  228. data/spec/adhearsion/voip/numerical_string_spec.rb +0 -61
  229. data/spec/adhearsion/voip/phone_number_spec.rb +0 -45
  230. data/spec/support/the_following_code.rb +0 -3
  231. data/spec/theatre/dsl_examples/simple_before_call.rb +0 -7
  232. data/spec/theatre/dsl_spec.rb +0 -69
  233. data/spec/theatre/invocation_spec.rb +0 -182
  234. data/spec/theatre/namespace_spec.rb +0 -125
  235. data/spec/theatre/spec_helper_spec.rb +0 -28
  236. data/spec/theatre/theatre_class_spec.rb +0 -148
data/CHANGELOG DELETED
@@ -1,174 +0,0 @@
1
- support/1.x.x
2
- 1.2.6
3
- - Bugfix: Adhearsion was not explicitly closing dialplan.rb or events.rb files when loading them. This caused file descriptors to remain open on JRuby even though they were GC'd by CRuby.
4
-
5
- 1.2.5
6
- - Catch missing exceptions raised in the after_initialized hook
7
- - Fixed memory leak in logging when lots of calls come in with unique call id's.
8
- - Fixed bug where we modified the filename variable passed to #record, which could lead to confusion by callers
9
- - Avoid some bugs on Ruby 1.8 and JRuby
10
- - Fixed a bug where generated component config files were not loaded
11
- - Prevent infinite loops when raising exceptions in exception handlers
12
- - ahn command now avoids issues with mismatch between installed and bundled gems
13
-
14
- 1.2.4
15
- - Backported Thor-based generators from Adhearsion 2 in order to escape Rubigen.
16
-
17
- 1.2.3
18
- - Changes from 1.2.2, without an accidental API change which slipped in
19
-
20
- 1.2.2 - yanked
21
- - Fixed a console bug related to recent versions of Pry passing extra arguments. Thanks to Alvaro Parres
22
- - Introducing new :initial_timeout and :interdigit_timeout options to #input in order to control the wait delay for the 1st and subsequent digits, respectively. Maintains support for the existing :timeout option. (https://github.com/adhearsion/adhearsion/pull/41)
23
- - Updated #input documentation for new features in Adhearsion 1.2.x
24
- - Fix bug where setting log formatters when demonising would not work (https://github.com/adhearsion/adhearsion/issues/36)
25
-
26
- 1.2.1
27
- - Removed the restful_rpc component since it is now in a gem.
28
- - Allow overriding the path to a component in the testing framework so as to support new style components (lib/)
29
- - Added a GUID to the default recording filename to ensure uniqueness
30
- - ECONNRESET exceptions are now handled as a call hangup
31
- - Fixed escaping of TTS strings containing commas when used with Cepstral via #speak
32
- - Made logging exceptions the responsibility of the framework rather than the app, so that this may not be disabled
33
-
34
- 1.2.0
35
- - New method: #play_or_speak allows playback of an audio file with TTS fallback
36
- - #input now takes :speak as a hash for TTS prompt or fallback
37
- - New method: #speak provides abstracted TTS rendering for UniMRCP and Cepstral
38
- - Allow leading "+" in Caller ID (E.164 format)
39
- - Allow using --pid-file without "daemon" for JRuby
40
- - Allow passing a block to #input to enable caller to detect when enough digits are collected.
41
- - Fix some issues with starting apps outside of their directory, generally related to Bundler/gem environments
42
- - Allow configuration of logging outputters/formatters
43
- - Using ahn_log in a dialplan context or on a call object logs to the call's context, named after its unique identifier
44
- - New method: #record_to_file with more useful return values
45
-
46
- 1.1.1
47
- - Command#play now returns false if audio failed to play
48
- - Added new commands (#play!, #interruptible_play!, #input!) which raise PlaybackError if audio fails to play
49
-
50
- 1.1.0
51
- - Added interactive call control console: ahn start console <path>
52
- - Added centralized exception handler through eventing system
53
- - Support for using ahn_hoptoad to send Adhearsion exceptions to Hoptoad
54
- - Adhearsion.active_calls can now use hash syntax to find calls by ID
55
- - Added Adhearsion::Calls#to_h
56
- - Add a Monitor to synchronize access to an AGI connection
57
-
58
- 1.0.3
59
- - Fix the play() command regression when passing an array of strings. This was breaking the SimonGame
60
- - Deprecate ManagerInterface#send_action_asynchronously
61
-
62
- 1.0.2
63
- - Fix rcov Rake task
64
- - Add Ben Langfeld as an author (Thanks, Ben!)
65
- - Add "rake" as a runtime dependency
66
- - Remove usage of BEGIN blocks (for Rubinius; CS)
67
-
68
- 1.0.1
69
- NOTE for Ruby 1.9 users: The behavior of Ruby 1.9 and case statements has changed
70
- in a way that renders NumericalString objects incompatible with
71
- case statements. The suggested workaround is to cast the NumericalString
72
- to a string and then compare. Example:
73
-
74
- obj = NumericalString.new("0987")
75
- case obj.to_s
76
- when "0987" then true
77
- else false
78
- end
79
-
80
- Or, if you need to ignore the leading zero:
81
- case obj.to_i
82
- when 987 then true
83
- else false
84
- end
85
-
86
- See https://adhearsion.lighthouseapp.com/projects/5871/tickets/127-ruby-19-and-numericalstring-comparisons-in-case-statements
87
- - Add say_chars command.
88
- - Add say_phonetic command.
89
- - Update play_time to accept format and timezone paramenters. This allows you to read back any particular section of the Time object. (i.e. Using format => 'IMp' would result in "eleven twenty-three" being said.)
90
- - Update play_time to allow using Date objects.
91
- - QueueAgentsListProxy#new now returns an AgentProxy instance if the agent was added successfully.
92
- - Add state_interface parameter to QueueAgentsListProxy#new. This allows you to specify a separate interface to watch for state changes on. (i.e. Your agents log in with Local channel extensions, but you want to check their direct SIP exten for state.)
93
- - Fixed issue with Queue#join! that would raise a QueueDoesNotExist error if the call was completed successfully.
94
- - Add support for AGI script parameter to Queue#join!
95
- - Migrate unit tests to RSpec 2
96
- - New components now include RubyGems skeleton files
97
- - Fix support for setting Caller ID name on AGI dial() command
98
- - Generate new apps with Bundler support, including auto-requiring of all gems
99
- - Update component testing framework to RSpec 2.x and mock with rspec
100
-
101
- 1.0.0
102
- - Fall back to using Asterisk's context if the AGI URI context is not found
103
- - Enable configuration of :auto_reconnect parameter for AMI
104
- - Replace all uses of Object#returning with Object#tap
105
- - Add support for loading Adhearsion components from RubyGems
106
- - Fix long-running AMI session parser failure bug (#72)
107
- - Support for Rails 3 (and ActiveSupport 3.0)
108
-
109
- 0.8.6
110
- - Fix packaging problem so all files are publicly readable
111
- - Improve AMI reconnecting logic; add "connection refused" retry timer
112
- - AGI protocol improvements: parse the status code and response text
113
-
114
- 0.8.5
115
- NOTE: If you are upgrading an Adhearsion application to 0.8.5, note the change
116
- to how request URIs are handled. With 0.8.4, the context name in Asterisk was
117
- required to match the Adhearsion context in dialplan.rb. Starting in 0.8.5 if
118
- an application path is passed in on the AGI URI, it will be preferred over the
119
- context name. For example:
120
-
121
- [stuff]
122
- exten => _X.,1,AGI(agi://localhost/myapp)
123
-
124
- AHN 0.8.4- will execute the "stuff" context in dialplan.rb
125
- AHN 0.8.5+ will execute the "myapp" context in dialplan.rb
126
-
127
- If you followed the documentation and did not specify an application path in
128
- the URI (eg. agi://localhost) you will not be impacted by this change.
129
-
130
- Other changes:
131
- - Added XMPP module and sample component. This allows you to easily write components which utilise a persistent XMPP connection maintained by Adhearsion
132
- - Prefer finding the dialplan.rb entry point by the AGI request URI instead of the calling context
133
- - Added :use_static_conf option for "meetme" to allow the use of disk-file-managed conferences
134
- - Logging object now shared with ActiveRecord and Blather
135
- - Fixed a longstanding bug where newlines were not sent after each AGI command
136
- - Fixed parsing of DBGet AMI command/response
137
- - Better shutdown handling/cleanup
138
- - Attempt to allow the AMI socket to reconnect if connection is lost
139
- - Improved support for Ruby 1.9
140
- - Numerous smaller bugs fixed. See: https://adhearsion.lighthouseapp.com/projects/5871-adhearsion/milestones/76510-085
141
-
142
- 0.8.4
143
- - Add configurable argument delimiter for talking to Asterisk. This enables Adhearsion to support Asterisk versions 1.4 (and prior) as well as 1.6 (and later).
144
- - Fixed using ActiveRecord in Adhearsion components
145
- - Daemonizing no longer truncates the Adhearsion log file
146
- - Add support for using ActiveLdap
147
- - Misc improvements to support Asterisk 1.6 changes
148
- - Escape commands sent to Asterisk via AGI
149
- - Manager Events now work when daemonized
150
-
151
- 0.8.3
152
- - The "uniqueid" call channel variable available in dialplan.rb is now *always* a String
153
- - Renamed interruptable_play to interruptible_play and made interruptible_play() public instead of protected.
154
- - Fixed an Asterisk Manager Interface parsing issue in which colons sometimes got stuck into the key name.
155
- - AGI "request" variable coercer will not blow up if no request is given. (Helps in testing with netcat/telnet)
156
-
157
- 0.8.2
158
- - When a call hangs up, Adhearsion will no longer show random exceptions (that were okay) and instead allows the user to rescue a Hangup exception.
159
- - ManagerInterfaceResponse now include()s DRbUndumped, allowing send_action() to be called directly over DRb.
160
- - Fixes an inconsequential bug when CTL-C'ing Adhearsion.
161
-
162
- 0.8.1
163
- - The sandbox component now comes
164
- - Minor bug fixes
165
-
166
- 0.8.0 rev 2
167
- - Added a few non-critical files to the .gemspec. They were ignored
168
-
169
- Notes from before 0.8.0:
170
- - (NOTE: This is obviously not a comprehensive list of pre-0.8.0 work. 0.8.0 was a complete rewrite of the previous version)
171
- - Adding a deprecation warning about Fixnum#digit and Fixnum#digits
172
- - Removed the AMI class and replaced it with the ManagerInterface class.
173
- - The old AMI high-level instance methods are available in the new ManagerInterface class, but a deprecation warning will be logged each time they're used. When the SuperManager class is implemented, they'll be removed entirely.
174
- - Moved Theatre into Adhearsion's lib folder.
data/bin/ahnctl DELETED
@@ -1,68 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # ahnctl - Adhearsion daemon controller
4
- #
5
- # Adhearsion, open source collaboration framework
6
- # Copyright (C) 2006,2007,2008 Jay Phillips
7
- #
8
- # This library is free software; you can redistribute it and/or
9
- # modify it under the terms of the GNU Lesser General Public
10
- # License as published by the Free Software Foundation; either
11
- # version 2.1 of the License, or (at your option) any later version.
12
- #
13
- # This library is distributed in the hope that it will be useful,
14
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
- # Lesser General Public License for more details.
17
- #
18
- # You should have received a copy of the GNU Lesser General Public
19
- # License along with this library; if not, write to the Free Software
20
- # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
-
22
- USAGE = "Usage: ahnctl start|stop|restart /path/to/adhearsion/app [--pid-file=/path/to/pid_file.pid]"
23
-
24
- # Blow up if the CLI arguments are invalid
25
- abort USAGE unless (2..3).include?(ARGV.size) && %w[start stop restart].include?(ARGV.first)
26
-
27
- # By default, ahnctl will use the version of Adhearsion it was installed with.
28
-
29
- pid_file = ARGV.pop if ARGV.size == 3
30
- ahn_command = File.expand_path File.dirname(__FILE__) + "/ahn"
31
- app_dir = File.expand_path ARGV.last
32
-
33
- pid_file_path_regexp = /^--pid-file=(.+)$/
34
- abort USAGE if pid_file && pid_file !~ pid_file_path_regexp
35
-
36
- # If pid_file is not nil, let's extract the path specified.
37
- pid_file &&= File.expand_path pid_file[pid_file_path_regexp,1]
38
-
39
- # If there was no third argument and pid_file is still nil, let's use the default.
40
- pid_file ||= app_dir + '/adhearsion.pid'
41
-
42
- abort "Directory is not an Adhearsion application!" unless File.exists?(app_dir + "/.ahnrc")
43
-
44
- def terminate(pid) `kill -s TERM #{pid} 2> /dev/null` end
45
- def kill(pid) `kill -s KILL #{pid} 2> /dev/null` end
46
-
47
- # Even if we're starting Adhearsion, we need to make sure to clean up after any stale
48
- # pid files. In effect, start is the same as restart.
49
- puts "Stopping Adhearsion app at #{app_dir}" if %w[stop restart].include? ARGV.first
50
-
51
- if File.exists?(pid_file)
52
- # An Adhearsion process may still be running. Let's kill the other one as cleanly as possible
53
- pid = File.read(pid_file).to_i
54
-
55
- # Time to spend waiting for Adhearsion to exit
56
- waiting_timeout = Time.now + 15
57
-
58
- terminate pid
59
- sleep 0.25 until `ps -p #{pid} | sed -e '1d'`.strip.empty? || Time.now > waiting_timeout
60
- kill pid
61
-
62
- `rm -f #{pid_file}`
63
- end
64
-
65
- if ['start', 'restart'].include? ARGV.first
66
- puts "Starting Adhearsion app at #{app_dir}"
67
- `#{ahn_command} start daemon #{app_dir} --pid-file=#{pid_file}`
68
- end
data/bin/jahn DELETED
@@ -1,43 +0,0 @@
1
- #!/usr/bin/env jruby
2
-
3
- # This "jahn" script is "ahn" for JRUBY!
4
-
5
- # Adhearsion, open source collaboration framework
6
- # Copyright (C) 2006,2007,2008 Jay Phillips
7
- #
8
- # This library is free software; you can redistribute it and/or modify it under
9
- # the terms of the GNU Lesser General Public License as published by the Free
10
- # Software Foundation; either version 2.1 of the License, or (at your option)
11
- # any later version.
12
- #
13
- # This library is distributed in the hope that it will be useful, but WITHOUT
14
- # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15
- # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
16
- # details.
17
- #
18
- # You should have received a copy of the GNU Lesser General Public License along
19
- # with this library; if not, write to the Free Software Foundation, Inc.,
20
- # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
-
22
- $:.unshift File.expand_path(File.dirname(__FILE__) + "/../lib")
23
-
24
- require 'rubygems'
25
- require 'bundler/setup'
26
- require 'adhearsion'
27
- require 'adhearsion/cli'
28
-
29
- # jahn will soon have JRuby-specific behavior such as creating a compiled .jar
30
- # file from an app.
31
- # require 'adhearsion/jruby'
32
-
33
- abort(<<-MESSAGE) unless RUBY_PLATFORM =~ /java/
34
- You must use jahn with JRuby! Are you running this script after installing Adhearsion with non-JRuby RubyGems?
35
-
36
- If you don't want to install Adhearsion with the JRuby version of RubyGems, try running jahn directly with an absolute path:
37
-
38
- #{File.expand_path(__FILE__)} start your_app_name
39
-
40
- Note: You must have the jruby executable in your $PATH and $JRUBY_HOME set.
41
- MESSAGE
42
-
43
- Adhearsion::CLI::AhnCommand.execute!
@@ -1,51 +0,0 @@
1
- # This is a file which shows you how to use the Asterisk Manager Interface library in a standalone Ruby script.
2
-
3
- PATH_TO_ADHEARSION = File.join(File.dirname(__FILE__), "/../..")
4
-
5
- MANAGER_CONNECTION_INFORMATION = {
6
- :host => "10.0.1.97",
7
- :username => "jicksta",
8
- :password => "roflcopter",
9
- :events => true
10
- }
11
-
12
- require 'rubygems'
13
- begin
14
- require 'adhearsion'
15
- rescue LoadError
16
- begin
17
- require File.join(PATH_TO_ADHEARSION, "/lib/adhearsion")
18
- rescue LoadError
19
- abort "Could not find Adhearsion! Please update the PATH_TO_ADHEARSION constant in this file"
20
- end
21
- end
22
-
23
- require 'adhearsion/voip/asterisk/manager_interface'
24
-
25
- # If you'd like to see the AMI protocol data, change this to :debug
26
- Adhearsion::Logging.logging_level = :warn
27
-
28
- # This makes addressing the ManagerInterface class a little cleaner
29
- include Adhearsion::VoIP::Asterisk::Manager
30
-
31
- # Let's instantiate a new ManagerInterface object and have it automatically connect using the Hash we defined above.
32
- interface = ManagerInterface.connect MANAGER_CONNECTION_INFORMATION
33
-
34
- # Send an AMI action with our new ManagerInterface object. This will return an Array of SIPPeer events.
35
- sip_peers = interface.send_action "SIPPeers"
36
-
37
- # Pretty-print the SIP peers on the server
38
-
39
- if sip_peers.any?
40
- sip_peers.each do |peer|
41
- # Uncomment the following line to view all the headers for each peer.
42
- # p peer.headers
43
-
44
- peer_name = peer.headers["ObjectName"]
45
- peer_status = peer.headers["Status"]
46
-
47
- puts "#{peer_name}: #{peer_status}"
48
- end
49
- else
50
- puts "This Asterisk server has no SIP peers!"
51
- end
@@ -1,302 +0,0 @@
1
- require 'fileutils'
2
- require 'adhearsion/script_ahn_loader'
3
-
4
- module Adhearsion
5
- module CLI
6
- module AhnCommand
7
- USAGE = <<USAGE
8
- Usage:
9
- ahn create /path/to/directory
10
- ahn start [console|daemon] [/path/to/directory]
11
- ahn version|-v|--v|-version|--version
12
- ahn help|-h|--h|--help|-help
13
-
14
- ahn enable component COMPONENT_NAME
15
- ahn disable component COMPONENT_NAME
16
- ahn create component COMPONENT_NAME
17
- USAGE
18
- class << self
19
-
20
- def execute!
21
- if ARGV.first == 'start' && !(ScriptAhnLoader.in_ahn_application? || ScriptAhnLoader.in_ahn_application_subdirectory?)
22
- args = parse_arguments
23
- Dir.chdir args[1] do
24
- args = args.compact.map(&:to_s)
25
- args[1], args[2] = args[2], '.'
26
- ScriptAhnLoader.exec_script_ahn! args
27
- end
28
- end
29
- CommandHandler.send(*parse_arguments)
30
- rescue CommandHandler::CLIException => error
31
- fail_and_print_usage error
32
- end
33
-
34
- ##
35
- # Provides a small abstraction of Kernel::abort().
36
- #
37
- def fail_and_print_usage(error)
38
- Kernel.abort "#{error.message}\n\n#{USAGE}"
39
- end
40
-
41
- def parse_arguments(args=ARGV.clone)
42
- action = args.shift
43
- case action
44
- when /^-?-?h(elp)?$/, nil then [:help]
45
- when /^-?-?v(ersion)?$/ then [:version]
46
- when "create"
47
- [:create, *args]
48
- when 'start'
49
- pid_file_regexp = /^--pid-file=(.+)$/
50
- if args.size > 3
51
- raise CommandHandler::CLIException, "Too many arguments supplied!" if args.size > 3
52
- else
53
- pid_file = nil
54
- pid_file = args.pop[pid_file_regexp, 1] if args.last =~ pid_file_regexp
55
- raise CommandHandler::CLIException, "Unrecognized final argument #{args.last}" unless args.size <= 2
56
- end
57
-
58
- if args.size == 2
59
- path = args.last
60
- if args.first =~ /foreground|daemon|console/
61
- mode = args.first.to_sym
62
- else
63
- raise CommandHandler::CLIException, "Invalid start mode requested: #{args.first}"
64
- end
65
- elsif args.size == 1
66
- path, mode = args.first, :foreground
67
- else
68
- raise CommandHandler::CLIException, "Invalid format for the start CLI command!"
69
- end
70
- [:start, path, mode, pid_file]
71
- when '-'
72
- [:start, Dir.pwd]
73
- when "enable", "disable"
74
- if args.size == 1
75
- raise CommandHandler::UnknownCommand, "Must supply an argument for what you wish to #{action}"
76
- elsif args.size == 2
77
- [action, *args]
78
- else
79
- raise CommandHandler::UnknownCommand, "Too many arguments supplied!"
80
- end
81
- else
82
- [action, *args]
83
- end
84
- end
85
- end
86
-
87
- module CommandHandler
88
- class << self
89
-
90
- def create(*args)
91
- if args.size.zero?
92
- raise CommandHandler::UnknownCommand.new("Must specify something to create!")
93
- elsif args.size == 1
94
- require 'adhearsion/generators'
95
- require 'adhearsion/generators/app/app_generator'
96
- Adhearsion::Generators::AppGenerator.start
97
- elsif args.size == 2
98
- # We're creating a feature (e.g. a component)
99
- feature_type, component_name = args
100
-
101
- if feature_type != "component"
102
- # At the moment, only components can be created.
103
- raise CommandHandler::UnknownCommand.new("Don't know how to create '#{feature_type}'")
104
- end
105
-
106
- if component_name !~ /^[a-z][\w_]+$/
107
- raise CommandHandler::ComponentError.new("Component name must be lowercase alphanumeric characters " +
108
- "and begin with a character")
109
- end
110
-
111
- app_path = PathString.from_application_subdirectory Dir.pwd
112
-
113
- if app_path.nil?
114
- new_component_dir = File.join Dir.pwd, component_name
115
- else
116
- puts "Adhearsion application detected. Creating new component at components/#{component_name}"
117
- new_component_dir = File.join app_path, "components", component_name
118
- end
119
-
120
- raise ComponentError.new("Component #{component_name} already exists!") if File.exists?(new_component_dir)
121
-
122
- # Everything's good. Let's create the component
123
- Dir.mkdir new_component_dir
124
-
125
- # Initial component code file
126
- Dir.mkdir File.join(new_component_dir, "lib")
127
- fn = File.join("lib", "#{component_name}.rb")
128
- puts "- #{fn}: Initial component code file"
129
- File.open(File.join(new_component_dir, fn),"w") do |file|
130
- file.puts <<-RUBY
131
- # See http://docs.adhearsion.com for more information on how to write components or
132
- # look at the examples in newly-created projects.
133
- RUBY
134
- end
135
-
136
- # Component configuration
137
- Dir.mkdir File.join(new_component_dir, "config")
138
- fn = File.join("config", "#{component_name}.yml")
139
- puts "- #{fn}: Example component configuration YAML"
140
- File.open(File.join(new_component_dir, fn),"w") do |file|
141
- file.puts '# You can use this file for component-specific configuration.'
142
- end
143
-
144
- # Component example gemspec
145
- fn = File.join("#{component_name}.gemspec")
146
- puts "- #{fn}: Example component gemspec"
147
- File.open(File.join(new_component_dir, fn), "w") do |file|
148
- file.puts <<-RUBY
149
- GEM_FILES = %w{
150
- #{component_name}.gemspec
151
- lib/#{component_name}.rb
152
- config/#{component_name}.yml
153
- }
154
-
155
- Gem::Specification.new do |s|
156
- s.name = "#{component_name}"
157
- s.version = "0.0.1"
158
-
159
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
160
- s.authors = ["Your Name Here!"]
161
-
162
- s.date = Date.today.to_s
163
- s.description = "This Adhearsion component gem has not yet been described."
164
- s.email = "noreply@example.com"
165
-
166
- s.files = GEM_FILES
167
-
168
- s.has_rdoc = false
169
- s.homepage = "http://adhearsion.com"
170
- s.require_paths = ["lib"]
171
- s.rubygems_version = "1.2.0"
172
- s.summary = "This Adhearsion component gem has no summary."
173
-
174
- s.specification_version = 2
175
- end
176
- RUBY
177
- end
178
-
179
- # Component example spec
180
- Dir.mkdir File.join(new_component_dir, "spec")
181
- fn = File.join("spec", "#{component_name}_spec.rb")
182
- puts "- #{fn}: Example component spec"
183
- File.open(File.join(new_component_dir, fn), "w") do |file|
184
- file.puts <<-RUBY
185
- require 'rubygems'
186
- require 'bundler'
187
- Bundler.setup
188
- Bundler.require
189
-
190
- require 'adhearsion/component_manager/spec_framework'
191
-
192
- component_name.upcase = ComponentTester.new("#{component_name}", File.dirname(__FILE__) + "/../..")
193
- RUBY
194
- end
195
- puts "Created blank component '#{component_name}' at #{new_component_dir}"
196
- else
197
- raise CommandHandler::UnknownCommand.new("Provided too many arguments to 'create'")
198
- end
199
- end
200
-
201
- def start(path, mode=:foreground, pid_file=nil)
202
- raise PathInvalid, path unless File.exists? path + "/.ahnrc"
203
- Adhearsion::Initializer.start path, :mode => mode, :pid_file => pid_file
204
- end
205
-
206
- def version
207
- puts "Adhearsion v#{Adhearsion::VERSION::STRING}"
208
- end
209
-
210
- def help
211
- puts USAGE
212
- end
213
-
214
- def enable(type, name)
215
- case type
216
- when "component"
217
- app_path = PathString.from_application_subdirectory Dir.pwd
218
- if app_path
219
- disabled_component_path = File.join app_path, "components", "disabled", name
220
- disabled_components_path = File.join app_path, "components", "disabled"
221
- enabled_component_path = File.join app_path, "components", name
222
- if File.directory? disabled_component_path
223
- FileUtils.mv disabled_component_path, enabled_component_path
224
- puts "Enabled component #{name}"
225
- elsif File.directory? enabled_component_path
226
- raise ComponentError.new("This component is already enabled.")
227
- elsif !File.directory? disabled_components_path
228
- raise ComponentError.new("There is no components/disabled directory!")
229
- else
230
- raise ComponentError.new("The requested component was not found.")
231
- end
232
- else
233
- raise PathInvalid.new(Dir.pwd)
234
- end
235
- else
236
- raise UnknownCommand.new("enable #{type}")
237
- end
238
- end
239
-
240
- def disable(type, name)
241
- case type
242
- when "component"
243
- app_path = PathString.from_application_subdirectory Dir.pwd
244
- if app_path
245
- disabled_dir = File.join app_path, "components", "disabled"
246
-
247
- disabled_component_path = File.join disabled_dir, name
248
- enabled_component_path = File.join app_path, "components", name
249
-
250
- Dir.mkdir disabled_dir unless File.directory?(disabled_dir)
251
-
252
- if File.directory? enabled_component_path
253
- if File.directory?(disabled_component_path)
254
- raise ComponentError.new("There is already a disabled component at #{disabled_component_path}")
255
- else
256
- FileUtils.mv enabled_component_path, disabled_component_path
257
- puts "Disabled component #{name}"
258
- end
259
- else
260
- raise ComponentError.new("Could not find component #{name} at #{enabled_component_path} !")
261
- end
262
- else
263
- raise PathInvalid.new(Dir.pwd)
264
- end
265
- else
266
- raise UnknownCommand.new("disable #{type}")
267
- end
268
- end
269
-
270
- def method_missing(action, *args)
271
- raise UnknownCommand, [action, *args] * " "
272
- end
273
-
274
- private
275
-
276
- end
277
-
278
- class CLIException < StandardError; end
279
-
280
- class UnknownCommand < CLIException
281
- def initialize(cmd)
282
- super "Unknown command: #{cmd}"
283
- end
284
- end
285
-
286
- class ComponentError < CLIException; end
287
-
288
- class UnknownProject < CLIException
289
- def initialize(project)
290
- super "Application #{project} does not exist! Have you installed it?"
291
- end
292
- end
293
-
294
- class PathInvalid < CLIException
295
- def initialize(path)
296
- super "Directory #{path} does not belong to an Adhearsion project!"
297
- end
298
- end
299
- end
300
- end
301
- end
302
- end