How to disable a CDR?

Hello,

I’ve got a part of dialplan, I’m using to test dialplan expressions. For these expressions, I don’t want any CDR entry to be generated while executing the corresponding dialplan part.

How can I do that ?
I’ve lately discovered CDR_PROP() function I’m probably mis-using it.
My Asterisk version is 20.9.

My unsuccessful attempts used Set(CDR_PROP(disable)=1) or Set(CDR_PROP(disable)=yes).

[foo]
exten = 1,1,Set(CDR_PROP(disable)=yes)
same = n,Set(FOO=foobar)
same = n,Verbose(0,Stripped FOO is ${FOO:1:3} )
same = n,Hangup()

Best regards

NoCDR()

https://docs.asterisk.org/Asterisk_20_Documentation/API_Documentation/Dialplan_Applications/NoCDR/

Thank you for replying.

In [1], it is mentioned that “This application is deprecated. Please use the CDR_PROP function to disable CDRs on a channel.”
I’ll try to better understand CDR_PROP function’s limits before retrying with NoCDR() (which is absent from Asterisk 22).

[1] NoCDR - Asterisk Documentation

With the following dialplan and channel originate Local/1@foo application Noop, a CDR is generated. I would expect no CDR to be generated.
Maybe, this comes from Local to PJSIP inheritance.

[foo]
exten = 1,1,Set(CDR_PROP(disable)=1)
same = n,Set(FOO=foobar)
same = n,Verbose(0,Stripped FOO is ${FOO:1:3} )
same = n,Hangup()

Are my expectations correct ?

No, because there are two channels as a result of that each with their own CDR. A ;1 leg which has CDR_PROP called on it to disable, and another that merely calls NoOp which I would expect to have a CDR.

What shall I expect with originate Local/1@bar extension 2@bar and :

[bar]
exten = 1,1,Set(CDR_PROP(disable)=1)
same = n,Set(FOO=foobar)
same = n,Verbose(0,Stripped FOO is ${FOO:1:3} )
same = n,Hangup()
exten = 2,1,Set(CDR_PROP(disable)=1)
same = n,Hangup()

In my testing, a CDR is created.

You should also show the CDR that is created.

I’ve got a cdr_adaptive_odbc.conf configured. It requires some CDR variables which are not set in the above [bar] context. This triggers errors which are the reason I tried to disable CDR creation.

I can simplify things to the point these errors (the ones due to missing variables) disappear.
Do you want me to try this ?

It would be helpful for anyone trying to look at this, to know what the CDR actually contains since there are multiple channels involved.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.