Search in sources :

Example 1 with PermanentTemporaryFailure

use of org.mobicents.smsc.library.PermanentTemporaryFailure 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.mobicents.protocols.ss7.map.api.errors.MAPErrorMessageSubscriberBusyForMtSms) MAPErrorMessageAbsentSubscriberSM(org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessageAbsentSubscriberSM) MAPErrorMessageExtensionContainer(org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessageExtensionContainer) MAPErrorMessageAbsentSubscriber(org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessageAbsentSubscriber) MAPException(org.mobicents.protocols.ss7.map.api.MAPException) MAPErrorMessageSMDeliveryFailure(org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessageSMDeliveryFailure) MAPErrorMessageFacilityNotSup(org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessageFacilityNotSup) ErrorAction(org.mobicents.smsc.library.ErrorAction) MAPErrorMessageSystemFailure(org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessageSystemFailure) SmsSet(org.mobicents.smsc.library.SmsSet) PermanentTemporaryFailure(org.mobicents.smsc.library.PermanentTemporaryFailure) MAPErrorMessage(org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessage)

Example 2 with PermanentTemporaryFailure

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

the class SmscPropertiesManagement method store.

/**
 * Persist
 */
public void store() {
    // everytime?
    try {
        XMLObjectWriter writer = XMLObjectWriter.newInstance(new FileOutputStream(persistFile.toString()));
        writer.setBinding(binding);
        // Enables cross-references.
        // writer.setReferenceResolver(new XMLReferenceResolver());
        writer.setIndentation(TAB_INDENT);
        writer.write(this.serviceCenterGt, SC_GT, String.class);
        if (networkIdVsServiceCenterGt.size() > 0) {
            ArrayList<ServiceCenterGtNetworkIdElement> al = new ArrayList<ServiceCenterGtNetworkIdElement>();
            for (Entry<Integer, String> val : networkIdVsServiceCenterGt.entrySet()) {
                ServiceCenterGtNetworkIdElement el = new ServiceCenterGtNetworkIdElement();
                el.networkId = val.getKey();
                el.serviceCenterGt = val.getValue();
                al.add(el);
            }
            SmscPropertiesManagement_serviceCenterGtNetworkId al2 = new SmscPropertiesManagement_serviceCenterGtNetworkId(al);
            writer.write(al2, SC_GT_LIST, SmscPropertiesManagement_serviceCenterGtNetworkId.class);
        }
        writer.write(this.serviceCenterSsn, SC_SSN, Integer.class);
        writer.write(this.hlrSsn, HLR_SSN, Integer.class);
        writer.write(this.mscSsn, MSC_SSN, Integer.class);
        writer.write(this.maxMapVersion, MAX_MAP_VERSION, Integer.class);
        writer.write(this.defaultValidityPeriodHours, DEFAULT_VALIDITY_PERIOD_HOURS, Integer.class);
        writer.write(this.maxValidityPeriodHours, MAX_VALIDITY_PERIOD_HOURS, Integer.class);
        writer.write(this.defaultTon, DEFAULT_TON, Integer.class);
        writer.write(this.defaultNpi, DEFAULT_NPI, Integer.class);
        writer.write(this.subscriberBusyDueDelay, SUBSCRIBER_BUSY_DUE_DELAY, Integer.class);
        writer.write(this.firstDueDelay, FIRST_DUE_DELAY, Integer.class);
        writer.write(this.secondDueDelay, SECOND_DUE_DELAY, Integer.class);
        writer.write(this.maxDueDelay, MAX_DUE_DELAY, Integer.class);
        writer.write(this.dueDelayMultiplicator, DUE_DELAY_MULTIPLICATOR, Integer.class);
        writer.write(this.maxMessageLengthReducer, MAX_MESSAGE_LENGTH_REDUCER, Integer.class);
        writer.write(this.dbHosts, DB_HOSTS, String.class);
        writer.write(this.dbPort, DB_PORT, Integer.class);
        writer.write(this.keyspaceName, KEYSPACE_NAME, String.class);
        writer.write(this.clusterName, CLUSTER_NAME, String.class);
        writer.write(this.fetchPeriod, FETCH_PERIOD, Long.class);
        writer.write(this.fetchMaxRows, FETCH_MAX_ROWS, Integer.class);
        writer.write(this.deliveryPause, DELIVERY_PAUSE, Boolean.class);
        writer.write(this.removingLiveTablesDays, REMOVING_LIVE_TABLES_DAYS, Integer.class);
        writer.write(this.removingArchiveTablesDays, REMOVING_ARCHIVE_TABLES_DAYS, Integer.class);
        writer.write(this.hrHlrNumber, HR_HLR_NUMBER, String.class);
        if (networkIdVsHrHlrNumber.size() > 0) {
            ArrayList<HrHlrNumberNetworkIdElement> al = new ArrayList<HrHlrNumberNetworkIdElement>();
            for (Entry<Integer, String> val : networkIdVsHrHlrNumber.entrySet()) {
                HrHlrNumberNetworkIdElement el = new HrHlrNumberNetworkIdElement();
                el.networkId = val.getKey();
                el.hrHlrNumber = val.getValue();
                al.add(el);
            }
            SmscPropertiesManagement_HrHlrNumberNetworkId al2 = new SmscPropertiesManagement_HrHlrNumberNetworkId(al);
            writer.write(al2, HR_HLR_NUMBER_LIST, SmscPropertiesManagement_HrHlrNumberNetworkId.class);
        }
        writer.write(this.hrSriBypass, HR_SRI_BYPASS, Boolean.class);
        if (networkIdVsHrSriBypass.size() > 0) {
            ArrayList<HrSriBypassNetworkIdElement> al = new ArrayList<HrSriBypassNetworkIdElement>();
            for (Entry<Integer, Boolean> val : networkIdVsHrSriBypass.entrySet()) {
                HrSriBypassNetworkIdElement el = new HrSriBypassNetworkIdElement();
                el.networkId = val.getKey();
                el.hrSriBypass = val.getValue();
                al.add(el);
            }
            SmscPropertiesManagement_HrSriBypassNetworkId al2 = new SmscPropertiesManagement_HrSriBypassNetworkId(al);
            writer.write(al2, HR_SRI_BYPASS_LIST, SmscPropertiesManagement_HrSriBypassNetworkId.class);
        }
        writer.write(this.nationalLanguageSingleShift, NATIONAL_LANGUAGE_SINGLE_SHIFT, Integer.class);
        writer.write(this.nationalLanguageLockingShift, NATIONAL_LANGUAGE_LOCKING_SHIFT, Integer.class);
        writer.write(this.esmeDefaultClusterName, ESME_DEFAULT_CLUSTER_NAME, String.class);
        writer.write(this.maxActivityCount, MAX_ACTIVITY_COUNT, Integer.class);
        writer.write(this.deliveryTimeout, DELIVERY_TIMEOUT, Integer.class);
        writer.write(this.deliveryTimeoutDeltaPerMessage, DELIVERY_TIMEOUT_DELTA_PER_MESSAGE, Integer.class);
        writer.write(this.vpProlong, VP_PROLONG, Integer.class);
        // writer.write(this.isSMSHomeRouting, SMS_HOME_ROUTING, Boolean.class);
        writer.write(this.smppEncodingForGsm7.toString(), SMPP_ENCODING_FOR_GSM7, String.class);
        writer.write(this.smppEncodingForUCS2.toString(), SMPP_ENCODING_FOR_UCS2, String.class);
        writer.write(this.httpEncodingForGsm7.toString(), HTTP_ENCODING_FOR_GSM7, String.class);
        writer.write(this.httpEncodingForUCS2.toString(), HTTP_ENCODING_FOR_UCS2, String.class);
        writer.write(this.reviseSecondsOnSmscStart, REVISE_SECONDS_ON_SMSC_START, Integer.class);
        writer.write(this.processingSmsSetTimeout, PROCESSING_SMS_SET_TIMEOUT, Integer.class);
        writer.write(this.generateReceiptCdr, GENERATE_RECEIPT_CDR, Boolean.class);
        writer.write(this.generateDetailedCdr, GENERATE_DETAILED_CDR, Boolean.class);
        writer.write(this.generateTempFailureCdr, GENERATE_TEMP_FAILURE_CDR, Boolean.class);
        writer.write(this.generateRejectionCdr, GENERATE_REJECTION_CDR, Boolean.class);
        writer.write(this.calculateMsgPartsLenCdr, CALCULATE_MSG_PARTS_LEN_CDR, Boolean.class);
        writer.write(this.delayParametersInCdr, DELAY_PARAMETERS_IN_CDR, Boolean.class);
        writer.write(this.receiptsDisabling, RECEIPTS_DISABLING, Boolean.class);
        writer.write(this.incomeReceiptsProcessing, INCOME_RECEIPTS_PROCESSING, Boolean.class);
        writer.write(this.enableIntermediateReceipts, ENABLE_INTERMEDIATE_RECEIPTS, Boolean.class);
        writer.write(this.origNetworkIdForReceipts, ORIG_NETWORK_ID_FOR_RECEIPTS, Boolean.class);
        writer.write(this.moDefaultMessagingMode, MO_DEFAULT_MESSAGING_MODE, Integer.class);
        writer.write(this.hrDefaultMessagingMode, HR_DEFAULT_MESSAGING_MODE, Integer.class);
        writer.write(this.sipDefaultMessagingMode, SIP_DEFAULT_MESSAGING_MODE, Integer.class);
        writer.write(this.generateCdr.getValue(), GENERATE_CDR, Integer.class);
        writer.write(this.generateArchiveTable.getValue(), GENERATE_ARCHIVE_TABLE, Integer.class);
        writer.write(this.storeAndForwordMode.toString(), STORE_AND_FORWORD_MODE, String.class);
        writer.write(this.minMessageId, MIN_MESSAGE_ID, Long.class);
        writer.write(this.maxMessageId, MAX_MESSAGE_ID, Long.class);
        writer.write(this.moCharging.toString(), MO_CHARGING, String.class);
        writer.write(this.hrCharging.toString(), HR_CHARGING, String.class);
        writer.write(this.txSmppCharging.toString(), TX_SMPP_CHARGING, String.class);
        writer.write(this.txSipCharging.toString(), TX_SIP_CHARGING, String.class);
        writer.write(this.txHttpCharging.toString(), TX_HTTP_CHARGING, String.class);
        writer.write(this.globalTitleIndicator.toString(), GLOBAL_TITLE_INDICATOR, String.class);
        writer.write(this.translationType, TRANSLATION_TYPE, Integer.class);
        writer.write(this.correlationIdLiveTime, CORRELATION_ID_LIVE_TIME, Integer.class);
        writer.write(this.sriResponseLiveTime, SRI_RESPONSE_LIVE_TIME, Integer.class);
        writer.write(this.httpDefaultSourceTon, HTTP_DEFAULT_SOURCE_TON, Integer.class);
        writer.write(this.httpDefaultSourceNpi, HTTP_DEFAULT_SOURCE_NPI, Integer.class);
        writer.write(this.httpDefaultDestTon, HTTP_DEFAULT_DEST_TON, Integer.class);
        writer.write(this.httpDefaultDestNpi, HTTP_DEFAULT_DEST_NPI, Integer.class);
        writer.write(this.httpDefaultNetworkId, HTTP_DEFAULT_NETWORK_ID, Integer.class);
        writer.write(this.httpDefaultMessagingMode, HTTP_DEFAULT_MESSAGING_MODE, Integer.class);
        writer.write(this.httpDefaultRDDeliveryReceipt, HTTP_DEFAULT_RD_DELIVERY_RECEIPT, Integer.class);
        writer.write(this.httpDefaultRDIntermediateNotification, HTTP_DEFAULT_RD_INTERMEDIATE_NOTIFICATION, Integer.class);
        writer.write(this.httpDefaultDataCoding, HTTP_DEFAULT_DATA_CODING, Integer.class);
        writer.write(this.cassandraUser, CASSANDRA_USER, String.class);
        writer.write(this.cassandraPass, CASSANDRA_PASS, String.class);
        if (smDeliveryFailure.size() > 0) {
            ArrayList<SmDeliveryFailureListElement> al = new ArrayList<SmDeliveryFailureListElement>();
            for (Entry<Integer, PermanentTemporaryFailure> val : smDeliveryFailure.entrySet()) {
                SmDeliveryFailureListElement el = new SmDeliveryFailureListElement();
                el.causeCode = val.getKey();
                el.status = val.getValue();
                al.add(el);
            }
            SmscPropertiesManagement_smDeliveryFailure al2 = new SmscPropertiesManagement_smDeliveryFailure(al);
            writer.write(al2, SM_DELIVERY_FAILURE_LIST, SmscPropertiesManagement_smDeliveryFailure.class);
        }
        if (smDeliveryFailureTpFailureCause.size() > 0) {
            ArrayList<SmDeliveryFailureTpFailureCauseListElement> al = new ArrayList<SmDeliveryFailureTpFailureCauseListElement>();
            for (Entry<Integer, PermanentTemporaryFailure> val : smDeliveryFailureTpFailureCause.entrySet()) {
                SmDeliveryFailureTpFailureCauseListElement el = new SmDeliveryFailureTpFailureCauseListElement();
                el.causeCode = val.getKey();
                el.status = val.getValue();
                al.add(el);
            }
            SmscPropertiesManagement_smDeliveryFailureTpFailureCause al2 = new SmscPropertiesManagement_smDeliveryFailureTpFailureCause(al);
            writer.write(al2, SM_DELIVERY_FAILURE_TP_FAILURE_CAUSE_LIST, SmscPropertiesManagement_smDeliveryFailureTpFailureCause.class);
        }
        writer.write(this.smDeliveryFailureDlrWithTpdu, SM_DELIVERY_FAILURE_WITH_TPDU, String.class);
        writer.write(this.diameterDestRealm, DIAMETER_DEST_REALM, String.class);
        writer.write(this.diameterDestHost, DIAMETER_DEST_HOST, String.class);
        writer.write(this.diameterDestPort, DIAMETER_DEST_PORT, Integer.class);
        writer.write(this.diameterUserName, DIAMETER_USER_NAME, String.class);
        writer.close();
    } catch (Exception e) {
        logger.error("Error while persisting the SMSC state in file", e);
    }
}
Also used : ArrayList(java.util.ArrayList) XMLObjectWriter(javolution.xml.XMLObjectWriter) XMLStreamException(javolution.xml.stream.XMLStreamException) FileNotFoundException(java.io.FileNotFoundException) FileOutputStream(java.io.FileOutputStream) PermanentTemporaryFailure(org.mobicents.smsc.library.PermanentTemporaryFailure)

