Search in sources :

Example 6 with LocationInfoWithLMSI

use of org.restcomm.protocols.ss7.map.api.service.sms.LocationInfoWithLMSI 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.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);
    // 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.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) MAPErrorMessageUnknownSubscriberImpl(org.restcomm.protocols.ss7.map.errors.MAPErrorMessageUnknownSubscriberImpl) 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) SendRoutingInfoForSMResponseImpl(org.restcomm.protocols.ss7.map.service.sms.SendRoutingInfoForSMResponseImpl) MProcRuleFactoryDefault(org.mobicents.smsc.mproc.impl.MProcRuleFactoryDefault) SmscManagement(org.mobicents.smsc.domain.SmscManagement) IMSI(org.restcomm.protocols.ss7.map.api.primitives.IMSI) SmppManagement(org.restcomm.smpp.SmppManagement) LocationInfoWithLMSIImpl(org.restcomm.protocols.ss7.map.service.sms.LocationInfoWithLMSIImpl) PersistenceException(org.mobicents.smsc.cassandra.PersistenceException) ErrorComponent(org.restcomm.slee.resource.map.events.ErrorComponent) MAPDialogSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy) ISDNAddressStringImpl(org.restcomm.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.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage) Test(org.testng.annotations.Test)

Example 7 with LocationInfoWithLMSI

use of org.restcomm.protocols.ss7.map.api.service.sms.LocationInfoWithLMSI in project smscgateway by RestComm.

the class MtTest method SuccessDeliveryUsimTest.

/**
 * MAP V3, 1 message, 1 segment, USim message
 */
@Test(groups = { "Mt" })
public void SuccessDeliveryUsimTest() 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();
    sd1.dataCodingScheme = 246;
    sd1.esmClass = 0x43;
    sd1.msg = "012345012345";
    sd1.msgUdh = new byte[] { 2, 112, 0 };
    lst.add(sd1);
    SmsSet smsSet = prepareDatabase(lst);
    // SmsSet smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(smsSet.getTargetId());
    // assertNotNull(smsSetX);
    // Sms smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId[0]);
    // assertEquals(smsX.getSmsSet().getInSystem(), 0);
    // 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);
    // assertNull(serviceMt.getLastMAPDialogSms());
    // ArrayList<MAPTestEvent> lstEvt = dlg.getEventList();
    // assertEquals(lstEvt.size(), 2);
    // assertEquals(dlg.getLocalAddress().getGlobalTitle().getDigits(), smscPropertiesManagement.getServiceCenterGt());
    // assertEquals(((GlobalTitle0100) dlg.getLocalAddress().getGlobalTitle()).getNumberingPlan(), org.restcomm.protocols.ss7.indicator.NumberingPlan.ISDN_TELEPHONY);
    // assertEquals(((GlobalTitle0100) dlg.getLocalAddress().getGlobalTitle()).getNatureOfAddress(), NatureOfAddress.INTERNATIONAL);
    // assertEquals(dlg.getRemoteAddress().getGlobalTitle().getDigits(), msdnDig);
    // assertEquals(((GlobalTitle0100) dlg.getRemoteAddress().getGlobalTitle()).getNumberingPlan(), org.restcomm.protocols.ss7.indicator.NumberingPlan.ISDN_TELEPHONY);
    // assertEquals(((GlobalTitle0100) dlg.getRemoteAddress().getGlobalTitle()).getNatureOfAddress(), NatureOfAddress.INTERNATIONAL);
    // 
    // MAPTestEvent evt = lstEvt.get(0);
    // assertEquals(evt.testEventType, MAPTestEventType.componentAdded);
    // SendRoutingInfoForSMRequest sriReq = (SendRoutingInfoForSMRequest) evt.event;
    // assertEquals(sriReq.getMsisdn().getAddress(), msdnDig);
    // assertEquals(sriReq.getMsisdn().getAddressNature(), AddressNature.international_number);
    // assertEquals(sriReq.getMsisdn().getNumberingPlan(), org.restcomm.protocols.ss7.map.api.primitives.NumberingPlan.ISDN);
    // assertEquals(sriReq.getServiceCentreAddress().getAddress(), smscPropertiesManagement.getServiceCenterGt());
    // assertEquals(sriReq.getServiceCentreAddress().getAddressNature(), AddressNature.international_number);
    // assertEquals(sriReq.getServiceCentreAddress().getNumberingPlan(), org.restcomm.protocols.ss7.map.api.primitives.NumberingPlan.ISDN);
    // assertTrue(sriReq.getSm_RP_PRI());
    // evt = lstEvt.get(1);
    // assertEquals(evt.testEventType, MAPTestEventType.send);
    // smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(smsSet.getTargetId());
    // assertNotNull(smsSetX);
    // smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId[0]);
    // assertEquals(smsX.getSmsSet().getInSystem(), 0);
    // 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);
    dlg = serviceMt.getLastMAPDialogSms();
    // acv =  dlg.getApplicationContext().getApplicationContextVersion();
    // assertEquals(acv, MAPApplicationContextVersion.version3);
    // 
    // lstEvt = dlg.getEventList();
    // assertEquals(lstEvt.size(), 2);
    dlg = serviceMt.getLastMAPDialogSms();
    ArrayList<MAPTestEvent> lstEvt = dlg.getEventList();
    assertEquals(lstEvt.size(), 2);
    MAPTestEvent evt = lstEvt.get(0);
    assertEquals(evt.testEventType, MAPTestEventType.componentAdded);
    MtForwardShortMessageRequestImpl mtFsmReq = (MtForwardShortMessageRequestImpl) evt.event;
    assertFalse(mtFsmReq.getMoreMessagesToSend());
    SM_RP_DA sm_RP_DA = mtFsmReq.getSM_RP_DA();
    IMSI daImsi = sm_RP_DA.getIMSI();
    assertEquals(daImsi.getData(), imsiDig);
    SM_RP_OA sm_RP_OA = mtFsmReq.getSM_RP_OA();
    AddressString scas = sm_RP_OA.getServiceCentreAddressOA();
    assertEquals(scas.getAddress(), smscPropertiesManagement.getServiceCenterGt());
    assertEquals(scas.getAddressNature(), AddressNature.international_number);
    assertEquals(scas.getNumberingPlan(), org.restcomm.protocols.ss7.map.api.primitives.NumberingPlan.ISDN);
    SmsSignalInfo ssi = mtFsmReq.getSM_RP_UI();
    SmsDeliverTpdu tpdu = (SmsDeliverTpdu) ssi.decodeTpdu(false);
