TAP3::Tap3edit - TAP3, RAP and NRTRDE files Encode/Decode library


TAP3-Tap3edit documentation  | view source Contained in the TAP3-Tap3edit distribution.

Index


NAME

Top

  TAP3::Tap3edit - TAP3, RAP and NRTRDE files Encode/Decode library
  http://www.tap3edit.com

SYNOPSYS

Top

  use TAP3::Tap3edit;




  $tap3 = TAP3::Tap3edit->new;
  $tap3->decode("CDOPER1OPER200001")  or  die $tap3->error; 

  $struct=$tap3->structure;
  # $struct is a hash which can be now changed to modify the TAP file structure.

  # After modifying the hash, it can be written into a new file
  $tap3->encode("CDOPER1OPER200001.new")  or  die $tap3->error;




  $tap3 = TAP3::Tap3edit->new;
  $tap3->get_info("CDOPER1OPER200002");

  $version=$tap3->version;
  $release=$tap3->release;

  $taptype=$tap3->file_type;

DESCRIPTION

Top

TAP3::Tap3edit decodes and encodes TAP, RAP and NRTRDE files using ASN.1 format, storing its tree information into a hash.

METHODS

Top

new:

Constructor, creates a new object.

error:

Returns the last error.

decode:

Decodes the tree structure of a TAP/RAP/NRT file into a HASH.

encode:

Encodes the structure opened by "decode" into a new TAP/RAP/NRT file.

structure:

Returns the Hash with the decoded ASN.1 tree of the file, for further edition.

get_info:

Gets only the basic information of the TAP/RAP/NRT file such as its version, release and file type.

spec_file:

Normaly the ASN.1 specifications files are stored in the "Spec" directory from the installation directory, but this method allows to use a certain specification file to decode our TAP/RAP/NRT file.

supl_spec_file:

The same as "spec_file" but in case of a RAP file sets the specification of its TAP version. Only used for RAP files.

version:

Returns the main version of the TAP/RAP/NRT file.

release:

Returns the main release of the TAP/RAP/NRT file.

supl_version:

Returns the suplementary version of the RAP file (version of its TAP file).

supl_release:

Returns the suplementery release of the RAP file (release of its TAP file).

file_type:

Returns the type of the file, TAP for CD and TD files, RAP for RC and RT files, ACK for AC files and NRT for NRTRDE Files (NR).

VARIABLES

Top

spec_path

Contains the default directories where to look for the specification files. It is disired to look somewhere else, add simply the new path to this array.

DECODING, EDITING AND ENCODING A TAP FILE

Top

Decoding a TAP file.

  use TAP3::Tap3edit;

  $tap3 = TAP3::Tap3edit->new;
  $tap3->decode("CDOPER1OPER200001")  or  die $tap3->error; # Remember to check the return values







Changing the structure of the TAP file

  $struct=$tap3->structure;
  # This will change the UtcTimeOffset of the AuditControlInfo.
  $struct->{transferBatch}->{auditControlInfo}->{earliestCallTimeStamp}->{utcTimeOffset}="+0300";







Encoding and saving the TAP file

  # Encode and save the new structure with change of Utc Offset into a new file
  $tap3->encode("CDOPER1OPER200001.new")  or  die $tap3->error; # Remember to check the return values







Getting just the version and release of a tap file

  $tap3 = TAP3::Tap3edit->new;
  $filename="CDOPER1OPER200002";
  $tap3->get_info($filename)  or  die $tap3->error; # Remember to check the return values

  print "$filename->Version: ".$tap3->version."\n";
  print "$filename->Release: ".$tap3->release."\n";







A RAP file is a file containing rejected information of a certain TAP file. This TAP file could be of any release of TAP3. That is why a RAP file has inside two versions: its own one and the version of the affected TAP file. Therefore we need here a main version and a suplementary one (supl_version) for the TAP.

  $tap3 = TAP3::Tap3edit->new;
  $filename="RCOPER2OPER100001";
  $tap3->get_info($filename)  or  die $tap3->error; # Remember to check the return values

  print "$filename->RAP Version: ".$tap3->version."\n";           # E.g. 1
  print "$filename->RAP Release: ".$tap3->release."\n";           # E.g. 2

  print "$filename->TAP Version: ".$tap3->supl_version."\n";      # E.g. 3
  print "$filename->TAP Release: ".$tap3->supl_release."\n";      # E.g. 9







Decode a TAP file with a certain specification file

  $tap3 = TAP3::Tap3edit->new;

  $tap3->spec_file("/home/javier/MySpec/TAP0304.asn");

  # Will decode the test TAP file with the specification of TAP3 release 4.
  $tap3->decode("TDOPER3OPER400003")  or  die $tap3->error; # Remember to check the return values







Delete all the Camel Attachments of a TAP file.

  $tap3 = TAP3::Tap3edit->new();
  $tap3->decode("CDOPER4OPER900028")  or  die $tap3->error;

  $struct=$tap3->structure;

  my $key;

  # Will scan all the calls for Camel attachments.
  foreach $key ( @{$struct->{'transferBatch'}->{'callEventDetails'} } ) {

        foreach ( keys %{$key} ) {

                if ( defined $key->{$_}->{'camelServiceUsed'} ) {
                        $key->{$_}->{'camelServiceUsed'} = ();
                }

        }
  }

  $tap3->encode("CDOPER4OPER900028")  or  die $tap3->error;







Dump the tree of the complete TAP file. You can see the complete structure of the TAP file

  use TAP3::Tap3edit;
  use Data::Dumper;

  $tap3 = TAP3::Tap3edit->new();
  $tap3->decode("CDOPER6OPER700111")  or  die $tap3->error;

  print Dumper ($tap3->structure); 




REQUIRED MODULES

Top

Convert::ASN1. A patched version fixing a problem with files with indefinite length can be found here: http://www.tap3edit.com/en_0_2_download.php

SEE ALSO

Top

Examples: http://www.tap3edit.com/en_3_1_examples.php Other TAP3 tools: http://www.tap3edit.com/en_4_1_tools.php

AUTHOR

Top

Javier Gutierrez <jgutierrez at tap3edit dot com> or http://www.tap3edit.com/en_0_3_contact.html

COPYRIGHT

Top


TAP3-Tap3edit documentation  | view source Contained in the TAP3-Tap3edit distribution.