support timeout for intiating calls, and set default to 15 seconds

This commit is contained in:
liamcottle
2024-05-21 18:09:05 +12:00
parent 4a6dec1da6
commit beef7d526b
3 changed files with 32 additions and 8 deletions

9
web.py
View File

@@ -304,12 +304,19 @@ class ReticulumWebChat:
# get path params
destination_hash = request.match_info.get("destination_hash", "")
timeout_seconds = int(request.query.get("timeout", 15))
print(timeout_seconds)
# convert destination hash to bytes
destination_hash = bytes.fromhex(destination_hash)
# initiate audio call
link_hash = await self.audio_call_manager.initiate(destination_hash)
link_hash = await self.audio_call_manager.initiate(destination_hash, timeout_seconds)
if link_hash is None:
return web.json_response({
"message": "timed out initiating call",
}, status=503)
return web.json_response({
"hash": link_hash.hex(),