Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, I am facing folllowing issue when I am trying to decode my BER encoded data via dump.pl script. Some of the data is notcoming in proper format in output (non printable characters) like callingPartyNumber , subscriberID. Any get around to dump these in hexadecimal format?
$VAR1 = { "diameterCreditControlRecord" => { "dAFirstValueAfter" => "+1920.57", "originHost" => "aaa://lg-2;transport=tcp", "originRealm" => "lg.gom", "recordSequenceNumber" => "\1", "finalCharge" => "+110.43", "dAFirstID" => 10, "callingPartyNumber" => "\241\b\30dB\205", "accumulatorValue4" => 0, "accumulatorDeltaValue" => 11043, "subscriberID" => "\241\b\30dB\205", "serviceProviderID" => 1, "trafficCase" => 20, "dAFirstValueBefore" => "+2031.00", "accumulatorID" => 5, "accumulatorValue2" => 0, "serviceOfferings" => 4259872, "accumulatorValue1" => 68, "dAFirstAccDuration" => 11043, "originatingLocationInfo" => "\221&!\360", "lastPartialOutput" => 1, "accountValueBefore" => "+48.22", "extText" => "inter", "chargedDuration" => "+#", "cdrType" => 0, "teleServiceCode" => 6, "dataVolume" => "\254\210h", "serviceClass" => 603, "triggerTime" => "!p\1qE!0\20\0", "extInt1" => 1, "nodeID" => "LGLLL", "numberOfSDPInterrogations" => 269, "accumulatorValue5" => 56795, "accountValueAfter" => "+0.02", "accumulatorValue3" => 0, "localSequenceNumber" => "\25\347qZ", "currencyType" => 0 }
The perl script is:

#!/usr/bin/perl use strict; use Data::Dumper; $Data::Dumper::Indent=1; $Data::Dumper::Quotekeys=1; $Data::Dumper::Useqq=1; use Convert::ASN1 qw{:all}; # parse ASN.1 desciptions my $asn = Convert::ASN1->new; $asn->prepare(<<ASN1) or die "prepare: ", $asn->error; CallDetailOutputRecord ::= CHOICE { sCFPDPRecord [0] SCFPDPRecord, sCFSMSPSMORecord [1] SCFSMSMORecord, sCFSMSCSMORecord [2] SCFSMSMORecord, diameterCreditControlRecord [3] DiameterCreditControlRecord, fBCRatingRecord [4] FBCRatingRecord, rTCCreditControlRecord [5] RTCCreditControlRecord } SCFPDPRecord ::= SEQUENCE { chargingID [0] ChargingID OPTIONAL, ggsnAddressUsed [1] GSNAddress OPTIONAL, accessPointName [2] AccessPointName OPTION +AL, recordSequenceNumber [3] RecordSequenceNumber O +PTIONAL, nodeID [4] NodeID OPTIONAL, localSequenceNumber [5] LocalSequenceNumber OP +TIONAL, lastPartialOutput [6] BOOLEAN OPTIONAL, trafficCase [7] TrafficCase OPTIONAL, subscriberNumber [8] AddressString OPTIONAL +, serviceClass [9] ServiceClass OPTIONAL, accountValueBefore [10] MoneyAmount OPTIONAL, accountValueAfter [11] MoneyAmount OPTIONAL, finalCharge [12] MoneyAmount OPTIONAL, chargedDuration [13] ChargedDuration OPTION +AL, cdrType [14] CDRType OPTIONAL, teleServiceCode [15] TeleServiceCode OPTION +AL, startOfChargingOfContext [16] TimeStamp OPTIONAL, familyAndFriendsIndicator [17] FamilyAndFriendsIndica +tor OPTIONAL, numberOfSDPInterrogations [18] NumberOfSDPInterrogati +ons OPTIONAL, dataVolume [19] DataVolume OPTIONAL, currencyType [20] CurrencyType OPTIONAL, callingPartyNumber [21] OCTET STRING OPTIONAL, originatingLocationInfo [22] AddressString OPTIONAL +, accountNumber [23] AddressString OPTIONAL +, terminatingLocationInfo [24] AddressString OPTIONAL +, calledPartyNumber [25] AddressString OPTIONAL +, accumulatorValue1 [26] AccumulatorValue OPTIO +NAL, accumulatorValue2 [27] AccumulatorValue OPTIO +NAL, accumulatorValue3 [28] AccumulatorValue OPTIO +NAL, accumulatorValue4 [29] AccumulatorValue OPTIO +NAL, accumulatorValue5 [30] AccumulatorValue OPTIO +NAL, accumulatorDeltaValue [31] AccumulatorValue OPTIO +NAL, accumulatorID [32] AccumulatorID OPTIONAL +, dAFirstID [33] DedicatedAccountID OPT +IONAL, dAFirstValueBefore [34] MoneyAmount OPTIONAL, dAFirstValueAfter [35] MoneyAmount OPTIONAL, triggerTime [36] TimeStamp OPTIONAL, dAFirstAccDuration [37] DedicatedAccountAccDur +ation OPTIONAL, accountGroupID [38] AccountGroupID OPTIONA +L, serviceOfferings [39] ServiceOfferings OPTIO +NAL, selectedCommunityIndicator [40] SelectedCommunityIndic +ator OPTIONAL, communityID1Charged [41] CommunityID OPTIONAL, communityID2Charged [42] CommunityID OPTIONAL, communityID3Charged [43] CommunityID OPTIONAL, communityID1NonCharged [44] CommunityID OPTIONAL, communityID2NonCharged [45] CommunityID OPTIONAL, communityID3NonCharged [46] CommunityID OPTIONAL, communityDataNonChargedNotAvailable [47] BOOLEAN OPTIONAL, accumulatorValue6 [48] AccumulatorValue OPTIO +NAL, accumulatorValue7 [49] AccumulatorValue OPTIO +NAL, accumulatorValue8 [50] AccumulatorValue OPTIO +NAL, accumulatorValue9 [51] AccumulatorValue OPTIO +NAL, accumulatorValue10 [52] AccumulatorValue OPTIO +NAL, dAFirstCampaignIdentifier [53] CampaignIdentifier OPTIONAL, dASecondID [54] DedicatedAccountID OPT +IONAL, dASecondValueBefore [55] MoneyAmount OPTIONAL, dASecondValueAfter [56] MoneyAmount OPTIONAL, dASecondCampaignIdentifier [57] CampaignIdentifier OPTIONAL, dASecondAccDuration [58] DedicatedAccountAccDur +ation OPTIONAL, dAThirdID [59] DedicatedAccountID OPT +IONAL, dAThirdValueBefore [60] MoneyAmount OPTIONAL, dAThirdValueAfter [61] MoneyAmount OPTIONAL, dAThirdCampaignIdentifier [62] CampaignIdentifier OPTIONAL, dAThirdAccDuration [63] DedicatedAccountAccDur +ation OPTION +AL, dAFourthID [64] DedicatedAccountID OPT +IONAL, dAFourthValueBefore [65] MoneyAmount OPTIONAL, dAFourthValueAfter [66] MoneyAmount OPTIONAL, dAFourthCampaignIdentifier [67] CampaignIdentifier OPTIONAL, dAFourthAccDuration [68] DedicatedAccountAccDur +ation + OPTIONAL, dAFifthID [69] DedicatedAccountID OPT +IONAL, dAFifthValueBefore [70] MoneyAmount OPTIONAL, dAFifthValueAfter [71] MoneyAmount OPTIONAL, dAFifthCampaignIdentifier [72] CampaignIdentifier OPTIONAL, dAFifthAccDuration [73] DedicatedAccountAccDur +ation OPTIONAL, accumulatorValue11 [74] AccumulatorValue OPTIONAL, accumulatorValue12 [75] AccumulatorValue OPTIONAL, accumulatorValue13 [76] AccumulatorValue OPTIONAL, accumulatorValue14 [77] AccumulatorValue OPTIONAL, accumulatorValue15 [78] AccumulatorValue OPTIONAL } SCFSMSMORecord ::= SEQUENCE { servedIMSI [0] IMSI, servedMSISDN [1] AddressString, serviceCenter [2] AddressString, nodeID [3] NodeID, localSequenceNumber [4] LocalSequenceNumber, trafficCase [5] TrafficCase OPTIONAL, serviceClass [6] ServiceClass OPTIONAL, accountValueBefore [7] MoneyAmount OPTIONAL, accountValueAfter [8] MoneyAmount OPTIONAL, finalCharge [9] MoneyAmount OPTIONAL, cdrType [10] CDRType, teleServiceCode [11] TeleServiceCode OPTION +AL, startOfChargingOfEvent [12] TimeStamp OPTIONAL, familyAndFriendsIndicator [13] FamilyAndFriendsIndica +tor OPTIONAL, numberOfSDPInterrogations [14] NumberOfSDPInterrogati +ons, currencyType [15] CurrencyType OPTIONAL, originatingLocationInfo [16] AddressString OPTIONAL +, accountNumber [17] AddressString OPTIONAL +, destinationNumber [18] AddressString, accumulatorValue1 [19] AccumulatorValue OPTIO +NAL, accumulatorValue2 [20] AccumulatorValue OPTIO +NAL, accumulatorValue3 [21] AccumulatorValue OPTIO +NAL, accumulatorValue4 [22] AccumulatorValue OPTIO +NAL, accumulatorValue5 [23] AccumulatorValue OPTIO +NAL, accumulatorDeltaValue [24] AccumulatorValue OPTIO +NAL, accumulatorID [25] AccumulatorID OPTIONAL +, dAFirstID [26] DedicatedAccountID OPT +IONAL, dAFirstValueBefore [27] MoneyAmount OPTIONAL, dAFirstValueAfter [28] MoneyAmount OPTIONAL, eventTimeStamp [29] TimeStamp, dAFirstAccDuration [30] DedicatedAccountAccDur +ation OPTIONAL, networkID [31] NetworkID OPTIONAL, smsReferenceNumber [32] CallReferenceNumber OP +TIONAL, mscAddress [33] AddressString OPTIONAL +, sgsn-Number [34] AddressString OPTIONAL +, accountGroupID [35] AccountGroupID OPTIONA +L, serviceOfferings [36] ServiceOfferings OPTIO +NAL, selectedCommunityIndicator [37] SelectedCommunityIndic +ator OPTIONAL, communityID1Charged [38] CommunityID OPTIONAL, communityID2Charged [39] CommunityID OPTIONAL, communityID3Charged [40] CommunityID OPTIONAL, communityID1NonCharged [41] CommunityID OPTION +AL, communityID2NonCharged [42] CommunityID OPTION +AL, communityID3NonCharged [43] CommunityID OPTION +AL, communityDataNonChargedNotAvailable [44] BOOLEAN OPTION +AL, calledPartyNumber [45] AddressString OPTIONAL +, accumulatorValue6 [46] AccumulatorValue OPTIO +NAL, accumulatorValue7 [47] AccumulatorValue OPTIO +NAL, accumulatorValue8 [48] AccumulatorValue OPTIO +NAL, accumulatorValue9 [49] AccumulatorValue OPTIO +NAL, accumulatorValue10 [50] AccumulatorValue OPTIO +NAL, dAFirstCampaignIdentifier [51] CampaignIdentifier OPTIONAL, dASecondID [52] DedicatedAccountID OPT +IONAL, dASecondValueBefore [53] MoneyAmount OPTIONAL, dASecondValueAfter [54] MoneyAmount OPTIONAL, dASecondCampaignIdentifier [55] CampaignIdentifier OPTIONAL, dASecondAccDuration [56] DedicatedAccountAccDur +ation OPTIONAL, dAThirdID [57] DedicatedAccountID OPT +IONAL, dAThirdValueBefore [58] MoneyAmount OPTIONAL, dAThirdValueAfter [59] MoneyAmount OPTIONAL, dAThirdCampaignIdentifier [60] CampaignIdentifier OPTIONAL, dAThirdAccDuration [61] DedicatedAccountAccDur +ation OPTIONAL, dAFourthID [62] DedicatedAccountID OPT +IONAL, dAFourthValueBefore [63] MoneyAmount OPTIONAL, dAFourthValueAfter [64] MoneyAmount OPTIONAL, dAFourthCampaignIdentifier [65] CampaignIdentifier OPTIONAL, dAFourthAccDuration [66] DedicatedAccountAccDur +ation OPTIONAL, dAFifthID [67] DedicatedAccountID OPT +IONAL, dAFifthValueBefore [68] MoneyAmount OPTIONAL, dAFifthValueAfter [69] MoneyAmount OPTIONAL, dAFifthCampaignIdentifier [70] CampaignIdentifier OPTIONAL, dAFifthAccDuration [71] DedicatedAccountAccDur +ation OPTIONAL, accumulatorValue11 [72] AccumulatorValue OPTIONAL, accumulatorValue12 [73] AccumulatorValue OPTIONAL, accumulatorValue13 [74] AccumulatorValue OPTIONAL, accumulatorValue14 [75] AccumulatorValue OPTIONAL, accumulatorValue15 [76] AccumulatorValue OPTIONAL } DiameterCreditControlRecord ::= SEQUENCE { cdrType [0] CDRType, nodeID [1] NodeID, recordSequenceNumber [2] RecordSequenceNumber, lastPartialOutput [3] BOOLEAN, trafficCase [4] TrafficCase OPTIONAL, teleServiceCode [5] TeleServiceCode OPTION +AL, subscriberID [6] AddressString OPTIONAL +, callingPartyNumber [7] AddressString OPTIONAL +, calledPartyNumber [8] AddressString OPTIONAL +, triggerTime [9] TimeStamp OPTIONAL, chargedDuration [10] ChargedDuration OPTION +AL, dataVolume [11] DataVolume OPTIONAL, numberOfEvents [12] NumberOfEvents OPTIONA +L, finalCharge [13] MoneyAmount OPTIONAL, accountValueBefore [14] MoneyAmount OPTIONAL, accountValueAfter [15] MoneyAmount OPTIONAL, sessionID [16] SessionID, userName [17] UserName OPTIONAL, numberOfSDPInterrogations [18] NumberOfSDPInterrogati +ons, originRealm [19] OriginRealm OPTIONAL, originHost [20] OriginHost OPTIONAL, serviceClass [21] ServiceClass OPTIONAL, accountNumber [22] AddressString OPTIONAL +, localSequenceNumber [23] LocalSequenceNumber, familyAndFriendsIndicator [24] FamilyAndFriendsIndica +tor OPTIONAL, currencyType [25] CurrencyType OPTIONAL, accumulatorValue1 [26] AccumulatorValue OPTIO +NAL, accumulatorValue2 [27] AccumulatorValue OPTIO +NAL, accumulatorValue3 [28] AccumulatorValue OPTIO +NAL, accumulatorValue4 [29] AccumulatorValue OPTIO +NAL, accumulatorValue5 [30] AccumulatorValue OPTIO +NAL, accumulatorDeltaValue [31] AccumulatorValue OPTIO +NAL, accumulatorID [32] AccumulatorID OPTIONAL +, dAFirstID [33] DedicatedAccountID OPT +IONAL, dAFirstValueBefore [34] MoneyAmount OPTIONAL, dAFirstValueAfter [35] MoneyAmount OPTIONAL, serviceProviderID [36] ServiceProviderID OPTI +ONAL, extInt1 [37] ExtInt OPTIONAL, extInt2 [38] ExtInt OPTIONAL, extInt3 [39] ExtInt OPTIONAL, extInt4 [40] ExtInt OPTIONAL, extText [41] ExtText OPTIONAL, gprsQoS [42] GPRSQoS OPTIONAL, redirectingPartyNumber [43] AddressString OPTIONAL +, originatingLocationInfo [44] AddressString OPTIONAL +, terminatingLocationInfo [45] AddressString OPTIONAL +, networkID [46] NetworkID OPTIONAL, subscriptionType [47] SubscriptionType OPTIO +NAL, smsDeliveryStatus [48] SmsDeliveryStatus OPTI +ONAL, calledPartyNumber2 [49] AddressString OPTIONAL +, calledPartyNumber3 [50] AddressString OPTIONAL +, radiusSessionID [51] RadiusSessionID OPTION +AL, multiSessionID [52] MultiSessionID OPTIONA +L, originalSubscriptionIDData [53] SubscriptionIDData OPT +IONAL, originalSubscriptionIDType [54] SubscriptionIDType OPT +IONAL, accountingCorrelationID [55] AccountingCorrelationI +D OPTIONAL, abnormalTerminationReason [56] AbnormalTerminationRea +son OPTIONAL, dAFirstAccDuration [57] DedicatedAccountAccDur +ation OPTIONAL, accountGroupID [58] AccountGroupID OPTIONA +L, serviceOfferings [59] ServiceOfferings OPTIO +NAL, selectedCommunityIndicator [60] SelectedCommunityIndic +ator OPTIONAL, communityID1Charged [61] CommunityID OPTIONAL, communityID2Charged [62] CommunityID OPTIONAL, communityID3Charged [63] CommunityID OPTIONAL, communityID1NonCharged [64] CommunityID OPTIONAL, communityID2NonCharged [65] CommunityID OPTIONAL, communityID3NonCharged [66] CommunityID OPTIONAL, communityDataNonChargedNotAvailable [67] BOOLEAN OPTIONAL, accumulatorValue6 [68] AccumulatorValue OPTIO +NAL, accumulatorValue7 [69] AccumulatorValue OPTIO +NAL, accumulatorValue8 [70] AccumulatorValue OPTIO +NAL, accumulatorValue9 [71] AccumulatorValue OPTIO +NAL, accumulatorValue10 [72] AccumulatorValue OPTIO +NAL, dAFirstCampaignIdentifier [73] CampaignIdentifier OPTIONAL, dASecondID [74] DedicatedAccountID OPT +IONAL, dASecondValueBefore [75] MoneyAmount OPTIONAL, dASecondValueAfter [76] MoneyAmount OPTIONAL, dASecondCampaignIdentifier [77] CampaignIdentifier OPTIONAL, dASecondAccDuration [78] DedicatedAccountAccDur +ation OPTIONAL, dAThirdID [79] DedicatedAccountID OPT +IONAL, dAThirdValueBefore [80] MoneyAmount OPTIONAL, dAThirdValueAfter [81] MoneyAmount OPTIONAL, dAThirdCampaignIdentifier [82] CampaignIdentifier OPTIONAL, dAThirdAccDuration [83] DedicatedAccountAccDur +ation OPTIONAL, dAFourthID [84] DedicatedAccountID OPT +IONAL, dAFourthValueBefore [85] MoneyAmount OPTIONAL, dAFourthValueAfter [86] MoneyAmount OPTIONAL, dAFourthCampaignIdentifier [87] CampaignIdentifier OPTIONAL, dAFourthAccDuration [88] DedicatedAccountAccDur +ation OPTIONAL, dAFifthID [89] DedicatedAccountID OPT +IONAL, dAFifthValueBefore [90] MoneyAmount OPTIONAL, dAFifthValueAfter [91] MoneyAmount OPTIONAL, dAFifthCampaignIdentifier [92] CampaignIdentifier OPTIONAL, dAFifthAccDuration [93] DedicatedAccountAccDur +ation OPTIONAL, usedAmountLastInterval [94] MoneyAmount OPTIONAL, deductedAmountLastInterval [95] MoneyAmount OPTIONAL, accumulatorValue11 [96] AccumulatorValue OPTIONAL, accumulatorValue12 [97] AccumulatorValue OPTIONAL, accumulatorValue13 [98] AccumulatorValue OPTIONAL, accumulatorValue14 [99] AccumulatorValue OPTIONAL, accumulatorValue15 [100] AccumulatorValue OPTIONAL } FBCRatingRecord ::= SEQUENCE { serviceClassInfo [0] SEQUENCE OF ServiceCla +ssInfo, ggsnAddressUsed [1] GSNAddress, chargingID [2] SEQUENCE OF ChargingID +, timeStamp [3] TimeStamp, volumeULAccumulatedTotal [4] DataVolume, volumeDLAccumulatedTotal [5] DataVolume, subscriberGroup [6] SubscriberGroup, nodeID [7] NodeID, localSequenceNumber [8] LocalSequenceNumber, servedIMSI [9] IMSI OPTIONAL, servedMSISDN [10] AddressString OPTIONAL +, userName [11] UserName OPTIONAL, recoveryData [12] RecoveryRecord OPTIONAL, serviceClassExtendedInfo [13] SEQUENCE OF ServiceClassExtendedInfo OPTIONAL, ratingRequested [14] BOOLEAN OPTIONAL, ratingSuccessful [15] BOOLEAN OPTIONAL, startOfUsageInfo [16] SEQUENCE OF StartOfUsageInfo OPTIONAL } RTCCreditControlRecord ::= SEQUENCE { cdrType [0] CDRType, nodeID [1] NodeID, recordSequenceNumber [2] RecordSequenceNumber, lastPartialOutput [3] BOOLEAN, trafficCase [4] TrafficCase OPTIONAL, teleServiceCode [5] TeleServiceCode OPTION +AL, subscriberID [6] AddressString OPTIONAL +, callingPartyNumber [7] AddressString OPTIONAL +, calledPartyNumber [8] AddressString OPTIONAL +, triggerTime [9] TimeStamp OPTIONAL, chargedDuration [10] ChargedDuration OPTIONAL, servedIMSI [11] IMSI OPTIONAL, numberOfEvents [12] NumberOfEvents OPTIONAL, finalCharge [13] MoneyAmount OPTIONAL, accountValueBefore [14] MoneyAmount OPTIONAL, accountValueAfter [15] MoneyAmount OPTIONAL, accountingCorrelationID [16] AccountingCorrelationID, numberOfSDPInterrogations [17] NumberOfSDPInterrogations, serviceClass [18] ServiceClass OPTIONAL, accountNumber [19] AddressString OPTIONAL, localSequenceNumber [20] LocalSequenceNumber, familyAndFriendsIndicator [21] FamilyAndFriendsIndicator OPTIONAL, currencyType [22] CurrencyType OPTIONAL, accumulatorValue1 [23] AccumulatorValue OPTIONAL, accumulatorValue2 [24] AccumulatorValue OPTIONAL, accumulatorValue3 [25] AccumulatorValue OPTIONAL, accumulatorValue4 [26] AccumulatorValue OPTIONAL, accumulatorValue5 [27] AccumulatorValue OPTIONAL, accumulatorDeltaValue [28] AccumulatorValue OPTIONAL, accumulatorID [29] AccumulatorID OPTIONAL, dAFirstID [30] DedicatedAccountID OPTIONAL, dAFirstValueBefore [31] MoneyAmount OPTIONAL, dAFirstValueAfter [32] MoneyAmount OPTIONAL, redirectingPartyNumber [33] AddressString OPTIONAL, originatingLocationInfo [34] AddressString OPTIONAL, terminatingLocationInfo [35] AddressString OPTIONAL, networkID [36] NetworkID OPTIONAL, subscriptionType [37] SubscriptionType OPTIONAL, calledPartyNumber2 [38] AddressString OPTIONAL, calledPartyNumber3 [39] AddressString OPTIONAL, dAFirstAccDuration [40] DedicatedAccountAccDuration OPTIONAL, accountGroupID [41] AccountGroupID OPTIONAL, serviceOfferings [42] ServiceOfferings OPTIONAL, selectedCommunityIndicator [43] SelectedCommunityIndicator OPTIONAL, communityID1Charged [44] CommunityID OPTIONAL, communityID2Charged [45] CommunityID OPTIONAL, communityID3Charged [46] CommunityID OPTIONAL, communityID1NonCharged [47] CommunityID OPTIONAL, communityID2NonCharged [48] CommunityID OPTIONAL, communityID3NonCharged [49] CommunityID OPTIONAL, communityDataNonChargedNotAvailable [50] BOOLEAN OPTIONAL, serviceCenter [51] AddressString OPTIONAL, startOfCharging [52] TimeStamp OPTIONAL, callSetUpResultCode [53] CallSetUpResultCode OPTIONAL +, usedUnchargedDuration [54] UsedUnchargedDuration OPTION +AL, usedUnchargedEvent [55] UsedUnchargedEvent OPTIONAL, dAFirstCampaignIdentifier [56] CampaignIdentifier OPTIONAL, dASecondID [57] DedicatedAccountID OPT +IONAL, dASecondValueBefore [58] MoneyAmount OPTIONAL, dASecondValueAfter [59] MoneyAmount OPTIONAL, dASecondCampaignIdentifier [60] CampaignIdentifier OPTIONAL, dASecondAccDuration [61] DedicatedAccountAccDur +ation OPTIONAL, dAThirdID [62] DedicatedAccountID OPT +IONAL, dAThirdValueBefore [63] MoneyAmount OPTIONAL, dAThirdValueAfter [64] MoneyAmount OPTIONAL, dAThirdCampaignIdentifier [65] CampaignIdentifier OPTIONAL, dAThirdAccDuration [66] DedicatedAccountAccDur +ation OPTIONAL, dAFourthID [67] DedicatedAccountID OPT +IONAL, dAFourthValueBefore [68] MoneyAmount OPTIONAL, dAFourthValueAfter [69] MoneyAmount OPTIONAL, dAFourthCampaignIdentifier [70] CampaignIdentifier OPTIONAL, dAFourthAccDuration [71] DedicatedAccountAccDur +ation OPTIONAL, dAFifthID [72] DedicatedAccountID OPT +IONAL, dAFifthValueBefore [73] MoneyAmount OPTIONAL, dAFifthValueAfter [74] MoneyAmount OPTIONAL, dAFifthCampaignIdentifier [75] CampaignIdentifier OPTIONAL, dAFifthAccDuration [76] DedicatedAccountAccDur +ation OPTIONAL } AbnormalTerminationReason ::= ENUMERATED { serviceElementTermination (0), connectionToUserBroken (1) } AccessPointName ::= OCTET STRING --(SIZE(1..100)) AccumulatorID ::= ENUMERATED { noAccumulator (0), accumulator1 (1), accumulator2 (2), accumulator3 (3), accumulator4 (4), accumulator5 (5), accumulator6 (6), accumulator7 (7), accumulator8 (8), accumulator9 (9), accumulator10 (10), accumulator11 (11), accumulator12 (12), accumulator13 (13), accumulator14 (14), accumulator15 (15) } AccumulatorValue ::= INTEGER --(0..2147483647) AccountGroupID ::= INTEGER --(0..2147483647) -- 0 undefined -- 1 - 2147483647 accountGroupID AccountingCorrelationID ::= OCTET STRING --(SIZE (1..255)) --AddressString ::= OCTET STRING --(SIZE (1..20)) AddressString ::= IA5String CallReferenceNumber ::= OCTET STRING --(SIZE (1..8)) CallSetUpResultCode ::= ENUMERATED { successful-ReleasedByService (0), successful-DisconnectByCallingParty (1), successful-DisconnectByCalledParty (2), successful-OngoingTollFree (3), non-Successful-CalledPartyRouteSelectFailure (4), non-Successful-CalledPartyBusy (5), non-Successful-CalledPartyNotReacheble (6), non-Successful-CalledPartyNoAnswer (7), non-Successful-CallingPartyAbandon (8), non-Successful-OtherReason (14), callForwardingHasBeenInvoked-ChargingCancelled (15) } CampaignIdentifier ::= INTEGER --(1..99999999) CDRType ::= ENUMERATED { serviceClassRequested (0), firstInterrogationUnsuccessful (1), invokeIntermediateInterrogationFinalReportUnsucc (2), internalError (3), subscriberTemporaryBlocked (4), partialDeduction (5) } ChargedDuration ::= OCTET STRING --(SIZE(1..4)) ChargingID ::= OCTET STRING --(SIZE(1..4)) CommunityID ::= INTEGER --(1..9999999) CurrencyType ::= ENUMERATED { localCurrency (0), eURO (1) } DataVolume ::= OCTET STRING --(SIZE(1..4)) DedicatedAccountAccDuration ::= INTEGER --(0..2147483647) DedicatedAccountID ::= ENUMERATED { dedicatedAccount1 (1), dedicatedAccount2 (2), dedicatedAccount3 (3), dedicatedAccount4 (4), dedicatedAccount5 (5), dedicatedAccount6 (6), dedicatedAccount7 (7), dedicatedAccount8 (8), dedicatedAccount9 (9), dedicatedAccount10 (10) } ExtInt ::= INTEGER --(0..65535) ExtText ::= OCTET STRING --(SIZE (1..29)) FamilyAndFriendsIndicator ::= INTEGER --(1..65535) GPRSQoS ::= INTEGER --(0..32767) GSNAddress ::= IPAddress IMSI ::= TBCD-String --(SIZE (3..8)) IPAddress ::= CHOICE { iPBinaryAddress [0] IPBinaryAddress, iPTextRepresentedAddress [1] IPTextRepresentedAddress } IPBinaryAddress ::= CHOICE { iPBinV4Address [0] OCTET STRING, --(SIZE(4)), iPBinV6Address [1] OCTET STRING --(SIZE(16)) } IPTextRepresentedAddress ::= CHOICE { iPTextV4Address [0] OCTET STRING, --(SIZE(7..15)), iPTextV6Address [1] OCTET STRING --(SIZE(15..45)) } LocalSequenceNumber ::= OCTET STRING --(SIZE(1..4)) MoneyAmount ::= OCTET STRING --(SIZE (1..15)) MultiSessionID ::= OCTET STRING --(SIZE (1..255)) NetworkID ::= INTEGER --(0..65534) NodeID ::= OCTET STRING --(SIZE (1..20)) NumberOfEvents ::= INTEGER --(0..65535) NumberOfSDPInterrogations ::= INTEGER --(1..65535) OriginHost ::= OCTET STRING --(SIZE (1..255)) OriginRealm ::= OCTET STRING --(SIZE (1..255)) RadiusSessionID ::= OCTET STRING --(SIZE (1..127)) RecordSequenceNumber ::= OCTET STRING --(SIZE(1..4)) RecoveryRecord ::= SEQUENCE { ccnTimeStamp [0] TimeStamp, accumulatorModificationDate [1] TimeStamp, recoveryState [2] RecoveryState, globalDeltaVolumeUL [3] DataVolume OPTIONAL, globalDeltaVolumeDL [4] DataVolume OPTIONAL, serviceClassDeltaValueList [5] SEQUENCE OF RecoveryServiceClassInfo OPTIONAL } RecoveryServiceClassInfo ::= SEQUENCE { serviceClass [0] ServiceClass, deltaTime [1] DataVolume OPTIONAL, deltaVolumeUL [2] DataVolume OPTIONAL, deltaVolumeDL [3] DataVolume OPTIONAL } RecoveryState ::= ENUMERATED { normal (1), provisioningRecovery (2), cdrRecovery (3) } SelectedCommunityIndicator ::= INTEGER --(0..9999999) ServiceClass ::= INTEGER --(0..65535) ServiceClassExtendedInfo ::= SEQUENCE { serviceClass [0] ServiceClass, timeAccumulated [1] DataVolume } ServiceOfferings ::= INTEGER --(0..2147483647) -- 0 undefined -- 1 - 2147483647 serviceOfferings ServiceProviderID ::= INTEGER --(0..65535) ServiceClassInfo ::= SEQUENCE { serviceClass [0] ServiceClass, volumeULAccumulated [1] DataVolume, volumeDLAccumulated [2] DataVolume } SessionID ::= OCTET STRING --(SIZE (1..255)) SmsDeliveryStatus ::= ENUMERATED { delivered (1), expired (2) } StartOfUsageInfo ::= SEQUENCE { serviceClass [0] ServiceClass, startOfUsage [1] TimeStamp } SubscriberGroup ::= OCTET STRING --(SIZE(1..4)) SubscriptionIDData ::= OCTET STRING --(SIZE (1..255)) SubscriptionIDType ::= ENUMERATED { endUserMSISDN (0), endUserIMSI (1), endUserSIPURL (2), endUserNAI (3), endUserPrivate (4) } SubscriptionType ::= INTEGER --(0..127) TBCD-String ::= OCTET STRING TeleServiceCode ::= ENUMERATED { voice (0), fax (1), data (2), unknown (3), sMS (4), gPRS (5), content (6), videoTelephony (7), videoConference (8), extensionTSC1 (65526), extensionTSC2 (65527), extensionTSC3 (65528), extensionTSC4 (65529), extensionTSC5 (65530), extensionTSC6 (65531), extensionTSC7 (65532), extensionTSC8 (65533), extensionTSC9 (65534), extensionTSC10 (65535) } TimeStamp ::= OCTET STRING --(SIZE(9)) TrafficCase ::= ENUMERATED { originatingInsideHPLMN (0), forwardedInsideHPLMN (1), terminatingInsideHPLMN (2), originatingOutsideHPLMNCAPv1 (3), forwardedOutsideHPLMNCAPv1 (4), terminatingOutsideHPLMN (5), roamingCallBackOutsideHPLMN (6), originatingOutsideHPLMNCAPv2 (7), forwardedOutsideHPLMNCAPv2 (8), terminatingOutsideHPLMNCAPv2 (9), originatingOutsideHPLMNCAPv3 (10), forwardedOutsideHPLMNCAPv3 (11), terminatingOutsideHPLMNCAPv3 (12), originatingServiceCharging (20), terminatingServiceCharging (21) } UsedUnchargedDuration ::= OCTET STRING --(SIZE(1..4)) UsedUnchargedEvent ::= OCTET STRING --(SIZE(1..4)) UserName ::= OCTET STRING --(SIZE (1..255)) ASN1 my $asn_cert = $asn->find('CallDetailOutputRecord'); my $fn =$ARGV[0]; exit unless defined $fn; open my $fh, "<", $fn or die "Failed to open $fn: $!\n"; my $buff; while (asn_read($fh, $buff) > 0) { #print "$asn_cert\n"; my $cert = $asn_cert->decode($buff) or die $asn_cert->error; #print "$cert->{'DetailOutputRecord'}\n"; print Dumper( $cert ); } close $fh;

Regards, Dhiraj

Replies are listed 'Best First'.
Re: Regarding Convert::ASN1 ?
by roboticus (Chancellor) on Jul 22, 2012 at 13:35 UTC

    Dhiraj:

    If you knew that your problem was that you needed to convert your data to a string of hex digits, why add the wild goose chase with Convert::ASN1?

    Anyway, you can convert to hex pretty easily using perldoc -f unpack. You would have easily found the answer had you done a simple search using something like "perl convert to hex" in Google or just about *any* search engine.

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

      Hi Roboticus, As the data which is being read in ASN BER encoded so I need to use Convert::ASN1 to decode it. This module uses Dumper to dump the decoded data structure in format like:
      $VAR1 = { "diameterCreditControlRecord" => { "dAFirstValueAfter" => "+1920.57", "originHost" => "aaa://lg-2;transport=tcp", "originRealm" => "lg.gom", "recordSequenceNumber" => "\1", "finalCharge" => "+110.43", "dAFirstID" => 10, "callingPartyNumber" => "\241\b\30dB\205", "accumulatorValue4" => 0, "accumulatorDeltaValue" => 11043, "subscriberID" => "\241\b\30dB\205", "serviceProviderID" => 1, "trafficCase" => 20, "dAFirstValueBefore" => "+2031.00", "accumulatorID" => 5, "accumulatorValue2" => 0, "serviceOfferings" => 4259872, "accumulatorValue1" => 68, "dAFirstAccDuration" => 11043, "originatingLocationInfo" => "\221&!\360", "lastPartialOutput" => 1, "accountValueBefore" => "+48.22", "extText" => "inter", "chargedDuration" => "+#", "cdrType" => 0, "teleServiceCode" => 6, "dataVolume" => "\254\210h", "serviceClass" => 603, "triggerTime" => "!p\1qE!0\20\0", "extInt1" => 1, "nodeID" => "LGLLL", "numberOfSDPInterrogations" => 269, "accumulatorValue5" => 56795, "accountValueAfter" => "+0.02", "accumulatorValue3" => 0, "localSequenceNumber" => "\25\347qZ", "currencyType" => 0 }
      Requirement is to have output in above format but print the fields which contain non printable characters like "localSequenceNumber" in hex format and rest of the fields in format already displayed above. Regards, Dhiraj

        dhiraj4mann:

        Then all you need to do is update your data after reading it:

        #!/usr/bin/perl use strict; use warnings; use Data::Dumper; my $VAR = { "diameterCreditControlRecord" => { "dAFirstValueAfter" => "+1920.57", "originHost" => "aaa://lg-2;transport=tcp", ..... snip ..... "callingPartyNumber" => "\241\b\30dB\205", "accumulatorValue4" => 0, "accumulatorDeltaValue" => 11043, "subscriberID" => "\241\b\30dB\205", ..... snip ..... } }; my $t = $$VAR{diameterCreditControlRecord}; # Now just convert each field you care about into a hex string: $$t{$_} = tohex($$t{$_}) for (qw( callingPartyNumber subscriberID )); print Dumper($VAR); sub tohex { ..... }

        ...roboticus

        When your only tool is a hammer, all problems look like your thumb.