[Freeswitch-dev] Lua session:playAndGetDigits regex

Robert Clayton rjcajax at gmail.com
Mon Mar 30 11:45:41 PDT 2009


Anthony,

Thanks. Great idea. My fallback was to use * as a terminator and only
allow fixed size input. This is much better.
What do you know I just lost the hard drive on my test system. With my scripts.
I will reconstruct an begin soon

By the way I get an error in LUA on my windows build.
"error C2695: 'LUA::Session::destroy': overriding virtual function
differs from 'CoreSession::destroy' only by calling convention
c:\fs\src\mod\languages\mod_lua\freeswitch_lua.h  26  mod_lua"

Bob
2009/3/30 Anthony Minessale <anthony.minessale at gmail.com>:
> try this,
>
> go to latest trunk,
>
> set the terminators to both # and * "#*" then when it stops check the
> variable read_terminator_used to see if it was # or *
> then you can continue in your loop
>
> i added the channel var read_terminator_used which should contain
>
> On Mon, Mar 30, 2009 at 10:42 AM, Robert Clayton <rjcajax at gmail.com> wrote:
>>
>> Anthony,
>>
>> Yes and no. The original regex was a little more complex, it only got
>> simplified in the thread while trying to discover what was going
>> wrong.
>> Where we got "\\*|\\d{6}" to match either a "*" or "123456" the
>> original problem. It also allowed any entry if a single (or multiple)
>> asterisk were entered at any position in the entry string. Which would
>> be an incorrect action.
>>
>> Correct: * and 123456 and does not match 1234
>> Incorrect: **, *123, 123 *, 12*24, 12**34, 1*2*3, etc.
>>
>> Regardless, this was an interim step. What I need is two actions, the
>> first FS easily allows, the second the complicating factor.
>> 1) Enter either a numeric string (either a defined length or undefined
>> length followed by a "#")
>> 2) Enter an asterisk at anytime to allow reentry from the beginning
>> (returning without requiring a following terminator)
>>
>> I tried to use the callback and filter the input myself but since (I
>> think) the callback only functions while the recording is playing that
>> could not be done unless I was sure either the user responded during
>> the recording or the recording was paused. Is there anyway for the the
>> callback to delay and not return at the end of the recording?
>>
>> Bob
>>
>> 2009/3/30 Anthony Minessale <anthony.minessale at gmail.com>:
>> > how about leave the regex blank if you can't figure one out and just
>> > collect
>> > 6 digits and look for * yourself?
>> > The one I told you saturday works for what you asked about.  the one you
>> > came back and asked about would require a | (or)
>> > with 2 expressions.
>> >
>> > On Mon, Mar 30, 2009 at 7:20 AM, Robert Clayton <rjcajax at gmail.com>
>> > wrote:
>> >>
>> >> Well, I hope that this thread has not died as it seems there has been
>> >> no solution.
>> >> Also, it seems there is not a solid understanding as to the
>> >> interaction between Lua and FS.
>> >>
>> >> Does this suggest that I should abandon Lua for another scripting
>> >> implementation such as JavaScript?
>> >>
>> >> 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
>> >> > GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
>> >> > IRC: irc.freenode.net #freeswitch
>> >> >
>> >> > FreeSWITCH Developer Conference
>> >> > sip:888 at conference.freeswitch.org
>> >> > iax:guest at conference.freeswitch.org/888
>> >> > googletalk:conf+888 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
>> >> >
>> >> >
>> >>
>> >> _______________________________________________
>> >> 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
>> > GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
>> > IRC: irc.freenode.net #freeswitch
>> >
>> > FreeSWITCH Developer Conference
>> > sip:888 at conference.freeswitch.org
>> > iax:guest at conference.freeswitch.org/888
>> > googletalk:conf+888 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
>> >
>> >
>>
>> _______________________________________________
>> 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
> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
> IRC: irc.freenode.net #freeswitch
>
> FreeSWITCH Developer Conference
> sip:888 at conference.freeswitch.org
> iax:guest at conference.freeswitch.org/888
> googletalk:conf+888 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
>
>



More information about the Freeswitch-dev mailing list