2013-11-26 5 views
0

Для набора номера я используюКак играть звук для вызываемого в звездочке

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

в моей Java-приложении. И для воспроизведения звука для вызывающего абонента, используя этот фрагмент кода:

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

Но как я могу играть звук для приемника вызова после вызываемого абонента телефона вверх?

ответ

0

как упомянуто в: voip-info можно с опцией A. Означает, что в этом случае с помощью

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

команды, играть greet файл вызываемого после получения телефона вверх.

+0

У меня такая же проблема, попробовал ваш код, но он не работает для меня. Он дает мне «Исключение в потоке» main «java.lang.IllegalStateException: попытка отправить команду из недопустимого потока», но если этот ответ отмечен, он должен работать. Я думаю, я не могу использовать команды exec, но я не уверен. можешь мне помочь? –

0

Также вы можете использовать специальное расширение (макросы) в приложении набора. Это запускается после вызова телефона. Кроме того, вы можете передавать параметры.

Пример 2: Набор макро http://www.voip-info.org/wiki/view/Asterisk+cmd+Dial

1

Есть 3 варианта сделать это. На самом деле только один вариант нужен, но исторически у нас есть 3

1) Именно для этой цели вариант А в команде diallout набора параметров

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. 

конфиденциальности на основе CallerID и спросить имя, если не найден

3) Macro и 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. 
Смежные вопросы