Hi,
I want to check value given to the javascript with conditions whether it is voicefile, extension or mobile Number when i press the dtmf value.
Steps i need to check in javascript:
When i Press the DTMF value 1 it should check the 3 condition
If the Value for argv[2]=vfsurya means it is a voice file so it should play the Voice file
If the Value for argv[2]=1001 means it is a extension. The call should Bridge the extension
If the Value for argv[2]=9841799874 means it is a Mobile number. The call should Bridge the Mobile number
var exit = false;
var dtmf_digits = "";
var repeat = 0;
var argv[2]=vfsurya; // or var argv[2]=1001 or var argv[2]=Mobile Number
function onInput( session, type, data, arg )
{
if ( type == "dtmf" )
{
console_log( "info", "Got digit " + data.digit + "\n" );
if ( data.digit == "1" )
{
if(argv[2].startswith("vf"))
{
var voice2=voice.substring(2)+"<br />"
session.streamFile("/usr/local/freeswitch/sounds/en/us/callie/"+voice2+".wav", onInput );
}
else if(argv[2].length==4)
{
console_log( "info", "Got voicefile " + argv[2] + "\n" );
session.execute("bridge", "sofia/internal/"+argv[2]+"%192.168.1.2", onInput );
}
else
{
}
}
}
}
But if 1 is pressed there is no event trigger but it get the dtmf value as 1 in freeswitch console.
can any one specify what is the error or correct me where i am wrong.
--
Thanks with Regards,
N.Baskar