Search in sources :

Example 1 with GenerateType

use of org.restcomm.smpp.GenerateType in project smscgateway by RestComm.

the class SmscPropertiesManagement method setGenerateArchiveTableInt.

@Override
public void setGenerateArchiveTableInt(int generateArchiveTable) {
    this.generateArchiveTable = new GenerateType(generateArchiveTable);
    this.store();
}
Also used : GenerateType(org.restcomm.smpp.GenerateType)

Example 2 with GenerateType

use of org.restcomm.smpp.GenerateType in project smscgateway by RestComm.

the class SmscPropertiesManagement method load.

/**
 * Load and create LinkSets and Link from persisted file
 *
 * @throws Exception
 */
public void load() throws FileNotFoundException {
    XMLObjectReader reader = null;
    try {
        reader = XMLObjectReader.newInstance(new FileInputStream(persistFile.toString()));
        reader.setBinding(binding);
        this.serviceCenterGt = reader.read(SC_GT, String.class);
        SmscPropertiesManagement_serviceCenterGtNetworkId al = reader.read(SC_GT_LIST, SmscPropertiesManagement_serviceCenterGtNetworkId.class);
        networkIdVsServiceCenterGt.clear();
        if (al != null) {
            for (ServiceCenterGtNetworkIdElement elem : al.getData()) {
                networkIdVsServiceCenterGt.put(elem.networkId, elem.serviceCenterGt);
            }
        }
        this.serviceCenterSsn = reader.read(SC_SSN, Integer.class);
        this.hlrSsn = reader.read(HLR_SSN, Integer.class);
        this.mscSsn = reader.read(MSC_SSN, Integer.class);
        this.maxMapVersion = reader.read(MAX_MAP_VERSION, Integer.class);
        Integer dvp = reader.read(DEFAULT_VALIDITY_PERIOD_HOURS, Integer.class);
        if (dvp != null)
            this.defaultValidityPeriodHours = dvp;
        Integer mvp = reader.read(MAX_VALIDITY_PERIOD_HOURS, Integer.class);
        if (mvp != null)
            this.maxValidityPeriodHours = mvp;
        Integer dTon = reader.read(DEFAULT_TON, Integer.class);
        if (dTon != null)
            this.defaultTon = dTon;
        Integer dNpi = reader.read(DEFAULT_NPI, Integer.class);
        if (dNpi != null)
            this.defaultNpi = dNpi;
        Integer val = reader.read(SUBSCRIBER_BUSY_DUE_DELAY, Integer.class);
        if (val != null)
            this.subscriberBusyDueDelay = val;
        val = reader.read(FIRST_DUE_DELAY, Integer.class);
        if (val != null)
            this.firstDueDelay = val;
        val = reader.read(SECOND_DUE_DELAY, Integer.class);
        if (val != null)
            this.secondDueDelay = val;
        val = reader.read(MAX_DUE_DELAY, Integer.class);
        if (val != null)
            this.maxDueDelay = val;
        val = reader.read(DUE_DELAY_MULTIPLICATOR, Integer.class);
        if (val != null)
            this.dueDelayMultiplicator = val;
        val = reader.read(MAX_MESSAGE_LENGTH_REDUCER, Integer.class);
        if (val != null)
            this.maxMessageLengthReducer = val;
        // for backup compatibility
        String vals = reader.read(HOSTS, String.class);
        if (vals != null) {
            String[] hostsArr = vals.split(":");
            if (hostsArr.length == 2) {
                this.dbHosts = hostsArr[0];
                this.dbPort = Integer.parseInt(hostsArr[1]);
            }
        }
        vals = reader.read(DB_HOSTS, String.class);
        if (vals != null)
            this.dbHosts = vals;
        val = reader.read(DB_PORT, Integer.class);
        if (val != null)
            this.dbPort = val;
        this.keyspaceName = reader.read(KEYSPACE_NAME, String.class);
        this.clusterName = reader.read(CLUSTER_NAME, String.class);
        Long vall = reader.read(FETCH_PERIOD, Long.class);
        if (vall != null)
            this.fetchPeriod = vall;
        val = reader.read(FETCH_MAX_ROWS, Integer.class);
        if (val != null)
            this.fetchMaxRows = val;
        Boolean valB = reader.read(DELIVERY_PAUSE, Boolean.class);
        if (valB != null) {
            this.deliveryPause = valB.booleanValue();
        }
        val = reader.read(REMOVING_LIVE_TABLES_DAYS, Integer.class);
        if (val != null)
            this.removingLiveTablesDays = val;
        val = reader.read(REMOVING_ARCHIVE_TABLES_DAYS, Integer.class);
        if (val != null)
            this.removingArchiveTablesDays = val;
        vals = reader.read(MO_UNKNOWN_TYPE_OF_NUMBER_PREFIX, String.class);
        vals = reader.read(HR_HLR_NUMBER, String.class);
        if (vals != null)
            this.hrHlrNumber = vals;
        SmscPropertiesManagement_HrHlrNumberNetworkId al2 = reader.read(HR_HLR_NUMBER_LIST, SmscPropertiesManagement_HrHlrNumberNetworkId.class);
        networkIdVsHrHlrNumber.clear();
        if (al2 != null) {
            for (HrHlrNumberNetworkIdElement elem : al2.getData()) {
                networkIdVsHrHlrNumber.put(elem.networkId, elem.hrHlrNumber);
            }
        }
        valB = reader.read(HR_SRI_BYPASS, Boolean.class);
        if (valB != null)
            this.hrSriBypass = valB;
        SmscPropertiesManagement_HrSriBypassNetworkId al3 = reader.read(HR_SRI_BYPASS_LIST, SmscPropertiesManagement_HrSriBypassNetworkId.class);
        networkIdVsHrSriBypass.clear();
        if (al3 != null) {
            for (HrSriBypassNetworkIdElement elem : al3.getData()) {
                networkIdVsHrSriBypass.put(elem.networkId, elem.hrSriBypass);
            }
        }
        val = reader.read(NATIONAL_LANGUAGE_SINGLE_SHIFT, Integer.class);
        if (val != null)
            this.nationalLanguageSingleShift = val;
        val = reader.read(NATIONAL_LANGUAGE_LOCKING_SHIFT, Integer.class);
        if (val != null)
            this.nationalLanguageLockingShift = val;
        this.esmeDefaultClusterName = reader.read(ESME_DEFAULT_CLUSTER_NAME, String.class);
        val = reader.read(MAX_ACTIVITY_COUNT, Integer.class);
        if (val != null)
            this.maxActivityCount = val;
        val = reader.read(DELIVERY_TIMEOUT, Integer.class);
        if (val != null)
            this.deliveryTimeout = val;
        val = reader.read(DELIVERY_TIMEOUT_DELTA_PER_MESSAGE, Integer.class);
        if (val != null)
            this.deliveryTimeoutDeltaPerMessage = val;
        val = reader.read(VP_PROLONG, Integer.class);
        if (val != null)
            this.vpProlong = val;
        // this line is for backward compatibility
        valB = reader.read(SMS_HOME_ROUTING, Boolean.class);
        // if (valB != null) {
        // this.isSMSHomeRouting = valB.booleanValue();
        // }
        vals = reader.read(SMPP_ENCODING_FOR_GSM7, String.class);
        if (vals != null)
            this.smppEncodingForGsm7 = Enum.valueOf(SmppEncoding.class, vals);
        vals = reader.read(SMPP_ENCODING_FOR_UCS2, String.class);
        if (vals != null)
            this.httpEncodingForUCS2 = Enum.valueOf(HttpEncoding.class, vals);
        vals = reader.read(HTTP_ENCODING_FOR_GSM7, String.class);
        if (vals != null)
            this.httpEncodingForGsm7 = Enum.valueOf(HttpEncoding.class, vals);
        vals = reader.read(HTTP_ENCODING_FOR_UCS2, String.class);
        if (vals != null)
            this.smppEncodingForUCS2 = Enum.valueOf(SmppEncoding.class, vals);
        val = reader.read(REVISE_SECONDS_ON_SMSC_START, Integer.class);
        if (val != null)
            this.reviseSecondsOnSmscStart = val;
        val = reader.read(PROCESSING_SMS_SET_TIMEOUT, Integer.class);
        if (val != null)
            this.processingSmsSetTimeout = val;
        valB = reader.read(GENERATE_RECEIPT_CDR, Boolean.class);
        if (valB != null) {
            this.generateReceiptCdr = valB.booleanValue();
        }
        valB = reader.read(GENERATE_DETAILED_CDR, Boolean.class);
        if (valB != null) {
            this.generateDetailedCdr = valB.booleanValue();
        }
        valB = reader.read(GENERATE_TEMP_FAILURE_CDR, Boolean.class);
        if (valB != null) {
            this.generateTempFailureCdr = valB.booleanValue();
        }
        valB = reader.read(GENERATE_REJECTION_CDR, Boolean.class);
        if (valB != null) {
            this.generateRejectionCdr = valB.booleanValue();
        }
        valB = reader.read(CALCULATE_MSG_PARTS_LEN_CDR, Boolean.class);
        if (valB != null) {
            this.calculateMsgPartsLenCdr = valB.booleanValue();
        }
        valB = reader.read(DELAY_PARAMETERS_IN_CDR, Boolean.class);
        if (valB != null) {
            this.delayParametersInCdr = valB.booleanValue();
        }
        valB = reader.read(DELAY_PARAMETERS_IN_CDR, Boolean.class);
        if (valB != null) {
            this.delayParametersInCdr = valB.booleanValue();
        }
        valB = reader.read(RECEIPTS_DISABLING, Boolean.class);
        if (valB != null) {
            this.receiptsDisabling = valB.booleanValue();
        }
        valB = reader.read(INCOME_RECEIPTS_PROCESSING, Boolean.class);
        if (valB != null) {
            this.incomeReceiptsProcessing = valB.booleanValue();
        }
        valB = reader.read(ENABLE_INTERMEDIATE_RECEIPTS, Boolean.class);
        if (valB != null) {
            this.enableIntermediateReceipts = valB.booleanValue();
        }
        valB = reader.read(ORIG_NETWORK_ID_FOR_RECEIPTS, Boolean.class);
        if (valB != null) {
            this.origNetworkIdForReceipts = valB.booleanValue();
        }
        val = reader.read(MO_DEFAULT_MESSAGING_MODE, Integer.class);
        if (val != null)
            this.moDefaultMessagingMode = val;
        val = reader.read(HR_DEFAULT_MESSAGING_MODE, Integer.class);
        if (val != null)
            this.hrDefaultMessagingMode = val;
        val = reader.read(SIP_DEFAULT_MESSAGING_MODE, Integer.class);
        if (val != null)
            this.sipDefaultMessagingMode = val;
        val = reader.read(GENERATE_CDR, Integer.class);
        if (val != null)
            this.generateCdr = new GenerateType(val);
        val = reader.read(GENERATE_ARCHIVE_TABLE, Integer.class);
        if (val != null)
            this.generateArchiveTable = new GenerateType(val);
        vals = reader.read(STORE_AND_FORWORD_MODE, String.class);
        if (vals != null)
            this.storeAndForwordMode = Enum.valueOf(StoreAndForwordMode.class, vals);
        vall = reader.read(MIN_MESSAGE_ID, Long.class);
        if (vall != null)
            this.minMessageId = vall;
        vall = reader.read(MAX_MESSAGE_ID, Long.class);
        if (vall != null)
            this.maxMessageId = vall;
        vals = reader.read(MO_CHARGING, String.class);
        if (vals != null) {
            if (vals.toLowerCase().equals("false")) {
                this.moCharging = MoChargingType.accept;
            } else if (vals.toLowerCase().equals("true")) {
                this.moCharging = MoChargingType.diameter;
            } else {
                this.moCharging = Enum.valueOf(MoChargingType.class, vals);
            }
        }
        vals = reader.read(HR_CHARGING, String.class);
        if (vals != null) {
            if (vals.toLowerCase().equals("false")) {
                this.hrCharging = MoChargingType.accept;
            } else if (vals.toLowerCase().equals("true")) {
                this.hrCharging = MoChargingType.diameter;
            } else {
                this.hrCharging = Enum.valueOf(MoChargingType.class, vals);
            }
        }
        vals = reader.read(TX_SMPP_CHARGING, String.class);
        if (vals != null)
            this.txSmppCharging = Enum.valueOf(ChargingType.class, vals);
        vals = reader.read(TX_SIP_CHARGING, String.class);
        if (vals != null)
            this.txSipCharging = Enum.valueOf(ChargingType.class, vals);
        vals = reader.read(TX_HTTP_CHARGING, String.class);
        if (vals != null) {
            if (vals.toLowerCase().equals("false")) {
                this.txHttpCharging = MoChargingType.accept;
            } else if (vals.toLowerCase().equals("true")) {
                this.txHttpCharging = MoChargingType.diameter;
            } else {
                this.txHttpCharging = Enum.valueOf(MoChargingType.class, vals);
            }
        }
        vals = reader.read(GLOBAL_TITLE_INDICATOR, String.class);
        if (vals != null)
            this.globalTitleIndicator = Enum.valueOf(GlobalTitleIndicator.class, vals);
        val = reader.read(TRANSLATION_TYPE, Integer.class);
        if (val != null)
            this.translationType = val;
        val = reader.read(CORRELATION_ID_LIVE_TIME, Integer.class);
        if (val != null)
            this.correlationIdLiveTime = val;
        val = reader.read(SRI_RESPONSE_LIVE_TIME, Integer.class);
        if (val != null)
            this.sriResponseLiveTime = val;
        val = reader.read(HTTP_DEFAULT_SOURCE_TON, Integer.class);
        if (val != null)
            this.httpDefaultSourceTon = val;
        val = reader.read(HTTP_DEFAULT_SOURCE_NPI, Integer.class);
        if (val != null)
            this.httpDefaultSourceNpi = val;
        val = reader.read(HTTP_DEFAULT_DEST_TON, Integer.class);
        if (val != null)
            this.httpDefaultDestTon = val;
        val = reader.read(HTTP_DEFAULT_DEST_NPI, Integer.class);
        if (val != null)
            this.httpDefaultDestNpi = val;
        val = reader.read(HTTP_DEFAULT_NETWORK_ID, Integer.class);
        if (val != null)
            this.httpDefaultNetworkId = val;
        val = reader.read(HTTP_DEFAULT_MESSAGING_MODE, Integer.class);
        if (val != null)
            this.httpDefaultMessagingMode = val;
        val = reader.read(HTTP_DEFAULT_RD_DELIVERY_RECEIPT, Integer.class);
        if (val != null)
            this.httpDefaultRDDeliveryReceipt = val;
        val = reader.read(HTTP_DEFAULT_RD_INTERMEDIATE_NOTIFICATION, Integer.class);
        if (val != null)
            this.httpDefaultRDIntermediateNotification = val;
        val = reader.read(HTTP_DEFAULT_DATA_CODING, Integer.class);
        if (val != null)
            this.httpDefaultDataCoding = val;
        vals = reader.read(CASSANDRA_USER, String.class);
        if (vals != null)
            this.cassandraUser = vals;
        vals = reader.read(CASSANDRA_PASS, String.class);
        if (vals != null)
            this.cassandraPass = vals;
        SmscPropertiesManagement_smDeliveryFailure al4 = reader.read(SM_DELIVERY_FAILURE_LIST, SmscPropertiesManagement_smDeliveryFailure.class);
        smDeliveryFailure.clear();
        if (al4 != null) {
            for (SmDeliveryFailureListElement elem : al4.getData()) {
                smDeliveryFailure.put(elem.causeCode, elem.status);
            }
        }
        SmscPropertiesManagement_smDeliveryFailureTpFailureCause al5 = reader.read(SM_DELIVERY_FAILURE_TP_FAILURE_CAUSE_LIST, SmscPropertiesManagement_smDeliveryFailureTpFailureCause.class);
        smDeliveryFailureTpFailureCause.clear();
        if (al5 != null) {
            for (SmDeliveryFailureTpFailureCauseListElement elem : al5.getData()) {
                smDeliveryFailureTpFailureCause.put(elem.causeCode, elem.status);
            }
        }
        vals = reader.read(SM_DELIVERY_FAILURE_WITH_TPDU, String.class);
        if (vals != null)
            this.smDeliveryFailureDlrWithTpdu = vals;
        this.diameterDestRealm = reader.read(DIAMETER_DEST_REALM, String.class);
        this.diameterDestHost = reader.read(DIAMETER_DEST_HOST, String.class);
        val = reader.read(DIAMETER_DEST_PORT, Integer.class);
        if (val != null)
            this.diameterDestPort = val;
        this.diameterUserName = reader.read(DIAMETER_USER_NAME, String.class);
        reader.close();
    } catch (XMLStreamException ex) {
        logger.error("Error while loading the SMSC state from file", ex);
    }
}
Also used : FileInputStream(java.io.FileInputStream) XMLStreamException(javolution.xml.stream.XMLStreamException) GenerateType(org.restcomm.smpp.GenerateType) XMLObjectReader(javolution.xml.XMLObjectReader)

