[asterisk-bugs] [Asterisk 0017170]: [patch] cdr_mongodb

Asterisk Bug Tracker noreply at bugs.digium.com
Tue May 4 10:15:36 CDT 2010


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=17170 
====================================================================== 
Reported By:                flaper87
Assigned To:                tilghman
====================================================================== 
Project:                    Asterisk
Issue ID:                   17170
Category:                   Addons/New Feature
Reproducibility:            N/A
Severity:                   feature
Priority:                   normal
Status:                     ready for testing
Target Version:             1.8
Asterisk Version:           1.6.2.6 
JIRA:                       SWP-1348 
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2010-04-12 14:54 CDT
Last Modified:              2010-05-04 10:15 CDT
====================================================================== 
Summary:                    [patch] cdr_mongodb
Description: 
Hey guys,

I created a MongoDB CDR backend for asterisk. It is hosted on github[0]
and I tested it on my home asterisk installation.

It depends on mongo-c-driver[1] so I added some building/installation
steps in the README file.

Please, let me know what you think and what can be improved.

I hope you like it.

[0] http://github.com/FlaPer87/cdr_mongodb
[1] http://github.com/mongodb/mongo-c-driver
====================================================================== 

---------------------------------------------------------------------- 
 (0121339) tilghman (administrator) - 2010-05-04 10:15
 https://issues.asterisk.org/view.php?id=17170#c121339 
---------------------------------------------------------------------- 
A couple of things:

1. Your unload routine doesn't actually free the memory allocated by the
module.  It should free all memory and unregister the CDR driver.
2. Please use ast_copy_string in preference to strncpy, as the former
guarantees NULL termination.
3. You should be using the ast_str API to build strings, instead of
strcpy/strcat.
4. I would prefer if your CDR driver scanned the structure of the database
and created an insertion statement to match, instead of relying upon a
static structure.  Most of the CDR drivers are done this way in trunk.
5. You need parentheses around ALL conditionals.  This would save you from
a definite bug at lines 191-193 and 195-197.  The bson_append_string's are
ALWAYS executed here, not as part of the conditional.
6. When using snprintf, the second parameter should always use the
sizeof() construct.  Also, snprintf is safe to receive the entire size of
the buffer.  No -1 offset is needed for this construct.
7. At line 297, you have a programming statement occur at the top of the
block, which makes the declarations fall to within a block.  Declarations
may only be at the very top of a block, per our programming guidelines. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-05-04 10:15 tilghman       Note Added: 0121339                          
======================================================================




More information about the asterisk-bugs mailing list