I am trying to write asn.1 schema for IMS cdrs having file header and repeating cdr headers(TS 32297 headers) but not able to decode these headers
In a specification shared by the client these headers are defined like this:
FileHeader ::= SEQUENCE
{ fileLength [0] INTEGER (SIZE(4) CODE("DEC")) OPTIONAL,
headerlength [1] INTEGER (SIZE (3) CODE ("DEC")) OPTIONAL,
highreleaseIdentifier [2] OCTET STRING (SIZE (1)CODE ("LEFT")) OPTIONAL,
lowreleaseIdentifier [3] OCTET STRING (SIZE (1)CODE ("LEFT")) OPTIONAL,
fileTimestamp [4] OCTET STRING (SIZE (4)CODE ("LEFT")) OPTIONAL,
lastcdrTimestamp [5] OCTET STRING (SIZE (4)CODE ("LEFT")) OPTIONAL,
dataRecordIdentifier [6] OCTET STRING (SIZE (8)CODE ("LEFT")) OPTIONAL,
totalCdr [10] OCTET STRING (SIZE (4)CODE ("LEFT")) OPTIONAL,
filesequencenumber [11] OCTET STRING (SIZE (4)CODE ("LEFT")) OPTIONAL,
filecloserReason [12] IMPLICIT FilecloserReason (SIZE (4)CODE("DEC")) OPTIONAL,
ipnodeaddress [13] OCTET STRING (SIZE (20)CODE ("LEFT")) OPTIONAL,
lostCdrindicator [14] OCTET STRING (SIZE (1)CODE ("LEFT")) OPTIONAL,
lengthCdrFilter [15] INTEGER (SIZE (2)CODE ("LEFT")) OPTIONAL,
cdrroutingFilter [16] OCTET STRING (SIZE (5)CODE ("LEFT")) OPTIONAL
}
CDRHeader ::= SEQUENCE
{
cDRLength [0] INTEGER (SIZE(2) CODE("DEC")) OPTIONAL,
releaseIdentifier [1] IMPLICIT OCTET STRING (SIZE (1)CODE ("LEFT")) OPTIONAL, -- This comprises of Release Id and Version Id
dataRecordIdentifier [2] IMPLICIT OCTET STRING (SIZE (1)CODE ("LEFT")) OPTIONAL, -- It comprises of Data Record Number and TS Number
releaseIdentifierextension [3] IMPLICIT ReleaseIdentifierextension (SIZE (1)CODE("DEC")) OPTIONAL
}
但是 ASNVE1 无法理解这些 CODE("DEC")/CODE ("LEFT"),因此无法编译此 asn 规范。
请建议如何修改标头的 ASN 架构
您的规格无效
您可以删除所有 CODE("DEC") 和 CODE ("LEFT")
你无法做你想做的事。 TS 32.297 标头未在 ASN.1 中指定,并且不符合 ASN.1 编码。如果您使用 Objective System 的 ASN1VE 工具查看此数据,它能够解析标头,然后显示 ASN.1 数据,但您必须告诉它您的数据有 32.297 个标头。然后使用描述 ASN.1 编码数据的未修改的 ASN.1 模式。
TS 32.297 是一种容器格式,您需要一个解析器从 TS 32.297 文件中提取 CDR 二进制文件。
如果您知道Kaitai Struct,我的TS 32.297 Kaitai struct format schema可用于解码TS 32.297文件并提取CDR,使用类似Kaitai Web IDE。
还有一个简单的 Web 应用程序可以执行此操作:browsablecdr.vercel.app 基于相同的架构。
对于离线使用,有一个免费的 cli 工具tttns。