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 版

第 16 章 交互式语音应答简介 交互式语音应答简介

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

一天,爱丽丝走到一个岔路口,看见树上有一只柴郡猫。"她问:"我该走哪条路?

"你想去哪儿?"这是他的回答。

"我不知道,"爱丽丝回答。

"那 "猫说,"没关系"

刘易斯-卡罗尔

交互式语音应答(IVR )一词经常被误用 来指自动语音服务员,但两者是完全不同的东西。 交互式语音应答系统的目的是接收呼叫者的输入,根据输入执行操作(通常是在数据库等外部系统中查找数据),并将结果发送给呼叫者。自动话务员(我们在第 14 章中介绍过)的作用是路由呼叫。最初,IVR 甚至不需要是电话系统。任何从人工输入并反馈结果的系统都属于 IVR 的范畴。传统上,IVR 系统实施起来复杂、昂贵、恼人。Asterisk 改变了这一切。

IVR 的组成部分

IVR 最基本的 元素与自动话务员的元素非常相似,尽管目标不同。我们至少需要一个提示来告诉呼叫者 IVR 的期望、一种接收呼叫者输入的方法、验证呼叫者的回复是否为有效输入的逻辑、决定 IVR 下一步的逻辑,最后,如果适用的话,还需要一个回复的存储机制。我们可以把 IVR 想象成一棵决策树,尽管它不需要有任何分支。例如,一项调查可能会向每个来电者呈现完全相同的提示集,无论来电者做出何种选择,唯一涉及的路由逻辑就是所给出的回答是否对问题有效。

从呼叫者的角度来看,每个 IVR 都需要以提示开始。这个初始提示将告诉呼叫者 IVR 的用途,并要求呼叫者提供第一个输入。我们在第 14 章讨论了自动话务员中的提示。稍后,我们将创建一个拨号计划,让你更好地管理多个语音提示。

IVR 的第二个组成部分是接收呼叫者输入的方法。记得在第 14 章中,我们讨论了用于接收新分机的Background()WaitExten() 应用程序。虽然您可以使用Background()WaitExten() 创建 IVR,但一般来说,使用Read()应用程序更简单实用,因为它既能处理提示,又能捕获应答。应用程序 Read()应用程序 专门设计用于 IVR 系统。其语法如下

Read(variable[,filename[&filename2...]][,maxdigits][,option][,attempts][,timeout])

参数说明见表 16-1

表 16-1. 读取()应用程序
论据目的
variable存储呼叫者回复的变量。最佳做法是为 IVR 中的每个变量取一个与该变量相关提示相似的名称。如果以后出于业务原因或使用方便,需要对 IVR 的步骤重新排序,这将有所帮助。将变量命名为var1var2 等,在短期内似乎很容易,但在以后的生命周期中会增加修复错误的难度。
prompt为呼叫方播放的文件(或文件列表,用&字符连接),要求输入。切记省略每个文件名末尾的格式扩展名。
maxdigits允许输入的最大字符数。如果是 "是"/"否 "和多选题,最好将该值限制在1 。如果输入长度较长,呼叫者可以按 # 键终止输入。
options
s (跳过)

如果通道未被应答,则立即退出。

i (指示)

与其播放提示音,不如播放某种指示音(如拨号音)。

n (没有回答

从呼叫方读取数字,即使线路尚未接通。

attempts

提示播放的次数。如果呼叫者没有输入任何内容,Read() 应用程序会自动重新提示用户。默认为一次。

timeout

呼叫方输入的秒数。Asterisk 的默认值为 10 秒,但可以使用该选项更改单个提示的值,或使用拨号计划功能 ...

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