Add hack/workaround.. do not re-encode if nothing was changed

This is a work-around/hack for something I don't understand
about the erlang code. It is an issue with me... this commit
should be reverted once we have a proper fix for this.
This commit is contained in:
Holger Hans Peter Freyther 2011-02-22 16:09:33 +01:00
parent 016e30628f
commit 44635c74f9
1 changed files with 6 additions and 1 deletions

View File

@ -151,6 +151,11 @@ mangle_rx_calling(from_msc, Addr = #sccp_addr{global_title = GT}) ->
mangle_rx_calling(_From, Addr) ->
Addr.
maybe_re_encode(DecOrig, DecNew, MapEncOld) when DecOrig == DecNew ->
MapEncOld;
maybe_re_encode(_DecOrig, DecNew, _MapEncOld) ->
map_codec:encode_tcap_msg(DecNew).
mangle_rx_sccp(From, ?SCCP_MSGT_UDT, Msg = #sccp_msg{parameters = Opts}) ->
% Mangle the SCCP Calling / Called Addresses
CalledParty = proplists:get_value(called_party_addr, Opts),
@ -165,7 +170,7 @@ mangle_rx_sccp(From, ?SCCP_MSGT_UDT, Msg = #sccp_msg{parameters = Opts}) ->
UserData = proplists:get_value(user_data, Opts),
MapDec = map_codec:parse_tcap_msg(UserData),
MapDecNew = map_masq:mangle_map(From, MapDec),
MapEncNew = map_codec:encode_tcap_msg(MapDecNew),
MapEncNew = maybe_re_encode(MapDec, MapDecNew, UserData),
Opts3 = lists:keyreplace(user_data, 1, Opts2,
{user_data, MapEncNew}),
Msg#sccp_msg{parameters = Opts3};