-
-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
decoding erros #171
Comments
Hello @Alhamdou, you have to use root name from which cdr spec begins. decoded_data = schema.decode('CallEventDataFile', bit_cdr) |
Hello @ladjigar thanks for the help. After making the necessary changes you suggested I was able decode the headers but the content inside was still encoded. This here is a sample of what am seeing in the output file. As you can see some are still encoded |
@Alhamdou I checked the asn schema. |
@Alhamdou class OctetString(StandardEncodeMixin, Type):
|
Hi @ladjigar i did modified the recomendation you made above. However, am still having some issues with the output. Execuse me am kinda new in this kind of problems, I do also appreciate the help you are given. This the new error message am having. CallEventRecord.outGatewayRecord: Set(outGatewayRecord, [Integer(recordType), OctetString(callingNumber), OctetString(calledNumber), OctetString(recordingEntity), ExplicitTag(mscIncomingROUTE), ExplicitTag(mscOutgoingROUTE), OctetString(seizureTime), OctetString(answerTime), OctetString(releaseTime), Integer(callDuration), Integer(causeForTerm), ExplicitTag(diagnostics), OctetString(callReference), Integer(sequenceNumber), SetOf(recordExtensions, Sequence(, [ObjectIdentifier(identifier), Boolean(significance), OctetString(information)])), Enumerated(partialRecordType), ExplicitTag(basicService), Sequence(additionalChgInfo, [Integer(chargeIndicator), OctetString(chargeParameters)]), Null(ussdCallBackFlag), Enumerated(chargedParty), OctetString(originalCalledNumber), OctetString(chargeAreaCode), OctetString(rateIndication), OctetString(roamingNumber), Integer(mscOutgoingCircuit), OctetString(orgMSCId), OctetString(callEmlppPriority), OctetString(eaSubscriberInfo), OctetString(selectedCIC), Enumerated(callerportedflag), Enumerated(cUGOutgoingAccessIndicator), OctetString(cUGInterlockCode), Enumerated(cUGIncomingAccessUsed), Enumerated(mscIncomingRouteAttribute), Enumerated(mscOutgoingRouteAttribute), OctetString(networkCallReference), OctetString(setupTime), OctetString(alertingTime), Enumerated(voiceIndicator), Enumerated(bCategory), Enumerated(callType), Integer(chargePulseNum), Enumerated(disconnectparty), Integer(chargePulseNumforITXTXA), OctetString(networkOperatorId), Enumerated(audioDataType), Integer(recordNumber), Sequence(partyRelCause, [Enumerated(releaseParty), Integer(releaseCause)]), Enumerated(chargeLevel), OctetString(locationNum), Enumerated(locationNumberNai), OctetString(translatedNumber), Sequence(location, [OctetString(locationAreaCode), OctetString(cellIdentifier)]), SequenceOf(changeOfLocation, Sequence(, [Sequence(location, [OctetString(locationAreaCode), OctetString(cellIdentifier)]), OctetString(changeTime)])), OctetString(firstmccmnc), OctetString(lastmccmnc), OctetString(icidvalue), OctetString(origioi), OctetString(termioi), Enumerated(calledportedflag), OctetString(locationroutingnumber), Enumerated(intermediateChargingInd), Integer(mscOutgoingROUTENumber), Integer(mscIncomingROUTENumber), OctetString(drcCallId), OctetString(drcCallRN)]) is missing and has no default value (At offset: 1046597) Thanks. |
@Alhamdou , convert return bytes to hex with return bytes(data[offset:end_offset]).hex()
Sample code. `$ cat t2.py import pprint schema = asn1tools.compile_files('huawei-cdr.asn', codec='der') pprint.pprint(decoded_data)` Sample output
|
Hi @ladjigar thanks so very much for the support that indeed works for me, however, i think it is not fully decoded looking at the 'callingNumber': '913272278951f0' this is still in hex and i was told this has to be a phone number but rather it is still in hex format. |
Hi @Alhamdou, BCDDirectoryNumber ::= OCTET STRING
|
Hi @ladjigar am sorry but am faily new to this projects, so if am to understand you properly does that mean that i cant convert it using this package ? If i can convert it from the BCDDirecotoryNumber what should be the step should i take. |
Hello I need help with regards to decoding my this .asn file. In this my code here when i tried to decode the `MTCallRecord i do see an empty { } in my save.txt file.
This is my code:
import asn1tools
Compile ASN.1 schema
path_asn = 'cdr_schema.asn'
schema = asn1tools.compile_files(path_asn, codec='der')
Input file path
file_path = 'b06044079.dat'
Output file path
output_file_path = 'output_decode.txt'
with open(file_path, "rb") as f:
bit_cdr = f.read()
Decode the data
decoded_data = schema.decode('MTCallRecord', bit_cdr)
Save the decoded data to a text file
with open(output_file_path, "w") as output_file:
output_file.write(str(decoded_data))
print(f"Decoded data saved to: {output_file_path}")
but when I change the type that i want to decode let's say for instance to
CallEventRecord
i get an error like this. " raise MissingMandatoryFieldError(member, offset)asn1tools.codecs.ber.MissingMandatoryFieldError: CallEventRecord.outGatewayRecord:"
If i also try to change the decoding to
CallEventDataFIle
i do get an output but almost all the data in the output file will still be encoded.I will definity appreciate it if assisted.
link to the asn file am using: https://drive.google.com/file/d/19dfbl6TUEZDNm61zEm8UEp3qNco8SoGH/view?usp=sharing
.dat link: https://drive.google.com/file/d/1ibNekvIGXrmW7-bYENRBNMXkDwdNWDIJ/view?usp=sharing
Thanks.
The text was updated successfully, but these errors were encountered: