[Freeswitch-dev] Lua session:playAndGetDigits regex
Robert Clayton
rjcajax at gmail.com
Fri Mar 27 08:03:26 PDT 2009
Brian,
Thanks for the rapid reply.
I was wanting, in Lua, for example to allow a user to enter either a file
number or an asterisk to abort the function and return to an earlier option.
I originally attempted this with a callback but found that at the end of the
recording the callback would return, yet found no way to delay the return
short of returning a pause on the first user input. This failed if the user
waits until the recording has ended as the function returns. I assumed that
stop might keep the callback active but it seems stop, break and false
appear equivalent.
So I attempted to apply session:playAndGetDigits which seems to only
evaluate input on either, the maximum number of entries defined, or entry of
a defined terminator. Where the entry of a terminator might be acceptable
for the numeric entry the need for a terminator after an asterisk would seem
clumsy.
It would be great if after each digit the entry was matched against a regex,
and if valid returned the value, with no need to predefine the terminator or
minimum and maximum dtmf signals as everything could be defined in the
regex.
Regardless I seem to be unable to even define the regex to match a single
asterisk as \* and [*] seem to be interpreted different than I would
expect.
This reminds me of the usual debit card check prompt "enter you sixteen
digit number and press pound when finished". If the system knows there are
only sixteen digits why require the pound.
Compounding the required terminator, the need to evaluate for either an
asterisk or a numeric string excapes me.
Bob
In short
2009/3/27 Brian West <brian at freeswitch.org>
> What exactly do you want to match? Can you give me examples?
> /b
>
> On Mar 26, 2009, at 11:05 PM, Robert Clayton wrote:
>
> All,
>
> Ok I know it must be me but...
>
> In the Lua regex portion of session:playAndGetDigits what regex would I use
> to match either a numeric entry, or an asterisk. It seems when I attempt to
> define an asterisk as a character rather than a metacharacter the regex
> script is evaluated other than I would assume.
> The error code presents \* as a single * and [*] other than a character,
> leading to the hint that there is no preceding character to multiply.
>
> I have at most 15 minutes of proficiency in regular expressions, but, are
> not \* or [*] equivalent to an asterisk character, rather than a
> metacharacter?
>
> Also it seems that the playAndGetDigits evaluates when either the maximum
> number of characters is entered or the terminator is pressed. Is there any
> way to evaluate the regex on each input and therefore dynamically return
> after an acceptable entry? As in the previous example a numeric string and a
> single asterisk are, usually, different lengths and if an asterisk was used
> for, say, abort, entering an asterisk followed by a terminator would seem
> incorrect.
>
> Bob
>
>
> Brian West
> brian at freeswitch.org
>
> -- Meet us a ClueCon! http://www.cluecon.com
>
>
>
>
> _______________________________________________
> Freeswitch-dev mailing list
> Freeswitch-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20090327/f678e22b/attachment.html
More information about the Freeswitch-dev
mailing list