Skip to content

Commit

Permalink
Merge pull request #234 from pipecat-ai/aleix/fix-daily-room-properti…
Browse files Browse the repository at this point in the history
…es-exp

transports(helpers): fix DailyRoomProperties.exp
  • Loading branch information
aconchillo authored Jun 13, 2024
2 parents 50d69a1 + ccd6af7 commit 289debe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Fixed an issue where `DailyRoomProperties.exp` always had the same old
timestamp unless set by the user.

- Fixed a couple of issues with `WebsocketServerTransport`. It needed to use
`push_audio_frame()` and also VAD was not working properly.

Expand Down
14 changes: 8 additions & 6 deletions src/pipecat/transports/services/helpers/daily_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
Methods that wrap the Daily API to create rooms, check room URLs, and get meeting tokens.
"""
from urllib.parse import urlparse

import requests
from typing import Literal, Optional
from time import time
import time

from pydantic import BaseModel, ValidationError
from urllib.parse import urlparse

from pydantic import Field, BaseModel, ValidationError
from typing import Literal, Optional


class DailyRoomSipParams(BaseModel):
Expand All @@ -26,7 +28,7 @@ class DailyRoomSipParams(BaseModel):


class DailyRoomProperties(BaseModel, extra="allow"):
exp: float = time() + 5 * 60
exp: float = Field(default_factory=lambda: time.time() + 5 * 60)
enable_chat: bool = False
enable_emoji_reactions: bool = False
eject_at_room_exp: bool = True
Expand Down Expand Up @@ -112,7 +114,7 @@ def get_token(self, room_url: str, expiry_time: float = 60 * 60, owner: bool = T
raise Exception(
"No Daily room specified. You must specify a Daily room in order a token to be generated.")

expiration: float = time() + expiry_time
expiration: float = time.time() + expiry_time

room_name = self._get_name_from_url(room_url)

Expand Down

0 comments on commit 289debe

Please sign in to comment.