【发布时间】:2019-06-21 14:20:00
【问题描述】:
我正在尝试更改 GSM TAP3.11 文件中 MO(发起)呼叫的费用值,但它无法处理所需的
在这里我可以直接访问持续时间值,但收费值与附加的情况不同,我正在尝试更改 (1) chargeDetail 和 (2) chargeDetail 上的收费值(下面屏幕截图中 ChargeDetailList 中的第一和第二条记录) .
我的背景只有python,这是第一次使用perl。我使用它是因为经过搜索我相信只有 perl 可以处理 TAP 文件。 (见TAP3::Tap3edit)
$struct=$tap3->structure;
my $key;
# Will scan all the calls for MOC's.
foreach $key ( @{$struct->{'transferBatch'}->{'callEventDetails'} } ) {
foreach ( keys %{$key} ) {
if ( $_ eq "mobileOriginatedCall" )
{
$duration= $key->{$_}->{'basicCallInformation'}->{'totalCallEventDuration'};
delete $key->{$_}{'basicCallInformation'}{'basicServiceUsedList'}[0]{'chargeInformationList'}[0]{'chargeDetailList'}[0]{'charge'};
$key->{$_}{'basicCallInformation'}{'basicServiceUsedList'}[0]{'chargeInformationList'}[0]{'chargeDetailList'}[0]{'charge'}=$duration * 0.12 /0.6;
$new_charge_value = $key->{$_}{'basicCallInformation'}{'basicServiceUsedList'}[0]{'chargeInformationList'}[0]{'chargeDetailList'}[0]{'charge'}=$duration * 0.12 /0.6;
}
}
}
$tap3->encode("$tap_file") or die $tap3->error;
【问题讨论】:
-
欢迎来到本站,欢迎使用 Perl 5! :) 查看tour 和how-to-ask page 了解更多关于提出问题的信息,以吸引高质量的答案。您可以edit your question 包含更多信息。例如,您能否添加创建
$tap3的方式,以及运行当前代码时会发生什么?谢谢! -
抱歉,perl 还是新手,我在这里尝试更改收费值
-
mashro3ak,Perl 人通常喜欢看到人们学习该语言 :) 。为了回答您的问题,我们需要更多信息。最好的是我们可以运行一个小程序来重现您的问题,以及您的 TAP3 文件的副本。