提交 68e1a563 authored 作者: Brian West's avatar Brian West

FS-4976

上级 6c711253
......@@ -69,6 +69,26 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_cdr_mongodb_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cdr_mongodb_shutdown);
SWITCH_MODULE_DEFINITION(mod_cdr_mongodb, mod_cdr_mongodb_load, mod_cdr_mongodb_shutdown, NULL);
static void bson_append_value(bson *cdr, char *name, char *val)
{
//Check the variable and insert it as int, long int or string depending on it's value
char* endptr;
long int lintValue = strtol(val, &endptr, 10);
if (!*endptr){
int intValue = lintValue;
if(intValue == lintValue){
bson_append_int(cdr, name, intValue);
}else{
bson_append_long(cdr, name, lintValue);
}
} else {
bson_append_string(cdr, name, val);
}
}
static void set_bson_profile_data(bson *b, switch_caller_profile_t *caller_profile)
{
bson_append_string(b, "username", caller_profile->username);
......@@ -162,7 +182,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
if ((hi = switch_channel_variable_first(channel))) {
for (; hi; hi = hi->next) {
if (!zstr(hi->name) && !zstr(hi->value)) {
bson_append_string(&cdr, hi->name, hi->value);
bson_append_value(&cdr, hi->name, hi->value);
}
}
switch_channel_variable_last(channel);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论