2013-11-26 55 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.