anchor.diff:  encode_isup_hdr(#isup_msg{msg_type = MsgType, cic = Cic}) ->
   	<<Cic:12/little, 0:4, MsgType:8>>.
   
  +% Table C-5	Address complete
  +encode_isup_msgt(?ISUP_MSGT_ACM, #isup_msg{parameters = Params}) ->
  +	BackCallInd = proplists:get_value(backward_call_ind, Params),
  +	OptBin = encode_isup_opts(Params),
  +	case OptBin of
  +		<<>> -> 	PtrOpt = 0;
  +		_    ->		PtrOpt = 1
  +	end,
  +	<<BackCallInd:16, PtrOpt:8, OptBin/binary>>;
  +% Table C-7	Call progress
  +encode_isup_msgt(?ISUP_MSGT_CPG, #isup_msg{parameters = Params}) ->
  +	EventInf = proplists:get_value(event_info, Params),
  +	OptBin = encode_isup_opts(Params),
  +	case OptBin of
  +		<<>> -> 	PtrOpt = 0;
  +		_    ->		PtrOpt = 1
  +	end,
  +	<<EventInf:8, PtrOpt:8, OptBin/binary>>;
  +% Table C-9	Circuit group reset acknowledgement
  +encode_isup_msgt(?ISUP_MSGT_GRA, #isup_msg{parameters = Params}) ->
  +	% V: Range and status
  +	{RangStsLen, RangeStatus} = proplists:get_value(?ISUP_PAR_RANGE_AND_STATUS, Params),
  +	<<1:8, RangStsLen:8, RangeStatus/binary>>;
  +% Table C-11	Connect
  +encode_isup_msgt(?ISUP_MSGT_CON, #isup_msg{parameters = Params}) ->
  +	BackCallInd = proplists:get_value(backward_call_ind, Params),
  +	OptBin = encode_isup_opts(Params),
  +	case OptBin of
  +		<<>> -> 	PtrOpt = 0;
  +		_    ->		PtrOpt = 1
  +	end,
  +	<<BackCallInd:16, PtrOpt:8, OptBin/binary>>;
  +% Table C-12	Continuity
  +encode_isup_msgt(?ISUP_MSGT_COT, #isup_msg{parameters = Params}) ->
  +	ContInd = proplists:get_value(continuity_ind, Params),
  +	<<ContInd:8>>;
   % Table C-16	Initial address
   encode_isup_msgt(?ISUP_MSGT_IAM, #isup_msg{parameters = Params}) ->
   	% Fixed part
  
positive.code: 					proplists:get_value(?ISUP_PAR_CALLED_P_NUM, Params)),
  	CalledPartyLen = byte_size(CalledParty),
  	% Optional part
  	PtrOpt = CalledPartyLen + 1 + 1, % 1 byte length, 1 byte start offset
  	OptBin = encode_isup_opts(Params),
  	<<FixedBin/binary, PtrVar:8, PtrOpt:8, CalledPartyLen:8, CalledParty/binary, OptBin/binary>>.
  
  encode_isup_msg(Msg = #isup_msg{msg_type = MsgType}) ->
  	HdrBin = encode_isup_hdr(Msg),
  
negative.code: 	% C.3.32 Subsequent Number
  	{PhoneBin, OddEven} = encode_isup_party(PhoneNum),
  	<<OddEven:1, 0:7, PhoneBin/binary>>;
  encode_isup_par(Atom, _More) when is_atom(Atom) ->
  	<<>>;
  encode_isup_par(OptNum, {OptLen, Binary}) when is_binary(Binary), is_integer(OptNum), is_integer(OptLen) ->
  	Binary.
  
  % encode a single OPTIONAL parameter (TLV type), skip all others
  encode_isup_optpar(ParNum, _ParBody) when is_atom(ParNum) ->
  	<<>>;
  encode_isup_optpar(ParNum, ParBody) ->
  	ParBin = encode_isup_par(ParNum, ParBody),
  	ParLen = byte_size(ParBin),
  	<<ParNum:8, ParLen:8, ParBin/binary>>.
  
  % recursive function to encode all optional parameters
  encode_isup_opts([], OutBin) ->
  	OutBin;
  encode_isup_opts([Opt|OptPropList], OutBin) ->
  