[asterisk-dev] No unique identifier for CDR

Atis Lezdins atis at iq-labs.net
Wed Aug 26 15:29:04 CDT 2009

On Wed, Aug 26, 2009 at 6:31 PM, Nick Lewis<Nick.Lewis at atltelecom.com> wrote:
> I have come up against a problem that there is no unique identifier for
> a CDR. This makes it difficult to associate other things such as call
> monitor recordings with a CDR.
> Each call does have a unique identifier which is stored in the CDR as
> "uniqueid" but there may be multiple CDRs representing one call. For
> example ResetCDR(w) saves a CDR and creates a new one for the call. Both
> CDR have the same "uniqueid".
> I propose a new read-only CDR field named something like "cdrinstance"
> that automatically increments after a ResetCDR(w) command. This can be
> used in conjunction with the "uniqueid" field to form a unique CDR
> identifier.
> Do you agree that the lack of a unique identifier for a CDR is a
> problem. If so what do you think of my proposed approach for a solution?
> https://issues.asterisk.org/view.php?id=15180

Actually, uniqueid represents unique channel, but there might be many
of them in a call.

There is linkedid field and variable in trunk, and You can expect them
in 1.6.3 releases which is not that close.

What I have done is at beginning of each call initialize an inherited variable:

if ("${call_id}"=="") {

so that it stays always the same for duration of call. It will be
repaced by linkedid when that release comes.

As for incremented variable - i have it too in a macro that calls
ResetCDR(w). However You also have to set it global, and if You're
updating it in a child channel, You have to use database (built-in or
some SQL) so that it's passed to parent channel.

Then it's quite easy to append that variable to CDR userfield after
each ResetCDR(w) or whenever new channel is created. However You can't
set variables for completely all CDR's, as there are some channels
that never execute dialplan. For me this is enough, i just delete
CDR's with empty userfield - they are basically some internal mirrors
of actual "dialplan executing" channels.


Atis Lezdins,
VoIP Project Manager / Developer,
IQ Labs Inc,
atis at iq-labs.net
Skype: atis.lezdins
Cell Phone: +371 28806004
Cell Phone: +1 800 7300689
Work phone: +1 800 7502835

More information about the asterisk-dev mailing list