Search in sources :

Example 1 with MAPErrorMessage

use of org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessage in project smscgateway by RestComm.

the class MAPListener method onMtForwardShortMessageRequest.

@Override
public void onMtForwardShortMessageRequest(MtForwardShortMessageRequest event) {
    if (logger.isInfoEnabled()) {
        logger.info("Rx : onMtForwardShortMessageIndication=" + event);
    }
    // Lets first close the Dialog
    MAPDialogSms mapDialogSms = event.getMAPDialog();
    // boolean sendError = true;
    try {
        if (this.currentMapMessageCount % 7 == 0) {
            // if (sendError) {
            // 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.addMtForwardShortMessageResponse(event.getInvokeId(), null, null);
        // mapDialogSms.close(false);
        }
    } catch (MAPException e) {
        logger.error("Error while sending MAPErrorMessageAbsentSubscriberSM ", e);
    }
    mapDialogSms.setUserObject(true);
}
Also used : MAPDialogSms(org.mobicents.protocols.ss7.map.api.service.sms.MAPDialogSms) MAPException(org.mobicents.protocols.ss7.map.api.MAPException) MAPErrorMessage(org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessage)

Example 2 with MAPErrorMessage

use of org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessage in project smscgateway by RestComm.

the class HrSriClientSbb method onErrorComponent.

public void onErrorComponent(ErrorComponent event, ActivityContextInterface aci) {
    super.onErrorComponent(event, aci);
    try {
        // we store error into CMP
        MAPErrorMessage mapErrorMessage = event.getMAPErrorMessage();
        this.setErrorResponse(mapErrorMessage);
        if (mapErrorMessage.isEmAbsentSubscriber()) {
            MAPErrorMessageAbsentSubscriber errAs = mapErrorMessage.getEmAbsentSubscriber();
            Boolean mwdSet = errAs.getMwdSet();
            if (mwdSet != null && mwdSet) {
                MWStatus mwStatus = event.getMAPDialog().getService().getMAPProvider().getMAPParameterFactory().createMWStatus(false, true, false, false);
                CorrelationIdValue correlationIdValue = this.getCorrelationIdValue();
                if (correlationIdValue != null) {
                    correlationIdValue.setMwStatus(mwStatus);
                    this.setCorrelationIdValue(correlationIdValue);
                }
            }
        }
    } catch (Throwable e1) {
        logger.severe("Exception in HrSriClientSbb.onErrorComponent when fetching records and issuing events: " + e1.getMessage(), e1);
    }
}
Also used : MAPErrorMessageAbsentSubscriber(org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessageAbsentSubscriber) MWStatus(org.mobicents.protocols.ss7.map.api.service.sms.MWStatus) CorrelationIdValue(org.mobicents.smsc.library.CorrelationIdValue) MAPErrorMessage(org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessage)

Example 3 with MAPErrorMessage

use of org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessage in project smscgateway by RestComm.

the class MtTest method testMProc_TempFail.

@Test(groups = { "Mt" })
public void testMProc_TempFail() throws Exception {
    if (!this.cassandraDbInited)
        return;
    MProcManagement mProcManagement = MProcManagement.getInstance();
    SmscManagement smscManagement = SmscManagement.getInstance("Test");
    SmppManagement smppManagement = SmppManagement.getInstance("Test");
    smscManagement.setSmppManagement(smppManagement);
    mProcManagement.setSmscManagement(smscManagement);
    smscManagement.registerRuleFactory(new MProcRuleFactoryDefault());
    DBOperations.getInstance().stop();
    smscManagement.start();
    try {
        mProcManagement.destroyMProcRule(1);
    } catch (Exception e) {
    }
    try {
        mProcManagement.destroyMProcRule(2);
    } catch (Exception e) {
    }
    // mProcManagement.createMProcRule(1, MProcRuleFactoryDefault.RULE_CLASS_NAME,
    // "networkidmask 0 newnetworkidaftertempfail 1");
    mProcManagement.createMProcRule(1, MProcRuleFactoryDefault.RULE_CLASS_NAME, "networkidmask 0 newnetworkidafterpermfail 1");
    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);
    // initial onSms message
    SmsSetEvent event = new SmsSetEvent();
    event.setSmsSet(smsSet);
    this.sriSbb.onSms(event, null, null);
    MAPDialogSmsProxy dlg = serviceSri.getLastMAPDialogSms();
    // assertFalse(this.mtSbb.isMAPVersionTested(MAPApplicationContextVersion.version1));
    // assertFalse(this.mtSbb.isMAPVersionTested(MAPApplicationContextVersion.version2));
    // assertFalse(this.mtSbb.isMAPVersionTested(MAPApplicationContextVersion.version3));
    // assertFalse(this.mtSbb.isNegotiatedMapVersionUsing());
    // SRI response
    IMSI imsi = new IMSIImpl(imsiDig);
    ISDNAddressString networkNodeNumber = new ISDNAddressStringImpl(AddressNature.international_number, org.mobicents.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);
    evt1.setMAPDialog(dlg);
    // MAPErrorMessage mapErrorMessage = new MAPErrorMessageAbsentSubscriberSMImpl(null, null, null);
    // ErrorComponent evt2 = new ErrorComponent(dlg, 0L, mapErrorMessage);
    MAPErrorMessage mapErrorMessage = new MAPErrorMessageUnknownSubscriberImpl(null, null);
    ErrorComponent evt2 = new ErrorComponent(dlg, 0L, mapErrorMessage);
    this.sriSbb.onErrorComponent(evt2, null);
    this.sriSbb.onDialogDelimiter(null, null);
    // ....................
    // assertFalse(this.mtSbb.isMAPVersionTested(MAPApplicationContextVersion.version1));
    // assertFalse(this.mtSbb.isMAPVersionTested(MAPApplicationContextVersion.version2));
    // assertTrue(this.mtSbb.isMAPVersionTested(MAPApplicationContextVersion.version3));
    // assertFalse(this.mtSbb.isNegotiatedMapVersionUsing());
    dlg = serviceMt.getLastMAPDialogSms();
