From ef0d2a79fb02a01fba57b0fc2c4c2c1e52818fed Mon Sep 17 00:00:00 2001 From: rene Date: Sat, 15 Oct 2011 20:32:37 -0500 Subject: [PATCH 1/2] added basic support monitoring specific queues --- .gitignore | 2 +- app.rb | 7 ++++- config/startup.rb | 4 +-- events.rb | 7 +++++ log/adhearsion.log | 11 -------- views/queue.erb | 70 ++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 86 insertions(+), 15 deletions(-) delete mode 100644 log/adhearsion.log create mode 100644 views/queue.erb diff --git a/.gitignore b/.gitignore index 58b9b3d..8b09770 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -log +log/* .bundle diff --git a/app.rb b/app.rb index 1c11dbd..257c6a6 100644 --- a/app.rb +++ b/app.rb @@ -5,4 +5,9 @@ get '/' do erb :index -end \ No newline at end of file +end + +get '/queue/:id' do + @queue_name = params[:id] + erb :queue +end diff --git a/config/startup.rb b/config/startup.rb index 22512a0..c998634 100644 --- a/config/startup.rb +++ b/config/startup.rb @@ -31,8 +31,8 @@ # The delimiter can also be specified in Asterisk's asterisk.conf. # This setting applies only to AGI. The AMI delimiter is auto-detected. # NB: The AMI user should have write access in order to execute actions, and AMI connections will fail otherwise. - config.enable_asterisk :argument_delimiter => ',', :listening_port => 4574 - config.asterisk.enable_ami :host => "127.0.0.1", :username => "ahn_ami", :password => "password", :events => true + config.enable_asterisk :argument_delimiter => ','#, :listening_port => 4574 + config.asterisk.enable_ami :host => "192.168.0.4", :username => "revisador", :password => "ruby", :events => true # Adhearsion supports two possible speech engines with Asterisk: UniMRCP and Cepstral. # Uncomment one of the below if you have it available. diff --git a/events.rb b/events.rb index 61f554b..f759c7b 100644 --- a/events.rb +++ b/events.rb @@ -1,12 +1,19 @@ require 'bayeux' events.asterisk.manager_interface.each do |event| + ahn_log.events "#{event.name} - - #{event.inspect}" case event.name when 'Join' Bayeux.publish('/caller/join', { :id => event.headers['Channel'], :number => event.headers['CallerIDNum'], :joinedAt => Time.now.to_i }) + + Bayeux.publish("/#{event.headers['Queue']}/join", { :id => event.headers['Channel'], + :number => event.headers['CallerIDNum'], + :joinedAt => Time.now.to_i }) when 'Leave' Bayeux.publish('/caller/leave', { :id => event.headers['Channel'] }) + + Bayeux.publish("/#{event.headers['Queue']}/leave", { :id => event.headers['Channel'] }) end end diff --git a/log/adhearsion.log b/log/adhearsion.log deleted file mode 100644 index 9c03ab5..0000000 --- a/log/adhearsion.log +++ /dev/null @@ -1,11 +0,0 @@ - INFO ahn: Adhearsion v1.2.1 initialized! - INFO agi: Adhearsion::VoIP::Asterisk::AGI::Server::RubyServer 0.0.0.0:4573 start - INFO ahn: Shutting down gracefully at 2011-10-07 22:54:42 -0400. - INFO ahn: Shutting down with 0 active calls - INFO events: Performing a graceful stop of events subsystem - INFO ahn: Adhearsion v1.2.1 initialized! - WARN ami: ACTIONS thread connection refused! Retrying in 5 seconds... - WARN ami: ACTIONS thread connection refused! Retrying in 5 seconds... - INFO ahn: Shutting down gracefully at 2011-10-09 12:45:16 -0400. - INFO ahn: Shutting down with 0 active calls - INFO events: Performing a graceful stop of events subsystem diff --git a/views/queue.erb b/views/queue.erb new file mode 100644 index 0000000..3a1c991 --- /dev/null +++ b/views/queue.erb @@ -0,0 +1,70 @@ + + + MiniQ: <%=@queue_name%> + + + + + + + + + + + +
+

Mini Q :: <%=@queue_name%> Call 1-855-TRO-LOLO

+
+ + + On hold for seconds + +
+ +
+ + From 1aca03ed7f1752921a9f7bbb70a5236a0c727d39 Mon Sep 17 00:00:00 2001 From: rene Date: Sat, 15 Oct 2011 20:42:41 -0500 Subject: [PATCH 2/2] reverted to original asterisk AMI settings --- config/startup.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/startup.rb b/config/startup.rb index c998634..22512a0 100644 --- a/config/startup.rb +++ b/config/startup.rb @@ -31,8 +31,8 @@ # The delimiter can also be specified in Asterisk's asterisk.conf. # This setting applies only to AGI. The AMI delimiter is auto-detected. # NB: The AMI user should have write access in order to execute actions, and AMI connections will fail otherwise. - config.enable_asterisk :argument_delimiter => ','#, :listening_port => 4574 - config.asterisk.enable_ami :host => "192.168.0.4", :username => "revisador", :password => "ruby", :events => true + config.enable_asterisk :argument_delimiter => ',', :listening_port => 4574 + config.asterisk.enable_ami :host => "127.0.0.1", :username => "ahn_ami", :password => "password", :events => true # Adhearsion supports two possible speech engines with Asterisk: UniMRCP and Cepstral. # Uncomment one of the below if you have it available.