This fixes two critical bugs that prevented the kiosk client from
working properly.
ISSUE 1: Kiosk User Offline/Can't Connect
==========================================
Problem: Client installed but showed offline, couldn't register
with Asterisk server. Services weren't starting properly for
headless/non-logged-in users.
Root Causes:
- Missing DBUS_SESSION_BUS_ADDRESS environment variable
- Insufficient wait time for PipeWire and network
- No logging to diagnose startup issues
- Service dependencies not strong enough
Fixes:
✓ Added DBUS_SESSION_BUS_ADDRESS to all user services
✓ Increased startup delays (5s for baresip, 8s for PTT)
✓ Changed Wants to Requires for pipewire-pulse (hard dependency)
✓ Added StandardOutput/StandardError=journal for logging
✓ Increased RestartSec from 5s to 10s for more stable restarts
ISSUE 2: PTT Not Muting Microphone
===================================
Problem: PTT configured but microphone NOT muted on startup,
pressing PTT button did nothing, had to manually mute.
Root Causes:
- kiosk-ptt script missing XDG_RUNTIME_DIR environment
- pactl commands failing silently without proper context
- No wait for PipeWire to be ready before muting
- No logging to see what was happening
Fixes:
✓ Added XDG_RUNTIME_DIR detection/setup in PTT script
✓ Added 10-second wait loop for PipeWire to become ready
✓ Added error handling with logger for failed pactl commands
✓ Added logging for all PTT press/release events
✓ Export KIOSK_UID env var in PTT service
Enhanced Logging & Diagnostics
===============================
All services now log to systemd journal with tags:
- baresip-launcher: Network detection, config verification, startup
- kiosk-ptt: Startup, mic mute status, PTT press/release events
- baresip.service: Service output (via StandardOutput=journal)
View logs:
journalctl -t baresip-launcher -f
journalctl -t kiosk-ptt -f
sudo -u kiosk journalctl --user -u baresip -f
New Features
============
1. Enhanced Diagnostics (Client Management > Run Diagnostics):
- Shows launcher logs (last 10 lines)
- Shows PTT logs (last 5 lines)
- Shows Baresip service logs (last 10 lines)
- Displays commands to view live logs
2. Manual Audio Fix Tool (Tools > Fix Audio):
- Restarts PipeWire services
- Unmutes microphone and speaker
- Sets volume to 75%
- Restarts Baresip
- Shows current status
Improved Baresip Launcher
==========================
- Logs all startup steps
- Verifies config and accounts files exist
- Better network wait logic with logging
- Clear error messages if files missing
- Network detection logs which interface found
Testing After Update
====================
1. For existing installs - restart services:
sudo -u kiosk systemctl --user daemon-reload
sudo -u kiosk systemctl --user restart pipewire pipewire-pulse baresip
2. Check status:
sudo -u kiosk systemctl --user status baresip
3. View logs:
journalctl -t baresip-launcher -n 50
journalctl -t kiosk-ptt -n 20
4. If still offline:
Main Menu > Tools > Fix Audio (Unmute & Restart)
This should resolve both the offline connection issue and the
PTT mic muting problem. All operations now have proper logging
for easier troubleshooting.
Added intelligent user selection that scans /home directory and
presents available users, making it much easier to install the
kiosk client for the correct user account.
Features:
1. Smart User Detection
- Scans /etc/passwd for real users (UID >= 1000)
- Excludes system accounts (nologin, /bin/false)
- Shows username, UID, and home directory
- Presents numbered list of available users
2. Intelligent Defaults
- Auto-suggests SUDO_USER if available
- Falls back to first detected user
- Highlights suggested choice as default
3. Manual Override
- Option to manually enter username
- Validates entered username exists
- Shows confirmation with UID
4. Improved User Experience
- install_client_only(): Uses new select_user function
- configure_local_client(): Shows current user, offers to change
- Clear feedback on user selection
- Proper error handling for invalid selections
5. Verified Ownership
All user configs are properly owned by selected user:
- ~/.baresip/config (chown in configure_baresip:1879)
- ~/.baresip/accounts (chown in configure_baresip:1879)
- ~/.config/systemd/user/* (chown in enable_client_services:1962)
- ~/.config/wireplumber/* (chown in configure_audio_ducking:1067)
- All PipeWire/audio operations run as selected user
Example Flow:
$ sudo ./easy-asterisk-interactive-v1.28.sh
> Install Client Only
Scanning for users...
1) kiosk (UID: 1000, Home: /home/kiosk)
2) admin (UID: 1001, Home: /home/admin)
3) Enter username manually
Select user [1]: 1
✓ Selected user: kiosk (UID: 1000)
This makes it much easier to install on kiosk systems where you
might not remember the exact username, and ensures all configs
are created with proper ownership from the start.
This commit addresses multiple critical issues that prevented the
kiosk client from working properly, especially regarding audio.
Issues Fixed:
1. Baresip config check error
- Removed premature check for .baresip directory
- Added option to install Baresip if not present
- Improved user flow for client configuration
2. Audio completely lost after client installation
- PTT service was starting even without PTT device configured
- Added ConditionPathExists to PTT systemd service
- Only enable PTT service when PTT device is actually configured
- Ensured audio is unmuted for normal intercom operation
3. PipeWire/PulseAudio initialization
- Added proper PipeWire and PipeWire-Pulse service dependencies
- Explicitly enable and start PipeWire services for user
- Added audio group membership check
4. Audio unmuting after installation
- Created ensure_audio_unmuted() helper function
- Automatically unmute microphone and speakers after install
- Set reasonable volume levels (75%) if too low
- Only applies when PTT is not configured
5. User permissions and ownership
- Ensured all configs owned by kiosk user
- Proper audio group membership
- Clear messaging about needing to log out/reboot
6. Enhanced diagnostics
- Added PipeWire service status checks
- Show microphone/speaker mute status and volumes
- Display PTT configuration status
- Clear error message when microphone is muted
- Added helpful instructions for troubleshooting
7. Improved user messaging
- Added comprehensive post-install instructions
- Clear explanation of audio configuration
- Guidance on when to log out/reboot
- Better error messages throughout
Key Changes:
- configure_local_client(): Offers to install Baresip if missing
- enable_client_services(): Only enables PTT when configured
- ensure_audio_unmuted(): New function to ensure audio works
- run_client_diagnostics(): Enhanced with audio status info
- install_client_only(): Added detailed audio setup message
The kiosk now works as a proper intercom out of the box, with
microphone and speakers unmuted and ready to use.
The PTT handler was muting the audio source before checking if a PTT
device was configured. This prevented kiosks from sending audio back
to calling phones during normal intercom operation.
Changes:
- Move audio mute command after PTT device check
- Only mute audio when PTT device is actually configured
- Leave audio unmuted for standard kiosk intercom functionality
- Add clarifying comments about PTT mode vs normal operation
This fixes the issue where phones calling the kiosk could send audio
but received no audio back from the kiosk.
ROOT CAUSE FOUND:
- install_server_only() was hardcoding ENABLE_TLS="y" (line 2039)
- install_full() wasn't setting ENABLE_TLS at all
- This caused devices to always use TLS/5061 even for LAN-only setups
FIXES:
1. install_server_only(): Changed ENABLE_TLS="y" to ENABLE_TLS="n"
2. install_full(): Added ENABLE_TLS="n" before configure_asterisk
3. Added debug output showing ENABLE_TLS and DOMAIN_NAME values in device summary
HOW IT WORKS NOW:
- Both install functions start with ENABLE_TLS="n" (LAN-only/UDP)
- Only setup_internet_access() sets ENABLE_TLS="y" (internet/TLS)
- Device configuration respects ENABLE_TLS value from saved config
- Device summary correctly displays UDP/5060 for LAN-only
- Device summary shows TLS/5061 only after internet/certs setup
This ensures devices use UDP transport for LAN-only installations
and TLS only when explicitly configured for internet calling.
CRITICAL FIX:
- Added load_config() call in add_device_menu to read saved ENABLE_TLS setting
- Device display now correctly shows UDP/5060 when ENABLE_TLS != "y"
- Device display shows TLS/5061 only when ENABLE_TLS == "y"
- SRTP requirement properly displayed based on TLS configuration
OTHER FIXES:
- ICE support only enabled when DOMAIN_NAME is set (FQDN/internet calling)
- RTP config: icesupport and STUN only for FQDN setups, not LAN-only
- Added informative message after server install before internet setup prompt
ISSUE RESOLVED:
When installing server-only without selecting internet/certs, devices now
correctly show:
Transport: UDP (port 5060)
SRTP: Not required
This matches the actual pjsip.conf configuration and allows mobile devices
to properly register with UDP transport on LAN networks.
Created v1.28.sh with all fixes, keeping v1.23.sh for reference.