K2InformaticsGmbH / smpp_parser

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

Unpack error {'ESME_RINVDSTADR',"ESME_RINVDSTADR","Invalid Dest Addr"} #46

Closed walter-weinmann closed 6 years ago

walter-weinmann commented 6 years ago
=== Reason: no match of right hand side value {error,
                                                    <<"Invalid Dest Addr">>}
  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_SUITE:test_compacted/1 (d:/K2/smpp_parser_idea/smpp_parser/_build/test/lib/smpp_parser/test/generated/ct/compacted_submit_multi_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_issue_46",
  "00 00 02 0E 00 00 00 21 00 00 00 00 00 00 00 01 57 41 50 00 06 0E 31 32 37 "
  "2E 30 2E 30 2E 31 00 0B 01 02 08 31 39 32 2E 31 36 38 2E 31 2E 31 00 02 64 "
  "69 73 74 72 69 62 75 74 69 6F 6E 5F 6C 69 73 74 5F 23 31 31 00 02 64 69 73 "
  "74 72 69 62 75 74 69 6F 6E 5F 6C 69 73 74 5F 23 34 00 01 04 03 31 39 32 2E "
  "31 2E 31 2E 31 30 00 02 64 69 73 74 72 69 62 75 74 69 6F 6E 5F 6C 69 73 74 "
  "5F 23 38 00 02 64 69 73 74 72 69 62 75 74 69 6F 6E 5F 6C 69 73 74 5F 23 35 "
  "00 01 02 03 31 36 38 2E 30 2E 30 2E 31 00 02 64 69 73 74 72 69 62 75 74 69 "
  "6F 6E 5F 6C 69 73 74 5F 23 32 00 01 04 0E 31 36 38 2E 30 2E 30 2E 31 00 02 "
  "64 69 73 74 72 69 62 75 74 69 6F 6E 5F 6C 69 73 74 5F 23 36 00 01 04 09 31 "
  "36 38 2E 31 32 33 2E 32 33 34 2E 33 32 31 00 08 07 01 39 39 30 39 32 32 31 "
  "35 35 32 34 32 30 30 30 52 00 00 0C 00 FF 0F FF 31 20 54 68 69 73 20 69 73 "
  "20 61 20 73 68 6F 72 74 20 6D 65 73 73 61 67 65 32 20 54 68 69 73 20 69 73 "
  "20 61 20 73 68 6F 72 74 20 6D 65 73 73 61 67 65 33 20 54 68 69 73 20 69 73 "
  "20 61 20 73 68 6F 72 74 20 6D 65 73 73 61 67 65 34 20 54 68 69 73 20 69 73 "
  "20 61 20 73 68 6F 72 74 20 6D 65 73 73 61 67 65 35 20 54 68 69 73 20 69 73 "
  "20 61 20 73 68 6F 72 74 20 6D 65 73 73 61 67 65 36 20 54 68 69 73 20 69 73 "
  "20 61 20 73 68 6F 72 74 20 6D 65 73 73 61 67 65 37 20 54 68 69 73 20 69 73 "
  "20 61 20 73 68 6F 72 74 20 6D 65 73 73 61 67 65 38 20 54 68 69 73 20 69 73 "
  "20 61 20 73 68 6F 72 74 20 6D 65 73 73 61 67 65 39 20 54 68 69 73 20 69 73 "
  "20 61 20 73 68 6F 72 74 20 6D 65 73 73 61 67 65 41 20 54 68 69 73 20 69 73 "
  "20 61 20 73 68 6F 72 74 20 6D 65 73 73 61 67 65 42 20 45 6E 64 02 05 00 01 "
  "27"}
c-bik commented 6 years ago
00 00 02 0E
00 00 00 21 submit_multi
00 00 00 00
00 00 00 01

57 41 50 00 # service_type
06 # source_addr_ton
0E # source_addr_npi
31 32 37 2E 30 2E 30 2E 31 00 # source_addr

0B # number_of_dests (11)
---
#1
01 # dest_flag (SME Address)
02 # dest_addr_ton
08 # dest_addr_npi
31 39 32 2E 31 36 38 2E 31 2E 31 00

