Merge pull request #312 from outis1one/claude/ionos-script-integration-x32ofw
Fix false TURN allocation failure, add attention recap, one-at-a-time…
This commit is contained in:
@@ -160,7 +160,13 @@ else
|
|||||||
warn "$c: couldn't read cached credentials, skipping live test"
|
warn "$c: couldn't read cached credentials, skipping live test"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
OUT="$(docker exec coturn timeout 10 turnutils_uclient -t -T -u "$_u" -w "$_p" "$TEST_HOST" -p "$COTURN_PORT" 2>&1)"
|
# Plain UDP only — no -t/-T (TCP/TLS) flags; coturn runs with
|
||||||
|
# --no-tls --no-dtls (services/coturn.sh), so requesting an
|
||||||
|
# encrypted/TCP transport here fails the allocation against a
|
||||||
|
# server that never offered one. See tools/pstn-test-check.sh's
|
||||||
|
# matching comment — confirmed live this was the actual cause of a
|
||||||
|
# "Cannot complete Allocation" failure, not a real coturn problem.
|
||||||
|
OUT="$(docker exec coturn timeout 10 turnutils_uclient -u "$_u" -w "$_p" "$TEST_HOST" -p "$COTURN_PORT" 2>&1)"
|
||||||
RC=$?
|
RC=$?
|
||||||
if [ "$RC" -eq 0 ]; then
|
if [ "$RC" -eq 0 ]; then
|
||||||
ok "$c: TURN allocation succeeded (credentials + relay range + reachability all confirmed working)"
|
ok "$c: TURN allocation succeeded (credentials + relay range + reachability all confirmed working)"
|
||||||
|
|||||||
+64
-19
@@ -20,12 +20,34 @@ set -uo pipefail
|
|||||||
PASS=0
|
PASS=0
|
||||||
WARN=0
|
WARN=0
|
||||||
FAIL=0
|
FAIL=0
|
||||||
|
WARN_MSGS=()
|
||||||
|
FAIL_MSGS=()
|
||||||
|
|
||||||
ok() { printf ' [OK] %s\n' "$1"; PASS=$((PASS + 1)); }
|
ok() { printf ' [OK] %s\n' "$1"; PASS=$((PASS + 1)); }
|
||||||
warn() { printf ' [WARN] %s\n' "$1"; WARN=$((WARN + 1)); }
|
warn() { printf ' [WARN] %s\n' "$1"; WARN=$((WARN + 1)); WARN_MSGS+=("$1"); }
|
||||||
fail() { printf ' [FAIL] %s\n' "$1"; FAIL=$((FAIL + 1)); }
|
fail() { printf ' [FAIL] %s\n' "$1"; FAIL=$((FAIL + 1)); FAIL_MSGS+=("$1"); }
|
||||||
section() { printf '\n== %s ==\n' "$1"; }
|
section() { printf '\n== %s ==\n' "$1"; }
|
||||||
|
|
||||||
|
# One extension's softphone setup block — shared by the full run below and
|
||||||
|
# the "print again, one at a time" prompt at the end, so the two can't drift.
|
||||||
|
# Reads SIP_SERVER/TURN_SERVER/TURN_USERNAME/TURN_PASSWORD from the caller's
|
||||||
|
# scope (set once, further down, before either call site runs).
|
||||||
|
print_ext_info() {
|
||||||
|
local ext="$1" pass="$2" transport="$3" ice="$4" port proto
|
||||||
|
if [ "$transport" = "transport-tls" ]; then port=5061; proto="tls"; else port=5060; proto="udp"; fi
|
||||||
|
echo " Extension $ext:"
|
||||||
|
echo " SIP server: $SIP_SERVER"
|
||||||
|
echo " Username: $ext"
|
||||||
|
echo " Password: $pass"
|
||||||
|
echo " Port: $port"
|
||||||
|
echo " Transport: $proto"
|
||||||
|
if [ "$ice" = "yes" ] && [ -n "${TURN_SERVER:-}" ]; then
|
||||||
|
echo " TURN server: $TURN_SERVER"
|
||||||
|
echo " TURN user: $TURN_USERNAME"
|
||||||
|
echo " TURN pass: $TURN_PASSWORD"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
if [ "$(id -u)" -ne 0 ]; then
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
echo "Run with sudo — needs docker exec and (on some boxes) systemctl/journalctl." >&2
|
echo "Run with sudo — needs docker exec and (on some boxes) systemctl/journalctl." >&2
|
||||||
exec sudo bash "$0" "$@"
|
exec sudo bash "$0" "$@"
|
||||||
@@ -187,7 +209,14 @@ else
|
|||||||
elif ! docker exec "$COTURN_CONTAINER" which turnutils_uclient &>/dev/null; then
|
elif ! docker exec "$COTURN_CONTAINER" which turnutils_uclient &>/dev/null; then
|
||||||
warn "turnutils_uclient not found in $COTURN_CONTAINER — skipping live allocation test"
|
warn "turnutils_uclient not found in $COTURN_CONTAINER — skipping live allocation test"
|
||||||
else
|
else
|
||||||
OUT="$(docker exec "$COTURN_CONTAINER" timeout 10 turnutils_uclient -t -T -u "$TURN_USERNAME" -w "$TURN_PASSWORD" 127.0.0.1 -p "${TURN_PORT:-3478}" 2>&1)"
|
# Plain UDP only — no -t/-T (TCP/TLS) flags. coturn is started with
|
||||||
|
# --no-tls --no-dtls (services/coturn.sh), so requesting an
|
||||||
|
# encrypted/TCP transport here just fails the allocation outright
|
||||||
|
# against a server that never offered one, misreporting a config
|
||||||
|
# problem that doesn't exist. Confirmed live: this was the actual
|
||||||
|
# cause of a "Cannot complete Allocation" failure against an
|
||||||
|
# otherwise fully working coturn instance.
|
||||||
|
OUT="$(docker exec "$COTURN_CONTAINER" timeout 10 turnutils_uclient -u "$TURN_USERNAME" -w "$TURN_PASSWORD" 127.0.0.1 -p "${TURN_PORT:-3478}" 2>&1)"
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
ok "Live TURN allocation succeeded with Asterisk's own configured credentials (user '$TURN_USERNAME')"
|
ok "Live TURN allocation succeeded with Asterisk's own configured credentials (user '$TURN_USERNAME')"
|
||||||
else
|
else
|
||||||
@@ -255,22 +284,7 @@ else
|
|||||||
else
|
else
|
||||||
while IFS='|' read -r ext pass transport ice; do
|
while IFS='|' read -r ext pass transport ice; do
|
||||||
[ -z "$ext" ] && continue
|
[ -z "$ext" ] && continue
|
||||||
if [ "$transport" = "transport-tls" ]; then
|
print_ext_info "$ext" "$pass" "$transport" "$ice"
|
||||||
port=5061; proto="tls"
|
|
||||||
else
|
|
||||||
port=5060; proto="udp"
|
|
||||||
fi
|
|
||||||
echo " Extension $ext:"
|
|
||||||
echo " SIP server: $SIP_SERVER"
|
|
||||||
echo " Username: $ext"
|
|
||||||
echo " Password: $pass"
|
|
||||||
echo " Port: $port"
|
|
||||||
echo " Transport: $proto"
|
|
||||||
if [ "$ice" = "yes" ] && [ -n "$TURN_SERVER" ]; then
|
|
||||||
echo " TURN server: $TURN_SERVER"
|
|
||||||
echo " TURN user: $TURN_USERNAME"
|
|
||||||
echo " TURN pass: $TURN_PASSWORD"
|
|
||||||
fi
|
|
||||||
echo ""
|
echo ""
|
||||||
done <<< "$DEVICE_INFO"
|
done <<< "$DEVICE_INFO"
|
||||||
ok "Printed setup info for $(wc -l <<< "$DEVICE_INFO") extension(s) — same values Sipnetic's"
|
ok "Printed setup info for $(wc -l <<< "$DEVICE_INFO") extension(s) — same values Sipnetic's"
|
||||||
@@ -362,10 +376,41 @@ fi
|
|||||||
# ── Summary ───────────────────────────────────────────────────────────────────
|
# ── Summary ───────────────────────────────────────────────────────────────────
|
||||||
section "Summary"
|
section "Summary"
|
||||||
echo " $PASS passed, $WARN warnings, $FAIL failed."
|
echo " $PASS passed, $WARN warnings, $FAIL failed."
|
||||||
|
|
||||||
|
if [ "${#FAIL_MSGS[@]}" -gt 0 ] || [ "${#WARN_MSGS[@]}" -gt 0 ]; then
|
||||||
|
echo ""
|
||||||
|
echo " Needs attention:"
|
||||||
|
for m in "${FAIL_MSGS[@]:-}"; do
|
||||||
|
[ -z "$m" ] && continue
|
||||||
|
echo " [FAIL] $m"
|
||||||
|
done
|
||||||
|
for m in "${WARN_MSGS[@]:-}"; do
|
||||||
|
[ -z "$m" ] && continue
|
||||||
|
echo " [WARN] $m"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo " This covers everything that can be checked without placing a real call"
|
echo " This covers everything that can be checked without placing a real call"
|
||||||
echo " or sending a real text, plus the provider-side values above that only a"
|
echo " or sending a real text, plus the provider-side values above that only a"
|
||||||
echo " human can confirm inside the portal itself. For the call/SMS test steps"
|
echo " human can confirm inside the portal itself. For the call/SMS test steps"
|
||||||
echo " and what each result means, see docs/pstn-sms-test-checklist.md."
|
echo " and what each result means, see docs/pstn-sms-test-checklist.md."
|
||||||
|
|
||||||
|
# ── Optional: reprint softphone setup one extension at a time ────────────────
|
||||||
|
# The full setup block scrolled past earlier in a long run — offer to show
|
||||||
|
# it again, one extension per screen, instead of scrolling back for it.
|
||||||
|
if [ -n "${DEVICE_INFO:-}" ] && [ -t 0 ]; then
|
||||||
|
echo ""
|
||||||
|
REPRINT=""
|
||||||
|
read -r -p " Show softphone setup again, one extension at a time? (y/n): " REPRINT
|
||||||
|
if [[ "$REPRINT" =~ ^[Yy]$ ]]; then
|
||||||
|
while IFS='|' read -r ext pass transport ice; do
|
||||||
|
[ -z "$ext" ] && continue
|
||||||
|
echo ""
|
||||||
|
print_ext_info "$ext" "$pass" "$transport" "$ice"
|
||||||
|
read -r -p " Press Enter for the next extension (Ctrl+C to stop)..." _ignored
|
||||||
|
done <<< "$DEVICE_INFO"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
[ "$FAIL" -eq 0 ]
|
[ "$FAIL" -eq 0 ]
|
||||||
|
|||||||
Reference in New Issue
Block a user