[asterisk-bugs] [Asterisk 0010903]: CUT() won't let you cut on a carriage return

noreply at bugs.digium.com noreply at bugs.digium.com
Sat Oct 6 03:08:10 CDT 2007


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=10903 
====================================================================== 
Reported By:                blitzrage
Assigned To:                Corydon76
====================================================================== 
Project:                    Asterisk
Issue ID:                   10903
Category:                   Functions/func_cut
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
Asterisk Version:           1.4.11  
SVN Branch (only for SVN checkouts, not tarball releases): N/A  
SVN Revision (number only!):  
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             10-05-2007 17:47 CDT
Last Modified:              10-06-2007 03:08 CDT
====================================================================== 
Summary:                    CUT() won't let you cut on a carriage return
Description: 
I'm trying to read in a file into the dialplan, and then parse each line of
the file with the CUT() function, but unfortunately have been unable to
make it work.

I've tried:

Set(LINE=${CUT(ENVELOPE,\n,1)})
Set(LINE=${CUT(ENVELOPE,\\n,1)})
Set(LINE=${CUT(ENVELOPE,\\\n,1)})
Set(LINE=${CUT(ENVELOPE,\r\n,1)})
Set(LINE=${CUT(ENVELOPE,\\r\\n,1)})
Set(LINE=${CUT(ENVELOPE,\\\r\\\n,1)})

But it seems it just cut on the literal letter ('r' or 'n' in this case).
====================================================================== 

---------------------------------------------------------------------- 
 blitzrage - 10-06-07 03:08  
---------------------------------------------------------------------- 
FYI for anyone else who comes across this in the meantime, I've developed a
work around:

exten => 8,n,Set(DATA=${SHELL(tr "\\\n"\, "&" <
${PATH_TO_VM}/${VM_CTX}/${MAILBOX}/INBOX/msg${MSGNUM}.txt \| cut -d \\\& -f
${LINE_NUMBER})}) 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
10-06-07 03:08  blitzrage      Note Added: 0071578                          
======================================================================




More information about the asterisk-bugs mailing list