对于拨号,我使用
exec("DIAL", "DAHDI/g0/" + callingPhoneNo + "," + currentTimeOut + ",mg,");
在我的java应用程序中。以及使用以下片段为呼叫者播放声音:
exec("background", "custom/incorrectPassword");
但我怎么能在被叫完电话后为听筒播放声音呢?
有三个选项可供选择。实际上只需要一个选项,但历史上我们有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(宏[^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.
您还可以在Dial应用程序中使用特殊扩展(宏)。这是在被呼叫者拿起电话后运行的。您也可以在其中传递参数。
示例2:拨号宏http://www.voip-info.org/wiki/view/Asterisk+cmd+拨号
如:voip信息中所述,使用A选项是可能的。意味着在这种情况下使用
exec("DIAL", "DAHDI/g0/" + callingPhoneNo + "," + currentTimeOut + ",mg|A(custom/greet)");
命令,拿起电话后为被叫播放greet
文件。