Search in sources :

Example 91 with SmsSet

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

the class AlertTest method createEmptySmsSet.

private SmsSet createEmptySmsSet(TargetAddress ta) {
    SmsSet smsSet = new SmsSet();
    smsSet.setDestAddr(ta1.getAddr());
    smsSet.setDestAddrNpi(ta1.getAddrNpi());
    smsSet.setDestAddrTon(ta1.getAddrTon());
    smsSet.setType(SmType.SMS_FOR_SS7);
    return smsSet;
}
Also used : SmsSet(org.mobicents.smsc.library.SmsSet)

Example 92 with SmsSet

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

the class AlertTest method testAlert1_Gsm1.

@Test(groups = { "Alert" })
public void testAlert1_Gsm1() throws Exception {
    if (!this.cassandraDbInited)
        return;
    this.prepareDatabase();
    SmsSet smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(procTargetId);
    assertNull(smsSetX);
    Sms smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId);
    assertEquals(smsX.getSmsSet().getInSystem(), 0);
    // boolean b1 = this.pers.checkSmsSetExists(ta1);
    // assertTrue(b1);
    // SmsSet smsSet = this.pers.obtainSmsSet(ta1);
    // assertEquals(smsSet.getInSystem(), 1);
    // assertEquals(smsSet.getDueDate(), farDate);
    Thread.sleep(1000);
    Date curDate = new Date();
    ISDNAddressString msisdn = new ISDNAddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, "5555");
    AddressString serviceCentreAddress = new AddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, "1111");
    AlertServiceCentreRequest evt = new AlertServiceCentreRequestImpl(msisdn, serviceCentreAddress);
    MAPProviderProxy proxy = new MAPProviderProxy();
    MAPApplicationContext appCntx = MAPApplicationContext.getInstance(MAPApplicationContextName.shortMsgAlertContext, MAPApplicationContextVersion.version2);
    MAPDialogSmsProxy dialog = new MAPDialogSmsProxy(new MAPServiceSmsProxy(proxy), appCntx, null, null);
    evt.setMAPDialog(dialog);
    this.sbb.onAlertServiceCentreRequest(evt, null);
    smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(procTargetId);
    // assertNotNull(smsSetX);  TODO: this will work after alert is with direct Activities sending
    smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId);
// assertNull(smsX);
// b1 = this.pers.checkSmsSetExists(ta1);
// assertTrue(b1);
// smsSet = this.pers.obtainSmsSet(ta1);
// assertEquals(smsSet.getInSystem(), 1);
// this.testDateEq(smsSet.getDueDate(), curDate);
}
Also used : AlertServiceCentreRequestImpl(org.mobicents.protocols.ss7.map.service.sms.AlertServiceCentreRequestImpl) MAPServiceSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy) 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) Date(java.util.Date) MAPDialogSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy) ISDNAddressStringImpl(org.mobicents.protocols.ss7.map.primitives.ISDNAddressStringImpl) MAPProviderProxy(org.mobicents.smsc.slee.resources.persistence.MAPProviderProxy) Sms(org.mobicents.smsc.library.Sms) AlertServiceCentreRequest(org.mobicents.protocols.ss7.map.api.service.sms.AlertServiceCentreRequest) SmsSet(org.mobicents.smsc.library.SmsSet) MAPApplicationContext(org.mobicents.protocols.ss7.map.api.MAPApplicationContext) ISDNAddressStringImpl(org.mobicents.protocols.ss7.map.primitives.ISDNAddressStringImpl) AddressStringImpl(org.mobicents.protocols.ss7.map.primitives.AddressStringImpl) Test(org.testng.annotations.Test)

Example 93 with SmsSet

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

the class SriSbb method onSms.

