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!
diff --git a/src/sccp_routing.erl b/src/sccp_routing.erl
index 46f23a0..07cb6cb 100644
--- a/src/sccp_routing.erl
+++ b/src/sccp_routing.erl
@@ -147,7 +147,7 @@
 		% the message to SCLC or unless the message is discarded by the
 		% traffic limitation mechanism;
 		{ok, LsName} = ss7_routes:route_dpc(Pc),
-		{remote, SccpMsg, LsName}
+		{remote, SccpMsg, LsName, Pc}
 	end;
 
 % Acccording to 2.3.2 Action (2)
@@ -172,7 +172,7 @@
 			% unless the message is discarded by the traffic
 			% limitation mechanism
 			{ok, LsName} = ss7_routes:route_dpc(Dpc),
-			{remote, SccpMsg, LsName}
+			{remote, SccpMsg, LsName, Dpc}
 		end
 	end;
 
@@ -192,7 +192,7 @@
 		% the message to SCLC or unless the message is discarded by the
 		% traffic limitation mechanism;
 		{ok, LsName} = ss7_routes:route_dpc(Pc),
-		{remote, SccpMsg, LsName}
+		{remote, SccpMsg, LsName, Pc}
 	end;
 
 % Acccording to 2.3.2 Action (4)
@@ -243,7 +243,7 @@
 	%route_main(SccpMsg),
 	%LsName = ss7_routes:route_dpc(),
 	%LsName = undefined,
-	%{remote, SccpMsg, LsName}.
+	%{remote, SccpMsg, LsName, undefined}.
 
 
 % CR or connectionless message, coming in from MTP
diff --git a/src/sccp_scrc.erl b/src/sccp_scrc.erl
index 01833ba..966de9a 100644
--- a/src/sccp_scrc.erl
+++ b/src/sccp_scrc.erl
@@ -181,9 +181,9 @@
 idle(#primitive{subsystem = 'MTP', gen_name = 'TRANSFER',
 		spec_name = indication, parameters = Mtp3}, LoopDat) ->
 	case sccp_routing:route_mtp3_sccp_in(Mtp3) of
-		{remote, SccpMsg2, LsName} ->
+		{remote, SccpMsg2, LsName, Dpc} ->
 			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
 			send_mtp_transfer_down(M3, LsName),
 			LoopDat1 = LoopDat;
@@ -247,11 +247,7 @@
 send_mtp_transfer_down(Mtp3, LsName) when is_record(Mtp3, mtp3_msg) ->
 	ss7_links:mtp3_tx(Mtp3, LsName).
 
-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) when is_record(SccpMsg, sccp_msg) ->
 	case Dpc of
 	    undefined ->
 		{error, dpc_undefined};
@@ -275,11 +271,18 @@
 		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) ->
 	case sccp_routing:route_local_out(SccpMsg) of
-		{remote, SccpMsg2, LsName} ->
+		{remote, SccpMsg2, LsName, Dpc} ->
 			% 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
 			send_mtp_transfer_down(M3, LsName),
 			LoopDat;