// MAPApplicationContextVersion vers = dlg.getApplicationContext().getApplicationContextVersion();
// assertEquals(vers, MAPApplicationContextVersion.version3);
}
Also used : MProcManagement(org.mobicents.smsc.domain.MProcManagement) LocationInfoWithLMSI(org.mobicents.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) MAPErrorMessageUnknownSubscriberImpl(org.mobicents.protocols.ss7.map.errors.MAPErrorMessageUnknownSubscriberImpl) IMSIImpl(org.mobicents.protocols.ss7.map.primitives.IMSIImpl) ArrayList(java.util.ArrayList) ISDNAddressString(org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString) SendRoutingInfoForSMResponse(org.mobicents.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMResponse) SendRoutingInfoForSMResponseImpl(org.mobicents.protocols.ss7.map.service.sms.SendRoutingInfoForSMResponseImpl) MProcRuleFactoryDefault(org.mobicents.smsc.mproc.impl.MProcRuleFactoryDefault) SmscManagement(org.mobicents.smsc.domain.SmscManagement) IMSI(org.mobicents.protocols.ss7.map.api.primitives.IMSI) SmppManagement(org.restcomm.smpp.SmppManagement) LocationInfoWithLMSIImpl(org.mobicents.protocols.ss7.map.service.sms.LocationInfoWithLMSIImpl) PersistenceException(org.mobicents.smsc.cassandra.PersistenceException) ErrorComponent(org.mobicents.slee.resource.map.events.ErrorComponent) MAPDialogSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy) ISDNAddressStringImpl(org.mobicents.protocols.ss7.map.primitives.ISDNAddressStringImpl) SmscPropertiesManagement(org.mobicents.smsc.domain.SmscPropertiesManagement) Sms(org.mobicents.smsc.library.Sms) SmsSet(org.mobicents.smsc.library.SmsSet) MAPErrorMessage(org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessage) Test(org.testng.annotations.Test)

Example 4 with MAPErrorMessage

use of org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessage in project smscgateway by RestComm.

the class MtTest method SuccessError3Test.

/**
 * MAP V3, SRI error absentSubscriber -> RSDS -> new delivery attempt -> SRI error absentSubscriber -> RSDS
 */