// *********
// initial event
public void onSms(SmsSetEvent event, ActivityContextInterface aci, EventContext eventContext) {
    SmsSet smsSet = event.getSmsSet();
    this.addInitialMessageSet(smsSet);
    try {
        if (this.logger.isFineEnabled()) {
            this.logger.fine("\nReceived Submit SMS. event= " + event + "this=" + this);
        }
        smscStatAggregator.updateMsgOutTryAll();
        smscStatAggregator.updateMsgOutTrySs7();
        if (smsSet.getDestAddrTon() == SmppConstants.TON_ALPHANUMERIC) {
            // bad TON at the destination address: alphanumerical is not supported
            this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.BAD_TYPE_OF_NUMBER, "TON \"alhpanumerical\" is not supported for as a destination address", true, null, false, ProcessingType.SS7_SRI);
            return;
        }
        if (smsSet.getDestAddrTon() != SmppConstants.TON_UNKNOWN && smsSet.getDestAddrTon() != SmppConstants.TON_INTERNATIONAL && smsSet.getDestAddrTon() != SmppConstants.TON_NATIONAL && smsSet.getDestAddrTon() != SmppConstants.TON_SUBSCRIBER) {
            // we support only following TON for a dest address
            this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.BAD_TYPE_OF_NUMBER, "TON " + smsSet.getDestAddrTon() + " is not supported for as a destination address", true, null, false, ProcessingType.SS7_SRI);
            return;
        }
        if (smsSet.getDestAddrNpi() != SmppConstants.NPI_UNKNOWN && smsSet.getDestAddrNpi() != SmppConstants.NPI_E164 && smsSet.getDestAddrNpi() != SmppConstants.NPI_X121 && smsSet.getDestAddrNpi() != SmppConstants.NPI_TELEX && smsSet.getDestAddrNpi() != SmppConstants.NPI_LAND_MOBILE) {
            // we support only following TON for a dest address
            this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.BAD_NPI, "NPI " + smsSet.getDestAddrNpi() + " is not supported for as a destination address", true, null, false, ProcessingType.SS7_SRI);
            return;
        }
        Sms sms = this.obtainNextMessage(ProcessingType.SS7_SRI);
        if (sms == null) {
            // this means that no messages with good ScheduleDeliveryTime or
            // no messages at all we have to reschedule
            this.markDeliveringIsEnded(true);
            return;
        }
        // checking for correlationId - may be we do not need SRI
        String correlationID = smsSet.getCorrelationId();
        CorrelationIdValue civ = null;
        if (correlationID != null) {
            civ = SmsSetCache.getInstance().getCorrelationIdCacheElement(correlationID);
            if (this.logger.isFineEnabled()) {
                this.logger.fine("HomeRouting: correlationID=" + correlationID + ", found CorrelationIdValue=" + civ);
            }
        }
        if (civ != null && civ.getLocationInfoWithLMSI() != null && civ.getImsi() != null) {
            // preloaded routing info is found - skip SRI request
            MWStatus mwStatus = civ.getMwStatus();
            if (mwStatus != null) {
                InformServiceCenterContainer informServiceCenterContainer = new InformServiceCenterContainer();
                informServiceCenterContainer.setMwStatus(mwStatus);
                this.setInformServiceCenterContainer(informServiceCenterContainer);
            }
            this.setSriMapVersion(civ.getSriMapVersion());
            this.executeForwardSM(smsSet, civ.getLocationInfoWithLMSI(), civ.getImsi(), smsSet.getNetworkId());
            return;
        }
        // checking for cached - may be we do not need SRI
        String targetID = smsSet.getTargetId();
        SriResponseValue srv = null;
        srv = SmsSetCache.getInstance().getSriResponseValue(targetID);
        if (this.logger.isFineEnabled()) {
            this.logger.fine("SRI requesting: targetID=" + targetID + ", found cached SriResponseValue=" + srv);
        }
        if (srv != null) {
            // preloaded routing info is found - skip SRI request
            this.setSriMapVersion(3);
            this.executeForwardSM(smsSet, srv.getLocationInfoWithLMSI(), srv.getImsi(), smsSet.getNetworkId());
            return;
        }
        // no preloaded routing info
        this.sendSRI(smsSet, smsSet.getDestAddr(), smsSet.getDestAddrTon(), smsSet.getDestAddrNpi(), this.getSRIMAPApplicationContext(this.maxMAPApplicationContextVersion));
    } catch (Throwable e1) {
        String s = "Exception in SriSbb.onSms when fetching records and issuing events: " + e1.getMessage();
        logger.severe(s, e1);
        markDeliveringIsEnded(true);
    // this.onDeliveryError(smsSet, ErrorAction.temporaryFailure, ErrorCode.SC_SYSTEM_ERROR, s, true, null, false);
    }
}
Also used : InformServiceCenterContainer(org.mobicents.smsc.slee.services.smpp.server.events.InformServiceCenterContainer) MWStatus(org.mobicents.protocols.ss7.map.api.service.sms.MWStatus) SriResponseValue(org.mobicents.smsc.library.SriResponseValue) MAPDialogSms(org.mobicents.protocols.ss7.map.api.service.sms.MAPDialogSms) Sms(org.mobicents.smsc.library.Sms) ISDNAddressString(org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.mobicents.protocols.ss7.map.api.primitives.AddressString) CorrelationIdValue(org.mobicents.smsc.library.CorrelationIdValue) SmsSet(org.mobicents.smsc.library.SmsSet)

