ISUP: Fix 2 bugs in encoding of options / end of options
diff --git a/src/isup_codec.erl b/src/isup_codec.erl
index 1e0efe8..ff53d6e 100644
--- a/src/isup_codec.erl
+++ b/src/isup_codec.erl
@@ -298,7 +298,13 @@
% recursive function to encode all optional parameters
encode_isup_opts([], OutBin) ->
- <<OutBin/binary, 0:8>>;
+ % terminate with end-of-options, but only if we have options
+ case OutBin of
+ <<>> ->
+ OutBin;
+ _ ->
+ <<OutBin/binary, 0:8>>
+ end;
encode_isup_opts([Opt|OptPropList], OutBin) ->
{OptType, OptBody} = Opt,
OptBin = encode_isup_optpar(OptType, OptBody),
@@ -315,7 +321,12 @@
M == ?ISUP_MSGT_ANM;
M == ?ISUP_MSGT_RLC;
M == ?ISUP_MSGT_FOT ->
- encode_isup_opts(Params);
+ OptBin = encode_isup_opts(Params),
+ case OptBin of
+ <<>> -> PtrOpt = 0;
+ _ -> PtrOpt = 1
+ end,
+ <<PtrOpt:8, OptBin/binary>>;
% Table C-5 Address complete
encode_isup_msgt(?ISUP_MSGT_ACM, #isup_msg{parameters = Params}) ->
BackCallInd = proplists:get_value(backward_call_ind, Params),