Search in sources :

Example 1 with MAPErrorMessageFacilityNotSup

use of org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessageFacilityNotSup in project smscgateway by RestComm.

the class MtSbb method onErrorComponent.

// *********
// MAP Component events
@Override
public void onErrorComponent(ErrorComponent event, ActivityContextInterface aci) {
    try {
        super.onErrorComponent(event, aci);
        SmsSet smsSet = getSmsSet();
        if (smsSet == null) {
            logger.severe("MtSbb.onErrorComponent(): CMP smsSet is missed");
            return;
        }
        MAPErrorMessage mapErrorMessage = event.getMAPErrorMessage();
        if (mapErrorMessage.isEmSubscriberBusyForMtSms()) {
            MAPErrorMessageSubscriberBusyForMtSms subscriberBusyForMtSms = mapErrorMessage.getEmSubscriberBusyForMtSms();
            this.onDeliveryError(smsSet, ErrorAction.subscriberBusy, ErrorCode.USER_BUSY, "Error subscriberBusyForMtSms after MtForwardSM Request: " + subscriberBusyForMtSms.toString(), true, mapErrorMessage, false, ProcessingType.SS7_MT);
        } else if (mapErrorMessage.isEmAbsentSubscriber()) {
            MAPErrorMessageAbsentSubscriber absentSubscriber = mapErrorMessage.getEmAbsentSubscriber();
            this.onDeliveryError(smsSet, ErrorAction.mobileNotReachableFlag, ErrorCode.ABSENT_SUBSCRIBER, "Error absentSubscriber after MtForwardSM Request: " + absentSubscriber.toString(), true, mapErrorMessage, false, ProcessingType.SS7_MT);
        } else if (mapErrorMessage.isEmAbsentSubscriberSM()) {
            MAPErrorMessageAbsentSubscriberSM absentSubscriber = mapErrorMessage.getEmAbsentSubscriberSM();
            this.onDeliveryError(smsSet, ErrorAction.mobileNotReachableFlag, ErrorCode.ABSENT_SUBSCRIBER, "Error absentSubscriberSM after MtForwardSM Request: " + absentSubscriber.toString(), true, mapErrorMessage, false, ProcessingType.SS7_MT);
        } else if (mapErrorMessage.isEmSMDeliveryFailure()) {
            MAPErrorMessageSMDeliveryFailure smDeliveryFailure = mapErrorMessage.getEmSMDeliveryFailure();
            SmsDeliverReportTpdu tpdu = null;
            try {
                tpdu = smDeliveryFailure.getSmsDeliverReportTpdu();
            } catch (MAPException e) {
            // we skip any possible Exception here
            }
            ErrorAction errAction;
            // checking firstly a case of FailureCause existence in tpdu
            if (tpdu != null && tpdu.getFailureCause() != null) {
                int tpduCauseCode = tpdu.getFailureCause().getCode();
                PermanentTemporaryFailure tpFailureCauseStatus = SmscPropertiesManagement.getInstance().getSmDeliveryFailureTpCause(tpduCauseCode);
                if (tpFailureCauseStatus == PermanentTemporaryFailure.temporary) {
                    errAction = ErrorAction.temporaryFailure;
                } else {
                    errAction = ErrorAction.permanentFailure;
                }
                this.onDeliveryError(smsSet, errAction, ErrorCode.SENDING_SM_FAILED, "Error smDeliveryFailure after MtForwardSM Request: " + smDeliveryFailure.toString(), true, mapErrorMessage, false, ProcessingType.SS7_MT);
            } else {
                // no FailureCause existence in tpdu - then checking DeliveryFailureCause code
                PermanentTemporaryFailure smDlrStatus = SmscPropertiesManagement.getInstance().getSmDeliveryFailure(smDeliveryFailure.getSMEnumeratedDeliveryFailureCause().getCode());
                if (smDeliveryFailure.getSMEnumeratedDeliveryFailureCause() == SMEnumeratedDeliveryFailureCause.memoryCapacityExceeded) {
                    if (smDlrStatus == PermanentTemporaryFailure.permanent)
                        errAction = ErrorAction.permanentFailure;
                    else
                        errAction = ErrorAction.memoryCapacityExceededFlag;
                    this.onDeliveryError(smsSet, errAction, ErrorCode.MESSAGE_QUEUE_FULL, "Error smDeliveryFailure after MtForwardSM Request: " + smDeliveryFailure.toString(), true, mapErrorMessage, false, ProcessingType.SS7_MT);
                } else {
                    if (smDlrStatus == PermanentTemporaryFailure.temporary)
                        errAction = ErrorAction.temporaryFailure;
                    else
                        errAction = ErrorAction.permanentFailure;
                    this.onDeliveryError(smsSet, errAction, ErrorCode.SENDING_SM_FAILED, "Error smDeliveryFailure after MtForwardSM Request: " + smDeliveryFailure.toString(), true, mapErrorMessage, false, ProcessingType.SS7_MT);
                }
            }
        } else if (mapErrorMessage.isEmSystemFailure()) {
            // TODO: may be it is not a permanent case ???
            MAPErrorMessageSystemFailure systemFailure = mapErrorMessage.getEmSystemFailure();
            this.onDeliveryError(smsSet, ErrorAction.temporaryFailure, ErrorCode.SYSTEM_FAILURE, "Error systemFailure after MtForwardSM Request: " + systemFailure.toString(), true, mapErrorMessage, false, ProcessingType.SS7_MT);
        } else if (mapErrorMessage.isEmFacilityNotSup()) {
            MAPErrorMessageFacilityNotSup facilityNotSup = mapErrorMessage.getEmFacilityNotSup();
            this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.FACILITY_NOT_SUPPORTED, "Error facilityNotSup after MtForwardSM Request: " + facilityNotSup.toString(), true, mapErrorMessage, false, ProcessingType.SS7_MT);
        } else if (mapErrorMessage.isEmExtensionContainer()) {
            MAPErrorMessageExtensionContainer extensionContainer = mapErrorMessage.getEmExtensionContainer();
            switch((int) (long) extensionContainer.getErrorCode()) {
                case MAPErrorCode.dataMissing:
                    this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.DATA_MISSING, "Error dataMissing after MtForwardSM Request: " + extensionContainer.toString(), true, mapErrorMessage, false, ProcessingType.SS7_MT);
                    break;
                case MAPErrorCode.unexpectedDataValue:
                    this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.UNEXPECTED_DATA, "Error unexpectedDataValue after MtForwardSM Request: " + extensionContainer.toString(), true, mapErrorMessage, false, ProcessingType.SS7_MT);
                    break;
                // break;
                case MAPErrorCode.unidentifiedSubscriber:
                    this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.UNDEFINED_SUBSCRIBER, "Error unidentifiedSubscriber after MtForwardSM Request: " + extensionContainer.toString(), true, mapErrorMessage, false, ProcessingType.SS7_MT);
                    break;
                case MAPErrorCode.illegalSubscriber:
                    this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.ILLEGAL_SUBSCRIBER, "Error illegalSubscriber after MtForwardSM Request: " + extensionContainer.toString(), true, mapErrorMessage, false, ProcessingType.SS7_MT);
                    break;
                case MAPErrorCode.illegalEquipment:
                    this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.ILLEGAL_EQUIPMENT, "Error illegalEquipment after MtForwardSM Request: " + extensionContainer.toString(), true, mapErrorMessage, false, ProcessingType.SS7_MT);
                    break;
                default:
                    this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.SYSTEM_FAILURE, "Error after MtForwardSM Request: " + extensionContainer.toString(), true, mapErrorMessage, false, ProcessingType.SS7_MT);
                    break;
            }
        } else {
            this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.SYSTEM_FAILURE, "Error after MtForwardSM Request: " + mapErrorMessage, true, mapErrorMessage, false, ProcessingType.SS7_MT);
        }
    } catch (Throwable e1) {
        logger.severe("Exception in MtSbb.onErrorComponent() when fetching records and issuing events: " + e1.getMessage(), e1);
        markDeliveringIsEnded(true);
    }
}
Also used : MAPErrorMessageSubscriberBusyForMtSms(org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessageSubscriberBusyForMtSms) MAPErrorMessageAbsentSubscriberSM(org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessageAbsentSubscriberSM) MAPErrorMessageExtensionContainer(org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessageExtensionContainer) MAPErrorMessageAbsentSubscriber(org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessageAbsentSubscriber) MAPException(org.restcomm.protocols.ss7.map.api.MAPException) MAPErrorMessageSMDeliveryFailure(org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessageSMDeliveryFailure) MAPErrorMessageFacilityNotSup(org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessageFacilityNotSup) ErrorAction(org.mobicents.smsc.library.ErrorAction) MAPErrorMessageSystemFailure(org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessageSystemFailure) SmsSet(org.mobicents.smsc.library.SmsSet) PermanentTemporaryFailure(org.mobicents.smsc.library.PermanentTemporaryFailure) MAPErrorMessage(org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage)

Aggregations

ErrorAction (org.mobicents.smsc.library.ErrorAction)1 PermanentTemporaryFailure (org.mobicents.smsc.library.PermanentTemporaryFailure)1 SmsSet (org.mobicents.smsc.library.SmsSet)1 MAPException (org.restcomm.protocols.ss7.map.api.MAPException)1 MAPErrorMessage (org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage)1 MAPErrorMessageAbsentSubscriber (org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessageAbsentSubscriber)1 MAPErrorMessageAbsentSubscriberSM (org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessageAbsentSubscriberSM)1 MAPErrorMessageExtensionContainer (org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessageExtensionContainer)1 MAPErrorMessageFacilityNotSup (org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessageFacilityNotSup)1 MAPErrorMessageSMDeliveryFailure (org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessageSMDeliveryFailure)1 MAPErrorMessageSubscriberBusyForMtSms (org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessageSubscriberBusyForMtSms)1 MAPErrorMessageSystemFailure (org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessageSystemFailure)1