asterisk(星号)中Dialplan基础:Answer, Playback, and Hangup Applications

 1.Answer()        //用于接听来电

As its name suggests, the Answer() application answers an incoming call. The Answer() application takes a delay (in milliseconds) as its first parameter. Adding a short delay is often useful for ensuring that the remote endpoing has time to begin processing audio before you play a sound prompt. Otherwise, you may not hear the very beginning of the prompt.

顾名思义,Answer()应用程序接听来电。The Answer()应用程序需要的延迟(以毫秒为单位)作为它的第一个参数。添加短延迟通常有助于确保远程端点在播放声音提示之前有时间开始处理音频。否则,您可能听不到提示的开头。

exten => 6000,1,Answer(500)

2.Playback()    //用于播放音频文件

The Playback() application loads a sound prompt from disk and plays it to the caller, ignoring any touch tone input from the caller. The first parameter to the dialplan application is the filename of the sound prompt you wish to play, without a file extension. If the channel has not already been answered, Playback() will answer the call before playing back the sound prompt, unless you pass noanswer as the second parameter.

To avoid the first few milliseconds of a prompt from being cut off you can play a second of silence. For example, if the prompt you wanted to play was hello-world which would look like this in the dialplan:

Playback()的应用程序加载声音从磁盘提示和它起着给呼叫者,忽略来自呼叫者任何触摸音输入。dialplan 应用程序的第一个参数是您希望播放的声音提示的文件名,没有文件扩展名。如果该频道尚未被接听,Playback()将在播放声音提示之前接听电话,除非您将noanswer作为第二个参数传递。

为了避免提示的前几毫秒被切断,您可以播放一秒钟的静音。例如,如果你想播放的提示是 hello-world,它在拨号方案中看起来像这样:

exten => 1234,1,Playback(hello-world)

3.Hangup()        //挂断电话

 

The Hangup() application hangs up the current call. While not strictly necessary due to auto-fallthrough (see the note on Priority numbers above), in general we recommend you add the Hangup() application as the last priority in any extension.

Now let's put Answer()Playback(), and Hangup() together to play a sample sound file.

在 Hangup()  应用程序挂起当前呼叫。虽然由于 auto-fallthrough 而不是绝对必要的(请参阅上面关于优先级编号的说明),但通常我们建议您将Hangup() 应用程序添加 为任何扩展中的最后一个优先级。

现在让我们将 Answer()、  Playback()和 Hangup() 放在一起来播放示例声音文件。

exten => 6000,1,Answer(500)
exten => 6000,n,Playback(hello-world)
exten => 6000,n,Hangup()

 

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

AnJunDeng

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值