A library that allows one to take an ASCII or Binary file from an Avaya CMS External Call History Interface (ECHI) and convert it into a Ruby hash for further processing.
- Convert Binary file to Ruby hash
- Convert ASCII file to Ruby hash
- Support both standard and extended file formats
- Tested with both Ruby 1.8.6 and JRuby 1.1.5
#Provide a filename to process as an argument on the commandline
filename = File.expand_path(ARGV0)
#Open the file
filehandle = open(filename, “rb”)
#Instantiate an EchiFiles class to process your ASCII or BINARY files
echi_handler = EchiFiles.new
#Use this to process a binary file
file_type = ‘BINARY’
format = ‘EXTENDED’
#In some cases the extra_byte is needed
extra_byte = true
data = echi_handler.process_file(filehandle, file_type, format, extra_byte)
#Use this to process a binary file
file_type = ‘ASCII’
format = ‘EXTENDED’
extra_byte = true
#Use this to process an ASCII file
data = echi_handler.process_file(filehandle, file_type, format, extra_byte)
#If you need to strip in characters from the asaiuui field
#data Is the Array of Hashes converted above
#
array_of_decimal_values Is an array of decimal ascii values to be stripped
data = echi_handler.strip_asaiuui(data, array_of_decimal_values)
- FasterCSV 1.4.0+
sudo gem install jsgoecke-echi_files —source=http://gems.github.com/