Summary: | ASTERISK-14214: [patch] The CUT function does not show the leading field-separators until it finds a value. | ||
Reporter: | Ramon Peek-Fares (ramonpeek) | Labels: | |
Date Opened: | 2009-05-27 13:47:04 | Date Closed: | 2009-06-15 07:17:18 |
Priority: | Minor | Regression? | No |
Status: | Closed/Complete | Components: | Functions/func_cut |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) patch-1.4.25.diff | |
Description: | The CUT function does not show the leading field-separators if the first values are NULL and will start functioning normal if it does find a value. For example: 1 - ${CUT(1---4-5-6--8--,,1-5)} results in: 1---4-5 (CORRECT) 2 - ${CUT(1---4-5-6--8--,,6-10)} results in: 6--8-- (CORRECT) 3 - ${CUT(1---4-5-6--8--,,2-10)} results in: 4-5-6--8-- (INCORRECT!, should be: --4-5-6--8--) In second and third statement the TRAILING separators are shown. However the third statement should also show the LEADING separators, which it doesn't. I've added a small dialplan example to test. And uploaded a patch I created for latest func_cut.c for Asterisk 1.4 trunk. The patch should also work on 1.6.2 (with offset) since this part has not been changed since. ****** STEPS TO REPRODUCE ****** Test dialplan: =============== exten = 802,1,Set(STRING=1---4-5-6--8--) exten = 802,n,Set(ENTRIES1-5=${CUT(STRING,,1-5)}) ; results in: 1---4-5 (CORRECT) exten = 802,n,Set(ENTRIES6-9=${CUT(STRING,,6-10)}) ; results in: 6--8-- (CORRECT) exten = 802,n,Set(ENTRIES2-7=${CUT(STRING,,2-10)}) ; results in: 4-5-6--8-- (INCORRECT!) exten = 802,n,Hangup | ||
Comments: | By: Tilghman Lesher (tilghman) 2009-05-27 13:55:14 > I've added a small dialplan example to test. Where's this small dialplan example? By: Ramon Peek-Fares (ramonpeek) 2009-05-27 13:56:44 It in the section "Steps to Reproduce.." within the ticked "Advanced view" ;-) By: Leif Madsen (lmadsen) 2009-05-27 13:56:57 Steps to Reproduce. By: Digium Subversion (svnbot) 2009-05-27 14:09:43 Repository: asterisk Revision: 197194 U branches/1.4/funcs/func_cut.c ------------------------------------------------------------------------ r197194 | tilghman | 2009-05-27 14:09:43 -0500 (Wed, 27 May 2009) | 5 lines Use a different determinator on whether to print the delimiter, since leading fields may be blank. (closes issue ASTERISK-14214) Reported by: ramonpeek Patch by me, though inspired in part by a patch from ramonpeek ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=197194 By: Digium Subversion (svnbot) 2009-05-27 14:20:57 Repository: asterisk Revision: 197209 _U trunk/ U trunk/funcs/func_cut.c ------------------------------------------------------------------------ r197209 | tilghman | 2009-05-27 14:20:57 -0500 (Wed, 27 May 2009) | 12 lines Recorded merge of revisions 197194 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r197194 | tilghman | 2009-05-27 14:09:42 -0500 (Wed, 27 May 2009) | 5 lines Use a different determinator on whether to print the delimiter, since leading fields may be blank. (closes issue ASTERISK-14214) Reported by: ramonpeek Patch by me, though inspired in part by a patch from ramonpeek ........ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=197209 By: Digium Subversion (svnbot) 2009-05-27 14:29:49 Repository: asterisk Revision: 197244 _U branches/1.6.0/ U branches/1.6.0/funcs/func_cut.c ------------------------------------------------------------------------ r197244 | tilghman | 2009-05-27 14:29:49 -0500 (Wed, 27 May 2009) | 19 lines Recorded merge of revisions 197209 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ................ r197209 | tilghman | 2009-05-27 14:20:56 -0500 (Wed, 27 May 2009) | 12 lines Recorded merge of revisions 197194 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r197194 | tilghman | 2009-05-27 14:09:42 -0500 (Wed, 27 May 2009) | 5 lines Use a different determinator on whether to print the delimiter, since leading fields may be blank. (closes issue ASTERISK-14214) Reported by: ramonpeek Patch by me, though inspired in part by a patch from ramonpeek ........ ................ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=197244 By: Digium Subversion (svnbot) 2009-05-27 14:29:59 Repository: asterisk Revision: 197245 _U branches/1.6.1/ U branches/1.6.1/funcs/func_cut.c ------------------------------------------------------------------------ r197245 | tilghman | 2009-05-27 14:29:59 -0500 (Wed, 27 May 2009) | 19 lines Recorded merge of revisions 197209 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ................ r197209 | tilghman | 2009-05-27 14:20:56 -0500 (Wed, 27 May 2009) | 12 lines Recorded merge of revisions 197194 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r197194 | tilghman | 2009-05-27 14:09:42 -0500 (Wed, 27 May 2009) | 5 lines Use a different determinator on whether to print the delimiter, since leading fields may be blank. (closes issue ASTERISK-14214) Reported by: ramonpeek Patch by me, though inspired in part by a patch from ramonpeek ........ ................ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=197245 By: Digium Subversion (svnbot) 2009-05-27 14:30:07 Repository: asterisk Revision: 197247 _U branches/1.6.2/ U branches/1.6.2/funcs/func_cut.c ------------------------------------------------------------------------ r197247 | tilghman | 2009-05-27 14:30:07 -0500 (Wed, 27 May 2009) | 19 lines Recorded merge of revisions 197209 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ................ r197209 | tilghman | 2009-05-27 14:20:56 -0500 (Wed, 27 May 2009) | 12 lines Recorded merge of revisions 197194 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r197194 | tilghman | 2009-05-27 14:09:42 -0500 (Wed, 27 May 2009) | 5 lines Use a different determinator on whether to print the delimiter, since leading fields may be blank. (closes issue ASTERISK-14214) Reported by: ramonpeek Patch by me, though inspired in part by a patch from ramonpeek ........ ................ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=197247 |