#!/usr/bin/with-contenv bashio bashio::log.info "Starting SIP Voice Notifier..." # Get config from add-on options SIP_SERVER=$(bashio::config 'sip_server') SIP_USER=$(bashio::config 'sip_user') SIP_PASSWORD=$(bashio::config 'sip_password') DEFAULT_DURATION=$(bashio::config 'default_duration') bashio::log.info "SIP Server: ${SIP_SERVER}" bashio::log.info "SIP User: ${SIP_USER}" bashio::log.info "Default Duration: ${DEFAULT_DURATION}s" # Wait for supervisor to be ready sleep 3 # Register service with Home Assistant via Supervisor API bashio::log.info "Registering sip_notifier.send_notification service with Home Assistant..." # Get add-on slug ADDON_SLUG="088d3b92_sip-notifier" # Register the service curl -sSL -X POST \ -H "Authorization: Bearer ${SUPERVISOR_TOKEN}" \ -H "Content-Type: application/json" \ -d "{ \"addon\": \"${ADDON_SLUG}\", \"service\": \"send_notification\" }" \ "http://supervisor/services/sip_notifier/send_notification" \ && bashio::log.info "Service registered successfully!" \ || bashio::log.warning "Service registration failed (may already exist)" bashio::log.info "Add-on ready - listening on port 8099" bashio::log.info "Service available as: sip_notifier.send_notification" # Start the Flask service exec python3 /app/sip_service.py