Search in sources :

Example 51 with Sms

use of org.mobicents.smsc.library.Sms 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 52 with Sms

use of org.mobicents.smsc.library.Sms in project smscgateway by RestComm.

the class CassandraTest method testingLifeCycle.

@Test(groups = { "cassandra" })
public void testingLifeCycle() throws Exception {
    if (!this.cassandraDbInited)
        return;
    long dueSlot = this.addingNewMessages();
    this.readAlertMessage();
    SmsSet smsSet = this.readDueSlotMessage(dueSlot, 1, 1);
    String[] remoteMessageId = new String[3];
    long l1 = 10000000;
    for (int i1 = 0; i1 < 3; i1++) {
        l1++;
        remoteMessageId[i1] = MessageUtil.createMessageIdString(l1);
    }
    String esmeId = "esme_3";
    archiveMessage(smsSet, remoteMessageId, esmeId);
    this.addingNewMessages2(dueSlot + 1);
    smsSet = this.readDueSlotMessage(dueSlot + 1, 2, 0);
    SmsSetCache.getInstance().clearProcessingSmsSet();
    smsSet = this.readDueSlotMessage(dueSlot, 1, 1);
    Sms sms = smsSet.getSms(0);
    assertFalse(smsSet.isAlertingSupported());
    sbb.c2_updateAlertingSupport(sms.getDueSlot(), sms.getSmsSet().getTargetId(), sms.getDbId());
    SmsSetCache.getInstance().clearProcessingSmsSet();
    smsSet = this.readDueSlotMessage(dueSlot, 1, 1);
    assertTrue(smsSet.isAlertingSupported());
}
Also used : Sms(org.mobicents.smsc.library.Sms) SmsSet(org.mobicents.smsc.library.SmsSet) Test(org.testng.annotations.Test)

Example 53 with Sms

use of org.mobicents.smsc.library.Sms in project smscgateway by RestComm.

the class CassandraTest method addingNewMessages2.

public void addingNewMessages2(long dueSlot) throws Exception {
    Date dt = new Date();
    PreparedStatementCollection psc = sbb.getStatementCollection(dt);
    // adding an extra messages for "1111"
    TargetAddress lock = this.sbb.obtainSynchroObject(ta1);
    try {
        synchronized (lock) {
            Sms sms_a5 = this.createTestSms(5, ta1.getAddr(), id5);
            sms_a5.setDueSlot(dueSlot);
            sbb.c2_registerDueSlotWriting(dueSlot);
            try {
                sbb.c2_createRecordCurrent(sms_a5);
            } finally {
                sbb.c2_unregisterDueSlotWriting(dueSlot);
            }
        }
    } finally {
        this.sbb.obtainSynchroObject(lock);
    }
}
Also used : Sms(org.mobicents.smsc.library.Sms) TargetAddress(org.mobicents.smsc.library.TargetAddress) Date(java.util.Date) PreparedStatementCollection(org.mobicents.smsc.cassandra.PreparedStatementCollection)

Example 54 with Sms

use of org.mobicents.smsc.library.Sms in project smscgateway by RestComm.

the class MtDatabaseCassandraTest method prepareSms.

private Sms prepareSms(SmsSet smsSet, int num) {
    Sms sms = new Sms();
    sms.setStored(true);
    sms.setSmsSet(smsSet);
    sms.setDbId(UUID.randomUUID());
    // sms.setDbId(id);
    sms.setSourceAddr("4444");
    sms.setSourceAddrTon(1);
    sms.setSourceAddrNpi(1);
    sms.setMessageId(8888888 + num);
    sms.setMoMessageRef(102 + num);
    sms.setMessageId(num);
    sms.setOrigEsmeName("esme_1");
    sms.setOrigSystemId("sys_1");
    sms.setSubmitDate(new Date());
    // sms.setDeliveryDate(new GregorianCalendar(2013, 1, 15, 12, 15 +
    // num).getTime());
    // sms.setServiceType("serv_type__" + num);
    sms.setEsmClass(3);
    sms.setProtocolId(0);
    sms.setPriority(0);
    sms.setRegisteredDelivery(0);
    sms.setReplaceIfPresent(0);
    sms.setDataCoding(0);
    sms.setDefaultMsgId(0);
    sms.setShortMessage(this.msg.getBytes());
    return sms;
}
Also used : Sms(org.mobicents.smsc.library.Sms) Date(java.util.Date)

