Description
The service is an interface for interaction between platform components and external SMS-gateways, Call-centers and e-mail servers. It is used to send notifications to the platform users as well as to Wi-Fi users.
Service configuration
Service installation
apt-get install eltex-ngw
Methods of starting/stopping the service
| Action | Command | Responce |
|---|---|---|
| Status check | systemctl status eltex-ngw | Service is active Active: active (running) Cервис не запущен Service is not active Active: failed |
| Service launch | systemctl start eltex-ngw | Service is active Active: active (running) ngw_skk_received_statuses_total |
| Service stop | systemctl stop eltex-ngw | Service is stopped Active: failed |
| Service restart | systemctl restart eltex-ngw | Service is restarted Active: active (running) |
| Creating a database user | eltex-ngw create-db-user | |
| Deleting a database | eltex-ngw remove-db |
If the ANSWER_SOFTWLC_LOCAL variable is set to "1" when installing the package using the installer script, the database user will be created automatically. When installing the package manually, the user must be created with the command:
eltex-ngw create-db-user
Configuration
/etc/eltex-ngw/application.conf
// Server configuration
server {
port = 8040 # port that listens to eltex-ngw service
// number of threads in executor that executes handlers and different gateways
threads = 50
}
http {
// Timeout of http connection to the end gateway
connectionTimeout = 30s
// Number of maximum simultaneous http connections
maxConnections = 50
// Time that connection will be kept alive
keepAliveTimeout = 5s
// Whether to check SSL certificate
checkCert = true
// HTTP User Agent
userAgent = eltex-ngw
}
sms {
// Incoming (user to service) sms config
incoming.config = "smsc.conf" # select gateway configuration for incoming messages (SMS from user to gateway)
// Outgoing (service to user) sms config
outgoing.config = "smsc.conf" # select configuration for outgoing messages (SMS from gateway to user)
call {
// Incoming (user to service) call config
incoming.config = "sbc.conf" # select the gateway configuration for incoming calls (call from user)
// Outgoing (service to user) call config
outgoing.config = "smg.conf" # select the configuration for outgoing calls (call to user)
email {
// Outgoing (service to user) email config
outgoing.config = "email.conf" # select the configuration for communicating with the e-mail server (SMTP)
database {
host = localhost # database address
port = 3306 # port
name = eltex_ngw # datadase name
user = javauser # database login
password = javapassword # database password
pool {
// Time to wait for a connection
connectionTimeout = 10s
// Time to wait for connection validation
validationTimeout = 3s
min = 1
max = 10
}
migrate = true
jdbc {
driverClass = com.mysql.cj.jdbc.Driver
url = "jdbc:mysql://${database.host}:${database.port}/${database.name}"
properties {
max_allowed_packet = 32362048
useUnicode = true
characterEncoding = utf8
}
}
# settings of the scheduler for clearing old messages in the database
// Configure the lifetime of different tables' content
cleanup {
// incoming events
events = 365d # event storage time
// sms
messages = 365d # sms storage time
// email
emails = 365d # emails storage time
// files
files = 7d # вfiles storage time
// limit deletions by this number (0 if no limit)
limit_events = 1000 # limit the number of records deleted per execution from the table eltex_ngw.incoming_events
limit_messages = 1000 # limit the number of records deleted per execution from the table eltex_ngw.messages
limit_emails = 1000 # limit the number of records deleted per execution from the table eltex_ngw.emails
limit_files = 1000 # limit the number of records deleted per execution from the table eltex_ngw.files
// cleanup schedule cron, e.g. "0 0 3 * * *"
// set to "-" to disable
cron = "0 0 3 * * *" # setting the scheduler to start clearing old records, the default value is "0 0 3 * * *" (every day at 3:00), to disable it specify "-"
// cron for optimize tables, cron-like expression, e.g. "0 0 4 5 * *"
// set to "-" to disable
cron_optimize = "0 0 4 5 * *" # scheduler setting to start clearing the database tables of deleted records, default value is "0 0 0 4 5 * * *" (every 5th day of the month at 4:00), to disable it specify "-".
}
}
Files are deleted from the "eltex_ngw.file_chunks" table automatically after deletion from the eltex_ngw.files table
/etc/eltex-ngw/gateway.d/
catalog contains configuration files for connecting to different gateways.
To connect to different gateways, a set of configuration templates has been created, which are located in the /etc/eltex-ngw/gateway.d/ directory. The most commonly used configurations are marked in green.
| File | Description | Purpose | Notes |
|---|---|---|---|
| email.conf | Mail server | To send e-mail messages using the SMTP protocol | |
| gazprom.conf | SMS | Individual integration | |
| kaspib.conf | Kaspi Bank | SMS | Individual integration |
| netping.conf | GSM gateway NetPing SMS | SMS | |
| nskbl.conf | SMS | Individual integration | |
| psbank.conf | SMS | Individual integration | |
| rtk.conf | Rostelecom | SMS | Individual integration |
| sbc.conf | Outgoing call | To authorize by user call | |
| script.conf | To send SMS using a script | ||
| serial_port.conf | GSM gateway Fargo maestro 100 | SMS | |
| sevensky.conf | Seven Sky | SMS | |
| skk.conf skk_template.json | SKK gateway | SMS | Individual integration |
| smg.conf | Incoming call | To authorize by calling the user | |
| smpp.conf | Gateway with SMPP support | SMS | |
| smsc.conf | SMS centre | SMS | |
| zagruzka.conf | Linked download | SMS | |
| mts.conf | MTS SMS gateway | SMS |
If you have not found a suitable gateway configuration template among the offered templates, please contact technical support for integration with your gateway.
/etc/default/eltex-ngw
Contains service initialization parameters.
- The amount of memory allocated to the application when the service starts:
# Initial size of Java heap JAVA_INIT_HEAP=16m
- The maximum amount of memory the service can lease:
# Maximum size of Java heap JAVA_MAX_HEAP=128m
- Additional java startup options:
# Additional arguments to pass to java JAVA_OPTS="-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/eltex-ngw"
/etc/eltex-ngw/log4j2.xml
Contains logging parameters.
- Interval for automatic re-reading of the logger configuration:
<Configuration monitorInterval="600">
- Basic logs storage directory:
<Property name="baseDir">/var/log/eltex-ngw</Property>
- Maximum allowable file size (if it is exceeded, a new file is created, and the old one is archived):
<Property name="maxFileSize">20 MB</Property>
- Total size of logs (current file + archived files). If it is exceeded, the oldest files will be deleted:
<Property name="accumulatedFileSize">100 GB</Property>
- Logs storage period, files modified earlier than this period will be deleted:
<Property name="lastModified">4d</Property>
- Maximum number of archive files, if exceeded, the oldest files will be overwritten:
<Property name="maxCount">10</Property>
- Log forwarding configuration block to Graylog (logging level, address, port):
<Property name="gelfLevel">OFF</Property> <Property name="gelfHost">udp:localhost</Property> <Property name="gelfPort">12201</Property>
- Logging level:
<Root level="ERROR">
Notes on configuring communication with the mail server
NGW provides interaction with the mail server via SMTP protocol and is used for sending notifications and reports to email. For correct operation it is required to enable and configure interaction with the mail server.
In the /etc/eltex-ngw/application.conf file, in the email section, the file of settings for interaction with the mail server is specified:
The /etc/eltex-ngw/gateway.d/email.conf file is used to configure communication with the mail server:
Важно!
The ability to specify the encryption protocol version "tlsVersion" has been implemented since SoftWLC version 1.21.
To be able to use "TLSv1.0" or "TLSv1.1" it is required to install Java 8 version 291 or earlier.
Service dockerization
The service can be launched in a docker container. For this purpose it is necessary to prepare the file docker-compose.yml
version: "3"
volumes:
softwlc_logs:
driver: local
services:
ngw:
container_name: ngw
image: hub.eltex-co.ru/softwlc/eltex-ngw:1.23-<tag>
ports:
- 8040:${NGW_PORT}
# - 1814:1814/udp # For smg.conf if needed
# - 8041:8041/udp # For sbc.conf if needed
volumes:
- "/etc/eltex-ngw/gateway.d:/etc/eltex-ngw/gateway.d"
- "/etc/timezone:/etc/timezone:ro"
environment:
- server.port=${NGW_PORT}
- JAVA_INIT_HEAP=${JAVA_INIT_HEAP}
- JAVA_MAX_HEAP=${JAVA_MAX_HEAP}
- sms.incoming.config=${NGW_SMS_INCOMING_CONF}
- sms.outgoing.config=${NGW_SMS_OUTGOING_CONF}
- call.incoming.config=${NGW_CALL_INCOMING_CONF}
- call.outgoing.config=${NGW_CALL_OUTGOING_CONF}
- email.outgoing.config=${NGW_EMAIL_OUTGOING_CONF}
- database.host=${NGW_DB_HOST}
- database.port=${NGW_DB_PORT}
- database.name=${NGW_DB_NAME}
- database.user=${NGW_DB_USER}
- database.password=${NGW_DB_PASSWORD}
- database.pool.connectionTimeout=${NGW_DB_POOL_CONNECTION_TIMEOUT}
- database.pool.min=${NGW_DB_POOL_MIN_IDLE}
- database.pool.max=${NGW_DB_POOL_SIZE}
- database.cleanup.events=${NGW_DB_CLEANUP_EVENTS}
- database.cleanup.messages=${NGW_DB_CLEANUP_MESSAGES}
- database.cleanup.emails=${NGW_DB_CLEANUP_EMAILS}
- database.cleanup.files=${NGW_DB_CLEANUP_FILES}
- database.cleanup.limit_events=${NGW_DB_CLEANUP_LIMIT_EVENTS}
- database.cleanup.limit_messages=${NGW_DB_CLEANUP_LIMIT_MESSAGES}
- database.cleanup.limit_emails=${NGW_DB_CLEANUP_LIMIT_EMAILS}
- database.cleanup.limit_files=${NGW_DB_CLEANUP_LIMIT_FILES}
- database.cleanup.cron=${NGW_DB_CLEANUP_CRON}
- database.cleanup.cron_optimize=${NGW_DB_CLEANUP_CRON_OPTIMIZE}
- NGW_LOG_LEVEL=${NGW_LOG_LEVEL}
- NGW_CONSOLE_LEVEL=${NGW_CONSOLE_LEVEL}
- GELF_LEVEL=${GELF_LEVEL}
- GELF_HOST=${GELF_HOST}
- GELF_PORT=${GELF_PORT}
- TZ=${TZ}
At the moment it is not possible to configure gateway settings located in the "/etc/eltex-ngw/gateway.d" folder via environment variables. To apply the necessary settings, you must mapping the configuration files of a previously installed deb version.
Some settings can be configured via the environment variables below. To do this, create an .env file and place it next to docker-compose.yml, specifying the necessary variables in the latter. In the "environment" block it is necessary to specify the names of the variables in accordance with the names of the variables in the configuration files. In case variables are not specified or variable names are specified incorrectly, default values will be applied.
NGW_PORT=8040 NGW_SMS_INCOMING_CONF= NGW_SMS_OUTGOING_CONF=smsc.conf NGW_CALL_INCOMING_CONF= NGW_CALL_OUTGOING_CONF= NGW_EMAIL_OUTGOING_CONF= NGW_DB_HOST=<IP-address> NGW_DB_PORT=3306 NGW_DB_NAME=eltex_ngw NGW_DB_USER=javauser NGW_DB_PASSWORD=javapassword NGW_DB_POOL_CONNECTION_TIMEOUT=10s NGW_DB_POOL_MIN_IDLE=1 NGW_DB_POOL_SIZE=10 NGW_DB_CLEANUP_EVENTS=365d NGW_DB_CLEANUP_MESSAGES=365d NGW_DB_CLEANUP_EMAILS=365d NGW_DB_CLEANUP_FILES=7d NGW_DB_CLEANUP_LIMIT_EVENTS=1000 NGW_DB_CLEANUP_LIMIT_MESSAGES=1000 NGW_DB_CLEANUP_LIMIT_EMAILS=1000 NGW_DB_CLEANUP_LIMIT_FILES=1000 # Don't clean up #NGW_DB_CLEANUP_CRON=- # 3 am each day NGW_DB_CLEANUP_CRON="0 0 3 * * *" # Don't optimize tables #NGW_DB_CLEANUP_CRON_OPTIMIZE=- # 4 am 5th day each month NGW_DB_CLEANUP_CRON_OPTIMIZE="0 0 4 5 * *" NGW_LOG_LEVEL=INFO NGW_CONSOLE_LEVEL=INFO GELF_LEVEL=OFF GELF_HOST=udp:localhost GELF_PORT=12201 #Настройка часового пояса TZ=Asia/Novosibirsk
Possible environment variables
Service start- NGW_PORT - Grpc port that will listen to the service.
- JAVA_INIT_HEAP - Xms JVM option.
- JAVA_MAX_HEAP - Xmx JVM option.
- JAVA_OPTS - JVM options (can override all other defaults).
SMS settings
- NGW_SMS_INCOMING_CONF - configuration file for user identification by incoming SMS (from user).
- NGW_SMS_OUTGOING_CONF - configuration file for user identification by outgoing SMS (to user).
- sms.pool.waitTimeout - timeout for receiving connection from the pool.
- sms.pool.min - minimum number of idle connections.
- sms.pool.max - connection pool size.
Call settings
- NGW_CALL_INCOMING_CONF - configuration file for user identification by incoming call (from user).
- NGW_CALL_OUTGOING_CONF - configuration file to identify the user by the outgoing call (to the user).
- call.pool.waitTimeout - timeout for receiving a connection from the pool.
- call.pool.min - minimum number of idle connections.
- call.pool.max - connection pool size.
Email settings
- NGW_EMAIL_OUTGOING_CONF - configuration file for outgoing mail.
- email.pool.waitTimeout - timeout for receiving a connection from the pool.
- email.pool.min - minimum number of idle connections.
- email.pool.max - connection pool size.
Database interaction settings
- NGW_DB_HOST - database connection host.
- NGW_DB_PORT - database connection port.
- NGW_DB_NAME - database name.
- NGW_DB_USER - database user name.
- NGW_DB_PASSWORD - database user password.
- NGW_DB_POOL_CONNECTION_TIMEOUT - timeout of receiving connection from the pool.
- NGW_DB_POOL_MIN_IDLE - minimum number of idle connections.
- NGW_DB_POOL_SIZE - the size of the database connection pool.
- NGW_DB_CLEANUP_EVENTS - database events lifetime.
- NGW_DB_CLEANUP_MESSAGES - database messages lifetime.
- NGW_DB_CLEANUP_EMAILS - database email lifetime.
- NGW_DB_CLEANUP_FILES - database lifetime of files sent by email.
NGW_DB_CLEANUP_LIMIT_EVENTS - limit of deletions from the event table at a time.
NGW_DB_CLEANUP_LIMIT_MESSAGES - limit of deletions from the table of messages at a time.
NGW_DB_CLEANUP_LIMIT_EMAILS - limit of deletions from the emails table at a time.
NGW_DB_CLEANUP_LIMIT_FILES - limit of deletions from the files table at a time.
NGW_DB_CLEANUP_CRON - cron cleanup schedule.
NGW_DB_CLEANUP_CRON_OPTIMIZE - cron table optimization schedule.
Logging settings
- NGW_LOG_LEVEL - log level when sending to the server specified in the "GELF_HOST" setting
- NGW_CONSOLE_LEVEL - level of logs in docker console
- GELF_LEVEL - disable/enable sending logs to the server
- GELF_HOST - server address for sending logs
- GELF_PORT - server port for sending logs
Time zone setting
- TZ - time zone in the format Asia/Novosibirsk (the list of existing time zones can be viewed with the command timedatectl list-timezones)
Additional configuration parameters for authorization by incoming call (from user)
Specify in the ".env" file the configuration file to be used:
NGW_CALL_INCOMING_CONF=sbc.conf
Specify the port mapping that is specified in the parameter of the sbc.conf file:
connection {
port = 8041
in docker-compose.yml file:
ports:
- 8040:${NGW_PORT}
- 8041:8041/udp # For sbc.conf if needed
Additional configuration parameters for authorization by outgoing call (user)
Specify in the ".env" file the configuration file to be used:
NGW_CALL_OUTGOING_CONF=smg.conf
Specify the port mapping that is specified in the smg.conf section parameter:
listen {
port = 1814
in docker-compose.yml file:
ports:
- 8040:${NGW_PORT}
- 1814:1814/udp # For smg.conf if needed
Service metrics
Service metrics are available at:
http://<IP-адрес eltex-ngw>:8040/actuator/prometheus
Example of setting up Prometheus connection:
- job_name: 'NGW'
metrics_path: '/actuator/prometheus'
scrape_interval: 60s
static_configs:
- targets: ['<IP-адрес eltex-ngw>:8040']
Metrics guide
Label application - 'NGW'.
Metrics are listed in alphabetical order (no help for common metrics starting with jetty, jvm, hikaricp, process, system):
Built-in documentation
The NGW service includes built-in documentation.
It can be found on the same port 8040 on which the whole service operates: http://ubuntu:8040/doc/index.html
It is intended primarily for developers.
For example, on the main page you can find out what version of ngw-client should be used when integrating with this service.