odoo17 音视频扩展

ODOO内置了音视频服务,同时也提供了与第三方平台Twilio的接口,用以实现音视频的扩展:

Twilio是美国一家云通讯公司,算是云通讯领域的巨头企业,与同行业的公司以销售&营销进行投资来促进业务增长不同,Twilio则以API为基础,在数年内有机地打造了一个专业和广泛的软件开发员社区。

odoo原生代码:

复制代码
def _get_ice_servers(self):
    """
    :return: List of dict, each of which representing a stun or turn server,
            formatted as expected by the specifications of RTCConfiguration.iceServers
    """
    if self.env['ir.config_parameter'].sudo().get_param('mail.use_twilio_rtc_servers'):
        (account_sid, auth_token) = get_twilio_credentials(self.env)
        if account_sid and auth_token:
            url = f'https://api.twilio.com/2010-04-01/Accounts/{account_sid}/Tokens.json'
            response = requests.post(url, auth=(account_sid, auth_token), timeout=60)
            if response.ok:
                response_content = response.json()
                if response_content:
                    return response_content['ice_servers']
    return self._get_local_ice_servers()

class MailIceServer(models.Model):
    _name = 'mail.ice.server'
    _description = 'ICE server'

    server_type = fields.Selection([('stun', 'stun:'), ('turn', 'turn:')], string='Type', required=True, default='stun')
    uri = fields.Char('URI', required=True)
    username = fields.Char()
    credential = fields.Char()

    def _get_local_ice_servers(self):
        """
        :return: List of up to 5 dict, each of which representing a stun or turn server
        """
        # firefox has a hard cap of 5 ice servers
        ice_servers = self.sudo().search([], limit=5)
        formatted_ice_servers = []
        for ice_server in ice_servers:
            formatted_ice_server = {
                'urls': '%s:%s' % (ice_server.server_type, ice_server.uri),
            }
            if ice_server.username:
                formatted_ice_server['username'] = ice_server.username
            if ice_server.credential:
                formatted_ice_server['credential'] = ice_server.credential
            formatted_ice_servers.append(formatted_ice_server)
        return formatted_ice_servers

可以看到ODOO通过用户名和密码及API调用Twilio的第三方服务(Twilio按账号收费的)。

ODOO也可以通过二次开发的方式与其他音视频平台对接,但要考虑其对于ODOO自身带来的服务压力。

相关推荐
FlightYe6 小时前
音视频修炼之容器与协议(四):RTSP详解
android·linux·ffmpeg·音视频·dash
乐橙开放平台10 小时前
海康和大华摄像头能统一管理吗?可以通过 GB28181 或视频融合平台接入
网络·后端·物联网·音视频
Mirawork16 小时前
Mirawork v0.32.0 更新体验:会话引用、任务分享与音频转写怎么用
人工智能·音视频
熬夜磕代码丶2 天前
RN鸿蒙空间音频实战
华为·音视频·harmonyos
一条破秋裤3 天前
【V4L2采集视频】
音视频
橙橙笔记4 天前
QT的学习第四部分
linux·qt·学习·音视频
AI视频工具指南4 天前
用 AI 能做哪些视频?按想交付的作品选做法
人工智能·aigc·音视频
希和20275 天前
免费AI视频生成工具汇总(国内优先,适合做漫剧、短视频,Obsidian笔记版)
人工智能·笔记·音视频
謓泽5 天前
【插件】用写网页的方式做视频?HyperFrames 让我重新理解了“做视频“这件事!
gpt·ai·大模型·音视频·媒体·claude·视频
无忧_wy5 天前
MoneyPrinterTurbo 自动化视频生成实战指南
运维·人工智能·自动化·音视频