We help IT Professionals succeed at work.

Asterisk CDR database?  schema?

Tim Titus
Tim Titus asked
Medium Priority
Last Modified: 2013-12-21
Anyone know what database Asterisk uses for their CDR database?  Anyone know what the schema is?  Fields, etc.?
Watch Question

Usually you would find it going to a CSV file or MySQL database.  Here is the field list for the CSV,


And there is an example of the table creating with a SQL command here,


In general voip-info.org has tons of useful Asterisk info and is often a good place to start.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


Excellent site!  Thanks!  One quick questions before I awared you the points:

It looks like there is no SourceIP or DestinationIP for the phone IP that was used in the call -- is this true, or is this in a different table?

From how the table is formatted, it looks like it only records external to internal calls -- not internal to internal calls, true?

There is no IP information recorded and there is also no separate table.
All attempted calls are logged regardless of the source or destination.


So there's no ability to track which phone's IP address connected to which gateway for a call?
If its an unauthenticated incoming call then the IP address will normally be recorded in the channel name which is in the call records.
If its authenticated then only the authenticated user name is mentioned.  You will have to look up the ${CHANNEL} variable to find the username and then query the built in asterisk database unser SIP/Registry/username to pull out the IP address and put that into the custom accountcode or user field.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.