<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div>Hi Avi,</div><div><br></div><div>The pertinent lines are :</div><div><br></div><div><div><action application="set" data="group_confirm_key=exec"/></div><div><action application="set" data="group_confirm_file=/usr/local/freeswitch/scripts/confirm.js"/></div><div><br></div><div>So I'm a step further now, I get:</div><div><br></div><div>2012-01-16 15:26:20.954602 [ERR] confirm.js:61 near SyntaxError: invalid returnreturn true;<br></div><div><br></div><div>The same occurs if I use brackets around the "true".</div><div><br></div><div>I've adapted the script slightly to use a pin pulled from a database (but I'm no Javascript Guru, so I'm guessing I missed a glaring bug !).</div><div><br></div><div>Thanks for your
help.</div><div><br></div><div>=============================================================</div><div><div>// confirm.js - Freeswitch Call PIN Check</div><div>//</div><div>//</div><div>console_log("info", "Destination: "+ session.destination + "\n");</div><div>//</div><div>if(!session.getVariable('my_legconf'))</div><div>{</div><div> console_log("info", "No B-Leg Confirmation Requested \n");</div><div> exit();</div><div>}</div><div>//</div><div>//</div><div>// Variables...</div><div>//</div><div>var v_continue = false;</div><div>var conf_pin = session.getVariable('my_legpin');</div><div>var attempts = 3;</div><div>var sound_file = "ivr-please_enter_pin_followed_by_pound.wav";</div><div>var pin_lastdigit="";</div><div>var pin = new Object();</div><div>pin.digits = "";</div><div><br></div><div>function parseInput (session,type,data,arg) {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>if ( type == "dtmf" )
{</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>pin_lastdigit = data.digit;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>pin.digits += pin_lastdigit;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>console.log("info","Read digit " + pin_lastdigit + "\n");</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>return false;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div>}</div><div>//</div><div>//</div><div>if (session.ready()) {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>session.answer();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>session.flushDigits();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>console.log("info","Starting PIN Collection\n");</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>var cnt =
attempts;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>while (session.ready() && ! v_continue && cnt-- > 0)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>session.execute("sleep","200");</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>session.streamFile(sound_file,parseInput);</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>while (pin_lastdigit != "#" && sesson.ready()) {</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>session.collectInput(parseInput,pin,5000);</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>console.log("info","Collected PIN: " + pin.digits + "\n");</div><div><span class="Apple-tab-span" style="white-space:pre">        
        </span>if ( pin.digits == conf_pin ) {</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>v_continue = true;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>console.log("info","PIN OK !.\n");</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>} else {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>pin_lastdigit = "";</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>pin.digits = "";</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>session.flushDigits();</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div>} else {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>console.log("info","Session not ready.\n");</div><div>}</div><div>//</div><div>//</div><div>if(v_continue) {</div><div>return
true;</div><div>} else {</div><div>return false;</div><div>}</div><div>=============================================================<br></div></div><div><br></div><div><br></div></div></div></body></html>