// assertEquals(tpdu.getDataCodingScheme().getCode(), 16);
// assertFalse(tpdu.getForwardedOrSpawned());
// assertFalse(tpdu.getMoreMessagesToSend());
// assertEquals(tpdu.getOriginatingAddress().getAddressValue(), origDig);
// assertEquals(tpdu.getOriginatingAddress().getNumberingPlanIdentification(), NumberingPlanIdentification.ISDNTelephoneNumberingPlan);
// assertEquals(tpdu.getOriginatingAddress().getTypeOfNumber(), TypeOfNumber.InternationalNumber);
// assertEquals(tpdu.getProtocolIdentifier().getCode(), 7);
// assertFalse(tpdu.getReplyPathExists());
// assertEquals(tpdu.getServiceCentreTimeStamp().getDay(), curDate.getDate());
// int mon1 = tpdu.getServiceCentreTimeStamp().getMonth();
// int mon2 = curDate.getMonth() + 1;
// assertEquals(mon1, mon2);
// assertEquals(tpdu.getSmsTpduType(), SmsTpduType.SMS_DELIVER);
// assertFalse(tpdu.getStatusReportIndication());
// assertFalse(tpdu.getUserDataHeaderIndicator());
// UserData ud = tpdu.getUserData();
// ud.decode();
// assertNull(ud.getDecodedUserDataHeader());
// String msg1 = ud.getDecodedMessage();
// assertEquals(msg1, msgShort);
// 
// //        evt = lstEvt.get(1);
// //        assertEquals(evt.testEventType, MAPTestEventType.send);
// //        smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(smsSet.getTargetId());
// //        assertNotNull(smsSetX);
// //        smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId[0]);
// //        assertEquals(smsX.getSmsSet().getInSystem(), 0);
// //
// //        UUID smsId = smsSet.getSms(0).getDbId();
// //        SmsProxy smsx2 = this.pers.obtainArchiveSms(procDueSlot, smsSet.getDestAddr(), smsId);
// //        assertNull(smsx2);
// 
// // Mt response
// MtForwardShortMessageResponseImpl evt2 = new MtForwardShortMessageResponseImpl(null, null);
// evt2.setMAPDialog(dlg);
// DialogAccept daevt = new DialogAccept(dlg, null);
// this.mtSbb.onDialogAccept(daevt, null);
// this.mtSbb.onMtForwardShortMessageResponse(evt2, null);
// DialogClose dcl = new DialogClose(dlg);
// this.mtSbb.onDialogClose(dcl, null);
// //        smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(smsSet.getTargetId());
// //        assertNull(smsSetX);
// //        smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId[0]);
// //        assertNull(smsX);
// 
// //        dlg = serviceSri.getLastMAPDialogSms();
// //        lstEvt = dlg.getEventList();
// //        assertEquals(lstEvt.size(), 2);
// //
// //        dlg = serviceMt.getLastMAPDialogSms();
// //        lstEvt = dlg.getEventList();
// //        assertEquals(lstEvt.size(), 2);
// //
// //        int b1 = this.pers.checkSmsExists(procDueSlot, smsSet.getTargetId());
// //        smsx2 = this.pers.obtainArchiveSms(procDueSlot, smsSet.getDestAddr(), smsId);
// //        assertNotNull(smsx2);
// //
// //        dlg = serviceRsds.getLastMAPDialogSms();
// //        assertNull(dlg);
}
Also used : SmsDeliverTpdu(org.restcomm.protocols.ss7.map.api.smstpdu.SmsDeliverTpdu) 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) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.restcomm.protocols.ss7.map.api.primitives.AddressString) IMSIImpl(org.restcomm.protocols.ss7.map.primitives.IMSIImpl) ArrayList(java.util.ArrayList) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) SM_RP_OA(org.restcomm.protocols.ss7.map.api.service.sms.SM_RP_OA) LocationInfoWithLMSIImpl(org.restcomm.protocols.ss7.map.service.sms.LocationInfoWithLMSIImpl) MAPTestEvent(org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy.MAPTestEvent) SendRoutingInfoForSMResponse(org.restcomm.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMResponse) SendRoutingInfoForSMResponseImpl(org.restcomm.protocols.ss7.map.service.sms.SendRoutingInfoForSMResponseImpl) MAPDialogSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy) SmsSignalInfo(org.restcomm.protocols.ss7.map.api.service.sms.SmsSignalInfo) ISDNAddressStringImpl(org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl) SmscPropertiesManagement(org.mobicents.smsc.domain.SmscPropertiesManagement) IMSI(org.restcomm.protocols.ss7.map.api.primitives.IMSI) MtForwardShortMessageRequestImpl(org.restcomm.protocols.ss7.map.service.sms.MtForwardShortMessageRequestImpl) SmsSet(org.mobicents.smsc.library.SmsSet) SM_RP_DA(org.restcomm.protocols.ss7.map.api.service.sms.SM_RP_DA) Test(org.testng.annotations.Test)

