Summary: | ASTERISK-07426: REGEX argument parsing isn't working | ||
Reporter: | hristo (hristo) | Labels: | |
Date Opened: | 2006-07-30 12:53:41 | Date Closed: | 2006-08-13 23:25:21 |
Priority: | Minor | Regression? | No |
Status: | Closed/Complete | Components: | Functions/func_strings |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ||
Description: | I have some regex lines in my dial plan and they are working properly with 1.2.x, but when I try the same configurations against trunk all regex lines generate the following error: func_strings.c:123 regex: Unexpected arguments: should have been in the form '"<regex>" <string>' It appears that the arguments are not parsed correctly. ****** ADDITIONAL INFORMATION ****** The problem can be reproduced like this: exten => 1234,1,NoOp(${REGEX("1" 1)}) exten => 1234,n,HangUp() And the result is: Jul 30 20:36:27 ERROR[26076]: func_strings.c:123 regex: Unexpected arguments: should have been in the form '"<regex>" <string>' Jul 30 20:36:27 DEBUG[26076]: pbx.c:1529 pbx_substitute_variables_helper_full: Function result is '(null)' | ||
Comments: | By: Tilghman Lesher (tilghman) 2006-07-30 23:56:18 For trunk, you need to backslash your quotes, as such: ${REGEX(\"1\" 1)} By: hristo (hristo) 2006-07-31 13:14:00 I have tried it, but it is not working. I have actually tried all of the following: exten => 1234,1,NoOp(${REGEX(\"1\" 1)}) exten => 1234,1,NoOp(${REGEX('\"1\" 1')}) exten => 1234,1,NoOp(${REGEX('\"1\"' 1)}) exten => 1234,1,NoOp(${REGEX('"1"' 1)}) exten => 1234,1,NoOp(${REGEX('"1" 1')}) exten => 1234,1,NoOp(${REGEX('"'1'"' 1)}) I still get that same error. It seems the configuration itself is parsed correctly because for all of them when I issue "show dialplan" I get: '1234' => 1. NoOp(${REGEX("1" 1)}) [pbx_config] 2. HangUp() [pbx_config] I have also tried double backslashes: exten => 1234,1,NoOp(${REGEX(\\"1\\" 1)}) Still the same problem, only "show dialplan" is different '1234' => 1. NoOp(${REGEX(\"1\" 1)}) [pbx_config] 2. HangUp() [pbx_config] By: hristo (hristo) 2006-08-07 19:27:39 Based on trial and error I have found out that if I change the delimiter character at line 120 of func_strings.c to anything but " the REGEX dialplan function arguments are parsed correctly (of course extensions.conf needs to be changed as well in order to match that new delimiter). For example if I change the delimiter from " to | like this: AST_NONSTANDARD_APP_ARGS(args, parse, '|'); recompile, and also change the relevant lines in extensions.conf to: exten => 1234,1,NoOp(${REGEX('|1| 1')}) I will get the expected function result. Unfortunately this is as far as I can go, because I have no C coding experience whatsoever. Hopefully this will at least give somebody else a hint where the real problem is. I am now sure that this is not only a matter of backslashing the quotes (see previous note). By: Russell Bryant (russell) 2006-08-13 23:25:21 fixed in the trunk in revision 39706 |