Example 3 with PermanentTemporaryFailure

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

the class SMSCShellExecutor method manageSet.

private String manageSet(String[] options) throws Exception {
    if (options.length < 4) {
        return SMSCOAMMessages.INVALID_COMMAND;
    }
    String parName = options[2].toLowerCase();
    try {
        if (parName.equals("scgt")) {
            String gt = options[3];
            if (options.length >= 6 && options[4].equals("networkid")) {
                int val = Integer.parseInt(options[5]);
                smscPropertiesManagement.setServiceCenterGt(val, gt);
            } else {
                smscPropertiesManagement.setServiceCenterGt(gt);
            }
        } else if (parName.equals("scssn")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setServiceCenterSsn(val);
        } else if (parName.equals("hlrssn")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setHlrSsn(val);
        } else if (parName.equals("mscssn")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setMscSsn(val);
        } else if (parName.equals("maxmapv")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setMaxMapVersion(val);
        } else if (parName.equals("gti")) {
            String val = options[3];
            switch(val) {
                case "0001":
                    smscPropertiesManagement.setGlobalTitleIndicator(GlobalTitleIndicator.GLOBAL_TITLE_INCLUDES_NATURE_OF_ADDRESS_INDICATOR_ONLY);
                    break;
                case "0010":
                    smscPropertiesManagement.setGlobalTitleIndicator(GlobalTitleIndicator.GLOBAL_TITLE_INCLUDES_TRANSLATION_TYPE_ONLY);
                    break;
                case "0011":
                    smscPropertiesManagement.setGlobalTitleIndicator(GlobalTitleIndicator.GLOBAL_TITLE_INCLUDES_TRANSLATION_TYPE_NUMBERING_PLAN_AND_ENCODING_SCHEME);
                    break;
                case "0100":
                    smscPropertiesManagement.setGlobalTitleIndicator(GlobalTitleIndicator.GLOBAL_TITLE_INCLUDES_TRANSLATION_TYPE_NUMBERING_PLAN_ENCODING_SCHEME_AND_NATURE_OF_ADDRESS);
                    break;
                default:
                    return SMSCOAMMessages.GLOBAL_TYTLE_INDICATOR_BAD_VALUES;
            }
        } else if (parName.equals("tt")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setTranslationType(val);
        } else if (parName.equals("defaultvalidityperiodhours")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setDefaultValidityPeriodHours(val);
        } else if (parName.equals("maxvalidityperiodhours")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setMaxValidityPeriodHours(val);
        } else if (parName.equals("defaultton")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setDefaultTon(val);
        } else if (parName.equals("defaultnpi")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setDefaultNpi(val);
        } else if (parName.equals("subscriberbusyduedelay")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setSubscriberBusyDueDelay(val);
        } else if (parName.equals("firstduedelay")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setFirstDueDelay(val);
        } else if (parName.equals("secondduedelay")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setSecondDueDelay(val);
        } else if (parName.equals("maxduedelay")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setMaxDueDelay(val);
        } else if (parName.equals("duedelaymultiplicator")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setDueDelayMultiplicator(val);
        } else if (parName.equals("maxmessagelengthreducer")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setMaxMessageLengthReducer(val);
        } else if (parName.equals("smppencodingforgsm7")) {
            String s1 = options[3].toLowerCase();
            if (s1.equals("utf8")) {
                smscPropertiesManagement.setSmppEncodingForGsm7(SmppEncoding.Utf8);
            } else if (s1.equals("unicode")) {
                smscPropertiesManagement.setSmppEncodingForGsm7(SmppEncoding.Unicode);
            } else if (s1.equals("gsm7")) {
                smscPropertiesManagement.setSmppEncodingForGsm7(SmppEncoding.Gsm7);
            } else {
                return String.format(SMSCOAMMessages.ILLEGAL_ARGUMENT, "SmppEncodingForGsm7 value", "UTF8 or UNICODE or GSM7 are possible");
            }
        } else if (parName.equals("smppencodingforucs2")) {
            String s1 = options[3].toLowerCase();
            if (s1.equals("utf8")) {
                smscPropertiesManagement.setSmppEncodingForUCS2(SmppEncoding.Utf8);
            } else if (s1.equals("unicode")) {
                smscPropertiesManagement.setSmppEncodingForUCS2(SmppEncoding.Unicode);
            } else if (s1.equals("gsm7")) {
                smscPropertiesManagement.setSmppEncodingForUCS2(SmppEncoding.Gsm7);
            } else {
                return String.format(SMSCOAMMessages.ILLEGAL_ARGUMENT, "SmppEncodingForUCS2 value", "UTF8 or UNICODE or GSM7 are possible");
            }
        } else if (parName.equals("dbhosts")) {
            String val = options[3];
            smscPropertiesManagement.setDbHosts(val);
        } else if (parName.equals("dbport")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setDbPort(val);
        } else if (parName.equals("keyspacename")) {
            String val = options[3];
            smscPropertiesManagement.setKeyspaceName(val);
        } else if (parName.equals("clustername")) {
            String val = options[3];
            smscPropertiesManagement.setClusterName(val);
        } else if (parName.equals("fetchperiod")) {
            long val = Long.parseLong(options[3]);
            smscPropertiesManagement.setFetchPeriod(val);
        } else if (parName.equals("fetchmaxrows")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setFetchMaxRows(val);
        } else if (parName.equals("maxactivitycount")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setMaxActivityCount(val);
        } else if (parName.equals("deliverytimeout")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setDeliveryTimeout(val);
        } else if (parName.equals("deliverytimeoutdeltapermessage")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setDeliveryTimeoutDeltaPerMessage(val);
        } else if (parName.equals("vpprolong")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setVpProlong(val);
        } else if (parName.equals("esmedefaultcluster")) {
            smscPropertiesManagement.setEsmeDefaultClusterName(options[3]);
        } else if (parName.equals("correlationidlivetime")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setCorrelationIdLiveTime(val);
        } else if (parName.equals("sriresponselivetime")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setSriResponseLiveTime(val);
        } else if (parName.equals("revisesecondsonsmscstart")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setReviseSecondsOnSmscStart(val);
        } else if (parName.equals("processingsmssettimeout")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setProcessingSmsSetTimeout(val);
        } else if (parName.equals("generatereceiptcdr")) {
            smscPropertiesManagement.setGenerateReceiptCdr(Boolean.parseBoolean(options[3]));
        } else if (parName.equals("generatetempfailurecdr")) {
            smscPropertiesManagement.setGenerateTempFailureCdr(Boolean.parseBoolean(options[3]));
        } else if (parName.equals("generaterejectioncdr")) {
            smscPropertiesManagement.setGenerateRejectionCdr(Boolean.parseBoolean(options[3]));
        } else if (parName.equals("calculatemsgpartslencdr")) {
            smscPropertiesManagement.setCalculateMsgPartsLenCdr(Boolean.parseBoolean(options[3]));
        } else if (parName.equals("delayparametersincdr")) {
            smscPropertiesManagement.setDelayParametersInCdr(Boolean.parseBoolean(options[3]));
        } else if (parName.equals("receiptsdisabling")) {
            smscPropertiesManagement.setReceiptsDisabling(Boolean.parseBoolean(options[3]));
        } else if (parName.equals("enableintermediatereceipts")) {
            smscPropertiesManagement.setEnableIntermediateReceipts(Boolean.parseBoolean(options[3]));
        } else if (parName.equals("enableintermediatereceipts")) {
            smscPropertiesManagement.setEnableIntermediateReceipts(Boolean.parseBoolean(options[3]));
        } else if (parName.equals("incomereceiptsprocessing")) {
            smscPropertiesManagement.setIncomeReceiptsProcessing(Boolean.parseBoolean(options[3]));
        } else if (parName.equals("orignetworkidforreceipts")) {
            smscPropertiesManagement.setOrigNetworkIdForReceipts(Boolean.parseBoolean(options[3]));
        } else if (parName.equals("generatecdr")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setGenerateCdrInt(val);
        } else if (parName.equals("generatearchivetable")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setGenerateArchiveTableInt(val);
        } else if (parName.equals("storeandforwordmode")) {
            smscPropertiesManagement.setStoreAndForwordMode(Enum.valueOf(StoreAndForwordMode.class, options[3]));
        } else if (parName.equals("mocharging")) {
            smscPropertiesManagement.setMoCharging(Enum.valueOf(MoChargingType.class, options[3]));
        } else if (parName.equals("hrcharging")) {
            smscPropertiesManagement.setHrCharging(Enum.valueOf(MoChargingType.class, options[3]));
        } else if (parName.equals("txsmppcharging")) {
            smscPropertiesManagement.setTxSmppChargingType(Enum.valueOf(ChargingType.class, options[3]));
        } else if (parName.equals("txsipcharging")) {
            smscPropertiesManagement.setTxSipChargingType(Enum.valueOf(ChargingType.class, options[3]));
        } else if (parName.equals("txhttpcharging")) {
            MoChargingType val = Enum.valueOf(MoChargingType.class, options[3]);
            if (val != MoChargingType.diameter)
                smscPropertiesManagement.setTxHttpCharging(val);
        } else if (parName.equals("diameterdestrealm")) {
            String val = options[3];
            smscPropertiesManagement.setDiameterDestRealm(val);
        } else if (parName.equals("diameterdesthost")) {
            String val = options[3];
            smscPropertiesManagement.setDiameterDestHost(val);
        } else if (parName.equals("diameterdestport")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setDiameterDestPort(val);
        } else if (parName.equals("diameterusername")) {
            String val = options[3];
            smscPropertiesManagement.setDiameterUserName(val);
        } else if (parName.equals("removinglivetablesdays")) {
            int val = Integer.parseInt(options[3]);
            if (val == 1 || val == 2 || val < 0)
                return SMSCOAMMessages.REMOVING_LIVE_ARCHIVE_TABLES_DAYS_BAD_VALUES;
            smscPropertiesManagement.setRemovingLiveTablesDays(val);
        } else if (parName.equals("removingarchivetablesdays")) {
            int val = Integer.parseInt(options[3]);
            if (val == 1 || val == 2 || val < 0)
                return SMSCOAMMessages.REMOVING_LIVE_ARCHIVE_TABLES_DAYS_BAD_VALUES;
            smscPropertiesManagement.setRemovingArchiveTablesDays(val);
        } else if (parName.equals("hrhlrnumber")) {
            String hrhlrnumber = options[3];
            if (options.length >= 6 && options[4].equals("networkid")) {
                int val = Integer.parseInt(options[5]);
                smscPropertiesManagement.setHrHlrNumber(val, hrhlrnumber);
            } else {
                smscPropertiesManagement.setHrHlrNumber(hrhlrnumber);
            }
        } else if (parName.equals("hrsribypass")) {
            boolean hrsribypass = Boolean.parseBoolean(options[3]);
            if (options.length >= 6 && options[4].equals("networkid")) {
                int val = Integer.parseInt(options[5]);
                smscPropertiesManagement.setHrSriBypass(val, hrsribypass);
            } else {
                smscPropertiesManagement.setHrSriBypass(hrsribypass);
            }
        } else if (parName.equals("nationallanguagesingleshift")) {
            int val = Integer.parseInt(options[3]);
            if (val < 0 || val > 13)
                return SMSCOAMMessages.NATIONAL_LANGUAGE_SHIFT_BAD_VALUE;
            smscPropertiesManagement.setNationalLanguageSingleShift(val);
        } else if (parName.equals("nationallanguagelockingshift")) {
            int val = Integer.parseInt(options[3]);
            if (val < 0 || val > 13)
                return SMSCOAMMessages.NATIONAL_LANGUAGE_SHIFT_BAD_VALUE;
            smscPropertiesManagement.setNationalLanguageLockingShift(val);
        } else if (parName.equals("httpdefaultsourceton")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setHttpDefaultSourceTon(val);
        } else if (parName.equals("httpDefaultSourceNpi")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setHttpDefaultSourceNpi(val);
        } else if (parName.equals("httpdefaultdestton")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setHttpDefaultDestTon(val);
        } else if (parName.equals("httpdefaultdestnpi")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setHttpDefaultDestNpi(val);
        } else if (parName.equals("httpdefaultnetworkid")) {
            int val = Integer.parseInt(options[3]);
            smscPropertiesManagement.setHttpDefaultNetworkId(val);
        } else if (parName.equals("httpdefaultmessagingmode")) {
            int val = Integer.parseInt(options[3]);
            if (val < 0 || val > 3)
                return SMSCOAMMessages.MESSAGING_MODE_BAD_VALUES;
            smscPropertiesManagement.setHttpDefaultMessagingMode(val);
        } else if (parName.equals("modefaultmessagingmode")) {
            int val = Integer.parseInt(options[3]);
            if (val < 0 || val > 3)
                return SMSCOAMMessages.MESSAGING_MODE_BAD_VALUES;
            smscPropertiesManagement.setMoDefaultMessagingMode(val);
        } else if (parName.equals("hrdefaultmessagingmode")) {
            int val = Integer.parseInt(options[3]);
            if (val < 0 || val > 3)
                return SMSCOAMMessages.MESSAGING_MODE_BAD_VALUES;
            smscPropertiesManagement.setHrDefaultMessagingMode(val);
        } else if (parName.equals("sipdefaultmessagingmode")) {
            int val = Integer.parseInt(options[3]);
            if (val < 0 || val > 3 || val == 2)
                return SMSCOAMMessages.MESSAGING_MODE_BAD_VALUES;
            smscPropertiesManagement.setSipDefaultMessagingMode(val);
        } else if (parName.equals("httpdefaultrddeliveryreceipt")) {
            int val = Integer.parseInt(options[3]);
            if (val < 0 || val > 3 || val == 2)
                return SMSCOAMMessages.DELIVERY_RECEIPT_BAD_VALUES;
            smscPropertiesManagement.setHttpDefaultRDDeliveryReceipt(val);
        } else if (parName.equals("httpdefaultrdintermediatenotification")) {
            int val = Integer.parseInt(options[3]);
            if (val < 0 || val > 1)
                return SMSCOAMMessages.INTERMEDIATE_RECEIPT_BAD_VALUES;
            smscPropertiesManagement.setHttpDefaultRDIntermediateNotification(val);
        } else if (parName.equals("httpdefaultdatacoding")) {
            int val = Integer.parseInt(options[3]);
            if (val < 0 || val > 255)
                return SMSCOAMMessages.DATA_CODING_BAD_VALUES;
            smscPropertiesManagement.setHttpDefaultDataCoding(val);
        } else if (parName.equals("httpencodingforgsm7")) {
            String s1 = options[3].toLowerCase();
            if (s1.equals("utf8")) {
                smscPropertiesManagement.setHttpEncodingForGsm7(HttpEncoding.Utf8);
            } else if (s1.equals("unicode")) {
                smscPropertiesManagement.setHttpEncodingForGsm7(HttpEncoding.Unicode);
            } else {
                return String.format(SMSCOAMMessages.ILLEGAL_ARGUMENT, "HttpEncodingForGsm7 value", "UTF8 or UNICODE are possible");
            }
        } else if (parName.equals("httpencodingforucs2")) {
            String s1 = options[3].toLowerCase();
            if (s1.equals("utf8")) {
                smscPropertiesManagement.setHttpEncodingForUCS2(HttpEncoding.Utf8);
            } else if (s1.equals("unicode")) {
                smscPropertiesManagement.setHttpEncodingForUCS2(HttpEncoding.Unicode);
            } else {
                return String.format(SMSCOAMMessages.ILLEGAL_ARGUMENT, "HttpEncodingForUCS2 value", "UTF8 or UNICODE are possible");
            }
        } else if (parName.equals("minmessageid")) {
            long val = Long.parseLong(options[3]);
            smscPropertiesManagement.setMinMessageId(val);
        } else if (parName.equals("maxmessageid")) {
            long val = Long.parseLong(options[3]);
            smscPropertiesManagement.setMaxMessageId(val);
        } else if (parName.equals("deliverypause")) {
            boolean val = Boolean.parseBoolean(options[3]);
            smscPropertiesManagement.setDeliveryPause(val);
        } else if (parName.equals("cassandrauser")) {
            String val = String.valueOf(options[3]);
            smscPropertiesManagement.setCassandraUser(val);
        } else if (parName.equals("cassandrapass")) {
            String val = String.valueOf(options[3]);
            smscPropertiesManagement.setCassandraPass(val);
        } else if (parName.equals("smdeliveryfailure")) {
            int val = Integer.valueOf(options[3]);
            if (options.length == 5 && !(val < 0 || val > 6)) {
                String s1 = options[4].toLowerCase();
                PermanentTemporaryFailure vale = Enum.valueOf(PermanentTemporaryFailure.class, s1);
                smscPropertiesManagement.setSmDeliveryFailure(val, vale);
            }
        } else if (parName.equals("smdeliveryfailure_tpfailurecause")) {
            int val = Integer.valueOf(options[3]);
            if (options.length == 5) {
                String s1 = options[4].toLowerCase();
                PermanentTemporaryFailure vale = Enum.valueOf(PermanentTemporaryFailure.class, s1);
                smscPropertiesManagement.setSmDeliveryFailureTpCause(val, vale);
            }
        } else if (parName.equals("smdeliveryfailure_dlr_withtpuserdata")) {
            String s1 = options[3].toLowerCase();
            if (options.length == 4) {
                smscPropertiesManagement.setSmDeliveryFailureDlrWithTpdu(s1);
            }
        } else {
            return SMSCOAMMessages.INVALID_COMMAND;
        }
    } catch (IllegalArgumentException e) {
        return String.format(SMSCOAMMessages.ILLEGAL_ARGUMENT, parName, e.getMessage());
    }
    return SMSCOAMMessages.PARAMETER_SUCCESSFULLY_SET;
}
Also used : PermanentTemporaryFailure(org.mobicents.smsc.library.PermanentTemporaryFailure)