Example 8 with LocationInfoWithLMSI

use of org.restcomm.protocols.ss7.map.api.service.sms.LocationInfoWithLMSI in project smscgateway by RestComm.

the class HrSriServerSbb method onSriSuccess.

/**
 * HrSriResultInterface
 */
@Override
public void onSriSuccess(CorrelationIdValue correlationIdValue, boolean sriBypass) {
    MAPDialogSms dlg = this.getActivity();
    if (dlg == null) {
        this.logger.severe("Home routing: can not get MAPDialog for sending SRI positive Response");
        return;
    }
    if (!sriBypass) {
        smscStatAggregator.updateMsgInHrSriPosReq();
        StringBuilder sb = new StringBuilder();
        sb.append("Home routing: positive SRI response from HLR: transaction: ");
        sb.append(correlationIdValue);
        if (this.logger.isInfoEnabled())
            this.logger.info(sb.toString());
    }
    // storing correlationId into a cache
    try {
        SmsSetCache.getInstance().putCorrelationIdCacheElement(correlationIdValue, smscPropertiesManagement.getCorrelationIdLiveTime());
    } catch (Exception e1) {
        if (dlg != null) {
            dlg.release();
        }
        String reason = "Home routing: Exception when ImsiCacheElement : " + e1.toString();
        this.logger.severe(reason, e1);
        return;
    }
    // sending positive SRI response
    try {
        String smscAddressForCountryCode = this.getSmscAddressForCountryCode();
        ISDNAddressString networkNodeNumber;
        if (smscAddressForCountryCode != null) {
            networkNodeNumber = this.mapParameterFactory.createISDNAddressString(AddressNature.international_number, NumberingPlan.ISDN, smscAddressForCountryCode);
        } else {
            networkNodeNumber = getNetworkNodeNumber(correlationIdValue.getNetworkId());
        }
        LocationInfoWithLMSI li = this.mapParameterFactory.createLocationInfoWithLMSI(networkNodeNumber, null, null, false, null);
        this.doSendResponse(correlationIdValue, dlg, correlationIdValue.getCorrelationID(), li);
    } catch (MAPException e) {
        if (dlg != null) {
            dlg.release();
        }
        String reason = "Home routing: MAPException when sending SRI positive Response : " + e.toString();
        this.logger.severe(reason, e);
    }
}
Also used : LocationInfoWithLMSI(org.restcomm.protocols.ss7.map.api.service.sms.LocationInfoWithLMSI) MAPDialogSms(org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms) MAPException(org.restcomm.protocols.ss7.map.api.MAPException) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.restcomm.protocols.ss7.map.api.primitives.AddressString) MAPException(org.restcomm.protocols.ss7.map.api.MAPException)