#2
02 # dest_flag (Distribution List)
64 69 73 74 72 69 62 75 74 69 6F 6E 5F 6C 69 73 74 5F 23 31 31 00 # dl_name

#3
02 # dest_flag (Distribution List)
64 69 73 74 72 69 62 75 74 69 6F 6E 5F 6C 69 73 74 5F 23 34 00 # dl_name

#4
01
04
03
31 39 32 2E 31 2E 31 2E 31 30 00

#5
02
64 69 73 74 72 69 62 75 74 69 6F 6E 5F 6C 69 73 74 5F 23 38 00

#6
02
64 69 73 74 72 69 62 75 74 69 6F 6E 5F 6C 69 73 74 5F 23 35 00

#7
01
02
03
31 36 38 2E 30 2E 30 2E 31 00

#8
02
64 69 73 74 72 69 62 75 74 69 6F 6E 5F 6C 69 73 74 5F 23 32 00

#9
01
04
0E
31 36 38 2E 30 2E 30 2E 31 00

#10
02
64 69 73 74 72 69 62 75 74 69 6F 6E 5F 6C 69 73 74 5F 23 36 00

#11
01
04
09
31 36 38 2E 31 32 33 2E 32 33 34 2E 33 32 31 00
---

08 # esm_class
07 # protocol_id
01 # priority_flag
39 39 30 39 32 32 31 35 35 32 34 32 30 30 30 52 00 # schedule_delivery_time
00 # validity_period
0C # registered_delivery
00 # data_coding
FF # sm_default_msg_id
0F # sm_length (15)
FF 31 20 54 68 69 73 20 69 73 20 61 20 73 68

6F 72 74 20 6D 65 73 73 61 67 65 32 20 54 68 69 73 20 69 73 20 61 20 73 68 6F 72 74 20 6D 65 73
73 61 67 65 33 20 54 68 69 73 20 69 73 20 61 20 73 68 6F 72 74 20 6D 65 73 73 61 67 65 34 20 54
68 69 73 20 69 73 20 61 20 73 68 6F 72 74 20 6D 65 73 73 61 67 65 35 20 54 68 69 73 20 69 73 20
61 20 73 68 6F 72 74 20 6D 65 73 73 61 67 65 36 20 54 68 69 73 20 69 73 20 61 20 73 68 6F 72 74
20 6D 65 73 73 61 67 65 37 20 54 68 69 73 20 69 73 20 61 20 73 68 6F 72 74 20 6D 65 73 73 61 67
65 38 20 54 68 69 73 20 69 73 20 61 20 73 68 6F 72 74 20 6D 65 73 73 61 67 65 39 20 54 68 69 73
20 69 73 20 61 20 73 68 6F 72 74 20 6D 65 73 73 61 67 65 41 20 54 68 69 73 20 69 73 20 61 20 73
68 6F 72 74 20 6D 65 73 73 61 67 65 42 20 45 6E 64 02 05 00 01 27

@walter-weinmann I don't understand the trainling bytes of this PDU "6F 72 ... 01 27", Another corrouption?

