Re: [Freeswitch-dev] Lua session:playAndGetDigits regex

2009-04-02 Thread Anthony Minessale
let me know if it works On Thu, Apr 2, 2009 at 1:54 PM, Robert Clayton wrote: > Anthony, > > I did not want you to think I did not appreciate this addition. I just > have not been able to grab a clean build yet to test yet. But when I > grab a clean build I will test it. > > Bob > > 2009/3/30 A

Re: [Freeswitch-dev] Lua session:playAndGetDigits regex

2009-04-02 Thread Robert Clayton
Anthony, I did not want you to think I did not appreciate this addition. I just have not been able to grab a clean build yet to test yet. But when I grab a clean build I will test it. Bob 2009/3/30 Anthony Minessale : > try this, > > go to latest trunk, > > set the terminators to both # and * "#

Re: [Freeswitch-dev] Lua session:playAndGetDigits regex

2009-03-30 Thread Robert Clayton
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

Re: [Freeswitch-dev] Lua session:playAndGetDigits regex

2009-03-30 Thread Anthony Minessale
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

Re: [Freeswitch-dev] Lua session:playAndGetDigits regex

2009-03-30 Thread Robert Clayton
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

Re: [Freeswitch-dev] Lua session:playAndGetDigits regex

2009-03-30 Thread Anthony Minessale
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 Clayt

Re: [Freeswitch-dev] Lua session:playAndGetDigits regex

2009-03-30 Thread Robert Clayton
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 Min

Re: [Freeswitch-dev] Lua session:playAndGetDigits regex

2009-03-28 Thread Robert Clayton
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 aster

Re: [Freeswitch-dev] Lua session:playAndGetDigits regex

