[erlang-questions] ASN.1 decode errors

Anthony Howe achowe@REDACTED
Thu Sep 12 16:29:11 CEST 2019


I've written a couple ASN.1 BER and PER transcoders to JSON for LTE,
TAP3, NRTRDE files before.  ( It was Erlang's open source ASN.1 support
that got me to learn the language in the first place. )  I'm trying to
write one now for GPRS charging records (ETSI TS 101 393 V7.4.0
(2000-02)); I have something that builds, but does not decode the input
and just reports a vague Erlang ASN error.

I figure the problem revolves around a mismatched set of ASN module
files (which are a frik'n pain to find, but I digress).  Anyway, I
figure if I understood the error better it might point me finally in the
right direction.

So the error is...

$ ./_build/default/bin/gprsdump -r cdr_0f1
cdr_0f1: processing...
runtime error: cdr_0f1: {badmatch,
                         {error,
                          {asn1,
                           {invalid_choice_tag,
                            {1,
                             <<0,168,161,129,165,128,1,19,131,8,48,36,128,
                               1,113,0,0,63,164>>}}}}}

Reset of stack omitted.

My interpretation is that initial CallEventRecord choice 1
(GGSNPDPRecord) is not decoding, but I have no idea what the binary is
suppose to be telling me, other than "You Are Here in the BER input".

CallEventRecord	::= CHOICE
{
	sgsnPDPRecord			[0] SGSNPDPRecord,
	ggsnPDPRecord			[1] GGSNPDPRecord,
	sgsnMMRecord			[2] SGSNMMRecord,
	sgsnSMORecord			[3] SGSNSMORecord,
	sgsnSMTRecord			[4] SGSNSMTRecord
}

Any clues to would be welcome.

Right now its looking like I'll have to learn how to decode BER by hand
in order to understand the failure better.  Maybe a generic BER to ASN
syntax decoder tool?


-- 
Anthony C Howe         	                                    SnertSoft
achowe@REDACTED       Twitter: SirWumpus       BarricadeMX & Milters
http://snert.com/      http://nanozen.info/     http://snertsoft.com/



More information about the erlang-questions mailing list