[asterisk-users] pipe character in CDR user field

David M. Lee dlee at digium.com
Thu Nov 29 09:58:40 CST 2012


On Nov 29, 2012, at 3:54 AM, Vieri wrote:

> I'm trying to set a CDR userfield to a custom value. This value may contain a '|' but it's really just part of the value.
> However, Asterisk keeps warning me about the application delimiter not being a pipe.
> It's NOT an application delimiter (it's just part of a variable value) so I'm expecting Asterisk not to warn me about it.
> Is it expected behavior?

Well, you certainly didn't expect it. I would not have expected it either :-D

> Why?

So, back in the early days, Asterisk inconsistently used different delimiters depending upon context. Sometimes it used pipes, sometimes commas. Inconsistency is never good, so we picked a winner (commas) and put in code to look for the loser (pipes) in the dial plan and warn if they show up. ('We' in this case would be Asterisk developers of long ago, by the way).

The code that does this checking[1] isn't the smartest code in the world. It basically looks at the data passed to the application, and if it contains a pipe, and no comma, and warnings are enabled, it warns you.

So you could disable warnings, but that would turn off other warnings that might be useful.

Another option would be a small hack in your dial plan: add a comma.

    MSet(CDR(userfield)="|usr_r=vieri",PIPE_HACK=true) ; Asterisk warns if it sees a pipe without a comma.

Since you're not trying to use a pipe as a delimiter, displaying the warning is a mistake in Asterisk. The whole pipe/comma thing happened so long ago[2], it's time to just lose the warning altogether.

 [1]: https://code.asterisk.org/code/browse/asterisk/branches/11/main/pbx.c?u=3&r=376690#to1583
 [2]: https://code.asterisk.org/code/changelog/asterisk?cs=188210

> See the following log:
> 
> <SIP/4053-0000007b>AGI Rx << EXEC Set CDR(userfield)="|usr_r=vieri"
>    -- AGI Script Executing Application: (Set) Options: (CDR(userfield)=|usr_r=vieri)
> [Nov 29 10:53:08] WARNING[4815]: pbx.c:1563 pbx_exec: The application delimiter is now the comma, not the pipe.  Did you forget to convert your dialplan?  (Set(CDR(userfield)=|usr_r=vieri))
> <SIP/4053-0000007b>AGI Tx >> 200 result=0
> 
> <SIP/4053-0000007d>AGI Rx << EXEC Set CDR(userfield)=\"|usr_r=vieri\"
>    -- AGI Script Executing Application: (Set) Options: (CDR(userfield)="|usr_r=vieri")
> [Nov 29 10:54:57] WARNING[4838]: pbx.c:1563 pbx_exec: The application delimiter is now the comma, not the pipe.  Did you forget to convert your dialplan?  (Set(CDR(userfield)="|usr_r=vieri"))
> <SIP/4053-0000007d>AGI Tx >> 200 result=0
> 
> Thanks,
> 
> Vieri

-- 
David M. Lee
Digium, Inc. | Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at:  www.digium.com  & www.asterisk.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20121129/4d3e7ba7/attachment.htm>


More information about the asterisk-users mailing list