CHANNEL replacing CDR command

Since CDR function is deprecated in Asterisk 13. How to set a custom variable in realtime Database using CHANNEL(Mycustomfield)

I keep getting “func_channel_write_real: Unknown or unavailable item requested: Mycustomfield”

Before “CDR(Mycustomfield) = newvalue” used to work. and now “CHANNEL(Mycustomfield) = newvalue” does not. I am using asterisk 13.6.0 Thanks

You cant set CDR custom field using this function.

Gets/sets various pieces of information about the channel, additional item may be available from the channel driver; see its documentation for details. Any item requested that is not available on the current channel will return an empty string.[/quote]

I tested and got the following warning trying to set unixtime custom field:


func_channel.c:730 func_channel_write_real: Unknown or unavailable item requested: ‘unixtime’

try to use CDR function same=>n,Set(CDR(unixtime)=12015001) I tested on Asterisk 13.0.0

Well if you use “same=>n,Set(CDR(unixtime)=12015001)” it does work ! but complains about deprecation and tell to use “CHANNEL command” but it doesn’t work!

Your assumptions for the CRD-function in Asterisk 13 aren’t correct. Only two parameters for the CDR-function are deprecated, not the function itself, see:

You should use the CHANNEL-function for amaflags as well as for accountcode. There’s nothing about unixtime. Possible params for CHANNEL are listed here:

Yes it works with CHANNEL(accountcode)!!! So Don’t use CDR(accountcode)