Example 9 with LocationInfoWithLMSI

use of org.restcomm.protocols.ss7.map.api.service.sms.LocationInfoWithLMSI in project smscgateway by RestComm.

the class CassandraTest method archiveMessage2.

public void archiveMessage2(SmsSet smsSet) throws Exception {
    Sms sms = smsSet.getSms(0);
    Date date = new Date();
    Date date2 = new Date(date.getTime() - 1000 * 3600 * 24);
    sms.setDeliveryDate(date2);
    sms.getSmsSet().setType(SmType.SMS_FOR_SS7);
    sms.getSmsSet().setImsi("12345678900000");
    ISDNAddressStringImpl networkNodeNumber = new ISDNAddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, "2223334444");
    LocationInfoWithLMSIImpl locationInfoWithLMSI = new LocationInfoWithLMSIImpl(networkNodeNumber, null, null, false, null);
    sms.getSmsSet().setLocationInfoWithLMSI(locationInfoWithLMSI);
    sbb.c2_createRecordArchive(sms, null, null, true, true);
    Sms smsy = sbb.c2_getRecordArchiveForMessageId(sms.getMessageId());
    this.checkTestSms(1, smsy, sms.getDbId(), true);
    // bad MessageId
    smsy = sbb.c2_getRecordArchiveForMessageId(sms.getMessageId() + 1234124124);
    assertNull(smsy);
}
Also used : ISDNAddressStringImpl(org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl) Sms(org.mobicents.smsc.library.Sms) LocationInfoWithLMSIImpl(org.restcomm.protocols.ss7.map.service.sms.LocationInfoWithLMSIImpl) Date(java.util.Date)

Example 10 with LocationInfoWithLMSI

use of org.restcomm.protocols.ss7.map.api.service.sms.LocationInfoWithLMSI in project smscgateway by RestComm.

the class SmsSetCasheTest method testSmppShellExecutor.

