我正在使用 Freeswitch ESL 客户端,我致力于发起呼叫并在两个应用程序之间建立连接并使它们相互通信。我曾尝试在一端播放声音并在另一端录制,现在工作正常我的要求是在一端发送 dtmf 在另一端接收,我试过以下
private void sendDtmf(Channel channel) {
SendMsg senDtmf = new SendMsg();
senDtmf.addCallCommand("execute");
senDtmf.addExecuteAppName("send_dtmf");
senDtmf.addExecuteAppArg("2174");
EslMessage response = sendSyncMultiLineCommand( channel,senDtmf.getMsgLines() );
if (response.getHeaderValue(Name.REPLY_TEXT).startsWith("+OK")) {
System.out.println(this.getClass().getName() + " >> DTMF Send");
System.out.println("Resp: " + response.toString());
log.info(this.getClass().getName() + " >> DTMF Send");
} else {
log.error(this.getClass().getName() + " >> DTMF failed :"
+ response.getHeaderValue(Name.REPLY_TEXT));
System.out.println(this.getClass().getName() + " >> DTMF failed :"
+ response.getHeaderValue(Name.REPLY_TEXT));
}
}
private void getdtmf( Channel channel, VoxtaMsg voxmsg)
{
SendMsg getDtmf= new SendMsg();
getDtmf.addCallCommand( "execute" );
getDtmf.addExecuteAppName( "play_and_get_digits" );
getDtmf.addExecuteAppArg("4 4 3 7000 # /tmp/sounds/test.wav /tmp/sounds/test1.wav dtmf \\d+");
EslMessage response = sendSyncMultiLineCommand( channel,getDtmf.getMsgLines() );
if ( response.getHeaderValue( Name.REPLY_TEXT).startsWith( "+OK" ) )
{
System.out.println(this.getClass().getName()+" >> DTMF Received");
log.info( this.getClass().getName()+" >> DTMF Received" );
}
else
{
log.error( this.getClass().getName() + " >> DTMF failed: [{}}" +
response.getHeaderValue( Name.REPLY_TEXT ));
System.out.println(this.getClass().getName() + " >> DTMF failed: [{}}" +
response.getHeaderValue( Name.REPLY_TEXT ) );
log.debug("----------------------done-------------------------");
}
}
但无法得到任何结果,我是否需要在拨号计划中配置任何东西,或者我的总方法是错误的?