Skip to Content
《Asterisk:权威指南》第 5 版
book

《Asterisk:权威指南》第 5 版

by Jim Van Meggelen, Russell Bryant, Leif Madsen
May 2025
Intermediate to advanced
414 pages
5h 2m
Chinese
O'Reilly Media, Inc.
Content preview from 《Asterisk:权威指南》第 5 版

第 20 章 WebRTC WebRTC

本作品已使用人工智能进行翻译。欢迎您提供反馈和意见:translation-feedback@oreilly.com

我所设想的网络,我们还没有看到。未来仍然比过去大得多。

蒂姆-伯纳斯-李

把浏览器当作电话

互联网通信领域正在酝酿一场新的革命,虽然它不可能像开源电信革命那样成为新闻,但它绝对有可能悄无声息地取代当前所有通信应用的核心。

如今,互联网上有大量封闭源代码的会议 应用程序。它们做的事情大致相同,但大多数都要求在使用前安装专有软件(当然,这些软件会努力保持加载在电脑内存中)。每家公司提供的服务都与你被迫安装的上一个会议应用程序(为你参加的其他会议)没有太大区别。每家公司都希望自己能超越其他公司,在这一领域占据主导地位。与此同时,WebRTC 正在悄然创造一种标准,它令人信服地消除了所有专有多媒体通信的概念,有望消除这种狭隘的、围墙式的思维,并为一些实际创新开放通信。

自从有了网络浏览器,人们就开始尝试将多媒体融入互联网体验。事实证明,这比想象的要困难得多,因此,今天电话仍然是一个独立的应用程序(当然,也可以说是一个独立的设备)。

WebRTC 有望改变这一切。

在本章中,我们将介绍 Asterisk 对 WebRTC 的理解。这绝不是一个全面的介绍;我们要做的只是带你创建一个普通的视频会议应用程序,这基本上就是每个人在开始使用 WebRTC 时都会用到的 "Hello World "应用程序。这是一个很好的入门方法,但重要的是要明白,WebRTC 的功能远不止于此。

初步知识

在 深入研究 WebRTC 之前,必须将一些基础技术结合起来。

首先,也是最重要的一点:如果你想认真学习 WebRTC,你将需要一个网络开发人员,最好是对各种语言、协议和互联网技术有深入了解的人。WebRTC 是一种网络开发,也是一种前沿技术,你会遇到不兼容问题、特定浏览器问题、未发现的错误、不完整的文档以及新技术固有的其他各种挑战。如果你不是一个拥有扎实的 Network+ 和 Linux 技能的全栈开发人员,你在学习 WebRTC 时将会遇到非常陡峭的学习曲线!

所以,是的,如果你想轻松地深入学习 WebRTC,你就需要成为一名全栈开发人员和 VoIP 专家。我们这么说并不是要吓唬你,而是想向你保证,如果你觉得有挑战性,那并不是因为你有什么不足,而只是因为这是一个复杂、多层次的东西。

在本章中,我们将配置 Asterisk 以支持 WebRTC,并运行一个预构建的 Web 应用程序,演示 Asterisk WebRTC 实现的基本音频/视频功能。虽然学习曲线仍然很陡峭,但希望我们已经为学习打下了基础。

为 WebRTC 配置 Asterisk

要使用 WebRTC 通过 Asterisk 传递 通话,必须使用 PJSIP 信道驱动程序。其配置与标准 SIP 电话类似,但不完全相同。

为此,我们需要在/etc/asterisk/pjsip.conf文件中添加一个传输类型:

[transport-udp] type=transport protocol=udp ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

What Successful Brick-and-Mortar Retailers Get Right

What Successful Brick-and-Mortar Retailers Get Right

Rob Angell
What Successful Project Managers Do

What Successful Project Managers Do

W. Scott Cameron, Jeffrey S. Russell, Edward J. Hoffman, Alexander Laufer
Three Essentials for Agentic AI Security

Three Essentials for Agentic AI Security

Paolo Dal Cin, Daniel Kendzior, Yusof Seedat, Renato Marinho

Publisher Resources

ISBN: 9798341659568