java - 如何为 Asterisk 中的被叫者播放声音

标签 java asterisk fastagi

调用我正在使用的号码

exec("DIAL", "DAHDI/g0/" + callingPhoneNo + "," + currentTimeOut + ",mg,");

在我的java应用程序中。 并使用此代码片段为调用者播放声音:

exec("background", "custom/incorrectPassword");

但是在被叫者接通电话后如何为调用接收者播放声音?

最佳答案

有 3 个选项可以执行此操作。实际上只需要一个选项,但历史上我们有 3 个

1) 正是为了这个目的,Dial 命令 diallout 参数中的选项 A

A(x): 
        x - The file to play to the called party
    Play an announcement to the called party, where <x> is the prompt
    to be played

2) 隐私模式选项。

p: This option enables screening mode. This is basically Privacy mode without memory.

P([x]): Enable privacy mode. Use <x> as the family/key in the AstDB
    database if it is provided. The current extension is used if a database
    family/key is not specified.

根据来电显示隐私播放消息,如果未找到则询问姓名

3) Macro 和 Gosub 的答案。只是用不同且最灵活的方式来处理调用,使用它您可以收集输入/确认/拒绝调用等。

M(macro[^arg[^...]]):

        macro - Name of the macro that should be executed.

        arg - Macro arguments

    Execute the specified <macro> for the *called* channel  before
    connecting to the calling channel. Arguments can be specified to the Macro
    using '^' as a delimiter. The macro can set the variable ${MACRO_RESULT}
    to specify the following actions after the macro is finished executing:

        ${MACRO_RESULT}: If set, this action will be taken after
        the macro finished executing.

            ABORT: Hangup both legs of the call

            CONGESTION: Behave as if line congestion was
            encountered

            BUSY: Behave as if a busy signal was encountered

            CONTINUE: Hangup the called party and allow the
            calling party to continue dialplan execution at the next priority

            GOTO:[[<context>^]<exten>^]<priority>: Transfer the
            call to the specified destination.




U(x[^arg[^...]]): 

    x - Name of the subroutine to execute via Gosub
    arg - Arguments for the Gosub routine

Execute via Gosub the routine <x> for the *called* channel before
connecting to the calling channel. Arguments can be specified to the Gosub
using '^' as a delimiter. The Gosub routine can set the variable ${GO
SUB_RESULT} to specify the following actions after the Gosub returns.

    ${GOSUB_RESULT}: 
        ABORT: Hangup both legs of the call.
        CONGESTION: Behave as if line congestion was
        encountered.
        BUSY: Behave as if a busy signal was encountered.
        CONTINUE: Hangup the called party and allow the
        calling party to continue dialplan execution at the next priority.
        GOTO:[[<context>^]<exten>^]<priority>: Transfer the
        call to the specified destination.

关于java - 如何为 Asterisk 中的被叫者播放声音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20212644/

相关文章:

python - Twisted/Starpy FastAgi 应用只能正确处理一个调用

java - 更改内容 View

javascript - 有条件地使用 STUN 服务器

ssl - 错误 488 此处 Not Acceptable

user-interface - AsteriskNOW 与 FreePBX。什么是最容易定制的?

php - 验证电话号码 php asterisk

load-balancing - 如何负载平衡 FastAGI?

android - JAVA_HOME 不工作

java - 用于验证单词不包含数字或特殊字符的正则表达式

java - 格式化一个Jtable Cell,如果格式化不合法,则什么都不做