support local_out messages with GT but not pointcode

We cannot determine the MTP3 DPC from simply looking at the CalledParty
GT address, as there is no PC in the GT.  We have to use the result
of the routing decision as MTP3 DPC in this case!
This commit is contained in:
Harald Welte 2013-06-18 19:33:50 +02:00
parent f6259f4ff4
commit d9b9aaa9cd
2 changed files with 16 additions and 13 deletions

View File

@ -147,7 +147,7 @@ route_local_out_action(1, SccpMsg, CalledParty) ->
% the message to SCLC or unless the message is discarded by the % the message to SCLC or unless the message is discarded by the
% traffic limitation mechanism; % traffic limitation mechanism;
{ok, LsName} = ss7_routes:route_dpc(Pc), {ok, LsName} = ss7_routes:route_dpc(Pc),
{remote, SccpMsg, LsName} {remote, SccpMsg, LsName, Pc}
end; end;
% Acccording to 2.3.2 Action (2) % Acccording to 2.3.2 Action (2)
@ -172,7 +172,7 @@ route_local_out_action(2, SccpMsg, CalledParty) ->
% unless the message is discarded by the traffic % unless the message is discarded by the traffic
% limitation mechanism % limitation mechanism
{ok, LsName} = ss7_routes:route_dpc(Dpc), {ok, LsName} = ss7_routes:route_dpc(Dpc),
{remote, SccpMsg, LsName} {remote, SccpMsg, LsName, Dpc}
end end
end; end;
@ -192,7 +192,7 @@ route_local_out_action(3, SccpMsg, CalledParty) ->
% the message to SCLC or unless the message is discarded by the % the message to SCLC or unless the message is discarded by the
% traffic limitation mechanism; % traffic limitation mechanism;
{ok, LsName} = ss7_routes:route_dpc(Pc), {ok, LsName} = ss7_routes:route_dpc(Pc),
{remote, SccpMsg, LsName} {remote, SccpMsg, LsName, Pc}
end; end;
% Acccording to 2.3.2 Action (4) % Acccording to 2.3.2 Action (4)
@ -243,7 +243,7 @@ route_cr_connless(Mtp3Msg, SccpMsg) when is_record(SccpMsg, sccp_msg) ->
%route_main(SccpMsg), %route_main(SccpMsg),
%LsName = ss7_routes:route_dpc(), %LsName = ss7_routes:route_dpc(),
%LsName = undefined, %LsName = undefined,
%{remote, SccpMsg, LsName}. %{remote, SccpMsg, LsName, undefined}.
% CR or connectionless message, coming in from MTP % CR or connectionless message, coming in from MTP

View File

@ -181,9 +181,9 @@ idle(#primitive{subsystem = 'N', gen_name = 'UNITDATA',
idle(#primitive{subsystem = 'MTP', gen_name = 'TRANSFER', idle(#primitive{subsystem = 'MTP', gen_name = 'TRANSFER',
spec_name = indication, parameters = Mtp3}, LoopDat) -> spec_name = indication, parameters = Mtp3}, LoopDat) ->
case sccp_routing:route_mtp3_sccp_in(Mtp3) of case sccp_routing:route_mtp3_sccp_in(Mtp3) of
{remote, SccpMsg2, LsName} -> {remote, SccpMsg2, LsName, Dpc} ->
io:format("routed to remote?!?~n"), io:format("routed to remote?!?~n"),
{ok, M3} = create_mtp3_out(SccpMsg2, LsName), {ok, M3} = create_mtp3_out(SccpMsg2, LsName, Dpc),
% generate a MTP-TRANSFER.req primitive to the lower layer % generate a MTP-TRANSFER.req primitive to the lower layer
send_mtp_transfer_down(M3, LsName), send_mtp_transfer_down(M3, LsName),
LoopDat1 = LoopDat; LoopDat1 = LoopDat;
@ -247,11 +247,7 @@ send_mtp_transfer_down(Mtp3) when is_record(Mtp3, mtp3_msg) ->
send_mtp_transfer_down(Mtp3, LsName) when is_record(Mtp3, mtp3_msg) -> send_mtp_transfer_down(Mtp3, LsName) when is_record(Mtp3, mtp3_msg) ->
ss7_links:mtp3_tx(Mtp3, LsName). ss7_links:mtp3_tx(Mtp3, LsName).
create_mtp3_out(SccpMsg, LsName) when is_record(SccpMsg, sccp_msg) -> create_mtp3_out(SccpMsg, LsName, Dpc) when is_record(SccpMsg, sccp_msg) ->
CalledParty = proplists:get_value(called_party_addr,
SccpMsg#sccp_msg.parameters),
% we _have_ to have a destination point code here
Dpc = CalledParty#sccp_addr.point_code,
case Dpc of case Dpc of
undefined -> undefined ->
{error, dpc_undefined}; {error, dpc_undefined};
@ -275,11 +271,18 @@ create_mtp3_out(SccpMsg, LsName) when is_record(SccpMsg, sccp_msg) ->
end end
end. end.
create_mtp3_out(SccpMsg, LsName) when is_record(SccpMsg, sccp_msg) ->
CalledParty = proplists:get_value(called_party_addr,
SccpMsg#sccp_msg.parameters),
% we _have_ to have a destination point code here
Dpc = CalledParty#sccp_addr.point_code,
create_mtp3_out(SccpMsg, LsName, Dpc).
send_sccp_local_out(LoopDat, SccpMsg) when is_record(SccpMsg, sccp_msg) -> send_sccp_local_out(LoopDat, SccpMsg) when is_record(SccpMsg, sccp_msg) ->
case sccp_routing:route_local_out(SccpMsg) of case sccp_routing:route_local_out(SccpMsg) of
{remote, SccpMsg2, LsName} -> {remote, SccpMsg2, LsName, Dpc} ->
% FIXME: get to MTP-TRANSFER.req % FIXME: get to MTP-TRANSFER.req
{ok, M3} = create_mtp3_out(SccpMsg2, LsName), {ok, M3} = create_mtp3_out(SccpMsg2, LsName, Dpc),
% generate a MTP-TRANSFER.req primitive to the lower layer % generate a MTP-TRANSFER.req primitive to the lower layer
send_mtp_transfer_down(M3, LsName), send_mtp_transfer_down(M3, LsName),
LoopDat; LoopDat;