use of org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage in project smscgateway by RestComm.
the class MtTest method SuccessError4Test.
/**
* MAP V3, Mt error no memory -> RSDS
*/
@Test(groups = { "Mt" })
public void SuccessError4Test() throws Exception {
if (!this.cassandraDbInited)
return;
MAPServiceSmsProxy serviceSri = (MAPServiceSmsProxy) this.sriSbb.mapProvider.getMAPServiceSms();
MAPServiceSmsProxy serviceMt = (MAPServiceSmsProxy) this.mtSbb.mapProvider.getMAPServiceSms();
MAPServiceSmsProxy serviceRsds = (MAPServiceSmsProxy) this.rsdsSbb.mapProvider.getMAPServiceSms();
SmscPropertiesManagement smscPropertiesManagement = SmscPropertiesManagement.getInstance();
MProcManagement.getInstance("Test");
ArrayList<SmsDef> lst = new ArrayList<SmsDef>();
SmsDef sd1 = new SmsDef();
lst.add(sd1);
SmsSet smsSet = prepareDatabase(lst);
Sms sms1 = smsSet.getSms(0);
UUID smsId = sms1.getDbId();
SmsProxy smsx1 = this.pers.obtainArchiveSms(procDueSlot, smsSet.getDestAddr(), smsId);
assertNull(smsx1);
SmsSet smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(procTargetId);
assertNotNull(smsSetX);
Sms smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId[0]);
assertEquals(smsX.getSmsSet().getInSystem(), 0);
assertEquals(SmsSetCache.getInstance().getProcessingSmsSetSize(), 1);
assertNull(smsSet.getStatus());
assertEquals(smsSet.getInSystem(), 0);
assertNull(smsSet.getInSystemDate());
assertEquals(smsSet.getDueDelay(), 0);
assertNull(smsSet.getDueDate());
assertFalse(smsSet.isAlertingSupported());
// initial onSms message
SmsSetEvent event = new SmsSetEvent();
event.setSmsSet(smsSet);
this.sriSbb.onSms(event, null, null);
MAPDialogSmsProxy dlg = serviceSri.getLastMAPDialogSms();
MAPApplicationContextVersion acv = dlg.getApplicationContext().getApplicationContextVersion();
assertEquals(acv, MAPApplicationContextVersion.version3);
ArrayList<MAPTestEvent> lstEvt = dlg.getEventList();
assertEquals(lstEvt.size(), 2);
assertNull(serviceMt.getLastMAPDialogSms());
lstEvt = dlg.getEventList();
assertEquals(lstEvt.size(), 2);
assertEquals(dlg.getLocalAddress().getGlobalTitle().getDigits(), smscPropertiesManagement.getServiceCenterGt());
assertEquals(dlg.getRemoteAddress().getGlobalTitle().getDigits(), msdnDig);
MAPTestEvent evt = lstEvt.get(0);
assertEquals(evt.testEventType, MAPTestEventType.componentAdded);
SendRoutingInfoForSMRequest sriReq = (SendRoutingInfoForSMRequest) evt.event;
assertEquals(sriReq.getMsisdn().getAddress(), msdnDig);
assertEquals(sriReq.getServiceCentreAddress().getAddress(), smscPropertiesManagement.getServiceCenterGt());
evt = lstEvt.get(1);
assertEquals(evt.testEventType, MAPTestEventType.send);
assertNull(serviceRsds.getLastMAPDialogSms());
// SRI response
IMSI imsi = new IMSIImpl(imsiDig);
ISDNAddressString networkNodeNumber = new ISDNAddressStringImpl(AddressNature.international_number, org.restcomm.protocols.ss7.map.api.primitives.NumberingPlan.ISDN, nnnDig);
LocationInfoWithLMSI locationInfoWithLMSI = new LocationInfoWithLMSIImpl(networkNodeNumber, null, null, false, null);
SendRoutingInfoForSMResponse evt1 = new SendRoutingInfoForSMResponseImpl(imsi, locationInfoWithLMSI, null, null, null);
evt1.setMAPDialog(dlg);
this.sriSbb.onSendRoutingInfoForSMResponse(evt1, null);
this.sriSbb.onDialogDelimiter(null, null);
smsx1 = this.pers.obtainArchiveSms(procDueSlot, smsSet.getDestAddr(), smsId);
assertNull(smsx1);
smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(procTargetId);
assertNotNull(smsSetX);
smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId[0]);
assertEquals(smsX.getSmsSet().getInSystem(), 0);
assertEquals(SmsSetCache.getInstance().getProcessingSmsSetSize(), 1);
dlg = serviceMt.getLastMAPDialogSms();
lstEvt = dlg.getEventList();
assertEquals(lstEvt.size(), 2);
// MT response - error
MAPErrorMessage mapErrorMessage = new MAPErrorMessageSMDeliveryFailureImpl(3, SMEnumeratedDeliveryFailureCause.memoryCapacityExceeded, null, null);
ErrorComponent evt2 = new ErrorComponent(dlg, 0L, mapErrorMessage);
this.mtSbb.onErrorComponent(evt2, null);
this.mtSbb.onDialogDelimiter(null, null);
PreparedStatementCollection[] pscc = this.pers.c2_getPscList();
long l1 = 0;
for (PreparedStatementCollection psc : pscc) {
l1 = this.pers.c2_getDueSlotForTargetId(psc, procTargetId);
if (l1 != 0)
break;
}
smsx1 = this.pers.obtainArchiveSms(l1, smsSet.getDestAddr(), smsId);
assertNull(smsx1);
smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(procTargetId);
assertNull(smsSetX);
smsX = this.pers.obtainLiveSms(l1, procTargetId, procId[0]);
assertEquals(smsX.getSmsSet().getInSystem(), 0);
assertEquals(SmsSetCache.getInstance().getProcessingSmsSetSize(), 0);
assertEquals(smsSet.getStatus(), ErrorCode.MESSAGE_QUEUE_FULL);
// assertEquals(smsSet.getInSystem(), 1);
// this.testDateEq(smsSet.getInSystemDate(), curDate);
assertEquals(smsSet.getDueDelay(), SmscPropertiesManagement.getInstance().getSecondDueDelay());
this.testDateEq(new Date(new Date().getTime() + SmscPropertiesManagement.getInstance().getSecondDueDelay() * 1000), smsSet.getDueDate());
assertFalse(smsSet.isAlertingSupported());
SmsSet smsSet2 = smsX.getSmsSet();
assertEquals(smsSet2.getStatus(), ErrorCode.MESSAGE_QUEUE_FULL);
// assertEquals(smsSet2.getInSystem(), 1);
// this.testDateEq(smsSet2.getInSystemDate(), curDate);
assertEquals(smsSet2.getDueDelay(), SmscPropertiesManagement.getInstance().getSecondDueDelay());
// this.testDateEq(new Date(new Date().getTime() + SmscPropertiesManagement.getInstance().getSecondDueDelay() * 1000), smsSet2.getDueDate());
assertFalse(smsSet2.isAlertingSupported());
dlg = serviceRsds.getLastMAPDialogSms();
acv = dlg.getApplicationContext().getApplicationContextVersion();
assertEquals(acv, MAPApplicationContextVersion.version3);
assertEquals(dlg.getLocalAddress().getGlobalTitle().getDigits(), smscPropertiesManagement.getServiceCenterGt());
assertEquals(dlg.getRemoteAddress().getGlobalTitle().getDigits(), msdnDig);
lstEvt = dlg.getEventList();
assertEquals(lstEvt.size(), 2);
evt = lstEvt.get(0);
assertEquals(evt.testEventType, MAPTestEventType.componentAdded);
ReportSMDeliveryStatusRequestImpl rsdsReq = (ReportSMDeliveryStatusRequestImpl) evt.event;
assertEquals(rsdsReq.getServiceCentreAddress().getAddress(), smscPropertiesManagement.getServiceCenterGt());
assertEquals(rsdsReq.getMsisdn().getAddress(), msdnDig);
assertEquals(rsdsReq.getSMDeliveryOutcome(), SMDeliveryOutcome.memoryCapacityExceeded);
evt = lstEvt.get(1);
assertEquals(evt.testEventType, MAPTestEventType.send);
// rsds response 2
ReportSMDeliveryStatusResponseImpl evt7 = new ReportSMDeliveryStatusResponseImpl(2, null, null);
evt7.setMAPDialog(dlg);
this.rsdsSbb.onReportSMDeliveryStatusResponse(evt7, null);
DialogClose dcl = new DialogClose(dlg);
this.rsdsSbb.onDialogClose(dcl, null);
// assertTrue(smsSet.isAlertingSupported());
}
use of org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage in project smscgateway by RestComm.
the class HrSriClientSbb method onSriFullResponse.
private void onSriFullResponse() {
SendRoutingInfoForSMResponse sendRoutingInfoForSMResponse = this.getSendRoutingInfoForSMResponse();
MAPErrorMessage errorMessage = this.getErrorResponse();
CorrelationIdValue correlationIdValue = this.getCorrelationIdValue();
if (correlationIdValue == null) {
this.logger.severe("Home routing HrSriClientSbb.onSriFullResponse(): CorrelationIdValue CMP missed");
return;
}
if (sendRoutingInfoForSMResponse != null) {
// we have positive response to SRI request
correlationIdValue.setImsi(sendRoutingInfoForSMResponse.getIMSI().getData());
correlationIdValue.setLocationInfoWithLMSI(sendRoutingInfoForSMResponse.getLocationInfoWithLMSI());
correlationIdValue.setSendRoutingInfoForSMResponse(sendRoutingInfoForSMResponse);
MProcResult mProcResult = MProcManagement.getInstance().applyMProcHrSri(getMProcRuleRa(), correlationIdValue);
if (mProcResult.isHrIsByPassed()) {
this.returnSriHrByPass(correlationIdValue);
} else {
this.returnSriSuccess(correlationIdValue);
}
return;
}
if (errorMessage != null) {
// we have a negative response
this.returnSriFailure(correlationIdValue, errorMessage, "Home routing HrSriClientSbb.onSriFullResponse(): MAP ErrorMessage received: " + errorMessage);
} else {
// we have no responses - this is an error behaviour
this.returnSriFailure(correlationIdValue, null, "Home routing HrSriClientSbb.onSriFullResponse(): Empty response after SRI Request");
}
}
use of org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage in project smscgateway by RestComm.
the class HrSriServerSbb method onSendRoutingInfoForSMRequest.
/**
* MAP SMS Events
*/
/**
* Received SRI request. But this is error, we should never receive this
* request
*
* @param evt
* @param aci
*/
public void onSendRoutingInfoForSMRequest(SendRoutingInfoForSMRequest evt, ActivityContextInterface aci) {
if (this.logger.isInfoEnabled()) {
this.logger.info("Home routing: HrSriServerSbb: Received SEND_ROUTING_INFO_FOR_SM_REQUEST = " + evt + " Dialog=" + evt.getMAPDialog());
}
this.setInvokeId(evt.getInvokeId());
MAPDialogSms dialog = evt.getMAPDialog();
// we are changing here SSN in CallingPartyAddress of a SRI response to HLR SSN
// because it is possible that this address has been updated inside SCCP routing procedure
// when a message came to SMSC
// TODO: check if it is a proper solution ?
SccpAddress locAddr = dialog.getLocalAddress();
SccpAddress locAddr2 = sccpParameterFact.createSccpAddress(locAddr.getAddressIndicator().getRoutingIndicator(), locAddr.getGlobalTitle(), locAddr.getSignalingPointCode(), smscPropertiesManagement.getHlrSsn());
dialog.setLocalAddress(locAddr2);
if (smscPropertiesManagement.getHrCharging() == MoChargingType.reject) {
try {
MAPErrorMessage errorMessage = this.mapProvider.getMAPErrorMessageFactory().createMAPErrorMessageFacilityNotSup(null, null, null);
dialog.sendErrorComponent(evt.getInvokeId(), errorMessage);
if (this.logger.isInfoEnabled()) {
this.logger.info("Home routing: Sent ErrorComponent = " + errorMessage);
}
if (smscPropertiesManagement.isGenerateRejectionCdr()) {
generateCDR(dialog.getNetworkId(), CdrGenerator.CDR_SUBMIT_FAILED_HR, errorMessage.toString(), true);
}
dialog.close(false);
return;
} catch (Throwable e) {
logger.severe("Home routing: Error while sending Error message", e);
return;
}
}
setupSriRequest(evt.getMsisdn(), evt.getServiceCentreAddress(), dialog.getNetworkId(), dialog.getRemoteAddress());
}
use of org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage in project smscgateway by RestComm.
the class MAPListener method onForwardShortMessageRequest.
@Override
public void onForwardShortMessageRequest(ForwardShortMessageRequest event) {
if (logger.isInfoEnabled()) {
logger.info("Rx : onForwardShortMessageRequest=" + event);
}
// Lets first close the Dialog
MAPDialogSms mapDialogSms = event.getMAPDialog();
try {
if (this.currentMapMessageCount % 7 == 0) {
// Send back AbsentSubscriber for every 7th MtSMS
MAPErrorMessage mapErrorMessage = mAPErrorMessageFactory.createMAPErrorMessageAbsentSubscriberSM(AbsentSubscriberDiagnosticSM.IMSIDetached, null, null);
mapDialogSms.sendErrorComponent(event.getInvokeId(), mapErrorMessage);
// mapDialogSms.close(false);
} else {
mapDialogSms.addForwardShortMessageResponse(event.getInvokeId());
// mapDialogSms.close(false);
}
} catch (MAPException e) {
logger.error("Error while sending MAPErrorMessageAbsentSubscriberSM ", e);
}
mapDialogSms.setUserObject(true);
}
Aggregations