Summary:ASTERISK-08423: Cut function requires | delimiter
Reporter:Larry (lweidig)Labels:
Date Opened:2006-12-22 11:10:03.000-0600Date Closed:2006-12-29 19:00:15.000-0600
Versions:Frequency of
Description:The cut function does not properly function in an AEL2 file if you use the , as the delimiter between parameters.  It does work with the | delimiter.  Code is simply much more readable with a comma and many other functions accept this.  Documentation suggests the comma will work (core show function CUT), reading code (func_cut.c) does not show it being looked for.
Comments:By: Jason Parker (jparker) 2006-12-22 11:27:14.000-0600

In 1.4, func_cut uses the standard AST_STANDARD_APP_ARGS macro(s), which use , or |.  Can you give an example of this not working?

By: Larry (lweidig) 2006-12-22 12:11:55.000-0600

Here is my version info:
Asterisk SVN-branch-1.4-r48637 built by root @ xxxxx.net on a i686 running Linux on 2006-12-21 15:52:45 UTC

The code:
returns "SIP/500"

The code:
returns ""

Have changed that one line in AEL dialplan and if gives the same results every time.  I suppose potentially this is an AEL parsing issue?

My file func_cut.c is $Revision: 40722 $ and this is checked out from the SVN 1.4 branch.

By: Jason Parker (jparker) 2006-12-22 12:21:17.000-0600

Per murf, this is a "limitation" in AEL.  What happens, is the extensions.conf parser turns "," into "|" internally, and the APP_ARGS macros use "|".  AEL does not change "," into "|".  I wouldn't really call this a bug, but it's something murf said he would look into.

By: Larry (lweidig) 2006-12-22 12:25:34.000-0600

Excellent, thanks!  I know with AEL2 a lot of its syntax started allowing both the | or , characters for "internal" commands.  Hopefully it will be extended to using this throughout as it just helps readability.  Programming a phone system is so much fun!  Your rapid response is greatly appreciated.

By: Steve Murphy (murf) 2006-12-29 18:54:56.000-0600

The reason for this is that ${...} expressions are passed untouched to the dialplan. I made a change such that for app arguments, all commas will be converted to a vertical bar, UNLESS the comma is escaped (eg. \,). This doesn't happen very often (hopefully), and when it does, hopefully no big surprises. It'll do wonders for CUT, tho!

fix appears in r.49061 in 1.4, and
              r.49062 in trunk.

By: Steve Murphy (murf) 2006-12-29 19:00:14.000-0600

Fixed, tested, and merged to 1.4 and trunk. Time to close this bug!
If there's probs, please feel free to reopen!