<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 class="Apple-style-span" face="'courier new', monospace"> session = freeswitch.Session("{ignore_early_media=true}sofia/gateway/" .. provider .. "/1" .. number_to_call);</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace"> while(session:ready()) do</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> session:answer();</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> session:setInputCallback("onInput","true");</font></div><div><font class="Apple-style-span" face="'courier new', monospace"><br>
</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> --playbackMessage(check_message);</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> digits = session:playAndGetDigits(4, 4, 1, 5000, "", get_digits_message, "", "[1]");</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> freeswitch.consoleLog("info", digits .. "\n");</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> freeswitch.consoleLog("info", "Did this check out? " .. (check_message == true and "yes" or "no" .. "\n"));</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace"> -- we got what we're looking for, so we can end this</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> if(check_success) then</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> freeswitch.consoleLog("info", "A positive response was received from this check.\n");</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> break;</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> else</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> -- not a positive response</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> -- if we reached our max attempts, we're finished move on</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> if(attempts == max_attempts) then</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> freeswitch.consoleLog("info", "We've reached our maximum attempts for this number.\n");</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> break;</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> end</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> end</font></div><div><font class="Apple-style-span" face="'courier new', monospace"> end</font></div>
</div>