Closed walter-weinmann closed 6 years ago
It seems like this parser doesn't parse the body if command_status
is not ESME_ROK
(as ovserbed in this partcular case)
f().
D = <<"00 00 00 1F 80 00 00 01 00 00 00 01 71 F2 14 67 53 4D 50 50 33 54 45 53 54 00 02 10 00"
" 01 01">>.
{ok, DStr} = smpp:decode(D).
{ok,#{command_id => <<"bind_receiver_resp">>,command_length => 31,
command_status => <<"ESME_RINVMSGLEN">>,
sequence_number => 1911690343}}
% Expected
#{command_id => <<"bind_receiver_resp">>,command_length => 31,
command_status => <<"ESME_RINVMSGLEN">>,sc_interface_version => 1,
sequence_number => 1911690343,system_id => <<"SMPP3TEST">>}
Works if command status is ESME_ROK
f().
D = <<"00 00 00 1F 80 00 00 00 00 00 00 01 71 F2 14 67 53 4D 50 50 33 54 45 53 54 00 02 10 00"
" 01 01">>.
{ok, DStr} = smpp:decode(D).
{ok, D1} = smpp:encode(DStr).
D1 == D.
true
@walter-weinmann I think the issue definition requires update and the issue requires re validation as per my comment above.
@walter-weinmann I put a temporarily wontfix to help me filter. Please feel to remove it when you update the info and the issue is still valid after your re-validation.
The solution with the test data generator is to use command_status 0x00000000
with all response operations.
create_operation(Rule, _CommandStatus, PDUBody) ->
PDU = lists:append(
[
integer_2_octet(length(PDUBody) div 2 + 16, 4),
integer_2_octet(?COMMAND_ID(Rule), 4),
%% not used because of issue #25 (https://github.com/K2InformaticsGmbH/smpp_parser/issues/25)
%% CommandStatus,
"00000000",
integer_2_octet(rand:uniform(4294967296), 4),
PDUBody
]),
?assertEqual(0, length(PDU) rem 2, "PDU=" ++ PDU),
create_byte_string(PDU, []).
Example
bind_receiver_resp
:Example
bind_transeiver_resp
:Example
bind_transmitter_resp
: