-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrunner.py
More file actions
47 lines (37 loc) · 1.18 KB
/
runner.py
File metadata and controls
47 lines (37 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import argparse
import os
import uuid
import aiohttp
from pipecat.transports.services.helpers.daily_rest import (
DailyRESTHelper,
DailyRoomParams,
DailyRoomProperties,
)
from config import settings
async def configure(aiohttp_session: aiohttp.ClientSession):
(url, token) = await configure_with_args(aiohttp_session)
return (url, token)
async def configure_with_args(
aiohttp_session: aiohttp.ClientSession,
parser: argparse.ArgumentParser | None = None,
):
daily_rest_helper = DailyRESTHelper(
daily_api_key=settings.DAILYCO_API_KEY,
daily_api_url=settings.DAILYCO_BASE_URL,
aiohttp_session=aiohttp_session,
)
room = await daily_rest_helper.create_room(
params=DailyRoomParams(
name=str(uuid.uuid4()),
properties=DailyRoomProperties(
start_video_off=True,
start_audio_off=True,
max_participants=2,
),
)
)
# Create a meeting token for the given room with an expiration 1 hour in
# the future.
expiry_time: float = 60 * 60
token = await daily_rest_helper.get_token(room.url, expiry_time)
return (room.url, token)