[asterisk-bugs] [Asterisk 0012831]: UNIQUE ID field length too small

noreply at bugs.digium.com noreply at bugs.digium.com
Wed Jun 11 11:57:43 CDT 2008


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=12831 
====================================================================== 
Reported By:                rayjay
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   12831
Category:                   CDR/General
Reproducibility:            always
Severity:                   tweak
Priority:                   normal
Status:                     new
Asterisk Version:           1.4.20.1 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             06-10-2008 23:45 CDT
Last Modified:              06-11-2008 11:57 CDT
====================================================================== 
Summary:                    UNIQUE ID field length too small
Description: 
I have noticed that the uniqueid field is too small when you define a
'systemname' on your asterisk server.  In my case I define the systemname
as the IP address of the server, so this could be up to 15 characters long
e.g. 192.168.123.456.  The following code in main/channel.c then creates
the uniqueid string for CDR etc.

ast_string_field_build(tmp, uniqueid, "%s-%li.%d",
ast_config_AST_SYSTEM_NAME,
  (long) time(NULL), ast_atomic_fetchadd_int(&uniqueint, 1));

The problem is that uniqueid is only a char[32] in length.  So, here is an
example uniqueid from a call:

192.168.123.456-1213156048.123456

With the hyphen, epoch timestamp, the dot and then the ast_atomic integer
- the total length here is 33 characters so when I view my CDR the uniqueid
is truncated e.g. 192.168.123.456-1213156048.1234 - and suddenly my
uniqueid is no longer unique anymore?

I have been having issues when the final integer passes 99999 - which
because of Asterisk's stability :) - happens after just a few days and my
CDR starts to show duplicate uniqueid's :(

I think given the fact that the systemname can be up to 20 characters and
to allow for a million calls then we should make the uniqueid field at
least a 40 character string?
====================================================================== 

---------------------------------------------------------------------- 
 Corydon76 - 06-11-08 11:57  
---------------------------------------------------------------------- 
I agree with you that that CDR field needs to be longer, but this would
break binary compatibility if we changed the length of that field in 1.4. 
I am therefore only going to make this change in trunk.

And actually 150, since 127 + "-" + 10 + "." + 10 + NULL = 150. 
Systemname does not necessarily need to be an IP address.

As a workaround in 1.4, you may need to consider shortening your
systemname to just the last 2 octets of your IP address. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
06-11-08 11:57  Corydon76      Note Added: 0088590                          
======================================================================




More information about the asterisk-bugs mailing list