Parser Cdma

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 6

#!

/usr/bin/perl
#
# Copyright (c) 2004 Javier Gutierrez <[email protected]>.
# All rights reserved. This program is free software; you can redistribute
# it and/or modify it under the same terms as Perl itself.
# http://www.tap3edit.com
#
# en: show the first service code of every call.
# de: zeigt den ersten Service-Code aller Calls an.
# sp: muestra el primer service code de todas las llamadas.
#
#
# Usage: tap3edit_show_service_code.txt tapfile
#
# E.g: tap3edit_show_service_code.txt CDOPER1OPER200001
#

use TAP3::Tap3edit;

$filename=shift;

if ( ! $filename ) {
die "Usage: $0 tapname\n";
}

$tap3 = TAP3::Tap3edit->new();
$tap3->decode($filename) or die $tap3->error;
$struct=$tap3->structure;
my $key;

# Get the record count of the total calls

$totRetCallCnt = $struct->{transferBatch}->{auditControlInfo}->{callEventDetails
Count};

$totalCharge = $struct->{transferBatch}->{auditControlInfo}->{totalCharge};
$operatorName = $struct->{transferBatch}->{auditControlInfo}->{totalCharge};
print $totRetCallCnt ;
print $totalCharge ;
$recipient = $struct->{transferBatch}->{batchControlInfo}->{recipient};
print $recipient ;
$sender = $struct->{transferBatch}->{batchControlInfo}->{sender};
print $sender ;
$fileSequenceNumber = $struct->{transferBatch}->{batchControlInfo}->{fileSequenc
eNumber};
print $fileSequenceNumber ;
$specificationVersionNumber = $struct->{transferBatch}->{batchControlInfo}->{spe
cificationVersionNumber};
print "specificationVersionNumber:$specificationVersionNumber" ;
$releaseVersionNumber = $struct->{transferBatch}->{batchControlInfo}->{releaseVe
rsionNumber};
print "releaseVersionNumber:$releaseVersionNumber" ;
$fileCreationTimeStamp = $struct->{transferBatch}->{batchControlInfo}->{fileCrea
tionTimeStamp}->{localTimeStamp};
print "fileCreationTimeStamp:$fileCreationTimeStamp" ;
$utcTimeOffset = $struct->{transferBatch}->{batchControlInfo}->{fileCreationTime
Stamp}->{utcTimeOffset};
print "utcTimeOffset:$utcTimeOffset" ;
$transfer_utcTimeOffset = $struct->{transferBatch}->{batchControlInfo}->{transfe
rCutOffTimeStamp}->{localTimeStamp};
print "utcTimeOffset:$transfer_utcTimeOffset" ;
$transfer_utcTimeOffset = $struct->{transferBatch}->{batchControlInfo}->{transfe
rCutOffTimeStamp}->{utcTimeOffset};
print "utcTimeOffset:$transfer_utcTimeOffset" ;
$available_localTimeStamp = $struct->{transferBatch}->{batchControlInfo}->{fileA
vailableTimeStamp}->{localTimeStamp};
print "$available_localTimeStamp:$available_localTimeStamp" ;
$available_utcTimeOffset = $struct->{transferBatch}->{batchControlInfo}->{fileAv
ailableTimeStamp}->{utcTimeOffset};
print "available_utcTimeOffset:$available_utcTimeOffset" ;

# Accounting info started


$localCurrency = $struct->{transferBatch}->{accountingInfo}->{localCurrency};
$tapDecimalPlaces = $struct->{transferBatch}->{accountingInfo}->{tapDecimalPlace
s};

print $localCurrency;
print $tapDecimalPlaces;

my $element;

foreach $element ( @{$struct->{'transferBatch'}->{'accountingInfo'}->{'currencyC


onversionInfo'} } ) {

if (defined $element->{numberOfDecimalPlaces}) {
$numberOfDecimalPlaces=$element->{numberOfDecimalPlaces}
;
print "numberOfDecimalPlaces: $numberOfDecimalPlaces\n";

if (defined $element->{exchangeRateCode}) {
$exchangeRateCode=$element->{exchangeRateCode};
print "exchangeRateCode: $exchangeRateCode\n";
}

if (defined $element->{exchangeRate}) {
$exchangeRate=$element->{exchangeRate};
print "exchangeRate: $exchangeRate\n";
}

#call event details info started

my $element;

foreach $element ( @{$struct->{'transferBatch'}->{'callEventDetails'}->{basicCal


lInformation} } ) {

if (defined $element->{totalCallEventDuration}) {
$totalCallEventDuration=$element->{totalCallEventDuratio
n};
print "totalCallEventDuration: $totalCallEventDuration\n
";
}

}
foreach $key ( @{$struct->{'transferBatch'}->{'callEventDetails'} } ) {

foreach ( keys %{$key} ) {

# Since the content of basicServiceUsedList is stored as


an Array we show
# the first elemet with "[0]". In the case we want to sh
ow all of them we
# can use "foreach".
print $callCounter;

$service_code=$key->{$_}{basicServiceUsedList}[0]{basicS
ervice}{serviceCode}{teleServiceCode};
print "Service Code: $service_code\n";

foreach $charge ( @{$key->{$_}->{basicServiceUsedList}[0


]{chargeInformationList}[0]{chargeDetailList} } ) {
print "chargeType= $charge->{chargeType}, charge= $charg
e->{charge},chargeableunits= $charge->{chargeableUnits},charge= $chargedunits->{
chargedUnits}\n";
}

}
}
#}

You might also like