oca-ocb-mail/odoo-bringout-oca-ocb-im_livechat/im_livechat/controllers/rtc.py
Ernad Husremovic daa394e8b0 19.0 vanilla
2026-03-09 09:31:39 +01:00

21 lines
890 B
Python

# Part of Odoo. See LICENSE file for full copyright and licensing details.
from werkzeug.exceptions import NotFound
from odoo.http import route, request
from odoo.addons.mail.controllers.discuss.rtc import RtcController
from odoo.addons.mail.tools.discuss import add_guest_to_context
class LivechatRtcController(RtcController):
@route()
@add_guest_to_context
def channel_call_join(self, channel_id, check_rtc_session_ids=None, camera=False):
# sudo: discuss.channel - visitor can check if there is an ongoing call
if not request.env.user._is_internal() and request.env["discuss.channel"].sudo().search([
("id", "=", channel_id),
("channel_type", "=", "livechat"),
("rtc_session_ids", "=", False),
]):
raise NotFound()
return super().channel_call_join(channel_id, check_rtc_session_ids, camera)