如何在星号中为被叫者播放声音

时间:2013-11-26 09:12:18

标签: java asterisk fastagi

拨打我正在使用的号码

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

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

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

但是,如果打电话给手机,怎么才能为呼叫接收器播放声音?

3 个答案:

答案 0 :(得分:1)

这样做有3种选择。实际上只需要一个选项,但历史上我们有3个

1)正是为此目的,拨号命令拨号参数

中的选项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:此选项启用筛选模式。这基本上是隐私           没有记忆的模式。

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.

答案 1 :(得分:0)

如前所述:voip-info可以使用A选项。 意味着在这种情况下使用

exec("DIAL", "DAHDI/g0/" + callingPhoneNo + "," + currentTimeOut + ",mg|A(custom/greet)");

命令,在接听电话后播放被叫方的greet文件。

答案 2 :(得分:0)

您也可以在拨号应用程序中使用特殊扩展名(宏)。这是在被叫方接听电话后运行的。您也可以在其中传递参数。

示例2:拨号宏 http://www.voip-info.org/wiki/view/Asterisk+cmd+Dial