Start_TURNServer.ps1 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # Copyright Epic Games, Inc. All Rights Reserved.
  2. . "$PSScriptRoot\Start_Common.ps1"
  3. set_start_default_values "y" "n" # Set both TURN and STUN server defaults
  4. use_args($args)
  5. print_parameters
  6. #$LocalIp = Invoke-WebRequest -Uri "http://169.254.169.254/latest/meta-data/local-ipv4"
  7. $LocalIP = (Test-Connection -ComputerName (hostname) -Count 1 | Select IPV4Address).IPV4Address.IPAddressToString
  8. Write-Output "Private IP: $LocalIp"
  9. $TurnPort="19303"
  10. $Pos = $global:TurnServer.LastIndexOf(":")
  11. if ($Pos -ne -1) {
  12. $TurnPort = $global:TurnServer.Substring($Pos+ 1)
  13. }
  14. echo "TURN port: ${turnport}"
  15. echo ""
  16. Push-Location $PSScriptRoot
  17. $TurnUsername = "PixelStreamingUser"
  18. $TurnPassword = "AnotherTURNintheroad"
  19. $Realm = "PixelStreaming"
  20. $ProcessExe = ".\turnserver.exe"
  21. $Arguments = "-p $TurnPort -r $Realm -X $PublicIP -E $LocalIP -L $LocalIP --no-cli --no-tls --no-dtls --pidfile `"C:\coturn.pid`" -f -a -v -n -u $TurnUsername`:$TurnPassword"
  22. # Add arguments passed to script to Arguments for executable
  23. $Arguments += $args
  24. Push-Location $PSScriptRoot\coturn\
  25. Write-Output "Running: $ProcessExe $Arguments"
  26. # pause
  27. Start-Process -FilePath $ProcessExe -ArgumentList $Arguments -NoNewWindow
  28. Pop-Location
  29. Pop-Location