K2InformaticsGmbH / smpp_parser

A parser for SMPP protocol PDUs
Apache License 2.0
3 stars 1 forks source link

Unpack error {'ESME_RINVTLVSTREAM', "Error in the optional part of the PDU Body"} (2). #63

Closed walter-weinmann closed 6 years ago

walter-weinmann commented 6 years ago
=== Reason: no match of right hand side value {error,
                                                    <<"Error in the optional part of the PDU Body">>}
  in function  smpp_test_utils:encode_decode/1 (d:/K2/smpp_parser_idea/smpp_parser/_build/test/lib/smpp_parser/test/src/smpp_test_utils.erl, line 41)
  in call from compacted_submit_multi_resp_SUITE:test_compacted/1 (d:/K2/smpp_parser_idea/smpp_parser/_build/test/lib/smpp_parser/test/generated/ct/compacted_submit_multi_resp_SUITE.erl, line 49)
  in call from test_server:ts_tc/3 (test_server.erl, line 1546)
  in call from test_server:run_test_case_eval1/6 (test_server.erl, line 1062)
  in call from test_server:run_test_case_eval/9 (test_server.erl, line 994)

Example:

 {"submit_multi_resp_issue_63",
  "00 00 00 A6 80 00 00 21 00 00 00 00 00 00 00 01 74 68 69 73 5F 63 6F 75 6C "
  "64 5F 62 65 5F 61 5F 6D 65 73 73 61 67 65 5F 69 64 00 06 01 01 08 31 36 38 "
  "2E 31 32 33 2E 32 33 34 2E 33 32 31 00 00 00 00 FF 01 04 00 31 32 37 2E 30 "
  "2E 30 2E 31 00 00 00 00 0F 01 02 06 31 36 38 2E 31 32 33 2E 32 33 34 2E 33 "
  "32 31 00 00 00 04 00 01 01 01 31 39 32 2E 31 2E 31 2E 31 30 00 00 00 04 FF "
  "01 00 00 31 36 38 2E 31 32 33 2E 32 33 34 2E 33 32 31 00 00 00 00 0F 01 02 "
  "0A 31 39 32 2E 31 2E 31 2E 31 30 00 00 00 01 12"}
c-bik commented 6 years ago

@walter-weinmann

Its looks like the test case has some issues:

{"submit_multi_resp_issue_63",
  "00 00 00 A6 80 00 00 21 00 00 00 00 00 00 00 01 74 68 69 73 5F 63 6F 75 6C "
  "64 5F 62 65 5F 61 5F 6D 65 73 73 61 67 65 5F 69 64 00 06 01 01 08 31 36 38 "
  "2E 31 32 33 2E 32 33 34 2E 33 32 31 00 00 00 00 FF 01 04 00 31 32 37 2E 30 "
  "2E 30 2E 31 00 00 00 00 0F 01 02 06 31 36 38 2E 31 32 33 2E 32 33 34 2E 33 "
  "32 31 00 00 00 04 00 01 01 01 31 39 32 2E 31 2E 31 2E 31 30 00 00 00 04 FF "
  "01 00 00 31 36 38 2E 31 32 33 2E 32 33 34 2E 33 32 31 00 00 00 00 0F 01 02 "
  "0A 31 39 32 2E 31 2E 31 2E 31 30 00 00 00 01 12"}

image

I tried to analying your test PDU manually and this is so far I have got with it:

00 00 00 A6 % command_length (166)
80 00 00 21 % command_id (submit_multi_resp)
00 00 00 00 % command_status (ESME_ROK)
00 00 00 01 % sequence_number (1)
% message_id ("this_could_be_a_message_id\0")
74 68 69 73 5F 63 6F 75 6C 64 5F 62 65 5F 61 5F 6D 65 73 73 61 67 65 5F 69 64 00
06 % no_unsuccess (6)
% #1 dest_addr_ton 1(International), dest_addr_npi 1 (ISDN), destination_addr (??)
%   error_status_code ESME_RUNKNOWNERR (0xFF)
01 01 08 31 36 38 2E 31 32 33 2E 32 33 34 2E 33 32 31 00 00 00 00 FF
% #2 dest_addr_ton 1(International), dest_addr_npi 4 (Telex), destination_addr (??)
%   error_status_code ESME_RINVSYSID (0x0F)
01 04 00 31 32 37 2E 30 2E 30 2E 31 00 00 00 00 0F
% #3 dest_addr_ton 1(International), dest_addr_npi 2 (?), destination_addr (??)
%   error_status_code ESME_RINVBNDSTS (0x04)
01 02 06 31 36 38 2E 31 32 33 2E 32 33 34 2E 33 32 31 00 00 00 04
% #4 dest_addr_ton 1(International), dest_addr_npi 2 (?), destination_addr (??)
%   error_status_code ESME_RINVBNDSTS (0x04)
00 01 01 01 31 39 32 2E 31 2E 31 2E 31 30 00 00 00 04
% #5 dest_addr_ton ?, dest_addr_npi ?, destination_addr ?
%   error_status_codeESME_RINVSYSID (0x0F)
FF 01 00 00 31 36 38 2E 31 32 33 2E 32 33 34 2E 33 32 31 00 00 00 00 0F
% #6 dest_addr_ton ?, dest_addr_npi ?, destination_addr ?
%   error_status_code ?
01 02 0A 31 39 32 2E 31 2E 31 2E 31 30 00 00 00 01 12

Can you please verify / confirm if the above is correct and help me fix the ? parts?

walter-weinmann commented 6 years ago

Test data generated in the wrong format.

c-bik commented 6 years ago

@walter-weinmann Shouldn't this be removed too? https://github.com/K2InformaticsGmbH/smpp_parser/blob/79493e8e7129cadc6d9ee7e08850effdd2fb5147/src/smpp.erl#L1044-L1052

walter-weinmann commented 6 years ago

See PR #66.

c-bik commented 6 years ago

fixed by https://github.com/K2InformaticsGmbH/smpp_parser/pull/66