Example 55 with Sms

use of org.mobicents.smsc.library.Sms in project smscgateway by RestComm.

the class MtSbb method setupMtForwardShortMessageRequest.

// *********
// Main service methods
public void setupMtForwardShortMessageRequest(ISDNAddressString networkNode, String imsiData, LMSI lmsi, int networkId) {
    if (this.logger.isFineEnabled()) {
        this.logger.fine("mperforming setupMtForwardShortMessageRequest ISDNAddressString= " + networkNode);
    }
    SmsSet smsSet = getSmsSet();
    if (smsSet == null) {
        markDeliveringIsEnded(true);
        logger.severe("MtSbb.setupMtForwardShortMessageRequest(): CMP smsSet is missed");
        return;
    }
    Sms sms0 = smsSet.getSms(0);
    Integer mtRemoteSccpTt = sms0.getMtRemoteSccpTt();
    SccpAddress networkNodeSccpAddress = this.getMSCSccpAddress(networkNode, mtRemoteSccpTt);
    IMSI imsi = this.mapParameterFactory.createIMSI(imsiData);
    SM_RP_DA sm_RP_DA = this.mapParameterFactory.createSM_RP_DA(imsi);
    AddressString scAddress = this.getServiceCenterAddressString(networkId);
    SM_RP_OA sm_RP_OA = this.mapParameterFactory.createSM_RP_OA_ServiceCentreAddressOA(scAddress);
    if (sms0 != null) {
        // we only set it for first sms in the list
        sms0.setMtServiceCenterAddress(scAddress.getAddress());
    }
    this.setNnn(networkNode);
    this.setNetworkNode(networkNodeSccpAddress);
    this.setSmRpDa(sm_RP_DA);
    this.setSmRpOa(sm_RP_OA);
    // Set cache with MAP version
    MAPApplicationContextVersion mapApplicationContextVersion = mapVersionCache.getMAPApplicationContextVersion(networkNode.getAddress());
    if (mapApplicationContextVersion == null) {
        mapApplicationContextVersion = MAPApplicationContextVersion.getInstance(smscPropertiesManagement.getMaxMapVersion());
    } else {
        this.setNegotiatedMapVersionUsing(true);
    }
    this.setMAPVersionTested(mapApplicationContextVersion);
    // dropaftersri mproc rules
    try {
        if (this.getTotalUnsentMessageCount() > 0) {
            ArrayList<Sms> lstPermFailured = new ArrayList<Sms>();
            ArrayList<Sms> lstRerouted = new ArrayList<Sms>();
            ArrayList<Integer> lstNewNetworkId = new ArrayList<Integer>();
            TargetAddress lock = persistence.obtainSynchroObject(new TargetAddress(smsSet));
            try {
                synchronized (lock) {
                    this.applyMprocRulesOnImsiResponse(smsSet, lstPermFailured, lstRerouted, lstNewNetworkId, networkNode, imsiData);
                    this.onImsiDrop(smsSet, lstPermFailured, lstRerouted, lstNewNetworkId, networkNode, imsiData);
                }
            } finally {
                persistence.releaseSynchroObject(lock);
            }
        }
    } catch (Throwable e) {
    }
    if (this.getTotalUnsentMessageCount() == 0) {
        setupReportSMDeliveryStatusRequestSuccess(smsSet, true);
        smsSet.setStatus(ErrorCode.SUCCESS);
        this.markDeliveringIsEnded(true);
    } else {
        try {
            this.sendMtSms(this.getMtFoSMSMAPApplicationContext(mapApplicationContextVersion), MessageProcessingState.firstMessageSending, null, smsSet.getNetworkId());
        } catch (SmscProcessingException e) {
            String reason = "SmscPocessingException when invoking sendMtSms() from setupMtForwardShortMessageRequest()-firstMessageSending: " + e.toString();
            this.logger.severe(reason, e);
            ErrorCode smStatus = ErrorCode.SC_SYSTEM_ERROR;
            try {
                smStatus = ErrorCode.fromInt(e.getSmppErrorCode());
            } catch (IllegalArgumentException e1) {
            }
            this.onDeliveryError(smsSet, ErrorAction.permanentFailure, smStatus, reason, true, null, false, ProcessingType.SS7_MT);
        } catch (Throwable e) {
            String reason = "Exception when invoking sendMtSms() from setupMtForwardShortMessageRequest()-firstMessageSending: " + e.toString();
            this.logger.severe(reason, e);
            ErrorCode smStatus = ErrorCode.SC_SYSTEM_ERROR;
            this.onDeliveryError(smsSet, ErrorAction.permanentFailure, smStatus, reason, true, null, false, ProcessingType.SS7_MT);
        }
    }
}
Also used : SccpAddress(org.restcomm.protocols.ss7.sccp.parameter.SccpAddress) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.restcomm.protocols.ss7.map.api.primitives.AddressString) SmscProcessingException(org.mobicents.smsc.library.SmscProcessingException) ArrayList(java.util.ArrayList) SM_RP_OA(org.restcomm.protocols.ss7.map.api.service.sms.SM_RP_OA) TargetAddress(org.mobicents.smsc.library.TargetAddress) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.restcomm.protocols.ss7.map.api.primitives.AddressString) MAPApplicationContextVersion(org.restcomm.protocols.ss7.map.api.MAPApplicationContextVersion) MAPDialogSms(org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms) MAPErrorMessageSubscriberBusyForMtSms(org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessageSubscriberBusyForMtSms) Sms(org.mobicents.smsc.library.Sms) IMSI(org.restcomm.protocols.ss7.map.api.primitives.IMSI) ErrorCode(org.mobicents.smsc.library.ErrorCode) MAPErrorCode(org.restcomm.protocols.ss7.map.api.errors.MAPErrorCode) SmsSet(org.mobicents.smsc.library.SmsSet) SM_RP_DA(org.restcomm.protocols.ss7.map.api.service.sms.SM_RP_DA)