Example 3 with GenerateType

use of org.restcomm.smpp.GenerateType in project smscgateway by RestComm.

the class SmscPropertiesManagement method setGenerateCdrInt.

@Override
public void setGenerateCdrInt(int generateCdr) {
    this.generateCdr = new GenerateType(generateCdr);
    this.store();
}
Also used : GenerateType(org.restcomm.smpp.GenerateType)

Example 4 with GenerateType

use of org.restcomm.smpp.GenerateType in project smscgateway by RestComm.

the class DeliveryCommonSbbTest method setUpClass.

@BeforeMethod
public void setUpClass() throws Exception {
    System.out.println("setUpClass");
    this.pers = new PersistenceRAInterfaceProxy();
    this.cassandraDbInited = this.pers.testCassandraAccess();
    if (!this.cassandraDbInited)
        return;
    this.pers.start();
    MProcManagement.getInstance("TestDeliveryCommonSbb");
    SmscPropertiesManagement.getInstance("TestDeliveryCommonSbb");
    SmscPropertiesManagement smscPropertiesManagement = SmscPropertiesManagement.getInstance();
    smscPropertiesManagement.setGenerateArchiveTable(new GenerateType(0));
    smscPropertiesManagement.setGenerateCdr(new GenerateType(0));
    // 15 min
    smscPropertiesManagement.setVpProlong(15 * 60);
}
Also used : GenerateType(org.restcomm.smpp.GenerateType) SmscPropertiesManagement(org.mobicents.smsc.domain.SmscPropertiesManagement) PersistenceRAInterfaceProxy(org.mobicents.smsc.slee.resources.persistence.PersistenceRAInterfaceProxy) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 5 with GenerateType

