使用星号Java读取dtmf [英] Read dtmf using asterisk-java
本文介绍了使用星号Java读取dtmf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在编写一个Java应用程序以通过DTMF拨打号码并获取用户的密码.我正在使用asterisk-java
连接到星号VOIP服务器并拨打该号码,但我不知道如何流式传输文件并以DTMF格式读取用户的输入.这是我的代码:
I am writing a java application to dial a number and get user's pin by DTMF. I am using asterisk-java
connect to an asterisk VOIP server and dial the number but I don't know how to stream a file and read user's input as DTMF. Here's my code:
OriginateAction originateAction = new OriginateAction();
originateAction.setChannel("SIP/1001");
originateAction.setContext("default");
originateAction.setCallerId("Server");
originateAction.setPriority(1);
// connect to Asterisk and log in
managerConnection.login();
// send the originate action and wait for a maximum of 30 seconds for Asterisk
// to send a reply
ManagerResponse originateResponse = managerConnection.sendAction(originateAction, 30000);
// print out whether the originate succeeded or not
System.out.println(originateResponse.getResponse());
// and finally log off and disconnect
managerConnection.logoff();
推荐答案
您正在使用AMI.
如果没有Dialplan支持,则无法在AMI中获取dtmf.您可以使用Dialplan中的类似内容通过ami获取事件
There are no way get dtmf in AMI without dialplan support. You can get event via ami using something like this in dialplan
exten => s,1,Read(variable,filetoplay)
exten => s,2,UserEvent(variable: variable)
或者您可以使用fastagi控制呼叫执行并收集dtmf
Or you can use fastagi to control call execution and collect dtmf
这篇关于使用星号Java读取dtmf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文