diff options
author | Harald Welte <laforge@gnumonks.org> | 2011-03-27 23:54:45 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2011-03-27 23:54:45 +0200 |
commit | 89f8031494f716116aa3d31beaef79819f1a550d (patch) | |
tree | 6c816b34110f2657d485b4294f0b90fd45792318 | |
parent | eee3eac368e41ded214f6762170fe6528f753fb8 (diff) |
explicitly try/catch ISUP errors and log all related data
-rw-r--r-- | src/mgw_nat.erl | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/mgw_nat.erl b/src/mgw_nat.erl index e15ae26..6e0a49e 100644 --- a/src/mgw_nat.erl +++ b/src/mgw_nat.erl @@ -78,15 +78,24 @@ mangle_rx_mtp3_serv(Fn, From, Path, ?MTP3_SERV_ISUP, Mtp3 = #mtp3_msg{payload = Isup = isup_codec:parse_isup_msg(Payload), io:format("ISUP Decode: ~p~n", [Isup]), %IsupMangled = mangle_rx_isup(From, Path, Isup#isup_msg.msg_type, Isup), - IsupMangled = Fn(isup, From, Path, Isup#isup_msg.msg_type, Isup), - if IsupMangled == Isup -> - Mtp3; - true -> - io:format("ISUP Encode In: ~p~n", [IsupMangled]), - Payload_out = isup_codec:encode_isup_msg(IsupMangled), - io:format("ISUP Encode Out: ~p~n", [Payload_out]), - % return modified MTP3 payload - Mtp3#mtp3_msg{payload = Payload_out} + try Fn(isup, From, Path, Isup#isup_msg.msg_type, Isup) of + IsupMangled -> + if IsupMangled == Isup -> + % return the unmodified original payload + Mtp3; + true -> + io:format("ISUP Encode In: ~p~n", [IsupMangled]), + Payload_out = isup_codec:encode_isup_msg(IsupMangled), + io:format("ISUP Encode Out: ~p~n", [Payload_out]), + % return modified MTP3 payload + Mtp3#mtp3_msg{payload = Payload_out} + end + catch error:Error -> + io:format("ISUP In: ~p~n", [Payload]), + io:format("ISUP Decode: ~p~n", [Isup]), + ip:format("ISUP mangling Error: ~p~n", [Error]), + % return the unmodified original payload + Mtp3 end; % mangle the SCCP content mangle_rx_mtp3_serv(Fn, From, Path, ?MTP3_SERV_SCCP, Mtp3 = #mtp3_msg{payload = Payload}) -> |