Example 94 with SmsSet

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

the class SriSbb method onDialogTimeout.

@Override
public void onDialogTimeout(DialogTimeout evt, ActivityContextInterface aci) {
    try {
        super.onDialogTimeout(evt, aci);
        SmsSet smsSet = getSmsSet();
        if (smsSet == null) {
            logger.severe("SriSbb.onDialogTimeout(): CMP smsSet is missed");
            markDeliveringIsEnded(true);
            return;
        }
        this.onDeliveryError(smsSet, ErrorAction.temporaryFailure, ErrorCode.HLR_REJECT_AFTER_ROUTING_INFO, "onDialogTimeout after SRI Request", true, null, false, ProcessingType.SS7_SRI);
    } catch (Throwable e1) {
        logger.severe("Exception in SriSbb.onDialogTimeout() when fetching records and issuing events: " + e1.getMessage(), e1);
        markDeliveringIsEnded(true);
    }
}
Also used : SmsSet(org.mobicents.smsc.library.SmsSet)

Example 95 with SmsSet

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

the class RxSipServerSbb method onTRANSACTION_TIMEOUT.

public void onTRANSACTION_TIMEOUT(javax.sip.TimeoutEvent event, ActivityContextInterface aci) {
    this.logger.warning("onTRANSACTION_TIMEOUT " + event);
    SmsSet smsSet = getSmsSet();
    if (smsSet == null) {
        logger.severe("RxSipServerSbb.onTRANSACTION_TIMEOUT(): CMP smsSet is missed");
        markDeliveringIsEnded(true);
        return;
    }
    this.onDeliveryError(smsSet, ErrorAction.temporaryFailure, ErrorCode.SC_SYSTEM_ERROR, "SIP Exception TRANSACTION_TIMEOUT received.");
}
Also used : SmsSet(org.mobicents.smsc.library.SmsSet)

Aggregations

SmsSet (org.mobicents.smsc.library.SmsSet)116 Sms (org.mobicents.smsc.library.Sms)61 Test (org.testng.annotations.Test)45 ArrayList (java.util.ArrayList)36 ISDNAddressString (org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString)35 Date (java.util.Date)32 AddressString (org.mobicents.protocols.ss7.map.api.primitives.AddressString)28 MAPDialogSmsProxy (org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy)28 MAPServiceSmsProxy (org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy)28 SmsSetEvent (org.mobicents.smsc.slee.services.smpp.server.events.SmsSetEvent)26 ISDNAddressStringImpl (org.mobicents.protocols.ss7.map.primitives.ISDNAddressStringImpl)25 SmscPropertiesManagement (org.mobicents.smsc.domain.SmscPropertiesManagement)25 UUID (java.util.UUID)23 SM_RP_DA (org.mobicents.protocols.ss7.map.api.service.sms.SM_RP_DA)21 SmsSignalInfo (org.mobicents.protocols.ss7.map.api.service.sms.SmsSignalInfo)21 SmsProxy (org.mobicents.smsc.slee.resources.persistence.SmsProxy)20 PreparedStatementCollection (org.mobicents.smsc.cassandra.PreparedStatementCollection)19 MAPApplicationContextVersion (org.mobicents.protocols.ss7.map.api.MAPApplicationContextVersion)18 IMSI (org.mobicents.protocols.ss7.map.api.primitives.IMSI)17 SendRoutingInfoForSMResponse (org.mobicents.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMResponse)17