<b><font class="Apple-style-span" color="#FF0000"> Hi,</font></b><div><div><b><font class="Apple-style-span" color="#FF0000"><br></font></b></div><div><b><font class="Apple-style-span" color="#FF0000">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.</font></b></div>
<div><b><br></b></div><div><b><font class="Apple-style-span" color="#009900">Steps i need to check in javascript:</font></b></div><div><font class="Apple-style-span" color="#009900"><b><br></b></font></div><div><font class="Apple-style-span" color="#009900"><b>When i Press the DTMF value 1 it should check the 3 condition</b></font></div>
<div><font class="Apple-style-span" color="#009900"><b><br></b></font></div><div><span class="Apple-style-span" style="font-weight: bold; ">If the Value for argv[2]=vfsurya means it is a voice file so it should play the Voice file</span></div>
<div><b>If the Value for argv[2]=1001 means it is a extension. The call should Bridge the extension</b></div><div><b>If the Value for argv[2]=9841799874 means it is a Mobile number. The call should Bridge the Mobile number</b></div>
<div><b><br></b></div></div><div><div><b><font class="Apple-style-span" color="#3333FF">var exit = false;</font></b></div><div><b><font class="Apple-style-span" color="#3333FF">var dtmf_digits = "";</font></b></div>
<div><b><font class="Apple-style-span" color="#3333FF">var repeat = 0;</font></b></div><div><div><div><b><font class="Apple-style-span" color="#3333FF">var argv[2]=vfsurya; // or var argv[2]=1001 or var argv[2]=Mobile Number</font></b></div>
<div><b><font class="Apple-style-span" color="#3333FF"><br></font></b></div></div></div><div><b><font class="Apple-style-span" color="#3333FF"><br></font></b></div><div><b><font class="Apple-style-span" color="#3333FF">function onInput( session, type, data, arg ) </font></b></div>
<div><b><font class="Apple-style-span" color="#3333FF">{</font></b></div><div><b><font class="Apple-style-span" color="#3333FF"> if ( type == "dtmf" ) </font></b></div><div><b><font class="Apple-style-span" color="#3333FF"> {</font></b></div>
<div><div><b><font class="Apple-style-span" color="#3333FF"> console_log( "info", "Got digit " + data.digit + "\n" );</font></b></div><div><b><font class="Apple-style-span" color="#3333FF"> if ( data.digit == "1" ) </font></b></div>
<div><span class="Apple-tab-span" style="white-space:pre"><b><font class="Apple-style-span" color="#3333FF">        </font></b></span><b><font class="Apple-style-span" color="#3333FF">{</font></b></div></div></div><div><div><b><font class="Apple-style-span" color="#3333FF"> if(argv[2].startswith("vf"))</font></b></div>
<div><span class="Apple-tab-span" style="white-space:pre"><b><font class="Apple-style-span" color="#3333FF">                </font></b></span><b><font class="Apple-style-span" color="#3333FF">{</font></b></div><div><span class="Apple-tab-span" style="white-space:pre"><b><font class="Apple-style-span" color="#3333FF">                        </font></b></span><b><font class="Apple-style-span" color="#3333FF">var voice2=voice.substring(2)+"<br />"</font></b></div>
<div><span class="Apple-tab-span" style="white-space:pre"><b><font class="Apple-style-span" color="#3333FF">                        </font></b></span><b><font class="Apple-style-span" color="#3333FF">session.streamFile("/usr/local/freeswitch/sounds/en/us/callie/"+voice2+".wav", onInput );</font></b></div>
<div><span class="Apple-tab-span" style="white-space:pre"><b><font class="Apple-style-span" color="#3333FF">                </font></b></span><b><font class="Apple-style-span" color="#3333FF">}</font></b></div><div><span class="Apple-tab-span" style="white-space:pre"><b><font class="Apple-style-span" color="#3333FF">                </font></b></span><b><font class="Apple-style-span" color="#3333FF">else if(argv[2].length==4)</font></b></div>
<div><span class="Apple-tab-span" style="white-space:pre"><b><font class="Apple-style-span" color="#3333FF">                </font></b></span><b><font class="Apple-style-span" color="#3333FF">{</font></b></div><div><span class="Apple-tab-span" style="white-space:pre"><b><font class="Apple-style-span" color="#3333FF">                        </font></b></span><b><font class="Apple-style-span" color="#3333FF">console_log( "info", "Got voicefile " + argv[2] + "\n" );</font></b></div>
<div><span class="Apple-tab-span" style="white-space:pre"><b><font class="Apple-style-span" color="#3333FF">                        </font></b></span><b><font class="Apple-style-span" color="#3333FF">session.execute("bridge", "sofia/internal/"+argv[2]+"%192.168.1.2", onInput ); </font></b></div>
<div><span class="Apple-tab-span" style="white-space:pre"><b><font class="Apple-style-span" color="#3333FF">                </font></b></span><b><font class="Apple-style-span" color="#3333FF">}</font></b></div><div><span class="Apple-tab-span" style="white-space:pre"><b><font class="Apple-style-span" color="#3333FF">                </font></b></span><b><font class="Apple-style-span" color="#3333FF">else</font></b></div>
<div><span class="Apple-tab-span" style="white-space:pre"><b><font class="Apple-style-span" color="#3333FF">                </font></b></span><b><font class="Apple-style-span" color="#3333FF">{</font></b></div><div><span class="Apple-tab-span" style="white-space:pre"><b><font class="Apple-style-span" color="#3333FF">                        </font></b></span><b><font class="Apple-style-span" color="#3333FF">session.execute("bridge", "sofia/default/sip:"+argv[2]+"@<a href="http://192.168.1.135:5066">192.168.1.135:5066</a>", onInput ); </font></b></div>
<div><span class="Apple-tab-span" style="white-space:pre"><b><font class="Apple-style-span" color="#3333FF">                </font></b></span><b><font class="Apple-style-span" color="#3333FF">}</font></b></div></div><div><b><font class="Apple-style-span" color="#3333FF"> }</font></b></div>
<div><b><font class="Apple-style-span" color="#3333FF"> }</font></b></div><div><b><font class="Apple-style-span" color="#3333FF">}</font></b></div><div><b><br></b></div><div><b><font class="Apple-style-span" color="#FF0000">But if 1 is pressed there is no event trigger but it get the dtmf value as 1 in freeswitch console. </font></b></div>
<div><b><font class="Apple-style-span" color="#FF0000"><br></font></b></div><div><b><font class="Apple-style-span" color="#FF0000">can any one specify what is the error or correct me where i am wrong.</font></b></div><div>
<b><font class="Apple-style-span" color="#FF0000"><br>-- <br>Thanks with Regards,<br><br>N.Baskar </font></b><br>
</div>