You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

35 rivejä
1.1 KiB

  1. from fastapi import APIRouter
  2. from fastapi.param_functions import Depends
  3. from fastapi.security import OAuth2PasswordRequestForm
  4. from fastapi_login.exceptions import InvalidCredentialsException
  5. from core.actions import get_user_by_name
  6. from models.presence import PresenceCreate,PresenceResponse
  7. from core.security import manager
  8. #
  9. router = APIRouter(
  10. prefix="/presence"
  11. )
  12. @router.get("/settings", tags=["Presense"])
  13. async def route_ring(active_user=Depends(manager),calledNumber=None, calledId=None, ringTime=None):
  14. api_settings = {}
  15. f = open("/conf/etc/presence/confphone.xml", "r")
  16. confPhone = ET.parse("/conf/etc/presence/confphone.xml")
  17. for user in confPhone.getroot():
  18. for presence in user:
  19. for child in presence:
  20. if child.tag == "id":
  21. api_settings.update(id=child.text)
  22. if child.tag == "confphoneactive":
  23. api_settings.update(isActive=child.text)
  24. if child.tag == "confphonefqdn":
  25. api_settings.update(fqdn=child.text)
  26. return api_settings