From 5f46fe188b9cc49f70e6809ec6e81b3fbb843b61 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 9 Dec 2025 13:19:18 +0000 Subject: [PATCH] Add Baresip configuration generator for /e/OS compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Baresip works significantly better than Linphone on /e/OS for background audio operation. Adding dedicated provisioning support. NEW FEATURE: Baresip Config Generator - Added create_baresip_config() function in Provisioning Manager - Generates account configuration with full setup instructions - Provides both config file and manual entry instructions - Includes /e/OS-specific permission guidance Key Benefits of Baresip on /e/OS: - Better background audio handling than Linphone - Works with screen off without special hacks - Lightweight and efficient - Handles /e/OS microphone permissions more reliably Configuration Generator Creates: - Account line in baresip format with all parameters - Manual entry instructions for Baresip app - Audio settings recommendations (OpenSL ES) - Default action setup (Call, not Message) - Extension dialing guidance - /e/OS permission instructions Usage: - Server Settings → Provisioning Manager → Create Baresip Config - Enter extension, password, display name - Get config file with complete setup instructions - Download via HTTP provisioning or copy to phone Menu Updates: - Provisioning Manager option 4: Create Baresip Config - Option numbers renumbered (Status=5, Directory=6, Troubleshoot=7) This addresses the persistent /e/OS audio issues by providing a better SIP client alternative that actually works with /e/OS's privacy model. --- easy-asterisk-v0.9.9.sh | 155 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 149 insertions(+), 6 deletions(-) diff --git a/easy-asterisk-v0.9.9.sh b/easy-asterisk-v0.9.9.sh index 370781c..67c24fd 100644 --- a/easy-asterisk-v0.9.9.sh +++ b/easy-asterisk-v0.9.9.sh @@ -1833,6 +1833,147 @@ MORE HELP: EOSHELP } +create_baresip_config() { + print_header "Create Baresip Account Config" + load_config + + local server_ip=$(hostname -I | cut -d' ' -f1) + local domain="${DOMAIN_NAME:-$server_ip}" + local transport="tcp" + + if [[ "$ENABLE_TLS" == "y" && -n "$DOMAIN_NAME" ]]; then + transport="tls" + fi + + echo "Baresip Config Generator" + echo "================================================" + echo "" + echo "Baresip works BETTER on /e/OS than Linphone!" + echo "Better background audio handling." + echo "" + echo "Current Configuration:" + echo " Domain: $domain" + echo " Transport: $transport" + echo " Server IP: $server_ip" + echo "" + + read -p "Enter extension number (e.g., 202): " extension + [[ -z "$extension" ]] && { print_error "Extension required"; return 1; } + + read -p "Enter SIP password: " sip_password + [[ -z "$sip_password" ]] && { print_error "Password required"; return 1; } + + read -p "Enter display name (e.g., Kitchen Phone): " display_name + display_name=${display_name:-Extension $extension} + + local config_file="$PROVISIONING_DIR/baresip-${extension}.conf" + + mkdir -p "$PROVISIONING_DIR" + + cat > "$config_file" << EOF +# Baresip Account Configuration for Extension ${extension} +# Generated by Easy Asterisk v0.9.9 +# +# HOW TO USE: +# 1. Install Baresip from F-Droid or Play Store +# 2. Open Baresip → Menu → Accounts → Add Account +# 3. Manually enter the SIP URI and settings below +# OR copy this file to your phone and import +# +# ACCOUNT CONFIGURATION: +# ===================== + +# Full account line format: +;auth_pass=${sip_password};outbound="sip:${server_ip}:5060;transport=${transport}";regint=3600;pubint=0;answermode=manual;medianat=none + +# Explanation of parameters: +# - sip:${extension}@${domain} = Your SIP URI +# - auth_pass = Your password +# - outbound = Asterisk server address +# - regint=3600 = Re-register every hour +# - pubint=0 = Don't publish presence +# - answermode=manual = Don't auto-answer +# - medianat=none = No NAT for media (LAN use) + +# MANUAL ENTRY IN BARESIP APP: +# ============================ +# If importing doesn't work, manually enter: +# +# Display Name: ${display_name} +# SIP URI: sip:${extension}@${domain} +# Auth Username: ${extension} +# Auth Password: ${sip_password} +# Outbound Proxy: sip:${server_ip}:5060;transport=${transport} +# Register: Yes +# Register Interval: 3600 + +# DIALING OTHER EXTENSIONS: +# ========================= +# Just dial the extension number: 101, 202, etc. +# Or full format: 101@${domain} + +# AUDIO SETTINGS (in Baresip app): +# ================================ +# Preferences → Audio: +# - Audio Driver: OpenSL ES (best for Android) +# - Echo Cancellation: Enabled +# - Noise Suppression: Enabled + +# DEFAULT ACTION (in Baresip app): +# ================================ +# Preferences → UI → Default Action: Call +# (This makes tapping a contact initiate a call, not message) + +# /e/OS SETTINGS: +# ============== +# Settings → Apps → Baresip: +# - Permissions → Microphone: While using app +# - Permissions → Phone: Allow +# - Battery: Unrestricted +# - Background data: Enabled +# +# Baresip handles /e/OS better than Linphone! +# Should work with screen off without special hacks. + +EOF + + chown asterisk:asterisk "$config_file" + chmod 644 "$config_file" + + print_success "Created: $config_file" + echo "" + echo "Download URL:" + echo " http://${server_ip}:8088/static/baresip-${extension}.conf" + echo "" + echo "═══════════════════════════════════════════════════════════" + echo "QUICK SETUP IN BARESIP APP:" + echo "═══════════════════════════════════════════════════════════" + echo "" + echo "1. Open Baresip → Menu (☰) → Accounts → Add (+)" + echo "" + echo "2. Enter these details:" + echo " Display Name: ${display_name}" + echo " SIP URI: sip:${extension}@${domain}" + echo " Auth User: ${extension}" + echo " Auth Pass: ${sip_password}" + echo " Outbound Proxy: sip:${server_ip}:5060;transport=${transport}" + echo "" + echo "3. Check 'Register' box" + echo "" + echo "4. Save and wait for registration" + echo "" + echo "5. To call extensions, just dial: 202, 101, etc." + echo "" + echo "6. Set default action to Call:" + echo " Menu → Preferences → UI → Default Action: Call" + echo "" + echo "═══════════════════════════════════════════════════════════" + echo "" + echo "NOTE: Baresip works MUCH BETTER on /e/OS than Linphone!" + echo " Should maintain audio with screen off." + echo "═══════════════════════════════════════════════════════════" +} + provisioning_manager_menu() { while true; do clear @@ -1840,9 +1981,10 @@ provisioning_manager_menu() { echo " 1) Setup HTTP Server (ports 8088/8089)" echo " 2) Create/Update linphone.xml" echo " 3) Edit linphone.xml" - echo " 4) Show Status" - echo " 5) Open Provisioning Directory" - echo " 6) Troubleshoot /e/OS Audio Issues" + echo " 4) Create Baresip Config" + echo " 5) Show Status" + echo " 6) Open Provisioning Directory" + echo " 7) Troubleshoot /e/OS Audio Issues" echo " 0) Back" read -p " Select: " choice @@ -1850,8 +1992,9 @@ provisioning_manager_menu() { 1) setup_http_provisioning ;; 2) create_linphone_xml ;; 3) edit_linphone_xml ;; - 4) show_provisioning_status ;; - 5) + 4) create_baresip_config ;; + 5) show_provisioning_status ;; + 6) if command -v mc &>/dev/null; then mc "$PROVISIONING_DIR" else @@ -1859,7 +2002,7 @@ provisioning_manager_menu() { ls -lah "$PROVISIONING_DIR" fi ;; - 6) troubleshoot_eos_audio ;; + 7) troubleshoot_eos_audio ;; 0) return ;; esac