2009-03-28 Thread Robert Clayton
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, 1,"#", "c:/DictationProject/audio/Validating.wav", "", "^([\d*]{6})$"); agent_id = session:playAndGetDigits(1,6, 2, 1

Re: [Freeswitch-dev] Lua session:playAndGetDigits regex

2009-03-28 Thread Anthony Minessale
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 > Michael, > > Good start! W

Re: [Freeswitch-dev] Lua session:playAndGetDigits regex

2009-03-27 Thread Robert Clayton
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

Re: [Freeswitch-dev] Lua session:playAndGetDigits regex

2009-03-27 Thread Michael Collins
2009/3/27 Robert Clayton : > Michael, > > Also note the error message reprints the expression without the escape. > > Bob > > On Fri, Mar 27, 2009 at 2:29 PM, Michael Collins wrote: That just hit me. Try "\\*" instead of "\*" to see if maybe the backslash is getting dropped off between Lua and Fr

Re: [Freeswitch-dev] Lua session:playAndGetDigits regex

2009-03-27 Thread Robert Clayton
Michael, Also note the error message reprints the expression without the escape. Bob On Fri, Mar 27, 2009 at 2:29 PM, Michael Collins wrote: > 2009/3/27 Robert Clayton : > > Michael, > > > > I liked "(\*|\d{6})" also but when entered in: > > > > agent_id = session:playAndGetDigits(1, 3, 2, 100

Re: [Freeswitch-dev] Lua session:playAndGetDigits regex

2009-03-27 Thread Robert Clayton
Michael, Simple Working Reference: agent_id = session:playAndGetDigits(1, 6, 2, 1,"#", "c:/DictationProject/audio/Validating.wav", "", "23"); Entering 45 returned nothing as expected, entering 23 returned 23 as expected.

Re: [Freeswitch-dev] Lua session:playAndGetDigits regex

2009-03-27 Thread Michael Collins
2009/3/27 Robert Clayton : > Michael, > > I liked "(\*|\d{6})" also but when entered in: > > agent_id = session:playAndGetDigits(1, 3, 2, 1,'#', > 'c:/DictationProject/audio/Validating.wav', '', "(\*|\d{6})"); > > Creates the error: > > 2009-03-27 14:05:36 [ERR] switch_regex.c:184 switch_regex_

Re: [Freeswitch-dev] Lua session:playAndGetDigits regex

2009-03-27 Thread Robert Clayton
Sorry the last line in my last email used a forward slash rather than a backslash. It should read: The escape characters seem to disappear and FS attempts to use the, \* an asterisk character, as * a metecharacter. On Fri, Mar 27, 2009 at 2:02 PM, Michael Collins wrote: > 2009/3/27 Robert Clay

Re: [Freeswitch-dev] Lua session:playAndGetDigits regex

2009-03-27 Thread Robert Clayton
Michael, I liked "(\*|\d{6})" also but when entered in: agent_id = session:playAndGetDigits(1, 3, 2, 1,'#', 'c:/DictationProject/audio/Validating.wav', '', "(\*|\d{6})"); Creates the error: 2009-03-27 14:05:36 [ERR] switch_regex.c:184 switch_regex_match_partial() Regula r Expression Error e

Re: [Freeswitch-dev] Lua session:playAndGetDigits regex

2009-03-27 Thread Michael Collins
2009/3/27 Robert Clayton : > As I understand it everything entered in square brackets(a character class) > is literal. In parentheses it is read as a metacharacter. Character classes have their own rules. I don't recommend using them unless you know precisely what you are doing. I like Brian's reg

Re: [Freeswitch-dev] Lua session:playAndGetDigits regex

2009-03-27 Thread Robert Clayton
Brian, Tried that as below. agent_id = session:playAndGetDigits(1, 3, 2, 1,'#', 'c:/DictationProject/audio/Validating.wav', '', '(\*|\d{4})'); errors with: 2009-03-27 13:43:51 [ERR] switch_regex.c:184 switch_regex_match_partial() Regular Expression Error expression[(*|d{4})] error[nothing t

Re: [Freeswitch-dev] Lua session:playAndGetDigits regex

2009-03-27 Thread Robert Clayton
As I understand it everything entered in square brackets(a character class) is literal. In parentheses it is read as a metacharacter. On Fri, Mar 27, 2009 at 2:48 AM, Even André Fiskvik wrote: > Imho you always have to escape the asterisk character if that is what > you want, > so "[*]" is bad.

Re: [Freeswitch-dev] Lua session:playAndGetDigits regex

2009-03-27 Thread Brian West
(\*|\d{6}) Here are my recommendations for reference: http://www.amazon.com/Mastering-Regular-Expressions-Jeffrey-Friedl/dp/0596528124/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1238166731&sr=8-1 This one is good too: http://www.amazon.com/Regular-Expression-Pocket-Reference-Expressions/dp/059651427

Re: [Freeswitch-dev] Lua session:playAndGetDigits regex

2009-03-27 Thread Brian West
in short? You basically repeated the exact same thing in the previous email! (\*|\d{4}) * or any 4 digit number you can change that if you like. /b On Mar 27, 2009, at 10:03 AM, Robert Clayton wrote: > > In short Brian West br...@freeswitch.org -- Meet us a ClueCon! http://www.cluecon.c

Re: [Freeswitch-dev] Lua session:playAndGetDigits regex

2009-03-27 Thread Robert Clayton
Brian, More succinctly how could I implement. "Enter the six digit file number or press the asterisk key to restart and enter again", assuming a person entered 3 digits got confused and wished to enter the number again from the beginning? Bob 2009/3/27 Brian West > What exactly do you want to

Re: [Freeswitch-dev] Lua session:playAndGetDigits regex

2009-03-27 Thread Even André Fiskvik
Imho you always have to escape the asterisk character if that is what you want, so "[*]" is bad. You would want "[\*]". See http://www.regular-expressions.info/characters.html for tips. Best regards, Even André On 27. mars. 2009, at 05.05, Robert Clayton wrote: > All, > > Ok I know it must

Re: [Freeswitch-dev] Lua session:playAndGetDigits regex

2009-03-27 Thread Robert Clayton
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 retu

Re: [Freeswitch-dev] Lua session:playAndGetDigits regex

2009-03-27 Thread Brian West
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 w

[Freeswitch-dev] Lua session:playAndGetDigits regex

2009-03-26 Thread Robert Clayton
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 woul