Search in sources :

Example 51 with SmsSet

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

the class SriSbb method onDialogProviderAbort.

@Override
public void onDialogProviderAbort(DialogProviderAbort evt, ActivityContextInterface aci) {
    try {
        super.onDialogProviderAbort(evt, aci);
        MAPAbortProviderReason abortProviderReason = evt.getAbortProviderReason();
        SmsSet smsSet = getSmsSet();
        if (smsSet == null) {
            logger.severe("SriSbb.onDialogProviderAbort(): CMP smsSet is missed");
            markDeliveringIsEnded(true);
            return;
        }
        this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.HLR_REJECT_AFTER_ROUTING_INFO, "onDialogProviderAbort after SRI Request: " + abortProviderReason != null ? abortProviderReason.toString() : "", true, null, false, ProcessingType.SS7_SRI);
    } catch (Throwable e1) {
        logger.severe("Exception in SriSbb.onDialogProviderAbort() when fetching records and issuing events: " + e1.getMessage(), e1);
        markDeliveringIsEnded(true);
    }
}
Also used : MAPAbortProviderReason(org.mobicents.protocols.ss7.map.api.dialog.MAPAbortProviderReason) SmsSet(org.mobicents.smsc.library.SmsSet)

Example 52 with SmsSet

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

the class SriSbb method onDialogReject.

// *********
// MAP Dialog events
@Override
public void onDialogReject(DialogReject evt, ActivityContextInterface aci) {
    try {
        MAPRefuseReason mapRefuseReason = evt.getRefuseReason();
        SmsSet smsSet = getSmsSet();
        if (smsSet == null) {
            logger.severe("SriSbb.onDialogReject(): CMP smsSet is missed");
            markDeliveringIsEnded(true);
            return;
        }
        if (mapRefuseReason == MAPRefuseReason.PotentialVersionIncompatibility && evt.getMAPDialog().getApplicationContext().getApplicationContextVersion() != MAPApplicationContextVersion.version1) {
            if (logger.isWarningEnabled()) {
                this.logger.warning("Rx : Sri onDialogReject / PotentialVersionIncompatibility=" + evt);
            }
            // possible a peer supports only MAP V1
            // Now send new SRI with supported ACN (MAP V1)
            this.sendSRI(smsSet, smsSet.getDestAddr(), smsSet.getDestAddrTon(), smsSet.getDestAddrNpi(), this.getSRIMAPApplicationContext(MAPApplicationContextVersion.version1));
            return;
        }
        // If ACN not supported, lets use the new one suggested
        if (mapRefuseReason == MAPRefuseReason.ApplicationContextNotSupported) {
            if (logger.isWarningEnabled()) {
                this.logger.warning("Rx : Sri onDialogReject / ApplicationContextNotSupported=" + evt);
            }
            // Now send new SRI with supported ACN
            ApplicationContextName tcapApplicationContextName = evt.getAlternativeApplicationContext();
            MAPApplicationContext supportedMAPApplicationContext = MAPApplicationContext.getInstance(tcapApplicationContextName.getOid());
            this.sendSRI(smsSet, smsSet.getDestAddr(), smsSet.getDestAddrTon(), smsSet.getDestAddrNpi(), this.getSRIMAPApplicationContext(supportedMAPApplicationContext.getApplicationContextVersion()));
            return;
        }
        super.onDialogReject(evt, aci);
        this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.HLR_REJECT_AFTER_ROUTING_INFO, "onDialogReject after SRI Request: " + mapRefuseReason != null ? mapRefuseReason.toString() : "", true, null, false, ProcessingType.SS7_SRI);
    } catch (Throwable e1) {
        logger.severe("Exception in SriSbb.onDialogReject() when fetching records and issuing events: " + e1.getMessage(), e1);
        markDeliveringIsEnded(true);
    }
}
Also used : ApplicationContextName(org.mobicents.protocols.ss7.tcap.asn.ApplicationContextName) MAPRefuseReason(org.mobicents.protocols.ss7.map.api.dialog.MAPRefuseReason) SmsSet(org.mobicents.smsc.library.SmsSet) MAPApplicationContext(org.mobicents.protocols.ss7.map.api.MAPApplicationContext)

Example 53 with SmsSet

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

the class SriSbb method onSriFullResponse.

