How to decode TS32297 headers in ASN.1 schema for BER

421 Views Asked by At
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 
}

But these CODE("DEC")/CODE ("LEFT") is not understandable by ASNVE1 so not able to compile this asn specs.

Please suggest how to modify the ASN schema for the headers

3

There are 3 best solutions below

1
YaFred On

Your specification is not valid

  1. CODE is not a valid constraint
  2. If it were a valid constraint, then you would need a logical operator to combine it with the SIZE constraint

You can remove all the CODE("DEC") and CODE ("LEFT")

0
Kevin On

You can't do what you are trying to do. TS 32.297 headers are not specified in ASN.1 and do not conform to ASN.1 encoding. If you are using Objective System's ASN1VE tool to view this data, it has the ability to parse the headers and then display the ASN.1 data, but you have to tell it that your data has 32.297 headers. And then use the unmodified ASN.1 schema that describes the ASN.1-encoded data.

0
Hao Li On

TS 32.297 is a container format, you need a parser to extract the CDR binary from a TS 32.297 file.

If you know Kaitai Struct, my TS 32.297 Kaitai struct format schema can be used to decode TS 32.297 file and extract CDRs, using, like Kaitai Web IDE.

There is also a simple web app to do so: browsablecdr.vercel.app based on the same schema.