aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2013-04-24 12:44:17 +0530
committerHarald Welte <laforge@gnumonks.org>2013-04-24 12:44:17 +0530
commit51c4b5c2791ed304fc868badfe69e369f5834212 (patch)
tree29b1832cd3c6d81ed26f530c8f2e6cd9f4ec8b03
parentdea74897270b3ebe8445d82042f4a931d5304865 (diff)
map_masq: Fix patching of IMSI and SC-Addr in SRI-RES and MO-FW-SM
-rw-r--r--src/map_masq.erl16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/map_masq.erl b/src/map_masq.erl
index ada31b3..8cd6c57 100644
--- a/src/map_masq.erl
+++ b/src/map_masq.erl
@@ -301,6 +301,8 @@ patch(_From, Default) ->
patch_scaddr(From, {serviceCentreAddressDA,Ar}) ->
NewAddr = patch_map_isdn_addr(From, Ar, smsCDA),
{serviceCentreAddressDA,NewAddr};
+patch_scaddr(From, {imsi,ImsiIn}) ->
+ {imsi, patch_imsi(mo_fw_sm_arg, From, ImsiIn)};
patch_scaddr(_From, Default) ->
Default.
@@ -512,7 +514,7 @@ imsi_direction(mo_fw_sm_arg) ->
reverse.
% check if we need to rewrite the IMSI
-patch_imsi(MsgType, from_msc, ImsiIn) ->
+patch_imsi2(MsgType, ImsiIn) ->
IsForward = imsi_direction(MsgType),
case application:get_env(mgw_nat, imsi_rewrite_tree) of
{ok, ImsiTree} ->
@@ -521,12 +523,22 @@ patch_imsi(MsgType, from_msc, ImsiIn) ->
% rewrite prefix, if it matches
case imsi_list:match_imsi(IsForward, ImsiTree, Imsi) of
{ok, NewImsi} ->
+ io:format("~p:Rewriting IMSI ~p to ~p~n", [MsgType,Imsi, NewImsi]),
map_codec:encode_map_tbcd(NewImsi);
_ ->
+ io:format("~p:Not Rewriting IMSI ~p~n", [MsgType,Imsi]),
ImsiIn
end;
_ ->
ImsiIn
- end;
+ end.
+
+% check if we need to rewrite the IMSI
+patch_imsi(_, _, asn1_NOVALUE) ->
+ asn1_NOVALUE;
+patch_imsi(sri_sm_res, from_msc, ImsiIn) ->
+ patch_imsi2(sri_sm_res, ImsiIn);
+patch_imsi(mo_fw_sm_arg, from_stp, ImsiIn) ->
+ patch_imsi2(mo_fw_sm_arg, ImsiIn);
patch_imsi(_, _, Imsi) ->
Imsi.