@Test(groups = { "SmsSet" })
public void testSmppShellExecutor() throws Exception {
    int correlationIdLiveTime = 2;
    int sriResponseLiveTime = 3;
    int deliveredMsgLiveTime = 3;
    SmsSetCache.start(correlationIdLiveTime, sriResponseLiveTime, deliveredMsgLiveTime);
    SmsSetCache ssc = SmsSetCache.getInstance();
    String remoteMessageId = "0000100001";
    String destId = "esme_33";
    Long messageId = 3000031L;
    String correlationID = "000000000011111";
    ISDNAddressString msisdn = new ISDNAddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, "11111111");
    AddressString serviceCentreAddress = new AddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, "22222222");
    CorrelationIdValue elem = new CorrelationIdValue(correlationID, msisdn, serviceCentreAddress, 0, null);
    ssc.putCorrelationIdCacheElement(elem, correlationIdLiveTime);
    Sms sms = new Sms();
    long mId = 222L;
    sms.setMessageId(mId);
    sms.setShortMessageText("textxxx");
    ssc.putDeliveredMsgValue(sms, deliveredMsgLiveTime);
    ssc.putDeliveredRemoteMsgIdValue(remoteMessageId, destId, messageId, deliveredMsgLiveTime);
    String targetID = "22222_1_1_2";
    LocationInfoWithLMSI locationInfoWithLMSI = null;
    SriResponseValue srv = new SriResponseValue(targetID, 2, "22222", 1, 1, locationInfoWithLMSI, "0000011111000000");
    ssc.putSriResponseValue(srv, sriResponseLiveTime);
    Thread.sleep(2500);
    CorrelationIdValue v1 = ssc.getCorrelationIdCacheElement(correlationID);
    assertNotNull(v1);
    SriResponseValue vv1 = ssc.getSriResponseValue(targetID);
    assertNotNull(vv1);
    Sms sms2 = ssc.getDeliveredMsgValue(mId);
    assertNotNull(sms2);
    Long msgId2 = ssc.getDeliveredRemoteMsgIdValue(remoteMessageId, destId);
    assertEquals((long) msgId2, (long) messageId);
    Thread.sleep(2500);
    CorrelationIdValue v2 = ssc.getCorrelationIdCacheElement(correlationID);
    assertNull(v2);
    SriResponseValue vv2 = ssc.getSriResponseValue(targetID);
    assertNotNull(vv2);
    sms2 = ssc.getDeliveredMsgValue(mId);
    assertNotNull(sms2);
    msgId2 = ssc.getDeliveredRemoteMsgIdValue(remoteMessageId, destId);
    assertEquals((long) msgId2, (long) messageId);
    Thread.sleep(2000);
    CorrelationIdValue v3 = ssc.getCorrelationIdCacheElement(correlationID);
    assertNull(v3);
    SriResponseValue vv3 = ssc.getSriResponseValue(targetID);
    assertNull(vv3);
    sms2 = ssc.getDeliveredMsgValue(mId);
    assertNull(sms2);
    msgId2 = ssc.getDeliveredRemoteMsgIdValue(remoteMessageId, destId);
    assertNull(msgId2);
    SmsSetCache.stop();
}
Also used : LocationInfoWithLMSI(org.mobicents.protocols.ss7.map.api.service.sms.LocationInfoWithLMSI) ISDNAddressString(org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.mobicents.protocols.ss7.map.api.primitives.AddressString) ISDNAddressString(org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString) ISDNAddressString(org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.mobicents.protocols.ss7.map.api.primitives.AddressString) ISDNAddressStringImpl(org.mobicents.protocols.ss7.map.primitives.ISDNAddressStringImpl) ISDNAddressStringImpl(org.mobicents.protocols.ss7.map.primitives.ISDNAddressStringImpl) AddressStringImpl(org.mobicents.protocols.ss7.map.primitives.AddressStringImpl) Test(org.testng.annotations.Test)

Aggregations

ISDNAddressString (org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString)20 ISDNAddressStringImpl (org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl)20 LocationInfoWithLMSI (org.restcomm.protocols.ss7.map.api.service.sms.LocationInfoWithLMSI)19 LocationInfoWithLMSIImpl (org.restcomm.protocols.ss7.map.service.sms.LocationInfoWithLMSIImpl)19 IMSI (org.restcomm.protocols.ss7.map.api.primitives.IMSI)18 Test (org.testng.annotations.Test)18 Sms (org.mobicents.smsc.library.Sms)17 IMSIImpl (org.restcomm.protocols.ss7.map.primitives.IMSIImpl)17 ArrayList (java.util.ArrayList)16 SmscPropertiesManagement (org.mobicents.smsc.domain.SmscPropertiesManagement)16 SmsSet (org.mobicents.smsc.library.SmsSet)16 MAPDialogSmsProxy (org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy)16 MAPServiceSmsProxy (org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy)16 SmsSetEvent (org.mobicents.smsc.slee.services.smpp.server.events.SmsSetEvent)16 SendRoutingInfoForSMResponse (org.restcomm.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMResponse)16 SendRoutingInfoForSMResponseImpl (org.restcomm.protocols.ss7.map.service.sms.SendRoutingInfoForSMResponseImpl)16 UUID (java.util.UUID)14 SmsProxy (org.mobicents.smsc.slee.resources.persistence.SmsProxy)14 MAPApplicationContextVersion (org.restcomm.protocols.ss7.map.api.MAPApplicationContextVersion)14 AddressString (org.restcomm.protocols.ss7.map.api.primitives.AddressString)14