walter-weinmann commented 6 years ago
00 00 02 0E # command_length
00 00 00 21 # command_id
00 00 00 00 # command_status
00 00 00 01 # sequence_number
57 41 50 00 # service_type
06 # source_addr_ton
0E # source_addr_npi
31 32 37 2E 30 2E 30 2E 31 00 # source_adr
0B # number_of_dests
================================================================================
dest_address # 01 --------------------------------------------------------------
01 # dest_flag
02 # dest_addr_ton
08 # dest_addr_npi
31 39 32 2E 31 36 38 2E 31 2E 31 00 # destination_addr
dest_address # 02 --------------------------------------------------------------
02 # dest_flag
64 69 73 74 72 69 62 75 74 69 6F 6E 5F 6C 69 73 74 5F 23 31 31 00 # dl_name
dest_address # 03 --------------------------------------------------------------
02 # dest_flag
64 69 73 74 72 69 62 75 74 69 6F 6E 5F 6C 69 73 74 5F 23 34 00 # dl_name
dest_address # 04 --------------------------------------------------------------
01 # dest_flag
04 # dest_addr_ton
03 # dest_addr_npi
31 39 32 2E 31 2E 31 2E 31 30 00 # destination_addr
dest_address # 05 --------------------------------------------------------------
02 # dest_flag
64 69 73 74 72 69 62 75 74 69 6F 6E 5F 6C 69 73 74 5F 23 38 00 # dl_name
dest_address # 06 --------------------------------------------------------------
02 # dest_flag
64 69 73 74 72 69 62 75 74 69 6F 6E 5F 6C 69 73 74 5F 23 35 00 # dl_name
dest_address # 07 --------------------------------------------------------------
01 # dest_flag
02 # dest_addr_ton
03 # dest_addr_npi
31 36 38 2E 30 2E 30 2E 31 00 # destination_addr
dest_address # 08 --------------------------------------------------------------
02 # dest_flag
64 69 73 74 72 69 62 75 74 69 6F 6E 5F 6C 69 73 74 5F 23 32 00 # dl_name
dest_address # 09 --------------------------------------------------------------
01 # dest_flag
04 # dest_addr_ton
0E # dest_addr_npi
31 36 38 2E 30 2E 30 2E 31 00 # destination_addr
dest_address # 10 --------------------------------------------------------------
02 # dest_flag
64 69 73 74 72 69 62 75 74 69 6F 6E 5F 6C 69 73 74 5F 23 36 00 # dl_name
dest_address # 11 --------------------------------------------------------------
01 # dest_flag
04 # dest_addr_ton
09 # dest_addr_npi
31 36 38 2E 31 32 33 2E 32 33 34 2E 33 32 31 00 # destination_addr
================================================================================
08 # esm_class
07 # protocol_id
01 priority_flag
39 39 30 39 32 32 31 35 35 32 34 32 30 30 30 52 00 # schedule_delivery_time
00 # validityx_period
0C # registered_delivery
00 # replace_if_present_flag
FF # data_coding
0F # sm_default_msg_id
FF # sm_length
31 20 54 68 69 73 20 69 73 20 61 20 73 68 6F 72 74 20 6D 65 73 73 61 67 65
32 20 54 68 69 73 20 69 73 20 61 20 73 68 6F 72 74 20 6D 65 73 73 61 67 65
33 20 54 68 69 73 20 69 73 20 61 20 73 68 6F 72 74 20 6D 65 73 73 61 67 65
34 20 54 68 69 73 20 69 73 20 61 20 73 68 6F 72 74 20 6D 65 73 73 61 67 65
35 20 54 68 69 73 20 69 73 20 61 20 73 68 6F 72 74 20 6D 65 73 73 61 67 65
36 20 54 68 69 73 20 69 73 20 61 20 73 68 6F 72 74 20 6D 65 73 73 61 67 65
37 20 54 68 69 73 20 69 73 20 61 20 73 68 6F 72 74 20 6D 65 73 73 61 67 65
38 20 54 68 69 73 20 69 73 20 61 20 73 68 6F 72 74 20 6D 65 73 73 61 67 65
39 20 54 68 69 73 20 69 73 20 61 20 73 68 6F 72 74 20 6D 65 73 73 61 67 65
41 20 54 68 69 73 20 69 73 20 61 20 73 68 6F 72 74 20 6D 65 73 73 61 67 65
42 20 45 6E 64 # short_message
Message Submission Request (user_response_code) --------------------------------
02 05 # parameter_tag
00 01 # length
27 # value

Looks good for me - replace_if_present_flagwas missing..

c-bik commented 6 years ago

On small correction was still required...

#2
02 # dest_flag (Distribution List)
64 69 73 74 72 69 62 75 74 69 6F 6E 5F 6C 69 73 74 5F 23 31 31 00 # dl_name

The max lenth of dl_name is 21 octets and that includes terminating NULL (0) So the corrected TVL is...

#2
02 # dest_flag (Distribution List)
64 69 73 74 72 69 62 75 74 69 6F 6E 5F 6C 69 73 74 5F 23 31 00 # dl_name

command_length is also adjusted accordingly