private void onSriFullResponse() {
    SendRoutingInfoForSMResponse sendRoutingInfoForSMResponse = this.getSendRoutingInfoForSMResponse();
    MAPErrorMessage errorMessage = this.getErrorResponse();
    SmsSet smsSet = getSmsSet();
    if (smsSet == null) {
        logger.severe("SriSbb.onSriFullResponse(): CMP smsSet is missed");
        markDeliveringIsEnded(true);
        return;
    }
    if (sendRoutingInfoForSMResponse != null) {
        // we have positive response to SRI request -
        // we will try to send messages
        // storing SRI response results into a cache firstly
        SriResponseValue sriResponseValue = new SriResponseValue(smsSet.getTargetId(), smsSet.getNetworkId(), smsSet.getDestAddr(), smsSet.getDestAddrTon(), smsSet.getDestAddrNpi(), sendRoutingInfoForSMResponse.getLocationInfoWithLMSI(), sendRoutingInfoForSMResponse.getIMSI().getData());
        try {
            SmsSetCache.getInstance().putSriResponseValue(sriResponseValue, smscPropertiesManagement.getSriResponseLiveTime());
        } catch (Exception e1) {
        // no actions in failure
        }
        executeForwardSM(smsSet, sendRoutingInfoForSMResponse.getLocationInfoWithLMSI(), sendRoutingInfoForSMResponse.getIMSI().getData(), smsSet.getNetworkId());
        return;
    }
    if (errorMessage != null) {
        // we have a negative response
        if (errorMessage.isEmAbsentSubscriber()) {
            this.onDeliveryError(smsSet, ErrorAction.mobileNotReachableFlag, ErrorCode.ABSENT_SUBSCRIBER, "AbsentSubscriber response from HLR: " + errorMessage.toString(), true, errorMessage, false, ProcessingType.SS7_SRI);
        } else if (errorMessage.isEmAbsentSubscriberSM()) {
            this.onDeliveryError(smsSet, ErrorAction.mobileNotReachableFlag, ErrorCode.ABSENT_SUBSCRIBER, "AbsentSubscriberSM response from HLR: " + errorMessage.toString(), true, errorMessage, false, ProcessingType.SS7_SRI);
        } else if (errorMessage.isEmCallBarred()) {
            this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.CALL_BARRED, "CallBarred response from HLR: " + errorMessage.toString(), true, errorMessage, false, ProcessingType.SS7_SRI);
        } else if (errorMessage.isEmFacilityNotSup()) {
            this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.FACILITY_NOT_SUPPORTED, "FacilityNotSuppored response from HLR: " + errorMessage.toString(), true, errorMessage, false, ProcessingType.SS7_SRI);
        } else if (errorMessage.isEmSystemFailure()) {
            // TODO: may be systemFailure is not a permanent error case ?
            this.onDeliveryError(smsSet, ErrorAction.temporaryFailure, ErrorCode.SYSTEM_FAILURE, "SystemFailure response from HLR: " + errorMessage.toString(), true, errorMessage, false, ProcessingType.SS7_SRI);
        } else if (errorMessage.isEmUnknownSubscriber()) {
            this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.UNKNOWN_SUBSCRIBER, "UnknownSubscriber response from HLR: " + errorMessage.toString(), true, errorMessage, false, ProcessingType.SS7_SRI);
        } else if (errorMessage.isEmExtensionContainer()) {
            if (errorMessage.getEmExtensionContainer().getErrorCode() == MAPErrorCode.dataMissing) {
                this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.DATA_MISSING, "DataMissing response from HLR", true, errorMessage, false, ProcessingType.SS7_SRI);
            } else if (errorMessage.getEmExtensionContainer().getErrorCode() == MAPErrorCode.unexpectedDataValue) {
                this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.UNEXPECTED_DATA, "UnexpectedDataValue response from HLR", true, errorMessage, false, ProcessingType.SS7_SRI);
            } else if (errorMessage.getEmExtensionContainer().getErrorCode() == MAPErrorCode.teleserviceNotProvisioned) {
                this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.TELESERVICE_NOT_PROVISIONED, "TeleserviceNotProvisioned response from HLR", true, errorMessage, false, ProcessingType.SS7_SRI);
            } else {
                this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.UNEXPECTED_DATA_FROM_HLR, "Error response from HLR: " + errorMessage.toString(), true, errorMessage, false, ProcessingType.SS7_SRI);
            }
        } else {
            this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.UNEXPECTED_DATA_FROM_HLR, "Error response from HLR: " + errorMessage.toString(), true, errorMessage, false, ProcessingType.SS7_SRI);
        }
    } else {
        // we have no responses - this is an error behaviour
        this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.HLR_REJECT_AFTER_ROUTING_INFO, "Empty response after SRI Request", false, null, false, ProcessingType.SS7_SRI);
    }
}
Also used : SriResponseValue(org.mobicents.smsc.library.SriResponseValue) SendRoutingInfoForSMResponse(org.mobicents.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMResponse) SmsSet(org.mobicents.smsc.library.SmsSet) MAPException(org.mobicents.protocols.ss7.map.api.MAPException) MAPErrorMessage(org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessage)

Example 54 with SmsSet

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

the class SriSbb method onRejectComponent.

@Override
public void onRejectComponent(RejectComponent event, ActivityContextInterface aci) {
    super.onRejectComponent(event, aci);
    String reason = this.getRejectComponentReason(event);
    SmsSet smsSet = getSmsSet();
    if (smsSet == null) {
        logger.severe("SriSbb.onRejectComponent(): CMP smsSet is missed");
        markDeliveringIsEnded(true);
        return;
    }
    this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.HLR_REJECT_AFTER_ROUTING_INFO, "onRejectComponent after SRI Request: " + reason != null ? reason.toString() : "", true, null, false, ProcessingType.SS7_SRI);
}
Also used : ISDNAddressString(org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.mobicents.protocols.ss7.map.api.primitives.AddressString) SmsSet(org.mobicents.smsc.library.SmsSet)

Example 55 with SmsSet

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

the class RxSipServerSbb method onSipSm.

// *********
// initial event
public void onSipSm(SmsSetEvent event, ActivityContextInterface aci, EventContext eventContext) {
    try {
        if (this.logger.isFineEnabled()) {
            this.logger.fine("\nReceived SIP SMS. event= " + event + "this=" + this);
        }
        SmsSet smsSet = event.getSmsSet();
        this.addInitialMessageSet(smsSet);
        try {
            this.sendMessage(smsSet);
        } catch (SmscProcessingException e) {
            String s = "SmscProcessingException when sending SIP MESSAGE=" + e.getMessage() + ", smsSet=" + smsSet;
            logger.severe(s, e);
            this.onDeliveryError(smsSet, ErrorAction.temporaryFailure, ErrorCode.SC_SYSTEM_ERROR, s);
        }
    } catch (Throwable e1) {
        logger.severe("Exception in RxSmppServerSbb.onDeliverSm() when fetching records and issuing events: " + e1.getMessage(), e1);
        markDeliveringIsEnded(true);
    }
}
Also used : SmscProcessingException(org.mobicents.smsc.library.SmscProcessingException) 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