Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

fix VOIP crashes under Python 3 #3835

Merged
merged 2 commits into from
Sep 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/3835.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fix VOIP crashes under Python 3 (#3821)
6 changes: 5 additions & 1 deletion synapse/rest/client/v1/voip.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ def on_GET(self, request):
expiry = (self.hs.get_clock().time_msec() + userLifetime) / 1000
username = "%d:%s" % (expiry, requester.user.to_string())

mac = hmac.new(turnSecret, msg=username, digestmod=hashlib.sha1)
mac = hmac.new(
turnSecret.encode(),
msg=username.encode(),
digestmod=hashlib.sha1
)
# We need to use standard padded base64 encoding here
# encode_base64 because we need to add the standard padding to get the
# same result as the TURN server.
Expand Down