From 44635c74f9137097dc1f169474b79d5c7cc9d63f Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Tue, 22 Feb 2011 16:09:33 +0100 Subject: [PATCH] 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. --- src/mgw_nat.erl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mgw_nat.erl b/src/mgw_nat.erl index 3c95111..b76169d 100644 --- a/src/mgw_nat.erl +++ b/src/mgw_nat.erl @@ -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};