K2InformaticsGmbH / smpp_parser

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

`broadcast_error_status` bad value #102

Closed c-bik closed 6 years ago

c-bik commented 6 years ago
> PDU = "00 00 00 33 80 00 01 11 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 07 00 04 00 00 01 01".
> Bin = list_to_binary([binary_to_integer(B, 16) || B <- re:split(PDU, " ")]).
> SMPP1 = smpp:unpack_map(Bin).
#{broadcast_error_status => [257],
  command_id => 2147483921,command_length => 51,
  command_status => 0,
  message_id => "this_could_be_a_message_id",
  sequence_number => 1}
55> JSON = smpp:internal2json(SMPP1).
** exception error: bad argument
     in function  list_to_binary/1
        called as list_to_binary([257])
     in call from smpp:internal2json/2 (c:/projects/git/K2InformaticsGmbH/smpp_parser/_build/test/lib/smpp_parser/src/smpp.erl, line 34)
     in call from maps:'-map/2-lc$^0/1-0-'/2 (maps.erl, line 232)
     in call from maps:map/2 (maps.erl, line 232)
shamis commented 6 years ago

This has also been fixed i think

> smpp:decode(PDU). 
{ok,#{broadcast_error_status => 257,
      command_id => <<"broadcast_sm_resp">>,command_length => 51,
      command_status => <<"ESME_ROK">>,
      message_id => <<"this_could_be_a_message_id">>,
      sequence_number => 1}}
c-bik commented 6 years ago

@shamis if you have verified it can you please it with comment?

shamis commented 6 years ago

verified on master