This commit is contained in:
edschuy95 2025-07-13 23:38:59 -04:00
parent eeda32a9b2
commit e865fcdd36
3 changed files with 35 additions and 0 deletions

13
app.py
View file

@ -1,8 +1,21 @@
from flask import Flask
from routes import yeastar, voipms
import logging
import os
import shutil
import sys
# Check for config.py at runtime
if not os.path.exists("config.py"):
print("config.py not found — creating from config.template.py")
try:
shutil.copyfile("config.template.py", "config.py")
print("Created config.py — please edit it with your real secrets.")
sys.exit(1) # Exit so user must edit it manually
except Exception as e:
print(f"Failed to create config.py: {e}")
sys.exit(1)
# Disable Flask/Werkzeug noisy request log
log = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR)

21
config.template.py Normal file
View file

@ -0,0 +1,21 @@
# config.template.py
# Yeastar webhook config
# Get the webhook URL from the channel configuration
# Set a secret in the channel configuration and put that here.
YEASTAR_WEBHOOK_URL = "https://your-yeastar-webhook-url"
YEASTAR_SECRET = "your-yeastar-secret"
# VOIP.ms SOAP endpoint (Farily static, update this if it changes in the future)
VOIPMS_ENDPOINT = "https://voip.ms/api/v1/server.php"
# Make this something semi-random and URL safe. Adds obscurity and makes your endpoint harder to guess
ENDPOINT_OBSCURITY = "abcdefghijklmnopqrstuvwxyz"
# When this is configured and you start your server up, your endpoints will be:
# http://your-ip-address:5000/{ENDPOINT_OBSCURITY}/yeastar-outbound <------- point your yeastar sms channel here
# and
# http://your-ip-address:5000/{ENDPOINT_OBSCURITY}/voipms-inbound <------- point your voip.ms DIDs to post here
# Endpoints can deliver verbose output for troubleshooting without restarting the proxy.
# Just update the channel or did and add "/verbose" to the URL.

View file

@ -24,6 +24,7 @@
<ItemGroup>
<Compile Include="app.py" />
<Compile Include="config.py" />
<Compile Include="config.template.py" />
<Compile Include="routes\helpers.py" />
<Compile Include="routes\voipms.py" />
<Compile Include="routes\yeastar.py" />