2013-11-26 28 views
0

播放声音被叫对于拨入号码,我在我的Java应用程序中使用如何在星号

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

。 而对于使用该片段播放声音支持来电:

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

但我怎么能被叫方的电话后向上播放声音呼叫接收器?

回答

0

正如在voip-info中提到的那样,它有可能带有A选项。 意味着这种情况下使用

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

命令,玩greet文件被叫摘手机上来了。

+0

我有同样的问题,试过你的代码,但它不适合我。它给我“线程中的异常”主“java.lang.IllegalStateException:尝试发送来自无效线程的命令”,但如果该答案被标记,它应该工作。我想我不能使用exec命令,但我不确定。你可以帮我吗? –

1

有用于执行此操作3个选项。其实只有一个选择需要的,但在历史上,我们有3

1)正是为了这个目的,在拨号命令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:该选项启用筛选模式。这基本上是没有内存的隐私 模式。根据来电显示,问名,如果没有找到

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. 

隐私播放消息)宏观和GOSUB的答案。只是不同的,最灵活的方式做事情叫,使用您可以收集输入/确认/拒绝通话等

M(宏[^ 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.