Aggregations

PermanentTemporaryFailure (org.mobicents.smsc.library.PermanentTemporaryFailure)3 FileNotFoundException (java.io.FileNotFoundException)1 FileOutputStream (java.io.FileOutputStream)1 ArrayList (java.util.ArrayList)1 XMLObjectWriter (javolution.xml.XMLObjectWriter)1 XMLStreamException (javolution.xml.stream.XMLStreamException)1 MAPException (org.mobicents.protocols.ss7.map.api.MAPException)1 MAPErrorMessage (org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessage)1 MAPErrorMessageAbsentSubscriber (org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessageAbsentSubscriber)1 MAPErrorMessageAbsentSubscriberSM (org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessageAbsentSubscriberSM)1 MAPErrorMessageExtensionContainer (org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessageExtensionContainer)1 MAPErrorMessageFacilityNotSup (org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessageFacilityNotSup)1 MAPErrorMessageSMDeliveryFailure (org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessageSMDeliveryFailure)1 MAPErrorMessageSubscriberBusyForMtSms (org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessageSubscriberBusyForMtSms)1 MAPErrorMessageSystemFailure (org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessageSystemFailure)1 ErrorAction (org.mobicents.smsc.library.ErrorAction)1 SmsSet (org.mobicents.smsc.library.SmsSet)1