@Test(groups = { "Mt" })
public void SuccessError3Test() 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();
    // SRI response
    MAPErrorMessage mapErrorMessage = new MAPErrorMessageAbsentSubscriberSMImpl(null, null, null);
    ErrorComponent evt2 = new ErrorComponent(dlg, 0L, mapErrorMessage);
    this.sriSbb.onErrorComponent(evt2, null);
    ISDNAddressStringImpl storedMSISDN = new ISDNAddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, msdnDig);
    MWStatusImpl mwStatus = new MWStatusImpl(false, true, false, true);
    InformServiceCentreRequestImpl evt4 = new InformServiceCentreRequestImpl(storedMSISDN, mwStatus, null, null, null);
    evt4.setMAPDialog(dlg);
    this.sriSbb.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.ABSENT_SUBSCRIBER);
    // 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());
    dlg = serviceRsds.getLastMAPDialogSms();
    // 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);
    // second delivery attempt **********************
    ArrayList<SmsSet> lst1 = this.pers.c2_getRecordList(l1);
    ArrayList<SmsSet> lst2 = this.pers.c2_sortRecordList(lst1);
    smsSet = lst2.get(0);
    // initial onSms message
    event = new SmsSetEvent();
    event.setSmsSet(smsSet);
    this.sriSbb.makeDlvIsNotInited();
    this.sriSbb.onSms(event, null, null);
    dlg = serviceSri.getLastMAPDialogSms();
    // SRI response
    mapErrorMessage = new MAPErrorMessageAbsentSubscriberSMImpl(null, null, null);
    evt2 = new ErrorComponent(dlg, 0L, mapErrorMessage);
    this.sriSbb.onErrorComponent(evt2, null);
    storedMSISDN = new ISDNAddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, msdnDig);
    mwStatus = new MWStatusImpl(false, true, false, true);
    evt4 = new InformServiceCentreRequestImpl(storedMSISDN, mwStatus, null, null, null);
    evt4.setMAPDialog(dlg);
    this.sriSbb.onDialogDelimiter(null, null);
    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.getDueDelay(), 600);
    this.testDateEq(new Date(new Date().getTime() + 600 * 1000), smsSet.getDueDate());
    for (PreparedStatementCollection psc : pscc) {
        l1 = this.pers.c2_getDueSlotForTargetId(psc, taR.getTargetId());
        if (l1 != 0)
            break;
    }
    assertEquals(l1, 0);
// we do no test here rsds response 2 - it is the same
}
Also used : MWStatusImpl(org.mobicents.protocols.ss7.map.service.sms.MWStatusImpl) MAPServiceSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy) SmsSetEvent(org.mobicents.smsc.slee.services.smpp.server.events.SmsSetEvent) ReportSMDeliveryStatusResponseImpl(org.mobicents.protocols.ss7.map.service.sms.ReportSMDeliveryStatusResponseImpl) ArrayList(java.util.ArrayList) PreparedStatementCollection(org.mobicents.smsc.cassandra.PreparedStatementCollection) Date(java.util.Date) ErrorComponent(org.mobicents.slee.resource.map.events.ErrorComponent) MAPErrorMessageAbsentSubscriberSMImpl(org.mobicents.protocols.ss7.map.errors.MAPErrorMessageAbsentSubscriberSMImpl) MAPDialogSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy) ISDNAddressStringImpl(org.mobicents.protocols.ss7.map.primitives.ISDNAddressStringImpl) DialogClose(org.mobicents.slee.resource.map.events.DialogClose) SmscPropertiesManagement(org.mobicents.smsc.domain.SmscPropertiesManagement) SmsProxy(org.mobicents.smsc.slee.resources.persistence.SmsProxy) MAPServiceSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy) MAPDialogSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy) Sms(org.mobicents.smsc.library.Sms) UUID(java.util.UUID) InformServiceCentreRequestImpl(org.mobicents.protocols.ss7.map.service.sms.InformServiceCentreRequestImpl) SmsSet(org.mobicents.smsc.library.SmsSet) MAPErrorMessage(org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessage) Test(org.testng.annotations.Test)

Example 5 with MAPErrorMessage

use of org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessage in project smscgateway by RestComm.

the class MtTest method SuccessError1Test.

/**
 * MAP V3, SRI error absentSubscriber + ISC -> RSDS
 */
@Test(groups = { "Mt" })
public void SuccessError1Test() 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());
    // SmsSet smsSet2 = pers.obtainSmsSet(ta1);
    SmsSet smsSet2 = smsX.getSmsSet();
    assertEquals(smsSet2.getStatus(), ErrorCode.SUCCESS);
    assertEquals(smsSet2.getInSystem(), 0);
    // this.testDateEq(smsSet2.getInSystemDate(), curDate);
    assertEquals(smsSet2.getDueDelay(), 0);
    assertNull(smsSet2.getDueDate());
    assertFalse(smsSet2.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
    MAPErrorMessage mapErrorMessage = new MAPErrorMessageAbsentSubscriberSMImpl(null, null, null);
    ErrorComponent evt2 = new ErrorComponent(dlg, 0L, mapErrorMessage);
    this.sriSbb.onErrorComponent(evt2, null);
    ISDNAddressStringImpl storedMSISDN = new ISDNAddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, msdnDig);
    MWStatusImpl mwStatus = new MWStatusImpl(false, true, false, true);
    InformServiceCentreRequestImpl evt4 = new InformServiceCentreRequestImpl(storedMSISDN, mwStatus, null, null, null);
    evt4.setMAPDialog(dlg);
    this.sriSbb.onInformServiceCentreRequest(evt4, null);
    this.sriSbb.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;
    }
    smsX = this.pers.obtainLiveSms(l1, procTargetId, procId[0]);
    smsSet2 = smsX.getSmsSet();
    assertEquals(smsSet2.getStatus(), ErrorCode.ABSENT_SUBSCRIBER);
    assertEquals(smsSet2.getInSystem(), 0);
    // 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());
    smsId = sms1.getDbId();
    smsx1 = this.pers.obtainArchiveSms(procDueSlot, smsSet.getDestAddr(), smsId);
    assertNull(smsx1);
    smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(procTargetId);
    assertNull(smsSetX);
    smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId[0]);
    assertNull(smsX);
    smsX = this.pers.obtainLiveSms(l1, procTargetId, procId[0]);
    assertNotNull(smsX);
    assertEquals(SmsSetCache.getInstance().getProcessingSmsSetSize(), 0);
    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.absentSubscriber);
    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);
    smsX = this.pers.obtainLiveSms(l1, procTargetId, procId[0]);
    smsSet2 = smsX.getSmsSet();
    assertEquals(smsSet2.getStatus(), ErrorCode.ABSENT_SUBSCRIBER);
    assertEquals(smsSet2.getInSystem(), 0);
    assertEquals(smsSet2.getDueDelay(), SmscPropertiesManagement.getInstance().getSecondDueDelay());
