本文介绍了使用 asterisk-java 读取 dtmf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个 Java 应用程序来拨号并通过 DTMF 获取用户的密码.我正在使用 asterisk-java 连接到 asterisk 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.

如果没有拨号计划支持,就无法在 AMI 中获得 dtmf.您可以使用拨号计划中的类似内容通过 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

这篇关于使用 asterisk-java 读取 dtmf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-24 16:15