Skip to content

Commit

Permalink
Merge pull request iamaleksey#6 from imrivera/master
Browse files Browse the repository at this point in the history
Return mandatory fields in non-OK responses
  • Loading branch information
iamaleksey committed Jul 8, 2016
2 parents 69b85d3 + 3bcb1cc commit b254c68
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/smpp_pdu_syntax.erl
Expand Up @@ -76,8 +76,16 @@ pack({CmdId, 0, SeqNum, Body}, PduType) ->
{error, Status} ->
{error, CmdId, Status, SeqNum}
end;
pack({CmdId, Status, SeqNum, _Body}, _PduType) ->
{ok, [<<16:32, CmdId:32, Status:32, SeqNum:32>>]}.
pack({CmdId, Status, SeqNum, Body}, PduType) ->
% In case of error, pack the standard types when possible
case pack_stds(Body, PduType#pdu.std_types) of
{ok, Stds, _BodyTlvs} ->
BodyBin = list_to_binary([Stds]),
Len = size(BodyBin) + 16,
{ok, [<<Len:32, CmdId:32, Status:32, SeqNum:32>>, BodyBin]};
_ ->
{ok, [<<16:32, CmdId:32, Status:32, SeqNum:32>>]}
end.


unpack(<<Len:32, CmdId:32, ?ESME_ROK:32, SeqNum:32, Body/binary>>, PduType)
Expand Down

0 comments on commit b254c68

Please sign in to comment.