adhearsion 1.2.6 → 2.0.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
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/.gitignore CHANGED
@@ -1,16 +1,23 @@
1
- .DS_Store
1
+ # Gem related stuff
2
+ *.gem
2
3
  pkg
4
+ .bundle
5
+ Gemfile.lock
6
+ vendor
7
+
8
+ # Testing stuff
9
+ coverage
10
+ spec/reports
11
+ example.log
12
+
13
+ # RBX stuff
3
14
  *~
4
15
  .*.sw?
5
- .yardoc
6
16
  nbproject
7
- vendor
8
- Gemfile.lock
9
- .bundle
17
+ /.rbx/
18
+
19
+ # General
20
+ .DS_Store
10
21
  .rvmrc
11
- coverage
12
- spec/reports
22
+ .yardoc
13
23
  doc
14
- /.rbx/
15
- tmp/
16
- *.log
@@ -0,0 +1,273 @@
1
+ # develop (2.0.0.head)
2
+
3
+ # 2.0.0.alpha1 - 2012-01-17
4
+
5
+ ## Major architectural changes
6
+ * Adhearsion is no longer a framework for creating Asterisk applications, and it does not know anything about the specifics of Asterisk. Adhearsion now makes use of the Punchblock library which abstracts features from common telephony engines. Supported engines are now:
7
+ * Asterisk 1.8+
8
+ * Voxeo Prism 11 w/ rayo-server
9
+ * Adhearsion now makes use of libraries for advanced concurrency primitives such as Actors, meaning Adhearsion is no longer compatible with Ruby 1.8. Officially supported Ruby platforms are:
10
+ * Ruby 1.9.2+ (YARV)
11
+ * JRuby 1.6.5+ (in 1.9 mode)
12
+ * Rubinius 2.0 (on release, in 1.9 mode)
13
+ * The old components architecture has been deprecated in favour of `Adhearsion::Plugin` (further details below).
14
+ * Theatre has been replaced in favour of a girl_friday and has-guarded-handlers based event queueing/handling system (further details below).
15
+ * The dialplan.rb file has been removed and is replaced by the routing DSL.
16
+
17
+ ## Plugin system
18
+ * Plugin system is the way to extend Adhearsion framework and provides the easiest path to add new functionality, configuration or modify the initialization process.
19
+ * Created Plugin infrastructure. Adhearsion::Plugin class allows to create dialplan, rpc, event and console methods, add initializers
20
+ and create or update any configuration
21
+ * Moved deprecated Adhearsion::Components behaviour to the dedicated gem adhearsion-components
22
+ * Moved ami_remote component to adhearsion-asterisk plugin
23
+ * Moved Rails integration to adhearsion-rails plugin as it is not an Adhearsion core feature
24
+ * Moved Active Record integration to adhearsion-rails plugin
25
+ * Moved XMPP integration to adhearsion-xmpp plugin
26
+ * Moved DRb integration to adhearsion-drb plugin
27
+ * Moved LDAP integration to adhearsion-ldap plugin
28
+ * Translate STOMP gateway component to a plugin and remove the component generators entirely
29
+ * Translate simon_game component to plugin
30
+
31
+ ## Configuration
32
+ * New configuration mechanism based on Loquacious that allows to configure both Adhearsion platform and plugins
33
+ * Added rake tasks to check the config options (rake adhearsion:config:desc) and config values (rake adhearsion:config:values)
34
+ * `automatically_answer_incoming_calls` has been replaced with `automatically_accept_incoming_calls`, which when set to `true` (as is the default), will automatically indicate call progress to the 3rd party, causing ringing. `answer` must now be used explicitly in the dialplan.
35
+ * Adhearsion now has environments. By default these are development, production, staging, test, and the set can be extended. The environment in use is dictated by the value of the AHN_ENV environment variable. Config may be set per environment.
36
+
37
+ ## Dialplan changes
38
+ * The dialplan no longer responds to methods for retrieval of call variables. This is because variables are aggregated from several sources, including SIP headers, which could result in collisions with methods that are required in the dialplan/controllers.
39
+
40
+ ### Media output
41
+ * Output functions reworked to to take advantage of Punchblock features, though method signatures have been kept similar.
42
+ * Output now allows for usage of String, Numeric, Time/Date, files on disk, files served via HTTP, and direct SSML. All non-file types are played via TTS.
43
+ * Output types are automatically detected and played accordingly
44
+
45
+ ### Input (DTMF and ASR)
46
+ * The same output types and recognition are now used in the input prompts too
47
+ * Input currently is DTMF-only using the `#input`, `#wait_for_digit` and `#stream_file` methods compatibly with preceding versions
48
+
49
+ ### Menu system
50
+ * #menu method and related code completely rewritten to take advantage of the new controller functionality and streamline the DSL.
51
+ * The #menu block now uses #match instead of #link, and allows for blocks as match actions
52
+ * #menu now resumes execution inside the current controller after completion
53
+
54
+ ### Recording
55
+ * TODO
56
+
57
+ ### Conferencing
58
+ * TODO
59
+
60
+ ### Bridging
61
+ * TODO
62
+
63
+ ### Call routing & controllers
64
+ * To be platform agnostic, inbound calls are no longer routed by Asterisk context. There is now an inbound call routing DSL defined in config/adhearsion.rb which routes calls based on their parameters to either a controller class or specifies a dialplan in a block.
65
+ * Call controllers (classes which inherit from Adhearsion::CallController) are the mechanism by which complex applications should be written. A controller is instantiated per call, and must respond to #run. Controllers have many "dialplan" methods, the same as dialplan.rb did.
66
+ * dialplan.rb is removed and no longer used. These should be moved to the router.
67
+
68
+ ## Eventing system
69
+ * Removed Theatre
70
+ * Event namespaces no longer need to be registered, and events with any name may be triggered and handled.
71
+ * The DSL has been simplified. For example, AMI events may now be handled like:
72
+
73
+ ```ruby
74
+ asterisk_manager_interface do |event|
75
+ ...
76
+ end
77
+
78
+ asterisk_manager_interface :name => /NewChannel/ do |event|
79
+ ...
80
+ end
81
+ ```
82
+
83
+ ## Logging
84
+ * Switched logging mechanism from log4r to logging
85
+ * Any logging config value can be updated via the centralized configuration object
86
+ * 6 logging levels are supported by default: TRACE < DEBUG < INFO < WARN < ERROR < FATAL
87
+ * The default logging pattern outputs the class name in any log message, using a colorized pattern in STDOUT to improve readability
88
+ * Any log message from an Adhearsion::Call object outputs the call unique id to distinguish messages from any call
89
+ * Log file location is configurable
90
+
91
+ ## Removal of non-core-critical functionality
92
+ * Removed all asterisk specific functionality
93
+ FIXME: What functionality?
94
+ * ConfirmationManager
95
+ * Asterisk AGI/AMI connection/protocol related code
96
+ * Asterisk `h` extension handling
97
+ * Removed LDAP, XMPP, Rails, ActiveRecord and DRb functionality and replaced them with plugins.
98
+ * Extracted some generic code to dependencies:
99
+ * future-resource
100
+
101
+ ## Miscellaneous
102
+ * Removed a lot of unused or unecessary code, including:
103
+ * Outbound call routing DSL
104
+ * FreeSWITCH support. This will be added to Punchblock at a later date.
105
+ * Replaced the rubigen generators with Thor
106
+ * New CLI command structure. Run `ahn` for details.
107
+ * Advanced shutdown routine:
108
+ * On first :shutdown, we flag the state internally. The intent is to shut down when the active calls count reaches 0, but otherwise operate normally.
109
+
110
+ * On second :shutdown, we start rejecting new incoming calls. Existing calls will continue to process until completion. Shut down when active call count reaches 0.
111
+
112
+ * On third :shutdown, send a Hangup to all active calls. Shut down when active call count reaches 0.
113
+
114
+ * In addition, the process can be force-stopped, which simply closes the connection to the server (and any component connections as well).
115
+ * Defined some project management guidelines for Adhearsion core (see http://adhearsion.com/contribute).
116
+ * TODO: Defined an Adhearsion code style guide and implemented it across the codebase (see http://adhearsion.com/style-guide).
117
+ * TODO: Transferred copyright in the Adhearsion codebase from individual contributors to Adhearsion Foundation Inc, the non-profit organisation responsible for supporting the Adhearsion project.
118
+ * TODO: Dual-licensed as LGPL and MIT.
119
+
120
+ # 1.2.1 - 2011-09-21
121
+ * Removed the restful_rpc component since it is now in a gem.
122
+ * Allow overriding the path to a component in the testing framework so as to support new style components (lib/)
123
+ * Added a GUID to the default recording filename to ensure uniqueness
124
+ * `ECONNRESET` exceptions are now handled as a call hangup
125
+ * Fixed escaping of TTS strings containing commas when used with Cepstral via `#speak`
126
+ * Made logging exceptions the responsibility of the framework rather than the app, so that this may not be disabled
127
+
128
+ # 1.2.0 - 2011-08-14
129
+ * New method: `#play_or_speak1 allows playback of an audio file with TTS fallback
130
+ * `#input` now takes `:speak` as a hash for TTS prompt or fallback
131
+ * New method: `#speak` provides abstracted TTS rendering for UniMRCP and Cepstral
132
+ * Allow leading "+" in Caller ID (E.164 format)
133
+ * Allow using `--pid-file` without "daemon" for JRuby
134
+ * Allow passing a block to #input to enable caller to detect when enough digits are collected.
135
+ * Fix some issues with starting apps outside of their directory, generally related to Bundler/gem environments
136
+ * Allow configuration of logging outputters/formatters
137
+ * Using `ahn_log` in a dialplan context or on a call object logs to the call's context, named after its unique identifier
138
+ * New method: `#record_to_file` with more useful return values
139
+
140
+ # 1.1.1 - 2011-06-13
141
+ * `Command#play` now returns `false` if audio failed to play
142
+ * Added new commands (`#play!`, `#interruptible_play!`, `#input!`) which raise PlaybackError if audio fails to play
143
+
144
+ # 1.1.0 - 2011-05-29
145
+ * Added interactive call control console: ahn start console <path>
146
+ * Added centralized exception handler through eventing system
147
+ * Support for using ahn_hoptoad to send Adhearsion exceptions to Hoptoad
148
+ * `Adhearsion.active_calls` can now use hash syntax to find calls by ID
149
+ * Added `Adhearsion::Calls#to_h`
150
+ * Add a Monitor to synchronize access to an AGI connection
151
+
152
+ # 1.0.3 - 2011-05-05
153
+ * Fix the `play()` command regression when passing an array of strings. This was breaking the SimonGame
154
+ * Deprecate `ManagerInterface#send_action_asynchronously`
155
+
156
+ # 1.0.2 - 2011-04-09
157
+ * Fix rcov Rake task
158
+ * Add Ben Langfeld as an author (Thanks, Ben!)
159
+ * Add "rake" as a runtime dependency
160
+ * Remove usage of BEGIN blocks (for Rubinius; CS)
161
+
162
+ # 1.0.1 - 2010-02-22
163
+ NOTE for Ruby 1.9 users: The behavior of Ruby 1.9 and case statements has changed
164
+ in a way that renders NumericalString objects incompatible with
165
+ case statements. The suggested workaround is to cast the NumericalString
166
+ to a string and then compare. Example:
167
+
168
+ ```ruby
169
+ obj = NumericalString.new("0987")
170
+ case obj.to_s
171
+ when "0987" then true
172
+ else false
173
+ end
174
+
175
+ # Or, if you need to ignore the leading zero:
176
+ case obj.to_i
177
+ when 987 then true
178
+ else false
179
+ end
180
+ ```
181
+
182
+ See https://adhearsion.lighthouseapp.com/projects/5871/tickets/127-ruby-19-and-numericalstring-comparisons-in-case-statements
183
+
184
+ * Add `say_chars` command.
185
+ * Add `say_phonetic` command.
186
+ * 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.)
187
+ * Update `play_time` to allow using Date objects.
188
+ * `QueueAgentsListProxy#new` now returns an `AgentProxy` instance if the agent was added successfully.
189
+ * 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.)
190
+ * Fixed issue with `Queue#join!` that would raise a `QueueDoesNotExist` error if the call was completed successfully.
191
+ * Add support for AGI script parameter to `Queue#join!`
192
+ * Migrate unit tests to RSpec 2
193
+ * New components now include RubyGems skeleton files
194
+ * Fix support for setting Caller ID name on AGI `dial()` command
195
+ * Generate new apps with Bundler support, including auto-requiring of all gems
196
+ * Update component testing framework to RSpec 2.x and mock with rspec
197
+
198
+ # 1.0.0 - 2010-10-28
199
+ * Fall back to using Asterisk's context if the AGI URI context is not found
200
+ * Enable configuration of `:auto_reconnect` parameter for AMI
201
+ * Replace all uses of `Object#returning` with `Object#tap`
202
+ * Add support for loading Adhearsion components from RubyGems
203
+ * Fix long-running AMI session parser failure bug (#72)
204
+ * Support for Rails 3 (and ActiveSupport 3.0)
205
+
206
+ # 0.8.6 - 2010-09-03
207
+ * Fix packaging problem so all files are publicly readable
208
+ * Improve AMI reconnecting logic; add "connection refused" retry timer
209
+ * AGI protocol improvements: parse the status code and response text
210
+
211
+ # 0.8.5 - 2010-08-24
212
+ NOTE: If you are upgrading an Adhearsion application to 0.8.5, note the change
213
+ to how request URIs are handled. With 0.8.4, the context name in Asterisk was
214
+ required to match the Adhearsion context in dialplan.rb. Starting in 0.8.5 if
215
+ an application path is passed in on the AGI URI, it will be preferred over the
216
+ context name. For example:
217
+
218
+ ```
219
+ [stuff]
220
+ exten => _X.,1,AGI(agi://localhost/myapp)
221
+ ```
222
+
223
+ AHN 0.8.4- will execute the "stuff" context in dialplan.rb
224
+ AHN 0.8.5+ will execute the "myapp" context in dialplan.rb
225
+
226
+ If you followed the documentation and did not specify an application path in
227
+ the URI (eg. `agi://localhost`) you will not be impacted by this change.
228
+
229
+ Other changes:
230
+ * Added XMPP module and sample component. This allows you to easily write components which utilise a persistent XMPP connection maintained by Adhearsion
231
+ * Prefer finding the dialplan.rb entry point by the AGI request URI instead of the calling context
232
+ * Added `:use_static_conf` option for "meetme" to allow the use of disk-file-managed conferences
233
+ * Logging object now shared with ActiveRecord and Blather
234
+ * Fixed a longstanding bug where newlines were not sent after each AGI command
235
+ * Fixed parsing of DBGet AMI command/response
236
+ * Better shutdown handling/cleanup
237
+ * Attempt to allow the AMI socket to reconnect if connection is lost
238
+ * Improved support for Ruby 1.9
239
+ * Numerous smaller bugs fixed. See: https://adhearsion.lighthouseapp.com/projects/5871-adhearsion/milestones/76510-085
240
+
241
+ # 0.8.4 - 2010-06-24
242
+ * 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).
243
+ * Fixed using ActiveRecord in Adhearsion components
244
+ * Daemonizing no longer truncates the Adhearsion log file
245
+ * Add support for using ActiveLdap
246
+ * Misc improvements to support Asterisk 1.6 changes
247
+ * Escape commands sent to Asterisk via AGI
248
+ * Manager Events now work when daemonized
249
+
250
+ # 0.8.3 -
251
+ * The `uniqueid` call channel variable available in dialplan.rb is now *always* a String
252
+ * Renamed `interruptable_play` to `interruptible_play` and made `interruptible_play` public instead of protected.
253
+ * Fixed an Asterisk Manager Interface parsing issue in which colons sometimes got stuck into the key name.
254
+ * AGI "request" variable coercer will not blow up if no request is given. (Helps in testing with netcat/telnet)
255
+
256
+ # 0.8.2 -
257
+ * 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.
258
+ * `ManagerInterfaceResponse` now include()s DRbUndumped, allowing `send_action()` to be called directly over DRb.
259
+ * Fixes an inconsequential bug when CTL-C'ing Adhearsion.
260
+
261
+ # 0.8.1 - 2009-01-29
262
+ * The sandbox component now comes
263
+ * Minor bug fixes
264
+
265
+ # 0.8.0 rev 2
266
+ * Added a few non-critical files to the `.gemspec`. They were ignored
267
+
268
+ # Notes from before 0.8.0:
269
+ * (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)
270
+ * Adding a deprecation warning about `Fixnum#digit` and `Fixnum#digits`
271
+ * Removed the AMI class and replaced it with the ManagerInterface class.
272
+ * 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.
273
+ * Moved Theatre into Adhearsion's lib folder.
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source "http://rubygems.org"
1
+ source :rubygems
2
2
 
