我正在编写一个java应用程序来拨打号码并通过DTMF获取用户的密码。我正在使用asterisk-java
连接到星号VOIP服务器并拨打该号码,但我不知道如何流式传输文件并将用户的输入读作DTMF。这是我的代码:
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();
答案 0 :(得分:1)
您正在使用AMI。
没有拨号方案支持,AMI无法获得dtmf。您可以通过拨号方式在拨号方式
中通过ami获取活动exten => s,1,Read(variable,filetoplay)
exten => s,2,UserEvent(variable: variable)
或者您可以使用fastagi来控制呼叫执行并收集dtmf