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 版

第 2 章 Asterisk 架构

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

先做第一件事,但顺序不一定如此。

神秘博士

Asterisk 与其他更传统的 PBX 有很大不同,Asterisk 中的拨号计划基本上以相同的方式处理所有传入信道,而不是将它们分为站、中继线、外围模块等。

在传统的 PBX 中,站(电话机)和中继线(连接到外部世界的资源)之间存在逻辑上的差异。这种限制使得在传统 PBX 中进行创造性路由选择变得非常困难或不可能。

另一方面,Asterisk 内部并没有中继或站点的概念。在 Asterisk 中,所有进出系统的信息都要经过某种通道,通道有很多种,但 Asterisk 的拨号计划会以类似的方式处理所有通道,这就意味着,内部用户可以存在于外部中继线(如手机)的一端,拨号计划处理该用户的方式与处理内部分机的方式完全相同。除非你使用过传统的 PBX、1可能不会立即意识到这有多么强大和自由。图 2-1说明了两种架构之间的区别。

图 2-1. Asterisk 与 PBX 架构对比

模块

Asterisk 建立在模块 上。模块是可加载的组件,提供特定功能,如通道驱动程序(如chan_pjsip.so),或允许连接外部技术的资源(如func_odbc.so)。Asterisk 模块根据/etc/asterisk/modules.conf文件中定义的参数加载。我们将在本书中讨论许多模块的使用,但目前我们只想介绍模块的概念,并让你对可用模块的类型有所了解。

实际上,Asterisk 可以在没有任何模块的情况下启动,尽管在这种状态下它什么也做不了。要了解 Asterisk 的架构,了解它的模块特性是很有用的。

备注

你可以在启动 Asterisk 时默认不加载任何模块,然后从控制台手动加载每个需要的模块,但这并不是你想投入生产的东西;只有当你在对系统进行性能调整时,想去掉 Asterisk 特定应用中不需要的所有东西时,这才会有用。

Asterisk 中的模块类型 包括以下几种:

  • 应用程序--拨号计划的主力军,如Dial(),Voicemail(),Playback(),Queue()

  • 桥接模块--将通道(调用)相互连接起来的机制

  • 呼叫详情记录(CDR)模块

  • 通道事件记录 (CEL) 模块

  • 通道驱动程序--进出系统的各种连接;SIP(会话发起协议)信息传送使用 PJSIP 通道驱动程序

  • 编解码器转换器--转换 G729、G711、G722、Speex 等各种编解码器

  • 格式解释器-同上,但与存储在文件系统中的文件有关

  • 拨号计划功能--增强拨号计划的功能

  • PBX 模块

  • 资源模块

  • 附加模块

  • 测试模块

在下面的章节中,我们列出了一个模块列表,我们认为这些模块非常重要,值得在本书中讨论。你可以在 Asterisk 下载中找到许多其他模块,但许多较老的模块要么已被弃用,要么几乎没有支持,因此不建议用于生产,除非你能找到能为你维护这些模块的开发人员。

是一份包含在menuselect 中的支持状态类型的官方 列表。2

应用

拨号计划 应用 用于extensions.conf,以定义可应用于呼叫的各种操作。例如 Dial()例如,应用程序 负责与外部资源建立呼出连接,可以说是最重要的拨号计划应用程序。表 2-1 列出了可用的应用程序。

表 2-1. ...
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