use of org.restcomm.smpp.GenerateType in project smscgateway by RestComm.

the class DeliveryCommonSbbTest method tearDownClass.

@AfterMethod
public void tearDownClass() throws Exception {
    System.out.println("tearDownClass");
    SmscPropertiesManagement smscPropertiesManagement = SmscPropertiesManagement.getInstance();
    if (smscPropertiesManagement != null) {
        smscPropertiesManagement.setGenerateArchiveTable(new GenerateType(7));
        smscPropertiesManagement.setGenerateCdr(new GenerateType(7));
        smscPropertiesManagement.setVpProlong(120);
    }
}
Also used : GenerateType(org.restcomm.smpp.GenerateType) SmscPropertiesManagement(org.mobicents.smsc.domain.SmscPropertiesManagement) AfterMethod(org.testng.annotations.AfterMethod)

Aggregations

GenerateType (org.restcomm.smpp.GenerateType)5 SmscPropertiesManagement (org.mobicents.smsc.domain.SmscPropertiesManagement)2 FileInputStream (java.io.FileInputStream)1 XMLObjectReader (javolution.xml.XMLObjectReader)1 XMLStreamException (javolution.xml.stream.XMLStreamException)1 PersistenceRAInterfaceProxy (org.mobicents.smsc.slee.resources.persistence.PersistenceRAInterfaceProxy)1 AfterMethod (org.testng.annotations.AfterMethod)1 BeforeMethod (org.testng.annotations.BeforeMethod)1