Permalink
Browse files

Adding events.rb back to newly created applications with some sample …

…documentation.
  • Loading branch information...
1 parent 238f8c6 commit 031a60625a65a1d960e3cb5f49b60827df1bdc58 Jay Phillips committed Oct 16, 2008
@@ -31,6 +31,7 @@ def manifest
m.file *["config/startup.rb"]*2
m.file *["dialplan.rb"]*2
+ m.file *["events.rb"]*2
m.file *["README"]*2
m.file *["Rakefile"]*2
@@ -0,0 +1,21 @@
+##
+# In this file you can define callbacks for different aspects of the framework. Below is an example:
+##
+#
+# events.asterisk.before_call.each do |call|
+# extension = call.variables[:extension]
+# ahn_log "Got a new call with extension #{extension}"
+# end
+#
+##
+# Here is a list of the events included by default:
+#
+# - events.after_initialized
+# - events.shutdown
+# - events.asterisk.before_call
+# - events.asterisk.failed_call
+# - events.asterisk.call_hangup
+#
+#
+# Note: events are mostly for components to register and expose to you.
+##
@@ -26,15 +26,15 @@ def serve(io)
call.hangup!
rescue FailedExtensionCallException => failed_call
begin
- ahn_log.agi "Received \"failed\" meta-call with :failed_reason => #{failed_call.call.failed_reason.inspect}. Executing OnFailedCall hooks."
+ ahn_log.agi "Received \"failed\" meta-call with :failed_reason => #{failed_call.call.failed_reason.inspect}. Executing Executing /asterisk/failed_call event callbacks."
Events.trigger [:asterisk, :failed_call], failed_call.call
call.hangup!
rescue => e
ahn_log.agi.error e
end
rescue HungupExtensionCallException => hungup_call
begin
- ahn_log.agi "Received \"h\" meta-call. Executing OnHungupCall hooks."
+ ahn_log.agi "Received \"h\" meta-call. Executing /asterisk/call_hangup event callbacks."
Events.trigger [:asterisk, :call_hangup], hungup_call.call
call.hangup!
rescue => e

0 comments on commit 031a606

Please sign in to comment.