From e865fcdd36c2c160f279efa3f168c0d1f7b304bd Mon Sep 17 00:00:00 2001 From: edschuy95 Date: Sun, 13 Jul 2025 23:38:59 -0400 Subject: [PATCH] . --- app.py | 13 +++++++++++++ config.template.py | 21 +++++++++++++++++++++ webhook-proxy.pyproj | 1 + 3 files changed, 35 insertions(+) create mode 100644 config.template.py diff --git a/app.py b/app.py index 374d551..ce7da38 100644 --- a/app.py +++ b/app.py @@ -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) diff --git a/config.template.py b/config.template.py new file mode 100644 index 0000000..d121556 --- /dev/null +++ b/config.template.py @@ -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. \ No newline at end of file diff --git a/webhook-proxy.pyproj b/webhook-proxy.pyproj index b7d819c..4f18272 100644 --- a/webhook-proxy.pyproj +++ b/webhook-proxy.pyproj @@ -24,6 +24,7 @@ +