diff --git a/core/slee/services/sbbs/src/main/java/org/mobicents/smsc/slee/services/mt/MtCommonSbb.java b/core/slee/services/sbbs/src/main/java/org/mobicents/smsc/slee/services/mt/MtCommonSbb.java index b584a620e..4fc3bbe45 100644 --- a/core/slee/services/sbbs/src/main/java/org/mobicents/smsc/slee/services/mt/MtCommonSbb.java +++ b/core/slee/services/sbbs/src/main/java/org/mobicents/smsc/slee/services/mt/MtCommonSbb.java @@ -556,6 +556,35 @@ protected AddressString getServiceCenterAddressString(int networkId) { org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan.ISDN, smscPropertiesManagement.getServiceCenterGt(networkId)); } } + + /** + * TODO : This is repetitive in each Sbb. Find way to make it static + * probably? + * + * This is our own number. We are Service Center. + * + * @return + */ + protected AddressString getServiceCenterAddressString(String mtLocalSccpGt, int networkId) { + if (mtLocalSccpGt == null) { + if (networkId == 0) { + mtLocalSccpGt = smscPropertiesManagement.getServiceCenterGt(); + } else { + mtLocalSccpGt = smscPropertiesManagement.getServiceCenterGt(networkId); + } + } + + if (networkId == 0) { + if (this.serviceCenterAddress == null) { + this.serviceCenterAddress = this.mapParameterFactory.createAddressString(AddressNature.international_number, + org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan.ISDN, mtLocalSccpGt); + } + return this.serviceCenterAddress; + } else { + return this.mapParameterFactory.createAddressString(AddressNature.international_number, + org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan.ISDN, mtLocalSccpGt); + } + } /** * TODO: This should be configurable and static as well diff --git a/core/slee/services/sbbs/src/main/java/org/mobicents/smsc/slee/services/mt/SriSbb.java b/core/slee/services/sbbs/src/main/java/org/mobicents/smsc/slee/services/mt/SriSbb.java index 3e3bd7164..b979b4324 100644 --- a/core/slee/services/sbbs/src/main/java/org/mobicents/smsc/slee/services/mt/SriSbb.java +++ b/core/slee/services/sbbs/src/main/java/org/mobicents/smsc/slee/services/mt/SriSbb.java @@ -517,13 +517,15 @@ private void sendSRI(SmsSet smsSet, String destinationAddress, int ton, int npi, MAPDialogSms mapDialogSms = null; try { Sms sms0 = smsSet.getSms(0); + String mtLocalSccpGt = null; Integer mtRemoteSccpTt = null; if (sms0 != null) { + mtLocalSccpGt = sms0.getMtLocalSccpGt(); mtRemoteSccpTt = sms0.getMtRemoteSccpTt(); } // 1. Create Dialog first and add the SRI request to it mapDialogSms = this.setupRoutingInfoForSMRequestIndication(destinationAddress, ton, npi, - mapApplicationContext, smsSet.getNetworkId(), mtRemoteSccpTt); + mapApplicationContext, smsSet.getNetworkId(), mtLocalSccpGt, mtRemoteSccpTt); // 2. Create the ACI and attach this SBB ActivityContextInterface sriDialogACI = this.mapAcif.getActivityContextInterface(mapDialogSms); @@ -545,7 +547,7 @@ private void sendSRI(SmsSet smsSet, String destinationAddress, int ton, int npi, } private MAPDialogSms setupRoutingInfoForSMRequestIndication(String destinationAddress, int ton, int npi, - MAPApplicationContext mapApplicationContext, int networkId, Integer newMtRemoteSccpTt) throws MAPException { + MAPApplicationContext mapApplicationContext, int networkId, String newMtLocalSccpGt, Integer newMtRemoteSccpTt) throws MAPException { // this.mapParameterFactory.creat String hlrAddress = destinationAddress; @@ -560,7 +562,7 @@ private MAPDialogSms setupRoutingInfoForSMRequestIndication(String destinationAd mapDialogSms.setNetworkId(networkId); ISDNAddressString isdn = this.getCalledPartyISDNAddressString(destinationAddress, ton, npi); - AddressString serviceCenterAddress = this.getServiceCenterAddressString(networkId); + AddressString serviceCenterAddress = this.getServiceCenterAddressString(newMtLocalSccpGt, networkId); boolean sm_RP_PRI = true; mapDialogSms.addSendRoutingInfoForSMRequest(isdn, sm_RP_PRI, serviceCenterAddress, null, false, null, null, null);