[Freeswitch-users] Lua - playAndGetDigits

Michael De Lorenzo delorenzodesign at gmail.com
Tue Mar 16 12:08:56 PDT 2010


>
> 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.
>
> 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.
>
> Can anyone point me in the right direction?
>
>
>     session = freeswitch.Session("{ignore_early_media=true}sofia/gateway/"
> .. provider .. "/1" .. number_to_call);
>
>     while(session:ready()) do
>        session:answer();
>        session:setInputCallback("onInput","true");
>
>        --playbackMessage(check_message);
>        digits = session:playAndGetDigits(4, 4, 1, 5000, "",
> get_digits_message, "", "[1]");
>        freeswitch.consoleLog("info", digits .. "\n");
>        freeswitch.consoleLog("info", "Did this check out? " ..
> (check_message == true and "yes" or "no" .. "\n"));
>
>        -- we got what we're looking for, so we can end this
>        if(check_success) then
>           freeswitch.consoleLog("info", "A positive response was received
> from this check.\n");
>           break;
>        else
>           -- not a positive response
>           -- if we reached our max attempts, we're finished move on
>           if(attempts == max_attempts) then
>             freeswitch.consoleLog("info", "We've reached our maximum
> attempts for this number.\n");
>             break;
>           end
>        end
>     end
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100316/9af4e364/attachment-0002.html 


More information about the FreeSWITCH-users mailing list