Search in sources :

Example 16 with MAPErrorMessage

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());
}
Also used : SendRoutingInfoForSMRequest(org.restcomm.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMRequest) LocationInfoWithLMSI(org.restcomm.protocols.ss7.map.api.service.sms.LocationInfoWithLMSI) MAPServiceSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy) SmsSetEvent(org.mobicents.smsc.slee.services.smpp.server.events.SmsSetEvent) ReportSMDeliveryStatusResponseImpl(org.restcomm.protocols.ss7.map.service.sms.ReportSMDeliveryStatusResponseImpl) IMSIImpl(org.restcomm.protocols.ss7.map.primitives.IMSIImpl) ArrayList(java.util.ArrayList) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) SendRoutingInfoForSMResponse(org.restcomm.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMResponse) MAPApplicationContextVersion(org.restcomm.protocols.ss7.map.api.MAPApplicationContextVersion) SendRoutingInfoForSMResponseImpl(org.restcomm.protocols.ss7.map.service.sms.SendRoutingInfoForSMResponseImpl) SmsProxy(org.mobicents.smsc.slee.resources.persistence.SmsProxy) MAPServiceSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy) MAPDialogSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy) IMSI(org.restcomm.protocols.ss7.map.api.primitives.IMSI) UUID(java.util.UUID) LocationInfoWithLMSIImpl(org.restcomm.protocols.ss7.map.service.sms.LocationInfoWithLMSIImpl) MAPTestEvent(org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy.MAPTestEvent) PreparedStatementCollection(org.mobicents.smsc.cassandra.PreparedStatementCollection) Date(java.util.Date) ErrorComponent(org.restcomm.slee.resource.map.events.ErrorComponent) MAPDialogSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy) ISDNAddressStringImpl(org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl) DialogClose(org.restcomm.slee.resource.map.events.DialogClose) SmscPropertiesManagement(org.mobicents.smsc.domain.SmscPropertiesManagement) Sms(org.mobicents.smsc.library.Sms) MAPErrorMessageSMDeliveryFailureImpl(org.restcomm.protocols.ss7.map.errors.MAPErrorMessageSMDeliveryFailureImpl) ReportSMDeliveryStatusRequestImpl(org.restcomm.protocols.ss7.map.service.sms.ReportSMDeliveryStatusRequestImpl) SmsSet(org.mobicents.smsc.library.SmsSet) MAPErrorMessage(org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage) Test(org.testng.annotations.Test)

Example 17 with MAPErrorMessage

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");
    }
}
Also used : MProcResult(org.mobicents.smsc.mproc.impl.MProcResult) SendRoutingInfoForSMResponse(org.restcomm.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMResponse) CorrelationIdValue(org.mobicents.smsc.library.CorrelationIdValue) MAPErrorMessage(org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage)

Example 18 with MAPErrorMessage

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());
}
Also used : SccpAddress(org.restcomm.protocols.ss7.sccp.parameter.SccpAddress) MAPDialogSms(org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms) MAPErrorMessage(org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage)

Example 19 with MAPErrorMessage

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);
}
Also used : MAPDialogSms(org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms) MAPException(org.restcomm.protocols.ss7.map.api.MAPException) MAPErrorMessage(org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage)

Aggregations

MAPErrorMessage (org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage)17 SmsSet (org.mobicents.smsc.library.SmsSet)7 ISDNAddressString (org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString)7 MAPDialogSms (org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms)7 ArrayList (java.util.ArrayList)6 Sms (org.mobicents.smsc.library.Sms)6 MAPException (org.restcomm.protocols.ss7.map.api.MAPException)6 SmscPropertiesManagement (org.mobicents.smsc.domain.SmscPropertiesManagement)5 MAPDialogSmsProxy (org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy)5 MAPServiceSmsProxy (org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy)5 SmsSetEvent (org.mobicents.smsc.slee.services.smpp.server.events.SmsSetEvent)5 AddressString (org.restcomm.protocols.ss7.map.api.primitives.AddressString)5 ISDNAddressStringImpl (org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl)5 ErrorComponent (org.restcomm.slee.resource.map.events.ErrorComponent)5 Test (org.testng.annotations.Test)5 UUID (java.util.UUID)4 PreparedStatementCollection (org.mobicents.smsc.cassandra.PreparedStatementCollection)4 SmsProxy (org.mobicents.smsc.slee.resources.persistence.SmsProxy)4 SendRoutingInfoForSMResponse (org.restcomm.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMResponse)4 ReportSMDeliveryStatusResponseImpl (org.restcomm.protocols.ss7.map.service.sms.ReportSMDeliveryStatusResponseImpl)4