#!/usr/bin/perl 
#
# Copyright (c) 2004 Javier Gutierrez <https://github.com/tap3edit/TAP3-Tap3edit>. 
# All rights reserved. This program is free software; you can redistribute 
# it and/or modify it under the same terms as Perl itself.
#  
#  Show all calls in a TAP file
#
#
#  Usage: tap3edit_show_calls tapfile
#
#  E.g: tap3edit_show_calls CDOPER1OPER200001
#


use TAP3::Tap3edit;

use Data::Dumper;
$Data::Dumper::Indent=1;
$Data::Dumper::Quotekeys=1;
$Data::Dumper::Useqq=1;



$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;

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

	foreach ( keys %{$key} ) {

		print "This call is: $_\n";
		print Dumper( $key->{$_} );

	}
}
