echi-converter 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +11 -1
- data/Manifest.txt +2 -0
- data/config/application.yml +3 -3
- data/config/extended_version13.yml +1 -1
- data/config/install_files.yml +2 -0
- data/config/standard_version12.yml +198 -0
- data/config/standard_version13.yml +198 -0
- data/lib/echi-converter.rb +12 -7
- data/lib/echi-converter/version.rb +1 -1
- data/website/index.html +3 -3
- data/website/index.txt +1 -1
- metadata +4 -2
data/History.txt
CHANGED
@@ -55,4 +55,14 @@
|
|
55
55
|
* Minor enhancement(s):
|
56
56
|
* Added additional details on gem requirements
|
57
57
|
* Bug fix(es):
|
58
|
-
* Bug #13166 - Corrected records field definition in ECHI_LOGS to integer
|
58
|
+
* Bug #13166 - Corrected records field definition in ECHI_LOGS to integer
|
59
|
+
|
60
|
+
== 0.1.1 2007-09-17
|
61
|
+
|
62
|
+
* Major enhancement(s):
|
63
|
+
* Minor enhancement(s):
|
64
|
+
* Removed some extraneous comments to the log and added others
|
65
|
+
* Added 'standard' schema definitions for revision 12 & 13 to the config directory
|
66
|
+
* Bug fix(es):
|
67
|
+
* Fixed bug #14020 issue with binary offset
|
68
|
+
* In binary handling properly insert a Y/N for the booleans
|
data/Manifest.txt
CHANGED
@@ -21,6 +21,8 @@ config/application.yml
|
|
21
21
|
config/database.yml
|
22
22
|
config/extended_version12.yml
|
23
23
|
config/extended_version13.yml
|
24
|
+
config/standard_version12.yml
|
25
|
+
config/standard_version13.yml
|
24
26
|
config/install_files.yml
|
25
27
|
db/migrate/001_create_echi_records.rb
|
26
28
|
db/migrate/002_create_echi_logs.rb
|
data/config/application.yml
CHANGED
@@ -3,14 +3,14 @@
|
|
3
3
|
#Connection details for the Avaya CMS/ECHI host
|
4
4
|
echi_host: localhost
|
5
5
|
echi_port: 22
|
6
|
-
echi_username:
|
7
|
-
echi_password:
|
6
|
+
echi_username: your_uname
|
7
|
+
echi_password: your_passwd
|
8
8
|
echi_connect_type: ftp #only ftp supported now, possible for ssh in the future
|
9
9
|
echi_ftp_directory: /Users/ftp/anonymous
|
10
10
|
echi_ftp_retry: 3
|
11
11
|
echi_ftp_delete: N #to not delete the files off of the FTP server set to N
|
12
12
|
echi_schema: extended_version13.yml
|
13
|
-
echi_format:
|
13
|
+
echi_format: BINARY #valid settings are ASCII or BINARY
|
14
14
|
echi_process_log: Y #valid is Y/N to turn it on or off
|
15
15
|
|
16
16
|
#Currently only ftp supported, but may want to add UUCP/Serial later
|
data/config/install_files.yml
CHANGED
@@ -27,6 +27,8 @@ files_to_copy:
|
|
27
27
|
- name: config/database.yml
|
28
28
|
- name: config/extended_version12.yml
|
29
29
|
- name: config/extended_version13.yml
|
30
|
+
- name: config/standard_version12.yml
|
31
|
+
- name: config/standard_version13.yml
|
30
32
|
- name: db/migrate/001_create_echi_records.rb
|
31
33
|
- name: db/migrate/002_create_echi_logs.rb
|
32
34
|
- name: examples/extended_version12/chr0003
|
@@ -0,0 +1,198 @@
|
|
1
|
+
#ECH File construct, order is important, as the application sequentially reads the file
|
2
|
+
#Version 12 - Standard Schema
|
3
|
+
fields:
|
4
|
+
- name: callid
|
5
|
+
type: int
|
6
|
+
length: 4
|
7
|
+
- name: acwtime
|
8
|
+
type: int
|
9
|
+
length: 4
|
10
|
+
- name: onholdtime
|
11
|
+
type: int
|
12
|
+
length: 4
|
13
|
+
- name: consulttime
|
14
|
+
type: int
|
15
|
+
length: 4
|
16
|
+
- name: disptime
|
17
|
+
type: int
|
18
|
+
length: 4
|
19
|
+
- name: duration
|
20
|
+
type: int
|
21
|
+
length: 4
|
22
|
+
- name: segstart
|
23
|
+
type: datetime
|
24
|
+
length: 4
|
25
|
+
- name: segstop
|
26
|
+
type: datetime
|
27
|
+
length: 4
|
28
|
+
- name: talktime
|
29
|
+
type: int
|
30
|
+
length: 4
|
31
|
+
- name: netintime
|
32
|
+
type: int
|
33
|
+
length: 4
|
34
|
+
- name: origholdtime
|
35
|
+
type: int
|
36
|
+
length: 4
|
37
|
+
- name: dispivector
|
38
|
+
type: int
|
39
|
+
length: 2
|
40
|
+
- name: dispsplit
|
41
|
+
type: int
|
42
|
+
length: 2
|
43
|
+
- name: firstivector
|
44
|
+
type: int
|
45
|
+
length: 2
|
46
|
+
- name: split1
|
47
|
+
type: int
|
48
|
+
length: 2
|
49
|
+
- name: split2
|
50
|
+
type: int
|
51
|
+
length: 2
|
52
|
+
- name: split3
|
53
|
+
type: int
|
54
|
+
length: 2
|
55
|
+
- name: trunkgroup
|
56
|
+
type: int
|
57
|
+
length: 2
|
58
|
+
- name: tklocid
|
59
|
+
type: int
|
60
|
+
length: 2
|
61
|
+
- name: origlocid
|
62
|
+
type: int
|
63
|
+
length: 2
|
64
|
+
- name: answerlocid
|
65
|
+
type: int
|
66
|
+
length: 2
|
67
|
+
- name: obslocid
|
68
|
+
type: int
|
69
|
+
length: 2
|
70
|
+
- name: assist
|
71
|
+
type: bool
|
72
|
+
length: 1
|
73
|
+
- name: audiodifficulty
|
74
|
+
type: bool
|
75
|
+
length: 1
|
76
|
+
- name: conference
|
77
|
+
type: bool
|
78
|
+
length: 1
|
79
|
+
- name: daqueued
|
80
|
+
type: bool
|
81
|
+
length: 1
|
82
|
+
- name: holdabn
|
83
|
+
type: bool
|
84
|
+
length: 1
|
85
|
+
- name: malicious
|
86
|
+
type: bool
|
87
|
+
length: 1
|
88
|
+
- name: observingcall
|
89
|
+
type: bool
|
90
|
+
length: 1
|
91
|
+
- name: transferred
|
92
|
+
type: bool
|
93
|
+
length: 1
|
94
|
+
- name: agentreleased
|
95
|
+
type: boolint
|
96
|
+
length: 1
|
97
|
+
- name: acdnum
|
98
|
+
type: int
|
99
|
+
length: 1
|
100
|
+
- name: calldisp
|
101
|
+
type: int
|
102
|
+
length: 1
|
103
|
+
- name: disppriority
|
104
|
+
type: int
|
105
|
+
length: 1
|
106
|
+
- name: holds
|
107
|
+
type: int
|
108
|
+
length: 1
|
109
|
+
- name: segment
|
110
|
+
type: int
|
111
|
+
length: 1
|
112
|
+
- name: ansreason
|
113
|
+
type: int
|
114
|
+
length: 1
|
115
|
+
- name: origreason
|
116
|
+
type: int
|
117
|
+
length: 1
|
118
|
+
- name: dispsklevel
|
119
|
+
type: int
|
120
|
+
length: 1
|
121
|
+
- name: events0
|
122
|
+
type: int
|
123
|
+
length: 1
|
124
|
+
- name: events1
|
125
|
+
type: int
|
126
|
+
length: 1
|
127
|
+
- name: events2
|
128
|
+
type: int
|
129
|
+
length: 1
|
130
|
+
- name: events3
|
131
|
+
type: int
|
132
|
+
length: 1
|
133
|
+
- name: events4
|
134
|
+
type: int
|
135
|
+
length: 1
|
136
|
+
- name: events5
|
137
|
+
type: int
|
138
|
+
length: 1
|
139
|
+
- name: events6
|
140
|
+
type: int
|
141
|
+
length: 1
|
142
|
+
- name: events7
|
143
|
+
type: int
|
144
|
+
length: 1
|
145
|
+
- name: events8
|
146
|
+
type: int
|
147
|
+
length: 1
|
148
|
+
- name: ucid
|
149
|
+
type: str
|
150
|
+
length: 21
|
151
|
+
- name: dispvdn
|
152
|
+
type: str
|
153
|
+
length: 8
|
154
|
+
- name: eqloc
|
155
|
+
type: str
|
156
|
+
length: 10
|
157
|
+
- name: firstvdn
|
158
|
+
type: str
|
159
|
+
length: 8
|
160
|
+
- name: origlogid
|
161
|
+
type: str
|
162
|
+
length: 10
|
163
|
+
- name: anslogid
|
164
|
+
type: str
|
165
|
+
length: 10
|
166
|
+
- name: lastobserver
|
167
|
+
type: str
|
168
|
+
length: 10
|
169
|
+
- name: dialednumber
|
170
|
+
type: str
|
171
|
+
length: 25
|
172
|
+
- name: callingparty
|
173
|
+
type: str
|
174
|
+
length: 13
|
175
|
+
- name: collectdigits
|
176
|
+
type: str
|
177
|
+
length: 17
|
178
|
+
- name: cwcdigits
|
179
|
+
type: str
|
180
|
+
length: 17
|
181
|
+
- name: callingII
|
182
|
+
type: str
|
183
|
+
length: 3
|
184
|
+
- name: cwcs0
|
185
|
+
type: str
|
186
|
+
length: 17
|
187
|
+
- name: cwcs1
|
188
|
+
type: str
|
189
|
+
length: 17
|
190
|
+
- name: cwcs2
|
191
|
+
type: str
|
192
|
+
length: 17
|
193
|
+
- name: cwcs3
|
194
|
+
type: str
|
195
|
+
length: 17
|
196
|
+
- name: cwcs4
|
197
|
+
type: str
|
198
|
+
length: 17
|
@@ -0,0 +1,198 @@
|
|
1
|
+
#ECH File construct, order is important, as the application sequentially reads the file
|
2
|
+
#Version 13 - Standard Schema
|
3
|
+
fields:
|
4
|
+
- name: callid
|
5
|
+
type: int
|
6
|
+
length: 4
|
7
|
+
- name: acwtime
|
8
|
+
type: int
|
9
|
+
length: 4
|
10
|
+
- name: onholdtime
|
11
|
+
type: int
|
12
|
+
length: 4
|
13
|
+
- name: consulttime
|
14
|
+
type: int
|
15
|
+
length: 4
|
16
|
+
- name: disptime
|
17
|
+
type: int
|
18
|
+
length: 4
|
19
|
+
- name: duration
|
20
|
+
type: int
|
21
|
+
length: 4
|
22
|
+
- name: segstart
|
23
|
+
type: datetime
|
24
|
+
length: 4
|
25
|
+
- name: segstop
|
26
|
+
type: datetime
|
27
|
+
length: 4
|
28
|
+
- name: talktime
|
29
|
+
type: int
|
30
|
+
length: 4
|
31
|
+
- name: netintime
|
32
|
+
type: int
|
33
|
+
length: 4
|
34
|
+
- name: origholdtime
|
35
|
+
type: int
|
36
|
+
length: 4
|
37
|
+
- name: dispivector
|
38
|
+
type: int
|
39
|
+
length: 2
|
40
|
+
- name: dispsplit
|
41
|
+
type: int
|
42
|
+
length: 2
|
43
|
+
- name: firstivector
|
44
|
+
type: int
|
45
|
+
length: 2
|
46
|
+
- name: split1
|
47
|
+
type: int
|
48
|
+
length: 2
|
49
|
+
- name: split2
|
50
|
+
type: int
|
51
|
+
length: 2
|
52
|
+
- name: split3
|
53
|
+
type: int
|
54
|
+
length: 2
|
55
|
+
- name: trunkgroup
|
56
|
+
type: int
|
57
|
+
length: 2
|
58
|
+
- name: tklocid
|
59
|
+
type: int
|
60
|
+
length: 2
|
61
|
+
- name: origlocid
|
62
|
+
type: int
|
63
|
+
length: 2
|
64
|
+
- name: answerlocid
|
65
|
+
type: int
|
66
|
+
length: 2
|
67
|
+
- name: obslocid
|
68
|
+
type: int
|
69
|
+
length: 2
|
70
|
+
- name: assist
|
71
|
+
type: bool
|
72
|
+
length: 1
|
73
|
+
- name: audiodifficulty
|
74
|
+
type: bool
|
75
|
+
length: 1
|
76
|
+
- name: conference
|
77
|
+
type: bool
|
78
|
+
length: 1
|
79
|
+
- name: daqueued
|
80
|
+
type: bool
|
81
|
+
length: 1
|
82
|
+
- name: holdabn
|
83
|
+
type: bool
|
84
|
+
length: 1
|
85
|
+
- name: malicious
|
86
|
+
type: bool
|
87
|
+
length: 1
|
88
|
+
- name: observingcall
|
89
|
+
type: bool
|
90
|
+
length: 1
|
91
|
+
- name: transferred
|
92
|
+
type: bool
|
93
|
+
length: 1
|
94
|
+
- name: agentreleased
|
95
|
+
type: boolint
|
96
|
+
length: 1
|
97
|
+
- name: acdnum
|
98
|
+
type: int
|
99
|
+
length: 1
|
100
|
+
- name: calldisp
|
101
|
+
type: int
|
102
|
+
length: 1
|
103
|
+
- name: disppriority
|
104
|
+
type: int
|
105
|
+
length: 1
|
106
|
+
- name: holds
|
107
|
+
type: int
|
108
|
+
length: 1
|
109
|
+
- name: segment
|
110
|
+
type: int
|
111
|
+
length: 1
|
112
|
+
- name: ansreason
|
113
|
+
type: int
|
114
|
+
length: 1
|
115
|
+
- name: origreason
|
116
|
+
type: int
|
117
|
+
length: 1
|
118
|
+
- name: dispsklevel
|
119
|
+
type: int
|
120
|
+
length: 1
|
121
|
+
- name: events0
|
122
|
+
type: int
|
123
|
+
length: 1
|
124
|
+
- name: events1
|
125
|
+
type: int
|
126
|
+
length: 1
|
127
|
+
- name: events2
|
128
|
+
type: int
|
129
|
+
length: 1
|
130
|
+
- name: events3
|
131
|
+
type: int
|
132
|
+
length: 1
|
133
|
+
- name: events4
|
134
|
+
type: int
|
135
|
+
length: 1
|
136
|
+
- name: events5
|
137
|
+
type: int
|
138
|
+
length: 1
|
139
|
+
- name: events6
|
140
|
+
type: int
|
141
|
+
length: 1
|
142
|
+
- name: events7
|
143
|
+
type: int
|
144
|
+
length: 1
|
145
|
+
- name: events8
|
146
|
+
type: int
|
147
|
+
length: 1
|
148
|
+
- name: ucid
|
149
|
+
type: str
|
150
|
+
length: 21
|
151
|
+
- name: dispvdn
|
152
|
+
type: str
|
153
|
+
length: 8
|
154
|
+
- name: eqloc
|
155
|
+
type: str
|
156
|
+
length: 10
|
157
|
+
- name: firstvdn
|
158
|
+
type: str
|
159
|
+
length: 8
|
160
|
+
- name: origlogid
|
161
|
+
type: str
|
162
|
+
length: 10
|
163
|
+
- name: anslogid
|
164
|
+
type: str
|
165
|
+
length: 10
|
166
|
+
- name: lastobserver
|
167
|
+
type: str
|
168
|
+
length: 10
|
169
|
+
- name: dialednumber
|
170
|
+
type: str
|
171
|
+
length: 25
|
172
|
+
- name: callingparty
|
173
|
+
type: str
|
174
|
+
length: 13
|
175
|
+
- name: collectdigits
|
176
|
+
type: str
|
177
|
+
length: 17
|
178
|
+
- name: cwcdigits
|
179
|
+
type: str
|
180
|
+
length: 17
|
181
|
+
- name: callingII
|
182
|
+
type: str
|
183
|
+
length: 3
|
184
|
+
- name: cwcs0
|
185
|
+
type: str
|
186
|
+
length: 17
|
187
|
+
- name: cwcs1
|
188
|
+
type: str
|
189
|
+
length: 17
|
190
|
+
- name: cwcs2
|
191
|
+
type: str
|
192
|
+
length: 17
|
193
|
+
- name: cwcs3
|
194
|
+
type: str
|
195
|
+
length: 17
|
196
|
+
- name: cwcs4
|
197
|
+
type: str
|
198
|
+
length: 17
|
data/lib/echi-converter.rb
CHANGED
@@ -83,7 +83,7 @@ module EchiConverter
|
|
83
83
|
when 'bool'
|
84
84
|
value = @binary_file.read(length).unpack("b8").last.to_s
|
85
85
|
#Process that one wierd boolean that is actually an int, instead of a bit
|
86
|
-
when '
|
86
|
+
when 'boolint'
|
87
87
|
value = @binary_file.read(length).unpack("U").first.to_i
|
88
88
|
#Change the values of the field to Y/N for the varchar(1) representation of BOOLEAN
|
89
89
|
if value == 1
|
@@ -119,7 +119,7 @@ module EchiConverter
|
|
119
119
|
bool_cnt = 0
|
120
120
|
record_cnt = 0
|
121
121
|
while @binary_file.eof == FALSE do
|
122
|
-
@log.debug '<====================START RECORD====================>'
|
122
|
+
@log.debug '<====================START RECORD ' + record_cnt.to_s + ' ====================>'
|
123
123
|
echi_record = EchiRecord.new
|
124
124
|
@echi_schema["fields"].each do | field |
|
125
125
|
#We handle the 'boolean' fields differently, as they are all encoded as bits in a single 8-bit byte
|
@@ -128,12 +128,17 @@ module EchiConverter
|
|
128
128
|
bytearray = dump_binary field["type"], field["length"]
|
129
129
|
end
|
130
130
|
#Ensure we parse the bytearray and set the appropriate flags
|
131
|
+
#We need to make sure the entire array is not nil, in order to do Y/N
|
132
|
+
#if Nil we then set all no
|
131
133
|
if bytearray != nil
|
132
|
-
|
134
|
+
if bytearray.slice(bool_cnt,1) == 1
|
135
|
+
value = 'Y'
|
136
|
+
else
|
137
|
+
value = 'N'
|
138
|
+
end
|
133
139
|
else
|
134
140
|
value = 'N'
|
135
141
|
end
|
136
|
-
@log.debug "Boolie: " + bool_cnt.to_s
|
137
142
|
bool_cnt += 1
|
138
143
|
if bool_cnt == 8
|
139
144
|
bool_cnt = 0
|
@@ -149,9 +154,9 @@ module EchiConverter
|
|
149
154
|
|
150
155
|
#Scan past the end of line record
|
151
156
|
@binary_file.read(1)
|
157
|
+
@log.debug '<====================STOP RECORD ' + record_cnt.to_s + ' ====================>'
|
152
158
|
record_cnt += 1
|
153
159
|
end
|
154
|
-
@log.debug '<====================STOP RECORD====================>'
|
155
160
|
@binary_file.close
|
156
161
|
|
157
162
|
#Move the file to the processed directory
|
@@ -247,7 +252,7 @@ def process_ascii filename
|
|
247
252
|
record_cnt = 0
|
248
253
|
FasterCSV.foreach(echi_file) do |row|
|
249
254
|
if row != nil
|
250
|
-
@log.debug '<====================START RECORD====================>'
|
255
|
+
@log.debug '<====================START RECORD ' + record_cnt.to_s + ' ====================>'
|
251
256
|
echi_record = EchiRecord.new
|
252
257
|
cnt = 0
|
253
258
|
@echi_schema["fields"].each do | field |
|
@@ -268,7 +273,7 @@ def process_ascii filename
|
|
268
273
|
cnt += 1
|
269
274
|
end
|
270
275
|
echi_record.save
|
271
|
-
@log.debug '<====================STOP RECORD====================>'
|
276
|
+
@log.debug '<====================STOP RECORD ' + record_cnt.to_s + ' ====================>'
|
272
277
|
record_cnt += 1
|
273
278
|
end
|
274
279
|
end
|
data/website/index.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<h1>ECHI Converter</h1>
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/echi-converter"; return false'>
|
35
35
|
<p>Get Version</p>
|
36
|
-
<a href="http://rubyforge.org/projects/echi-converter" class="numbers">0.1.
|
36
|
+
<a href="http://rubyforge.org/projects/echi-converter" class="numbers">0.1.1</a>
|
37
37
|
</div>
|
38
38
|
<h1>→ ‘echi-converter’</h1>
|
39
39
|
|
@@ -41,7 +41,7 @@
|
|
41
41
|
<h2>The <span class="caps">ECHI</span> (External Call History Interface) Converter</h2>
|
42
42
|
|
43
43
|
|
44
|
-
<p>Provides a Ruby based utility for fetching Avaya <span class="caps">CMS</span> / <span class="caps">ECHI</span> files in binary form from an <span class="caps">FTP</span> server, converting them to <span class="caps">ASCII</span> and then inserting them into a database via ActiveRecord.</p>
|
44
|
+
<p>Provides a Ruby based utility for fetching Avaya <span class="caps">CMS</span> / <span class="caps">ECHI</span> files in binary/ASCII form from an <span class="caps">FTP</span> server, converting them, if necessary, to <span class="caps">ASCII</span> and then inserting them into a database via ActiveRecord.</p>
|
45
45
|
|
46
46
|
|
47
47
|
<h2>Status</h2>
|
@@ -201,7 +201,7 @@
|
|
201
201
|
|
202
202
|
<p>Comments are welcome. Send an email to <a href="mailto:jason@goecke.net">jason [at] goecke.net</a>.</p>
|
203
203
|
<p class="coda">
|
204
|
-
<a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>,
|
204
|
+
<a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>, 17th September 2007<br>
|
205
205
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
206
206
|
</p>
|
207
207
|
</div>
|
data/website/index.txt
CHANGED
@@ -5,7 +5,7 @@ h1. → 'echi-converter'
|
|
5
5
|
|
6
6
|
h2. The ECHI (External Call History Interface) Converter
|
7
7
|
|
8
|
-
Provides a Ruby based utility for fetching Avaya CMS / ECHI files in binary form from an FTP server, converting them to ASCII and then inserting them into a database via ActiveRecord.
|
8
|
+
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.
|
9
9
|
|
10
10
|
h2. Status
|
11
11
|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: echi-converter
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.1.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.1.1
|
7
|
+
date: 2007-09-17 00:00:00 -07:00
|
8
8
|
summary: ECHI Conversion Utility - Provides a utility to fetch Avaya CMS / ECHI binary files, convert them and insert into a database table via ActiveRecord
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -51,6 +51,8 @@ files:
|
|
51
51
|
- config/database.yml
|
52
52
|
- config/extended_version12.yml
|
53
53
|
- config/extended_version13.yml
|
54
|
+
- config/standard_version12.yml
|
55
|
+
- config/standard_version13.yml
|
54
56
|
- config/install_files.yml
|
55
57
|
- db/migrate/001_create_echi_records.rb
|
56
58
|
- db/migrate/002_create_echi_logs.rb
|