echi-converter 0.4.2 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ spec/reports
6
+ .yardoc
7
+ doc
@@ -226,4 +226,9 @@
226
226
  * Minor enhancement(s):
227
227
  * Added an option 'echi_use_utc' in application.yml to record all data times in UTC for binary files, true by default
228
228
  * Bug fix(es):
229
- * Known issue(s):
229
+ * Known issue(s):
230
+
231
+ == 0.4.4 2012-01-10
232
+
233
+ * Added Version 16 file format support
234
+ * Fixed requiring logger for newer versions of Ruby
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in ruby_speech.gemspec
4
+ gemspec
File without changes
@@ -0,0 +1,184 @@
1
+ The ECHI (External Call History Interface) Converter
2
+ -------------
3
+
4
+ Provides a Ruby based utility for fetching Avaya CMS / ECHI files in binary/ASCII form from an FTP server, converting them, if necessary, to ASCII and then inserting them into a database via ActiveRecord. With this utility you only need the standard Avaya CMS Release 13 or better without any additional software or utilities from Avaya, as this utility will process either binary or ASCII output from the Avaya CMS.
5
+
6
+ Status
7
+ ======
8
+ This release is now in production use within Call Centers using the Avaya CMS. The utility successfully and reliably imports the data provided by the Avaya CMS ECHI into various databases, including Microsoft Sqlserver, Oracle and MySQL. This provides the repository of call segments that may then be used to provide detailed Cradle to Grave reporting for the call center.
9
+
10
+ Features
11
+ ========
12
+ The utility provides the following capabilities:
13
+
14
+ * Support of ActiveRecord (means you may use Oracle, MySQL, MS-SQL, Postgres, DB2, ODBC, etc)
15
+ * Generate your schema via ActiveRecord Migrations automatically
16
+ * Fetch Binary or ASCII CSV files from the Avaya CMS platform via FTP
17
+ * Insert the records into the defined database table using database transactions, via ActiveRecord, on a per file basis to support recovery on failure
18
+ * Change schema structure via YML configuration file to accommodate various releases of the ECHI format
19
+ * Supports inserting data from the various '.dat' files provided by the Avaya CMS into associated tables
20
+ * Runs as a daemon (via fork) on Posix (*NIX) and a service on Windows
21
+ * Has a watchdog process on Posix or you may set a service watch on Windows
22
+ * Allows for multiple FTP sessions to be used for greater performance
23
+
24
+ Table names:
25
+
26
+ * echi_records - stores all ECHI data
27
+ * echi_logs - stores a log entry for each file processed
28
+ * echi_acds - stores the data from the acd.dat file
29
+ * echi_agents - stores the data from the agname.dat file
30
+ * echi_aux_reasons - stores the data from the aux_rsn.dat file
31
+ * echi_cwcs - stores data from the cwc.dat file
32
+ * echi_splits - stores data from the split.dat file
33
+ * echi_trunk_groups - stores data from the tkgrp.dat file
34
+ * echi_vdns - stores data from the vdn.dat file
35
+ * echi_vectors - stores data from the vector.dat file
36
+
37
+ What ECHI-Converter is not
38
+ =============
39
+ * A reporting engine
40
+ * A set of database maintenance scripts
41
+
42
+ Requirements
43
+ ============
44
+ * [Ruby v1.8.6+](http://www.ruby-lang.org/)
45
+ * [Rubygems v1.2+](http://www.rubygems.org/)
46
+ * [ActiveRecord v2.1+](http://activerecord.rubyforge.org/)
47
+ * [ActiveSupport v2.1+](http://activesupport.rubyforge.org/)
48
+ * [Daemons v1.0.10+](http://daemons.rubyforge.org/)
49
+ * [FasterCSV v1.2.3+](http://fastercsv.rubyforge.org/)
50
+ * [Rake v0.8.1+](http://rake.rubyforge.org/)
51
+ * [UUIDTools v1.0.3+](http://sporkmonger.com/projects/uuidtools/)
52
+ * [Win32-service v.0.6.1+](http://win32utils.rubyforge.org/) (Manual install for Windows only)
53
+ * Avaya CMS ECHI Release 12+ enabled and configured to send to an FTP server
54
+
55
+ Installing
56
+ ==========
57
+ `gem install echi-converter`
58
+
59
+ Setup
60
+ =====
61
+ First, create the directory with all of the project files where you will run this application from:
62
+
63
+ `echi-converter create myproject`
64
+
65
+ Once you have installed a project into your preferred directory, you then need to configure for your environment. The first step is to modify each of these files:
66
+
67
+ * config/application.yml
68
+ * Change each of the 'echi' settings for connecting to your local FTP server where the CMS puts the ASCII/binary files
69
+ * Select which schema you would like to use (ie - extended_version12.yml) based on what you have in place
70
+ * config/database.yml
71
+ * Change to match your local database and database login credentials, full ActiveRecord support
72
+ * Note: Your database user and database must exist before running rake, as rake will then create the schema
73
+
74
+ Once this is complete, then simply run these commands from the project directory:
75
+
76
+ * rake migrate (creates the tables required for the system)
77
+ * echi-converter (starts the server daemon, refer to its usage)
78
+
79
+ Note: When using a Windows FTP server, you must configure the FTP server to provide a UNIX directory listing format.
80
+
81
+ Usage
82
+ ======
83
+ * echi-converter create myproject - create the local project to run the ECHI converter from
84
+ * echi-converter upgrade myproject - location of project to upgrade after a new gem is installed
85
+
86
+ For POSIX (*NIX):
87
+
88
+ * echi-converter run myproject - Run the ECHI converter interactively from the location given
89
+ * echi-converter start myproject - Start the ECHI converter in daemon mode from the location given
90
+ * echi-converter stop myproject - Stop the ECHI converter daemon
91
+ * echi-converter restart myproject - Restart the ECHI converter
92
+ * echi-converter zap myproject - If there has been an unexpected close and the system still thinks the converter is running, clean up the pid files
93
+
94
+ For MS-Windows:
95
+
96
+ * echi-converter install myproject - install the service (must specify complete path such as c:\path\to\my\project - if the directory name or path has any spaces, please enclose the "myproject" in double quotes )
97
+ * echi-converter start - start the service
98
+ * echi-converter stop - stop the service
99
+ * echi-converter pause - pause the service
100
+ * echi-converter resume - resume the service
101
+ * echi-converter status - returns the status of a configured service
102
+ * echi-converter delete - delete the service"
103
+
104
+ * If you would like to run the script interactively, you may also execute this command:
105
+ ** ruby "c:\myproject\lib\main_win32.rb"
106
+
107
+ Multi-byte character support:
108
+
109
+ * If you require multi-byte character support be sure to set your database to 'utf8' as well as uncomment the option 'encoding: utf8' in the config/database.yml file
110
+
111
+ Demonstration of usage
112
+ ================
113
+ Start the daemon/service:
114
+
115
+ `echi-converter start myproject`
116
+
117
+ Stop the daemon/service:
118
+
119
+ `echi-converter stop myproject`
120
+
121
+ Supported Platforms
122
+ ==================
123
+ While the use of Ruby allows for operation on a multitude of platforms, these are the platforms that have actually been tested on. If you have success running on other platforms, please feel free to provide details on the Google Group.
124
+
125
+ Operating Systems
126
+ ===============
127
+ * POSIX
128
+ * Windows XP SP2
129
+ * Windows 2000
130
+ * Windows 2003
131
+
132
+ Databases
133
+ =========
134
+ * MySQL
135
+ * Microsoft Sqlserver
136
+ * DB2
137
+ * Sqlite3
138
+ * Postgres
139
+ * Oracle
140
+
141
+ FTP Servers
142
+ ============
143
+ * VSFTP
144
+ * Windows 2003/XP FTP Servers (When using a Windows FTP server, you must configure the FTP server to provide a UNIX directory listing format.)
145
+
146
+ Related Avaya Documentation for ECHI
147
+ ==============
148
+ * [Avaya Call Management System Release 14 External Call History Interface](http://support.avaya.com/elmodocs2/cms/R14/ECHI.pdf)
149
+ * [Avaya Call Management System Release 13 External Call History Interface](http://support.avaya.com/elmodocs2/cms_r13_1/07-300737_ECHI.pdf)
150
+
151
+ Screencast
152
+ ============
153
+ You may view the screencast on howto install and use the ECHI-Converter [here](http://www.screencast.com/t/lQQkIVkUZMr).
154
+
155
+ Consulting Services
156
+ =============
157
+ If you would like help installing, configuring or adding features please do not hesitate to contact the consulting services of Adhearsion [here](http://www.adhearsion.com/consulting).
158
+
159
+ Forum
160
+ ======
161
+ Please report questions on the [Google Group](http://groups.google.com/group/echi-converter)
162
+ Please report bugs on the [Bug tracker](https://github.com/mojolingo/echi-converter/issues)
163
+
164
+ Changelog
165
+ ======
166
+ View the [changelog](https://github.com/mojolingo/echi-converter/blob/master/CHANGELOG)
167
+
168
+ How to submit patches
169
+ ==============
170
+ * Read the [8 steps for fixing other people's code](http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/)
171
+ * Submit a pull request on github
172
+
173
+ License
174
+ ========
175
+ This code is free to use under the terms of the LGPL license.
176
+
177
+ Contact
178
+ ========
179
+ Comments are welcome. Send an email to [echi [at] mojolingo.com](mailto:echi@mojolingo.com).
180
+
181
+ Brought to you by
182
+ =================
183
+ * [Adhearsion](http://www.adhearsion.com), the open-source, unconventional voice framework that ties technologies together neatly.
184
+ * [Mojo Lingo](http://www.mojolingo.com), voice applications that work like magic!
data/Rakefile CHANGED
@@ -1,152 +1,26 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
- require 'rake/clean'
4
- require 'rake/testtask'
5
- require 'rake/packagetask'
6
- require 'rake/gempackagetask'
7
- require 'rake/rdoctask'
8
- require 'rake/contrib/rubyforgepublisher'
9
- require 'fileutils'
10
- require 'hoe'
11
- require 'active_record'
3
+ require 'logger'
4
+ require 'active_record'
12
5
  require 'yaml'
13
6
 
14
- include FileUtils
15
- require File.join(File.dirname(__FILE__), 'lib', 'echi-converter', 'version')
7
+ require 'yard'
8
+ YARD::Rake::YardocTask.new
16
9
 
17
- AUTHOR = 'Jason Goecke' # can also be an array of Authors
18
- EMAIL = "jason [at] goecke.net"
19
- DESCRIPTION = "ECHI Conversion Utility - Provides a utility to fetch Avaya CMS / ECHI binary files, convert them and insert into a database table via ActiveRecord"
20
- GEM_NAME = 'echi-converter' # what ppl will type to install your gem
21
-
22
- @config_file = "~/.rubyforge/user-config.yml"
23
- @config = nil
24
- def rubyforge_username
25
- unless @config
26
- begin
27
- @config = YAML.load(File.read(File.expand_path(@config_file)))
28
- rescue
29
- puts <<-EOS
30
- ERROR: No rubyforge config file found: #{@config_file}"
31
- Run 'rubyforge setup' to prepare your env for access to Rubyforge
32
- - See http://newgem.rubyforge.org/rubyforge.html for more details
33
- EOS
34
- exit
35
- end
36
- end
37
- @rubyforge_username ||= @config["username"]
38
- end
39
-
40
- RUBYFORGE_PROJECT = 'echi-converter' # The unix name for your project
41
- HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
42
- DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
43
-
44
- NAME = "echi-converter"
45
- REV = nil
46
- # UNCOMMENT IF REQUIRED:
47
- # REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil
48
- VERS = EchiConverter::VERSION::STRING + (REV ? ".#{REV}" : "")
49
- CLEAN.include ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store']
50
- RDOC_OPTS = ['--quiet', '--title', 'echi-converter documentation',
51
- "--opname", "index.html",
52
- "--line-numbers",
53
- "--main", "README",
54
- "--inline-source"]
55
-
56
- class Hoe
57
- def extra_deps
58
- @extra_deps.reject { |x| Array(x).first == 'hoe' }
59
- end
60
- end
61
-
62
- # Generate all the Rake tasks
63
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
64
- hoe = Hoe.new(GEM_NAME, VERS) do |p|
65
- p.author = AUTHOR
66
- p.description = DESCRIPTION
67
- p.email = EMAIL
68
- p.summary = DESCRIPTION
69
- p.url = HOMEPATH
70
- p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
71
- p.test_globs = ["test/**/test_*.rb"]
72
- p.clean_globs |= CLEAN #An array of file patterns to delete on clean.
73
-
74
- # == Optional
75
- p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
76
- #p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
77
- p.extra_deps = [
78
- ['activerecord', '>=1.15.3'],
79
- ['activesupport', '>=1.4.2'],
80
- ['daemons', '>=1.0.7'],
81
- ['fastercsv', '>=1.2.0'],
82
- ['hoe', '>=1.3.0'],
83
- ['rake', '>=0.7.3'],
84
- ['uuidtools', '>=1.0.1']
85
- ]
86
- #p.spec_extras = {} # A hash of extra values to set in the gemspec.
87
- end
88
-
89
- CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\n\n")
90
- PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
91
- hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
10
+ ##Add the ability to use ActiveRecord Migrations to create the database
11
+ desc "Migrate the database through scripts in db/migrate. Target specific version with VERSION=x"
12
+ task :migrate => :environment do
13
+ # Load the working directory and configuration file
14
+ workingdirectory = File.expand_path(File.dirname(__FILE__))
15
+ config = YAML::load File.open("#{workingdirectory}/config/application.yml")
92
16
 
93
- desc 'Generate website files'
94
- task :website_generate do
95
- Dir['website/**/*.txt'].each do |txt|
96
- sh %{ ruby scripts/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
97
- end
98
- end
17
+ # Load the configured schema
18
+ @@echi_schema = YAML::load File.open(File.join(workingdirectory, "config", config["echi_schema"]))
99
19
 
100
- desc 'Upload website files to rubyforge'
101
- task :website_upload do
102
- host = "#{rubyforge_username}@rubyforge.org"
103
- remote_dir = "/var/www/gforge-projects/#{PATH}/"
104
- local_dir = 'website'
105
- sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
20
+ ActiveRecord::Migrator.migrate 'db/migrate', ENV["VERSION"] ? ENV["VERSION"].to_i : nil
106
21
  end
107
22
 
108
- desc 'Generate and upload website files'
109
- task :website => [:website_generate, :website_upload, :publish_docs]
110
-
111
- desc 'Release the website and new gem version'
112
- task :deploy => [:check_version, :website, :release] do
113
- puts "Remember to create SVN tag:"
114
- puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
115
- "svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
116
- puts "Suggested comment:"
117
- puts "Tagging release #{CHANGES}"
23
+ task :environment do
24
+ ActiveRecord::Base.establish_connection YAML::load(File.open('config/database.yml'))
25
+ ActiveRecord::Base.logger = Logger.new 'log/database.log'
118
26
  end
119
-
120
- desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
121
- task :local_deploy => [:website_generate, :install_gem]
122
-
123
- task :check_version do
124
- unless ENV['VERSION']
125
- puts 'Must pass a VERSION=x.y.z release version'
126
- exit
127
- end
128
- unless ENV['VERSION'] == VERS
129
- puts "Please update your version.rb to match the release version, currently #{VERS}"
130
- exit
131
- end
132
- end
133
-
134
- ##Add the ability to use ActiveRecord Migrations to create the database
135
- desc "Migrate the database through scripts in db/migrate. Target specific version with VERSION=x"
136
- task :migrate => :environment do
137
- #Load the working directoy and configuration file
138
- workingdirectory = File.expand_path(File.dirname(__FILE__))
139
- configfile = workingdirectory + '/config/application.yml'
140
- config = YAML::load(File.open(configfile))
141
-
142
- #Load the configured schema
143
- schemafile = workingdirectory + "/config/" + config["echi_schema"]
144
- @@echi_schema = YAML::load(File.open(schemafile))
145
-
146
- ActiveRecord::Migrator.migrate('db/migrate', ENV["VERSION"] ? ENV["VERSION"].to_i : nil )
147
- end
148
-
149
- task :environment do
150
- ActiveRecord::Base.establish_connection(YAML::load(File.open('config/database.yml')))
151
- ActiveRecord::Base.logger = Logger.new(File.open('log/database.log', 'a'))
152
- end
data/TODO ADDED
@@ -0,0 +1,4 @@
1
+ TODO for echi_converter
2
+ ==========================
3
+ - Add SSH/SFTP support
4
+ - Add the ability to export to CSV files as well
@@ -3,6 +3,7 @@ require 'rubygems'
3
3
  require 'daemons'
4
4
  require 'fileutils'
5
5
  require 'yaml'
6
+ require 'logger'
6
7
  include FileUtils
7
8
 
8
9
  Signal.trap("INT") do
@@ -10,7 +11,7 @@ Signal.trap("INT") do
10
11
  Process.exit
11
12
  end
12
13
 
13
- usage = "Usage:
14
+ usage = "Usage:
14
15
  echi-converter create myproject - create the local project to run the ECHI converter from (on Windows, directory names must not have spaces)
15
16
  echi-converter upgrade myproject - location of project to upgrade after a new gem version is installed"
16
17
 
@@ -30,11 +31,11 @@ if RUBY_PLATFORM["-mswin32"]
30
31
  echi-converter status - check the status of a configured service
31
32
  echi-converter delete - delete the service"
32
33
  else
33
- usage = usage +
34
+ usage = usage +
34
35
  "echi-converter run myproject - Run the ECHI converter interactively from the location given
35
36
  echi-converter start myproject - Start the ECHI converter in daemon mode from the location given
36
37
  echi-converter stop myproject - Stop the ECHI converter daemon
37
- echi-converter restart myproject - Restart the ECHI converter
38
+ echi-converter restart myproject - Restart the ECHI converter
38
39
  echi-converter zap myproject - If there has been an unexpected close and the system still thinks the converter is running, clean up the pid files"
39
40
  end
40
41
 
@@ -79,7 +80,7 @@ def create_project dir_name
79
80
  end
80
81
  rescue => err
81
82
  puts err
82
- puts 'Fatal...exiting... - ' + err
83
+ puts 'Fatal...exiting... - ' + err.to_s
83
84
  exit
84
85
  end
85
86
  puts ''
@@ -92,8 +93,8 @@ def upgrade_project project_name
92
93
  dest_dir_relative = project_name || Dir.pwd
93
94
  dest_dir = File.expand_path dest_dir_relative
94
95
  base_dir = File.expand_path File.dirname(__FILE__)
95
-
96
- begin
96
+
97
+ begin
97
98
  echi_install_conf = YAML::load(File.open("#{@echi_gem_loc}/config/install_files.yml"))
98
99
  #Copy files
99
100
  echi_install_conf["files_to_upgrade"].each do |file|
@@ -153,11 +154,11 @@ end
153
154
 
154
155
  #Launches dynamically or as a deamon for *NIX platforms
155
156
  def launch_project run_type, project_name
156
-
157
+
157
158
  #Set various file paths
158
159
  pid_directory = project_name + '/log'
159
160
  script_path = project_name + '/lib/main.rb'
160
-
161
+
161
162
  #Build options to run as a daemon
162
163
  options = {
163
164
  :app_name => 'echi-converter',
@@ -170,12 +171,12 @@ def launch_project run_type, project_name
170
171
  :dir => pid_directory,
171
172
  :script => ''
172
173
  }
173
-
174
+
174
175
  #If set, run interactively and not as a daemon
175
176
  if run_type == 'run'
176
177
  options["ontop"] = true
177
178
  end
178
-
179
+
179
180
  #Daemonize
180
181
  Daemons.run(script_path, options)
181
182
  end
@@ -212,9 +213,9 @@ elsif ARGV[0] == 'run' || ARGV[0] == 'start' || ARGV[0] == 'stop' || ARGV[0] ==
212
213
  begin
213
214
  launch_project ARGV[0], ARGV[1]
214
215
  rescue => err
215
- puts 'Failed to launch project: ' + err
216
+ puts 'Failed to launch project: ' + err.to_s
216
217
  end
217
218
  end
218
219
  else
219
220
  puts usage
220
- end
221
+ end