// TODO: alertingSupport field is not now filled (It can be filled in: this.rsdsSbb.onReportSMDeliveryStatusResponse(evt7, null);)
// assertTrue(smsSet2.isAlertingSupported());
// TODO: ???? .........
// boolean b1 = this.pers.checkSmsSetExists(taR);
// TODO: ???? .........
// assertFalse(b1);
}
Also used : MWStatusImpl(org.mobicents.protocols.ss7.map.service.sms.MWStatusImpl) SendRoutingInfoForSMRequest(org.mobicents.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMRequest) MAPServiceSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy) SmsSetEvent(org.mobicents.smsc.slee.services.smpp.server.events.SmsSetEvent) ReportSMDeliveryStatusResponseImpl(org.mobicents.protocols.ss7.map.service.sms.ReportSMDeliveryStatusResponseImpl) ArrayList(java.util.ArrayList) MAPApplicationContextVersion(org.mobicents.protocols.ss7.map.api.MAPApplicationContextVersion) MAPErrorMessageAbsentSubscriberSMImpl(org.mobicents.protocols.ss7.map.errors.MAPErrorMessageAbsentSubscriberSMImpl) SmsProxy(org.mobicents.smsc.slee.resources.persistence.SmsProxy) MAPServiceSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy) MAPDialogSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy) UUID(java.util.UUID) InformServiceCentreRequestImpl(org.mobicents.protocols.ss7.map.service.sms.InformServiceCentreRequestImpl) MAPTestEvent(org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy.MAPTestEvent) PreparedStatementCollection(org.mobicents.smsc.cassandra.PreparedStatementCollection) ErrorComponent(org.mobicents.slee.resource.map.events.ErrorComponent) MAPDialogSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy) ISDNAddressStringImpl(org.mobicents.protocols.ss7.map.primitives.ISDNAddressStringImpl) DialogClose(org.mobicents.slee.resource.map.events.DialogClose) SmscPropertiesManagement(org.mobicents.smsc.domain.SmscPropertiesManagement) Sms(org.mobicents.smsc.library.Sms) ReportSMDeliveryStatusRequestImpl(org.mobicents.protocols.ss7.map.service.sms.ReportSMDeliveryStatusRequestImpl) SmsSet(org.mobicents.smsc.library.SmsSet) MAPErrorMessage(org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessage) Test(org.testng.annotations.Test)

Aggregations

MAPErrorMessage (org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessage)17 ISDNAddressString (org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString)7 MAPDialogSms (org.mobicents.protocols.ss7.map.api.service.sms.MAPDialogSms)7 SmsSet (org.mobicents.smsc.library.SmsSet)7 ArrayList (java.util.ArrayList)6 MAPException (org.mobicents.protocols.ss7.map.api.MAPException)6 Sms (org.mobicents.smsc.library.Sms)6 AddressString (org.mobicents.protocols.ss7.map.api.primitives.AddressString)5 ISDNAddressStringImpl (org.mobicents.protocols.ss7.map.primitives.ISDNAddressStringImpl)5 ErrorComponent (org.mobicents.slee.resource.map.events.ErrorComponent)5 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 Test (org.testng.annotations.Test)5 UUID (java.util.UUID)4 SendRoutingInfoForSMResponse (org.mobicents.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMResponse)4 ReportSMDeliveryStatusResponseImpl (org.mobicents.protocols.ss7.map.service.sms.ReportSMDeliveryStatusResponseImpl)4 DialogClose (org.mobicents.slee.resource.map.events.DialogClose)4 PreparedStatementCollection (org.mobicents.smsc.cassandra.PreparedStatementCollection)4