Search in sources :

Example 1 with ISDNAddressStringImpl

use of org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl 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.restcomm.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.restcomm.protocols.ss7.map.service.sms.ReportSMDeliveryStatusResponseImpl) ArrayList(java.util.ArrayList) PreparedStatementCollection(org.mobicents.smsc.cassandra.PreparedStatementCollection) Date(java.util.Date) ErrorComponent(org.restcomm.slee.resource.map.events.ErrorComponent) MAPErrorMessageAbsentSubscriberSMImpl(org.restcomm.protocols.ss7.map.errors.MAPErrorMessageAbsentSubscriberSMImpl) 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) 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.restcomm.protocols.ss7.map.service.sms.InformServiceCentreRequestImpl) SmsSet(org.mobicents.smsc.library.SmsSet) MAPErrorMessage(org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage) Test(org.testng.annotations.Test)

Example 2 with ISDNAddressStringImpl

use of org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl 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 3 with ISDNAddressStringImpl

use of org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl 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 4 with ISDNAddressStringImpl

use of org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl in project smscgateway by RestComm.

the class MoSbbTest method testMo4_Gsm8.

@Test(groups = { "Mo" })
public void testMo4_Gsm8() throws Exception {
    if (!this.cassandraDbInited)
        return;
    // SmppSessionsProxy smppServerSessions = new SmppSessionsProxy();
    // this.sbb.setSmppServerSessions(smppServerSessions);
    AddressString serviceCentreAddressDA = new AddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, "1111");
    SM_RP_DA sm_RP_DA = new SM_RP_DAImpl(serviceCentreAddressDA);
    ISDNAddressString msisdn = new ISDNAddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, "4444");
    SM_RP_OAImpl sm_RP_OA = new SM_RP_OAImpl();
    sm_RP_OA.setMsisdn(msisdn);
    AddressField destinationAddress = new AddressFieldImpl(TypeOfNumber.InternationalNumber, NumberingPlanIdentification.ISDNTelephoneNumberingPlan, "5555");
    ProtocolIdentifier protocolIdentifier = new ProtocolIdentifierImpl(12);
    DataCodingScheme dataCodingScheme = new DataCodingSchemeImpl(4);
    UserDataHeader decodedUserDataHeader = new UserDataHeaderImpl();
    UserDataHeaderElement informationElement = new ConcatenatedShortMessagesIdentifierImpl(false, 55, 3, 1);
    decodedUserDataHeader.addInformationElement(informationElement);
    UserData userData = new UserDataImpl("abc 01234567890", dataCodingScheme, decodedUserDataHeader, isoCharset);
    SmsTpdu tpdu = new SmsSubmitTpduImpl(false, false, false, 150, destinationAddress, protocolIdentifier, null, userData);
    // isoCharset
    SmsSignalInfo sm_RP_UI_0 = new SmsSignalInfoImpl(tpdu, null);
    ForwardShortMessageRequestImpl event0 = new ForwardShortMessageRequestImpl(sm_RP_DA, sm_RP_OA, sm_RP_UI_0, false);
    AsnOutputStream aos = new AsnOutputStream();
    event0.encodeAll(aos);
    ForwardShortMessageRequestImpl event = new ForwardShortMessageRequestImpl();
    AsnInputStream ais = new AsnInputStream(aos.toByteArray());
    ais.readTag();
    event.decodeAll(ais);
    long dueSlot = this.pers.c2_getDueSlotForTime(new Date());
    PreparedStatementCollection psc = this.pers.getStatementCollection(new Date());
    int b1 = this.pers.checkSmsExists(dueSlot, ta1.getTargetId());
    long b2 = this.pers.c2_getDueSlotForTargetId(psc, ta1.getTargetId());
    assertEquals(b1, 0);
    assertEquals(b2, 0L);
    MAPProviderProxy proxy = new MAPProviderProxy();
    MAPDialogSmsProxy dialog = new MAPDialogSmsProxy(new MAPServiceSmsProxy(proxy), null, null, null);
    event.setMAPDialog(dialog);
    Date curDate = new Date();
    MAPApplicationContext act = MAPApplicationContext.getInstance(MAPApplicationContextName.shortMsgMORelayContext, MAPApplicationContextVersion.version2);
    dialog.setApplicationContext(act);
    this.sbb.onForwardShortMessageRequest(event, null);
    b2 = this.pers.c2_getDueSlotForTargetId(psc, ta1.getTargetId());
    dueSlot = b2;
    b1 = this.pers.checkSmsExists(dueSlot, ta1.getTargetId());
    assertEquals(b1, 1);
    assertEquals(b2, dueSlot);
    assertEquals(dialog.getResponseCount(), 1);
    assertEquals(dialog.getErrorList().size(), 0);
    SmsSet smsSet = this.pers.c2_getRecordListForTargeId(dueSlot, ta1.getTargetId());
    assertEquals(smsSet.getDestAddr(), "5555");
    assertEquals(smsSet.getDestAddrTon(), SmppConstants.TON_INTERNATIONAL);
    assertEquals(smsSet.getDestAddrNpi(), SmppConstants.NPI_E164);
    assertEquals(smsSet.getInSystem(), 0);
    assertEquals(smsSet.getDueDelay(), 0);
    assertNull(smsSet.getStatus());
    assertFalse(smsSet.isAlertingSupported());
    Sms sms = smsSet.getSms(0);
    assertNotNull(sms);
    assertEquals(sms.getSourceAddr(), "4444");
    assertEquals(sms.getSourceAddrTon(), SmppConstants.TON_INTERNATIONAL);
    assertEquals(sms.getSourceAddrNpi(), SmppConstants.NPI_E164);
    assertEquals(sms.getMessageId(), DBOperations.MESSAGE_ID_LAG + 1);
    assertEquals(sms.getMoMessageRef(), 150);
    assertEquals(sms.getDataCoding(), 4);
    assertNull(sms.getOrigEsmeName());
    assertNull(sms.getOrigSystemId());
    assertNull(sms.getServiceType());
    assertEquals(sms.getEsmClass() & 0xFF, 67);
    assertEquals(sms.getRegisteredDelivery(), 0);
    assertEquals(sms.getProtocolId(), 12);
    assertEquals(sms.getPriority(), 0);
    assertEquals(sms.getReplaceIfPresent(), 0);
    assertEquals(sms.getDefaultMsgId(), 0);
    assertEquals(sms.getTlvSet().getOptionalParameterCount(), 0);
    assertNull(sms.getScheduleDeliveryTime());
    assertDateEq(sms.getValidityPeriod(), MessageUtil.addHours(curDate, 24 * 3));
    assertEquals(sms.getDeliveryCount(), 0);
    assertEquals(sms.getShortMessageText(), "abc 01234567890");
    assertEquals(sms.getShortMessageBin(), decodedUserDataHeader.getEncodedData());
}
Also used : DataCodingScheme(org.restcomm.protocols.ss7.map.api.smstpdu.DataCodingScheme) UserDataHeaderImpl(org.restcomm.protocols.ss7.map.smstpdu.UserDataHeaderImpl) AsnInputStream(org.mobicents.protocols.asn.AsnInputStream) MAPServiceSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.restcomm.protocols.ss7.map.api.primitives.AddressString) UserData(org.restcomm.protocols.ss7.map.api.smstpdu.UserData) SmsTpdu(org.restcomm.protocols.ss7.map.api.smstpdu.SmsTpdu) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) SmsSignalInfoImpl(org.restcomm.protocols.ss7.map.service.sms.SmsSignalInfoImpl) DataCodingSchemeImpl(org.restcomm.protocols.ss7.map.smstpdu.DataCodingSchemeImpl) ProtocolIdentifierImpl(org.restcomm.protocols.ss7.map.smstpdu.ProtocolIdentifierImpl) SmsSignalInfo(org.restcomm.protocols.ss7.map.api.service.sms.SmsSignalInfo) UserDataHeaderElement(org.restcomm.protocols.ss7.map.api.smstpdu.UserDataHeaderElement) UserDataImpl(org.restcomm.protocols.ss7.map.smstpdu.UserDataImpl) MAPProviderProxy(org.mobicents.smsc.slee.resources.persistence.MAPProviderProxy) ProtocolIdentifier(org.restcomm.protocols.ss7.map.api.smstpdu.ProtocolIdentifier) UserDataHeader(org.restcomm.protocols.ss7.map.api.smstpdu.UserDataHeader) ISDNAddressStringImpl(org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl) AddressStringImpl(org.restcomm.protocols.ss7.map.primitives.AddressStringImpl) AddressField(org.restcomm.protocols.ss7.map.api.smstpdu.AddressField) ConcatenatedShortMessagesIdentifierImpl(org.restcomm.protocols.ss7.map.smstpdu.ConcatenatedShortMessagesIdentifierImpl) ForwardShortMessageRequestImpl(org.restcomm.protocols.ss7.map.service.sms.ForwardShortMessageRequestImpl) MoForwardShortMessageRequestImpl(org.restcomm.protocols.ss7.map.service.sms.MoForwardShortMessageRequestImpl) SM_RP_DAImpl(org.restcomm.protocols.ss7.map.service.sms.SM_RP_DAImpl) AddressFieldImpl(org.restcomm.protocols.ss7.map.smstpdu.AddressFieldImpl) SM_RP_OAImpl(org.restcomm.protocols.ss7.map.service.sms.SM_RP_OAImpl) Date(java.util.Date) PreparedStatementCollection(org.mobicents.smsc.cassandra.PreparedStatementCollection) MAPDialogSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy) ISDNAddressStringImpl(org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl) AsnOutputStream(org.mobicents.protocols.asn.AsnOutputStream) Sms(org.mobicents.smsc.library.Sms) SM_RP_DA(org.restcomm.protocols.ss7.map.api.service.sms.SM_RP_DA) MAPApplicationContext(org.restcomm.protocols.ss7.map.api.MAPApplicationContext) SmsSet(org.mobicents.smsc.library.SmsSet) SmsSubmitTpduImpl(org.restcomm.protocols.ss7.map.smstpdu.SmsSubmitTpduImpl) Test(org.testng.annotations.Test)

Example 5 with ISDNAddressStringImpl

use of org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl 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)

Aggregations

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