install-freeswitch.ps1 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #Download and install latest version on FreeSWITCH 1.6.
  2. #Set it to auto start
  3. Function Install-FreeSWITCH() {
  4. . .\resources\get-link.ps1
  5. . .\resources\get-file.ps1
  6. . .\resources\get-cpu.ps1
  7. if (Get-Installed-App "FreeSWITCH*") {
  8. Write-Host FreeSWITCH is already installed
  9. return
  10. }
  11. $cpu = Get-CPU
  12. if ($cpu -eq "x86") {
  13. $url = "http://files.freeswitch.org/windows/installer/x86/"
  14. }
  15. else {
  16. $url = "http://files.freeswitch.org/windows/installer/x64/"
  17. }
  18. $link = Get-Link $url "*${switch_version}*"
  19. Write-Host Download FreeSWITCH from $link -ForegroundColor Cyan
  20. $filename = Get-File $link
  21. #Required for FreeSWITCH
  22. if ( ([System.Environment]::OSVersion.Version.Build -lt 9600) -and -not (Get-Installed-App "FreeSWITCH*") -and -not (Get-HotFix -id KB2999226)) {
  23. Write-Host Install update KB2999226
  24. Return
  25. }
  26. Write-Host "Install Freeswitch" -ForegroundColor Cyan
  27. #Remove FreeSWITCH
  28. Start-Process MsiExec.exe "/x {B004A325-1272-47E5-A415-A74E9FC99865} /passive /qb" -Wait
  29. #Install new version
  30. Start-Process msiexec "/i $filename /passive /qb" -Wait
  31. #Configure service to auto start
  32. Start-Process sc "config FreeSWITCH start= auto" -Wait -NoNewWindow
  33. #Start-Service FreeSWITCH
  34. #Set permissions to folder "c:\Program Files\FreeSWITCH" for PHP (IIS)
  35. if ($iis_identity -ne "LocalSystem") {
  36. Icacls "c:\Program Files\FreeSWITCH" /grant "NetworkService:(OI)(CI)M"
  37. }
  38. #mod_lua.dll is missing from recent windows builds
  39. $lua = "C:\Program Files\FreeSWITCH\mod\mod_lua.dll"
  40. if ( -not (Test-Path $lua) ) {
  41. Get-File "https://github.com/fusionpbx/fusionpbx-install.sh/raw/master/windows/resources/$cpu/mod_lua.dll"
  42. Copy-Item ".\mod_lua.dll" -Destination $lua
  43. }
  44. }