Pipe Character In CDR User Field

Home » Asterisk Users » Pipe Character In CDR User Field
Asterisk Users 2 Comments

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? Why?

See the following log:

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)) AGI Tx >> 200 result=0

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")) AGI Tx >> 200 result=0

Thanks,

Vieri

2 thoughts on - Pipe Character In CDR User Field

  • I’ve not tried this with a pipe but I’ve done this with a different character and it works.

    Try

    Set(CDR(userfield)=${SPRINTF(%c,7C)}usr_r=veri

  • Well, you certainly didn’t expect it. I would not have expected it either 😀

    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