Summary: | ASTERISK-13672: ENUMLOOKUP - broken regex. | ||
Reporter: | Chris Maciejewski (chris-mac) | Labels: | |
Date Opened: | 2009-03-01 15:56:55.000-0600 | Date Closed: | 2009-03-06 11:35:38.000-0600 |
Priority: | Major | Regression? | No |
Status: | Closed/Complete | Components: | Functions/func_enum |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ||
Description: | The following number +44800123123 is registered with e164.org. $ dig 3.2.1.3.2.1.0.0.8.4.4.e164.org naptr returns: .... 3.2.1.3.2.1.0.0.8.4.4.e164.org. 11 IN NAPTR 200 10 "u" "E2U+SIP" "!^\\+44800(.*)$!sip:44800\\1@selfnet.at!" . so in theory it should translate to: sip:44800123123@selfnet.at But the following dialplan function: exten => _X.,n,Set(ENUM_URI=${ENUMLOOKUP(+44800123123,sip,s,,e164.org)}) exten => _X.,n,NoOp(Enum URI: ${ENUM_URI}) returns: ... "Enum URI: 4480044800123123@selfnet.at") in new stack | ||
Comments: | By: Digium Subversion (svnbot) 2009-03-06 11:19:56.000-0600 Repository: asterisk Revision: 180532 U branches/1.4/main/enum.c ------------------------------------------------------------------------ r180532 | dvossel | 2009-03-06 11:19:55 -0600 (Fri, 06 Mar 2009) | 9 lines Fix handling of backreferences for ENUM lookups enum.c did not handle regex backtraces correctly. The '\1' in the regex is a backreference that requires a pattern match to be inserted. The way the code used to work is that it would find the backreference and insert the entire input string minus the '+'. This is incorrect. The regexec() function takes in a variable called pmatch which is an array of structs containing the start and end indexes for each backreference substring. The original code actually passed the pmatch array pointer into regexec but never did anything with it. Now when a backtrace is found, the backtrace number is looked up in the pmatch array and the correct substring is inserted. (closes issue ASTERISK-13672) Reported by: chris-mac Review: http://reviewboard.digium.com/r/187/ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=180532 By: Digium Subversion (svnbot) 2009-03-06 11:26:38.000-0600 Repository: asterisk Revision: 180534 _U trunk/ U trunk/main/enum.c ------------------------------------------------------------------------ r180534 | dvossel | 2009-03-06 11:26:38 -0600 (Fri, 06 Mar 2009) | 15 lines Merged revisions 180532 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r180532 | dvossel | 2009-03-06 11:19:55 -0600 (Fri, 06 Mar 2009) | 9 lines Fix handling of backreferences for ENUM lookups enum.c did not handle regex backtraces correctly. The '\1' in the regex is a backreference that requires a pattern match to be inserted. The way the code used to work is that it would find the backreference and insert the entire input string minus the '+'. This is incorrect. The regexec() function takes in a variable called pmatch which is an array of structs containing the start and end indexes for each backreference substring. The original code actually passed the pmatch array pointer into regexec but never did anything with it. Now when a backtrace is found, the backtrace number is looked up in the pmatch array and the correct substring is inserted. (closes issue ASTERISK-13672) Reported by: chris-mac Review: http://reviewboard.digium.com/r/187/ ........ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=180534 By: Digium Subversion (svnbot) 2009-03-06 11:28:53.000-0600 Repository: asterisk Revision: 180535 _U branches/1.6.0/ U branches/1.6.0/main/enum.c ------------------------------------------------------------------------ r180535 | dvossel | 2009-03-06 11:28:53 -0600 (Fri, 06 Mar 2009) | 22 lines Merged revisions 180534 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ................ r180534 | dvossel | 2009-03-06 11:26:38 -0600 (Fri, 06 Mar 2009) | 15 lines Merged revisions 180532 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r180532 | dvossel | 2009-03-06 11:19:55 -0600 (Fri, 06 Mar 2009) | 9 lines Fix handling of backreferences for ENUM lookups enum.c did not handle regex backtraces correctly. The '\1' in the regex is a backreference that requires a pattern match to be inserted. The way the code used to work is that it would find the backreference and insert the entire input string minus the '+'. This is incorrect. The regexec() function takes in a variable called pmatch which is an array of structs containing the start and end indexes for each backreference substring. The original code actually passed the pmatch array pointer into regexec but never did anything with it. Now when a backtrace is found, the backtrace number is looked up in the pmatch array and the correct substring is inserted. (closes issue ASTERISK-13672) Reported by: chris-mac Review: http://reviewboard.digium.com/r/187/ ........ ................ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=180535 By: Digium Subversion (svnbot) 2009-03-06 11:35:37.000-0600 Repository: asterisk Revision: 180537 _U branches/1.6.1/ U branches/1.6.1/main/enum.c ------------------------------------------------------------------------ r180537 | dvossel | 2009-03-06 11:35:37 -0600 (Fri, 06 Mar 2009) | 22 lines Merged revisions 180534 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ................ r180534 | dvossel | 2009-03-06 11:26:38 -0600 (Fri, 06 Mar 2009) | 15 lines Merged revisions 180532 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r180532 | dvossel | 2009-03-06 11:19:55 -0600 (Fri, 06 Mar 2009) | 9 lines Fix handling of backreferences for ENUM lookups enum.c did not handle regex backtraces correctly. The '\1' in the regex is a backreference that requires a pattern match to be inserted. The way the code used to work is that it would find the backreference and insert the entire input string minus the '+'. This is incorrect. The regexec() function takes in a variable called pmatch which is an array of structs containing the start and end indexes for each backreference substring. The original code actually passed the pmatch array pointer into regexec but never did anything with it. Now when a backtrace is found, the backtrace number is looked up in the pmatch array and the correct substring is inserted. (closes issue ASTERISK-13672) Reported by: chris-mac Review: http://reviewboard.digium.com/r/187/ ........ ................ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=180537 |