feat: add Windows real RTC voice device simulator
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
[CmdletBinding()]
|
||||
param([switch]$NoBuild)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$scriptDirectory = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$projectRoot = Resolve-Path (Join-Path $scriptDirectory "..\..")
|
||||
$runtimeDirectory = Join-Path $scriptDirectory "runtime"
|
||||
$environmentFile = Join-Path $runtimeDirectory "local-rtc.env"
|
||||
$requiredFiles = @(
|
||||
"rtc-app-key",
|
||||
"volc-access-key-id",
|
||||
"volc-secret-access-key",
|
||||
"voice-chat-template.json",
|
||||
"local-rtc.env"
|
||||
)
|
||||
|
||||
foreach ($name in $requiredFiles) {
|
||||
if (-not (Test-Path -LiteralPath (Join-Path $runtimeDirectory $name) -PathType Leaf)) {
|
||||
throw "缺少 $name,请先运行 .\deploy\local-rtc\configure.ps1"
|
||||
}
|
||||
}
|
||||
|
||||
Push-Location $projectRoot
|
||||
try {
|
||||
$arguments = @(
|
||||
"compose",
|
||||
"-f", "compose.yaml",
|
||||
"-f", "deploy/local-rtc/compose.override.yaml",
|
||||
"--env-file", $environmentFile,
|
||||
"up", "-d"
|
||||
)
|
||||
if (-not $NoBuild) { $arguments += "--build" }
|
||||
$arguments += @(
|
||||
"postgres", "redis", "minio", "keycloak", "migrate", "seed",
|
||||
"callbacks", "mock-alert-receiver", "mock-provider", "api", "worker"
|
||||
)
|
||||
& docker @arguments
|
||||
if ($LASTEXITCODE -ne 0) { throw "Docker Compose 启动失败" }
|
||||
|
||||
Write-Host "`n等待本地 API 就绪..." -ForegroundColor Cyan
|
||||
$deadline = [DateTime]::UtcNow.AddMinutes(3)
|
||||
do {
|
||||
Start-Sleep -Seconds 2
|
||||
try {
|
||||
$health = Invoke-RestMethod -Uri "http://localhost:58080/health/ready" -TimeoutSec 3
|
||||
if ($health) { break }
|
||||
}
|
||||
catch { }
|
||||
} while ([DateTime]::UtcNow -lt $deadline)
|
||||
|
||||
if (-not $health) { throw "本地 API 未在三分钟内就绪,请检查 docker compose logs api worker" }
|
||||
Write-Host "本地真实 RTC 后端已就绪:http://localhost:58080" -ForegroundColor Green
|
||||
Write-Host "现在可以启动 Windows 语音终端模拟器。" -ForegroundColor Green
|
||||
}
|
||||
finally {
|
||||
Pop-Location
|
||||
}
|
||||
Reference in New Issue
Block a user