Jump to content

- PBXScript

- # PBXScript.Sleep()

  Followers 0

  Lua → VBScript SwxWare v13.10

  This function stops the execution of the current script for the given number of milliseconds.

      PBXScript.Sleep(1000)

  This function returns a PBXResult value of PBXSuccess.

  The numeric parameter gives the number of milliseconds to "sleep".

  This function is used to wait a certain amount of time without consuming any CPU load. A common usage is e.g. in a call queue to check every second for the availability of a free agent. While "sleeping" one second no cpu load is used.

  When ever you need to loop within your script make sure to use this function to slow the execution of the loop down and save cpu load.

  An endless loop, like

      while true
      do
        i = i + 1
      end

  will drive the CPU load of the server machine to 100% and therefore interfere negatively with all calls on and other activities of the SwyxServer.

  So, whenever you need to do something like the above, you need to slow the loop down.

      while true
      do
        i = i + 1
        PBXScript.Sleep(1000)
      end

  By Tom Wellige

  - May 22, 2022
  Share
  Share
  Followers 0

## Important Information

By using this site, you agree to our Terms of Use and have taken note of our Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.