Aggregations

Sms (org.mobicents.smsc.library.Sms)139 SmsSet (org.mobicents.smsc.library.SmsSet)62 Test (org.testng.annotations.Test)43 Date (java.util.Date)42 ArrayList (java.util.ArrayList)35 ISDNAddressString (org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString)33 TargetAddress (org.mobicents.smsc.library.TargetAddress)30 MAPDialogSmsProxy (org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy)27 MAPServiceSmsProxy (org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy)27 ISDNAddressStringImpl (org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl)26 AddressString (org.restcomm.protocols.ss7.map.api.primitives.AddressString)24 SmscPropertiesManagement (org.mobicents.smsc.domain.SmscPropertiesManagement)23 UUID (java.util.UUID)22 PreparedStatementCollection (org.mobicents.smsc.cassandra.PreparedStatementCollection)21 SmsSetEvent (org.mobicents.smsc.slee.services.smpp.server.events.SmsSetEvent)21 SmsProxy (org.mobicents.smsc.slee.resources.persistence.SmsProxy)20 SM_RP_DA (org.restcomm.protocols.ss7.map.api.service.sms.SM_RP_DA)19 SmsSignalInfo (org.restcomm.protocols.ss7.map.api.service.sms.SmsSignalInfo)19 MAPApplicationContextVersion (org.restcomm.protocols.ss7.map.api.MAPApplicationContextVersion)17 UserData (org.restcomm.protocols.ss7.map.api.smstpdu.UserData)17