拨打我正在使用的号码
exec("DIAL", "DAHDI/g0/" + callingPhoneNo + "," + currentTimeOut + ",mg,");
在我的 Java 应用程序中。并使用此代码段为呼叫者播放声音:
exec("background", "custom/incorrectPassword");
但是,在被叫方电话接通后,我怎样才能为来电者播放声音?
执行此操作有 3 个选项。实际上只需要一个选项,但历史上我们有 3 个
1)正是为了这个目的,Dial command diallout parameters中的选项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.
基于 callerid 的隐私播放消息,如果未找到则询问姓名
3)宏和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.
如:voip-info中所述,可以使用 A 选项。意味着对于这种情况使用
exec("DIAL", "DAHDI/g0/" + callingPhoneNo + "," + currentTimeOut + ",mg|A(custom/greet)");
命令,greet
拿起电话后为被叫播放文件。
您也可以在拨号应用程序中使用特殊扩展名(宏)。这是在被叫方拿起电话后运行的。您也可以在其中传递参数。
示例 2:拨号宏 http://www.voip-info.org/wiki/view/Asterisk+cmd+Dial