[Freeswitch-dev] Lua session:playAndGetDigits regex

Robert Clayton rjcajax at gmail.com
Sat Mar 28 06:57:39 PDT 2009


Or to be more specific:

As a side note, when this gets worked out I am not sure if this answers my
other problem. If I wished for, say, "enter 6 numeric digits or an asterisk
to allow reentry."  Is there any way to allow for an immediate response for
either 6 consecutive numeric digits or an asterisk, singularly entered, or
embedded in a numeric input, without the requirement for a terminating
character?


On Sat, Mar 28, 2009 at 9:48 AM, Robert Clayton <rjcajax at gmail.com> wrote:

> Anthony,
>
> You are a good man. Early in the morning and up working.
>
> Though not presenting an error these versions return no results.
>
> agent_id = session:playAndGetDigits(1,6, 2, 10000,"#",
> "c:/DictationProject/audio/Validating.wav", "", "^([\d*]{6})$");
> agent_id = session:playAndGetDigits(1,6, 2, 10000,"#",
> "c:/DictationProject/audio/Validating.wav", "", "^([\\d*]{6})$");
> agent_id = session:playAndGetDigits(1,6, 2, 10000,"#",
> "c:/DictationProject/audio/Validating.wav", "", "^([0-9]{6})$");
>
> 123456, 12345, 1234, 123, 12, 1 NO
> ---------------------------------------------------------
>
> Likewise the following does not return anything.
> agent_id = session:playAndGetDigits(1,6, 2, 10000,"#",
> "c:/DictationProject/audio/Validating.wav", "", "[\d*]{6}");
>
> But the following works as expected.
> agent_id = session:playAndGetDigits(1,6, 2, 10000,"#",
> "c:/DictationProject/audio/Validating.wav", "", "[0-9]{6}");
>
> 12345 NO
> 123456 YES
> ---------------------------------------------------------
>
> But some good news, per Michael assuming interaction between Lua and FS
> this works.
> agent_id = session:playAndGetDigits(1,6, 2, 10000,"#",
> "c:/DictationProject/audio/Validating.wav", "", "[\\d\*]{6}");
>
> But this does not.
> agent_id = session:playAndGetDigits(1,6, 2, 10000,"#",
> "c:/DictationProject/audio/Validating.wav", "", "^([\\d\*]{6})$");
>
> Go figure. I will continue to experiment. Now let's see is this inductive
> or deductive programming?
> ---------------------------------------------------------
>
> As a side note, when this gets worked out I am not sure if this answers my
> other problem. If I wished for, say, "enter 6 numeric digits or an asterisk
> to allow reentry", is there any way to allow for an immediate response for
> either 6 numeric digits or a single asterisk without the requirement of a
> terminator.
>
> Bob
>
> 2009/3/28 Anthony Minessale <anthony.minessale at gmail.com>
>
> try
>>
>> /^([\d*]{6})$/
>>
>> \d is shorthand for 0-9 and anything in a [] is a set of chars so [\d*]
>> means 0-9 and *
>> [\d*]{6} means exactly 6 from the previous set and wrap the whole thing in
>> ^$ means exact match
>> from beginning to end of the string.
>>
>>
>> 2009/3/28 Robert Clayton <rjcajax at gmail.com>
>>
>> Michael,
>>>
>>> Good start! We are getting warmer.
>>>
>>> Where "(\\*|\\d{6})" will not match either * or 123456 or anything I can
>>> think of.
>>> "\\*|\\d{6}" does match * and 123456 and does not match 1234
>>> So far so good.
>>> BUT, if an asterisk(s) are entered in a combination with numbers anything
>>> goes **, *123, 123 *, 12*24, 12**34, 1*2*3, etc.
>>>
>>> Bob
>>>
>>>
>>> On Fri, Mar 27, 2009 at 5:54 PM, Michael Collins <msc at freeswitch.org>wrote:
>>>
>>>> 2009/3/27 Robert Clayton <rjcajax at gmail.com>:
>>>> > Michael,
>>>> >
>>>> > Also note the error message reprints the expression without the
>>>> escape.
>>>> >
>>>> > Bob
>>>> >
>>>> > On Fri, Mar 27, 2009 at 2:29 PM, Michael Collins <msc at freeswitch.org>
>>>> wrote:
>>>>
>>>> That just hit me. Try "\\*" instead of "\*" to see if maybe the
>>>> backslash is getting dropped off between Lua and FreeSWITCH.
>>>>
>>>> -MC
>>>>
>>>> _______________________________________________
>>>> 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
>>>>
>>>
>>>
>>> _______________________________________________
>>> 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
>>>
>>>
>>
>>
>> --
>> Anthony Minessale II
>>
>> FreeSWITCH http://www.freeswitch.org/
>> ClueCon http://www.cluecon.com/
>>
>> AIM: anthm
>> MSN:anthony_minessale at hotmail.com <MSN%3Aanthony_minessale at hotmail.com>
>> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<PAYPAL%3Aanthony.minessale at gmail.com>
>> IRC: irc.freenode.net #freeswitch
>>
>> FreeSWITCH Developer Conference
>> sip:888 at conference.freeswitch.org <sip%3A888 at conference.freeswitch.org>
>> iax:guest at conference.freeswitch.org/888
>> googletalk:conf+888 at conference.freeswitch.org<googletalk%3Aconf%2B888 at conference.freeswitch.org>
>> pstn:213-799-1400
>>
>> _______________________________________________
>> 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/20090328/5c533c77/attachment.html 


More information about the Freeswitch-dev mailing list