3
3
  gemspec
@@ -0,0 +1,17 @@
1
+ ENV['SKIP_RCOV'] = 'true'
2
+
3
+ group 'rspec' do
4
+ guard 'rspec', :version => 2, :cli => '--format documentation' do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
7
+ watch('spec/spec_helper.rb') { "spec/" }
8
+ end
9
+ end
10
+
11
+ group 'cucumber' do
12
+ guard 'cucumber', :cli => '--profile guard' do
13
+ watch(%r{^features/.+\.feature$})
14
+ watch(%r{^features/support/.+$}) { 'features' }
15
+ watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
16
+ end
17
+ end
@@ -1,24 +1,76 @@
1
1
  Adhearsion
2
- ==========
2
+ ===========
3
3
 
4
4
  Adhearsion is an open-source voice application development framework. Adhearsion users write applications atop the framework with Ruby and **call into their code**.
5
5
 
6
- Adhearsion rests above a lower-level telephony platform, namely [Asterisk](http://asterisk.org), and provides a framework for integrating with various resources, such as SQL, LDAP and XMPP (Jabber).
6
+ Adhearsion rests above a lower-level telephony platform, for example [Asterisk](http://asterisk.org) or [Voxeo PRISM](http://voxeolabs.com/prism/), and provides a framework for integrating with various resources, such as SQL, LDAP and XMPP (Jabber).
7
7
 
8
- Adhearsion has...
8
+ Features
9
+ --------
9
10
 
10
- * An elegant dialplan system for writing the code which controls a live phone call
11
- * A sophisticated Asterisk Manager Interface library with a lexer written in [Ragel](http://www.complang.org/ragel).
12
- * An events subsystem which maintains a Thread-pool for executing your namespaced callbacks. (supports AMI events too!)
13
- * A very useful component architecture with which you may write Adhearsion plugins and share them with the world via RubyGems.
11
+ * An elegant system of call controllers for writing the code which controls a live phone call.
12
+ * An events subsystem which maintains a Thread-pool for executing your namespaced callbacks.
13
+ * A very useful plugin architecture with which you may write Adhearsion plugins and share them with the world via RubyGems.
14
14
  * JRuby compatibility for running atop the Java Virtual Machine and using virtually any Java library.
15
15
  * Ability to re-use existing Ruby on Rails database models with ActiveRecord/ActiveLDAP
16
16
  * Easy interactive communication via XMPP instant messages using the Blather library
17
- * Good regression test coverage
17
+ * Strong test coverage
18
+ * Much more
19
+
20
+ Requirements
21
+ ------------
22
+
23
+ * Ruby 1.9.2+ or JRuby 1.6.5+
24
+ * A VoIP platform:
25
+ * Asterisk 1.8+
26
+ * Prism 11+ with rayo-server
27
+ * An interest in building cool new things
28
+
29
+ Install
30
+ -------
31
+
32
+ `gem install adhearsion`
33
+
34
+ Examples
35
+ --------
36
+
37
+ An Adhearsion application can be as simple as this:
38
+
39
+ ```ruby
40
+ answer
41
+ speak 'Hello, and thank you for your call. We will put you through to the front desk now...'
42
+ dial 'tel:+18005550199'
43
+ hangup
44
+ ```
45
+
46
+ For more examples, check out [the website](http://adhearsion.com/examples).
18
47
 
19
48
  Documentation
20
49
  =============
21
50
 
22
- Visit [Adhearsion's website](http://adhearsion.com) for code examples and more information about the project. Also checkout the [Adhearsion wiki on Github](http://github.com/adhearsion/adhearsion/wiki) for community documentation.
51
+ Visit [Adhearsion's website](http://adhearsion.com) for code examples and more information about the project. Also checkout the [Adhearsion wiki on Github](http://github.com/adhearsion/adhearsion/wiki) for community documentation.
23
52
 
24
53
  If you're having trouble, you may want to try asking your question on the IRC channel (#adhearsion on irc.freenode.net), [mailing list](http://groups.google.com/group/adhearsion) or, if you've found a bug, report it on the [bug tracker](https://github.com/adhearsion/adhearsion/issues).
54
+
55
+ Author
56
+ ------
57
+
58
+ Original author: [Jay Phillips](https://github.com/jicksta)
59
+
60
+ Core team:
61
+
62
+ * [Ben Klang](https://github.com/bklang)
63
+ * [Ben Langfeld](https://github.com/benlangfeld)
64
+ * [Jason Goecke](https://github.com/jsgoecke)
65
+
66
+ Contributors: https://github.com/adhearsion/adhearsion/contributors
67
+
68
+ Contributions
69
+ -----------------------------
70
+
71
+ Adhearsion has a set of [contribution guidelines](https://github.com/adhearsion/adhearsion/wiki/Contributing) which help to smooth the contribution process.
72
+
73
+ Copyright
74
+ ---------
75
+
76
+ Copyright (c) 2011 Individual contributors. GNU LESSER GENERAL PUBLIC LICENSE (see LICENSE for details).
data/Rakefile CHANGED
@@ -4,17 +4,27 @@ ENV['RUBY_FLAGS'] = "-I#{%w(lib ext bin spec).join(File::PATH_SEPARATOR)}"
4
4
  require 'rubygems'
5
5
  require 'bundler/gem_tasks'
6
6
  require 'bundler/setup'
7
- require 'date'
8
- require 'adhearsion/version'
9
7
 
10
- task :default => :spec
8
+ task :default => [:spec, :features]
11
9
  task :gem => :build
12
10
 
13
11
  require 'rspec/core/rake_task'
14
12
  RSpec::Core::RakeTask.new
15
13
 
16
14
  require 'ci/reporter/rake/rspec'
17
- task :ci => ['ci:setup:rspec', :spec]
15
+ require 'ci/reporter/rake/cucumber'
16
+ task :ci => ['ci:setup:rspec', :spec, 'ci:setup:rspec', :features]
17
+
18
+ require 'cucumber'
19
+ require 'cucumber/rake/task'
20
+ require 'ci/reporter/rake/cucumber'
21
+ Cucumber::Rake::Task.new(:features) do |t|
22
+ t.cucumber_opts = %w{--tags ~@jruby} unless defined?(JRUBY_VERSION)
23
+ end
24
+
25
+ Cucumber::Rake::Task.new(:wip) do |t|
26
+ t.cucumber_opts = %w{-p wip -q}
27
+ end
18
28
 
19
29
  begin
20
30
  require 'yard'
@@ -25,48 +35,6 @@ rescue LoadError
25
35
  STDERR.puts "\nCould not require() YARD! Install with 'gem install yard' to get the 'yardoc' task\n\n"
26
36
  end
27
37
 
28
- desc "Check Ragel version"
29
- task :check_ragel_version do
30
- ragel_version_match = `ragel --version`.match /(\d)\.(\d)+/
31
- abort "Could not get Ragel version! Is it installed? You must have at least version 6.3" unless ragel_version_match
32
- big, small = ragel_version_match.captures.map &:to_i
33
- if big < 6 || (big == 6 && small < 3)
34
- abort "Please upgrade Ragel! You're on version #{ragel_version_match[0]} and must be on 6.3 or later"
35
- end
36
- if (big == 6 && small < 7)
37
- puts "WARNING: A change to Ruby since 1.9 affects the Ragel generated code."
38
- puts "WARNING: You MUST be using Ragel version 6.7 or have patched it using"
39
- puts "WARNING: the patch found at:"
40
- puts "WARNING: http://www.mail-archive.com/ragel-users@complang.org/msg00440.html"
41
- end
42
- end
43
-
44
- RAGEL_FILES = %w[lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb]
45
-
46
- desc "Used to regenerate the AMI source code files. Note: requires Ragel 6.3 or later be installed on your system"
47
- task :ragel => :check_ragel_version do
48
- RAGEL_FILES.each do |ragel_file|
49
- ruby_file = ragel_file.sub ".rl.rb", ".rb"
50
- puts `ragel -n -R #{ragel_file} -o #{ruby_file} 2>&1`
51
- raise "Failed generating code from Ragel file #{ragel_file}" if $?.to_i.nonzero?
52
- end
53
- end
54
-
55
- desc "Generates a GraphVis document showing the Ragel state machine"
56
- task :visualize_ragel => :check_ragel_version do
57
- RAGEL_FILES.each do |ragel_file|
58
- base_name = File.basename ragel_file, ".rl.rb"
59
- puts "ragel -V #{ragel_file} -o #{base_name}.dot 2>&1"
60
- puts `ragel -V #{ragel_file} -o #{base_name}.dot 2>&1`
61
- raise "Failed generating code from Ragel file #{ragel_file}" if $?.to_i.nonzero?
62
- end
63
- end
64
-
65
- desc "Test that the .gemspec file executes"
66
- task :debug_gem do
67
- require 'rubygems/specification'
68
- gemspec = File.read 'adhearsion.gemspec'
69
- spec = nil
70
- Thread.new { spec = eval("$SAFE = 3\n#{gemspec}") }.join
71
- puts "SUCCESS: Gemspec runs at the $SAFE level 3."
38
+ task :stats do
39
+ system 'doc/cloc-1.55.pl . --exclude-dir=.git,vendor,coverage,doc'
72
40
  end