I am working with Freeswitch ESL client, I worked on originating call and establishing connection between two applications and making them communicate with each other. I have tried playing sound at one end and recording at the other, It is working fine now my requirement is to send dtmf at one end receiving at other end, I have tried following
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-------------------------");
}
}
but could not get any result, Do I need to configure any thing in dial plans, or my total approach is wrong?