voip.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # Copyright 2014-2016 OpenMarket Ltd
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. from ._base import Config
  15. class VoipConfig(Config):
  16. def read_config(self, config):
  17. self.turn_uris = config.get("turn_uris", [])
  18. self.turn_shared_secret = config["turn_shared_secret"]
  19. self.turn_user_lifetime = self.parse_duration(config["turn_user_lifetime"])
  20. def default_config(self, **kwargs):
  21. return """\
  22. ## Turn ##
  23. # The public URIs of the TURN server to give to clients
  24. turn_uris: []
  25. # The shared secret used to compute passwords for the TURN server
  26. turn_shared_secret: "YOUR_SHARED_SECRET"
  27. # How long generated TURN credentials last
  28. turn_user_lifetime: "1h"
  29. """