dectmngr-init: add few arguments for dectmngr

Add few arguments for dectmngr, which is based on the UCI config for
asterisk and dect:

    -sync $pcm_fsync (UCI dect.global.pcm_fsync)

    -slotsShift $pcm_slot_start (UCI dect.global.pcm_slot_star)

    -extensionShift N (starting index of UCI asterisk.extensionN for DECT)
This commit is contained in:
George Yang 2025-04-30 16:41:19 +02:00
parent d3ae8b5020
commit b1c9ce0d25

View file

@ -11,6 +11,25 @@ LOG_PATH=/var/log/dectmngr
DB_PATH=/etc/dect
DCX81_UART_DT_ALIAS=/proc/device-tree/aliases/dcx81-uart
get_extension_shift() {
local dect_exts
get_dect_extension() {
local ext=$1
local type
config_get type $ext type
[ "$type" == "dect" ] && echo $ext
}
config_load "asterisk"
dect_exts=$(config_foreach get_dect_extension "extension" |sort |head -n1)
echo "${dect_exts#extension}"
}
# Ask dectmngr to exit nicely and wait for it to clean up, which is a slow process.
stop_and_wait_dectmngr() {
dect_pid=$(pidof $PROG)
@ -56,6 +75,8 @@ start_service() {
return 0
fi
opt_ext="-extensionShift $(get_extension_shift)"
local dcx81_uart_device
if ! dcx81_uart_device="$(get_dcx81_device)"; then
logger -t "$PROG" -p daemon.warning "Could not determine DCX81 UART device. Falling back to default ttyH0."
@ -77,6 +98,11 @@ start_service() {
config_load dect
config_get log_dect_cmbs global log_dect_cmbs syslog
config_get pcm_slot_start global pcm_slot_start
config_get pcm_fsync global pcm_fsync
[ -n "$pcm_fsync" ] && opt_ext="$opt_ext -sync $pcm_fsync"
[ -n "$pcm_slot_start" ] && opt_ext="$opt_ext -slotsShift $pcm_slot_start"
procd_open_instance