<div>set the console log level to 7. Then you can see the DTMF values in console log , while you are pressing the keys.</div><div><br></div><div>Lloyd<br><br><div class="gmail_quote">On Tue, Mar 16, 2010 at 8:23 PM, Michael De Lorenzo <span dir="ltr"><<a href="mailto:delorenzodesign@gmail.com">delorenzodesign@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">So I tried Michael's suggestion of:<br><br><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse"><font face="'courier new', monospace"><div class="im">
digits
= session:playAndGetDigits(1, 4, 1, 5000, "#", get_digits_message, "",
"\\d+");<br><br></div><span style="font-family:times new roman,serif">but it still didn't detect that I had pressed any keys. What would cause this? Is there someplace I can check to see if anything at all is being detected?</span><br>
</font></span><br><br><div class="gmail_quote"><div><div></div><div class="h5">On Tue, Mar 16, 2010 at 5:00 PM, Michael Collins <span dir="ltr"><<a href="mailto:msc@freeswitch.org" target="_blank">msc@freeswitch.org</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex"><div><div></div><div class="h5">
<br><br><div class="gmail_quote"><div>On Tue, Mar 16, 2010 at 1:21 PM, Michael De Lorenzo <span dir="ltr"><<a href="mailto:delorenzodesign@gmail.com" target="_blank">delorenzodesign@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
<span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse"><div>I'm having some trouble getting consistent results with playAndGetDigits, sometimes the digits are record and other times they're not. It seemed to have something to do with how quickly the digits were pressed, but now that no longer seems to be the case.</div>
<div><br></div><div>I'm trying to have users press a confirmation code, in this case "1111" although I'd like to make it accept "1" or "11" or "111" or "1111" if possible.</div>
<div><br></div><div>Can anyone point me in the right direction?</div><div><br></div><br><div><div><font face="'courier new', monospace"> session = freeswitch.Session("{ignore_early_media=true}sofia/gateway/" .. provider .. "/1" .. number_to_call);</font></div>
<div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace"> while(session:ready()) do</font></div><div><font face="'courier new', monospace"> session:answer();</font></div>
<div><font face="'courier new', monospace"> session:setInputCallback("onInput","true");</font></div><div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace"> --playbackMessage(check_message);</font></div>
<div><font face="'courier new', monospace"> digits = session:playAndGetDigits(4, 4, 1, 5000, "", get_digits_message, "", "[1]");</font></div></div></span></blockquote></div><div>
<br>
You are specifying a minimum of four and a maximum of four digits. Also, your regex will match any string that has a digit 1 in it, which may or may not be what you are looking for. Lastly, you haven't specified a terminator key (like "#") but you are giving the user only one try and waiting 5000ms for the entry. Try something like this:<br>
<br><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse"><font face="'courier new', monospace">digits
= session:playAndGetDigits(1, 4, 1, 5000, "#", get_digits_message, "",
"\\d+");</font></span><br><br>Let us know if that works. Oh, one other thing: you might want to add an invalid message because playAndGetDigits will handle invalid input for you. <br><font color="#888888">-MC<br>
</font><br>P.S. - This topic is covered in greater detail in Chapter 7 of the upcoming FreeSWITCH book. ;) <br>
<br> </div><div><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
<span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse"><div><div><font face="'courier new', monospace"> freeswitch.consoleLog("info", digits .. "\n");</font></div>
<div><font face="'courier new', monospace"> freeswitch.consoleLog("info", "Did this check out? " .. (check_message == true and "yes" or "no" .. "\n"));</font></div>
<div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace"> -- we got what we're looking for, so we can end this</font></div><div><font face="'courier new', monospace"> if(check_success) then</font></div>
<div><font face="'courier new', monospace"> freeswitch.consoleLog("info", "A positive response was received from this check.\n");</font></div><div><font face="'courier new', monospace"> break;</font></div>
<div><font face="'courier new', monospace"> else</font></div><div><font face="'courier new', monospace"> -- not a positive response</font></div><div><font face="'courier new', monospace"> -- if we reached our max attempts, we're finished move on</font></div>
<div><font face="'courier new', monospace"> if(attempts == max_attempts) then</font></div><div><font face="'courier new', monospace"> freeswitch.consoleLog("info", "We've reached our maximum attempts for this number.\n");</font></div>
<div><font face="'courier new', monospace"> break;</font></div><div><font face="'courier new', monospace"> end</font></div><div><font face="'courier new', monospace"> end</font></div>
<div><font face="'courier new', monospace"> end</font><br></div></div></span><br></blockquote></div></div><br>
<br></div></div>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br>
<br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br></div>