|
|
|
@ -318,11 +318,11 @@ int medmysql_insert_cdrs(cdr_entry_t *entries, u_int64_t count, struct medmysql_
|
|
|
|
|
|
|
|
|
|
if (batches->cdrs.len == 0) {
|
|
|
|
|
batches->cdrs.len = sprintf(batches->cdrs.str, "insert into cdr (id, update_time, " \
|
|
|
|
|
"source_user_id, source_provider_id, source_user, source_domain, " \
|
|
|
|
|
"source_user_id, source_provider_id, source_external_subscriber_id, source_external_contract_id, source_account_id, source_user, source_domain, " \
|
|
|
|
|
"source_cli, source_clir, "\
|
|
|
|
|
"destination_user_id, destination_provider_id, destination_user, destination_domain, " \
|
|
|
|
|
"destination_user_id, destination_provider_id, destination_external_subscriber_id, destination_external_contract_id, destination_account_id, destination_user, destination_domain, " \
|
|
|
|
|
"destination_user_in, destination_domain_in, destination_user_dialed, " \
|
|
|
|
|
"call_type, call_status, call_code, start_time, duration, call_id, " \
|
|
|
|
|
"peer_auth_user, peer_auth_realm, call_type, call_status, call_code, start_time, duration, call_id, " \
|
|
|
|
|
"carrier_cost, reseller_cost, customer_cost) values ");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -332,17 +332,29 @@ int medmysql_insert_cdrs(cdr_entry_t *entries, u_int64_t count, struct medmysql_
|
|
|
|
|
char str_carrier_cost[32] = "";
|
|
|
|
|
char str_reseller_cost[32] = "";
|
|
|
|
|
char str_customer_cost[32] = "";
|
|
|
|
|
char str_source_accid[32] = "";
|
|
|
|
|
char str_dest_accid[32] = "";
|
|
|
|
|
snprintf(str_source_clir, sizeof(str_source_clir), "%d", e->source_clir);
|
|
|
|
|
snprintf(str_duration, sizeof(str_duration), "%d", e->duration);
|
|
|
|
|
snprintf(str_carrier_cost, sizeof(str_carrier_cost), "%d", e->carrier_cost);
|
|
|
|
|
snprintf(str_reseller_cost, sizeof(str_reseller_cost), "%d", e->reseller_cost);
|
|
|
|
|
snprintf(str_customer_cost, sizeof(str_customer_cost), "%d", e->customer_cost);
|
|
|
|
|
snprintf(str_source_accid, sizeof(str_source_accid), "%d", e->source_account_id);
|
|
|
|
|
snprintf(str_dest_accid, sizeof(str_dest_accid), "%d", e->destination_account_id);
|
|
|
|
|
|
|
|
|
|
CDRPRINT("(NULL, now(), '");
|
|
|
|
|
CDRESCAPE(e->source_user_id);
|
|
|
|
|
CDRPRINT("','");
|
|
|
|
|
CDRESCAPE(e->source_provider_id);
|
|
|
|
|
CDRPRINT("','");
|
|
|
|
|
|
|
|
|
|
CDRESCAPE(e->source_ext_subscriber_id);
|
|
|
|
|
CDRPRINT("','");
|
|
|
|
|
CDRESCAPE(e->source_ext_contract_id);
|
|
|
|
|
CDRPRINT("',");
|
|
|
|
|
CDRESCAPE(str_source_accid);
|
|
|
|
|
CDRPRINT(",'");
|
|
|
|
|
|
|
|
|
|
CDRESCAPE(e->source_user);
|
|
|
|
|
CDRPRINT("','");
|
|
|
|
|
CDRESCAPE(e->source_domain);
|
|
|
|
@ -355,6 +367,12 @@ int medmysql_insert_cdrs(cdr_entry_t *entries, u_int64_t count, struct medmysql_
|
|
|
|
|
CDRPRINT("','");
|
|
|
|
|
CDRESCAPE(e->destination_provider_id);
|
|
|
|
|
CDRPRINT("','");
|
|
|
|
|
CDRESCAPE(e->destination_ext_subscriber_id);
|
|
|
|
|
CDRPRINT("','");
|
|
|
|
|
CDRESCAPE(e->destination_ext_contract_id);
|
|
|
|
|
CDRPRINT("',");
|
|
|
|
|
CDRESCAPE(str_dest_accid);
|
|
|
|
|
CDRPRINT(",'");
|
|
|
|
|
CDRESCAPE(e->destination_user);
|
|
|
|
|
CDRPRINT("','");
|
|
|
|
|
CDRESCAPE(e->destination_domain);
|
|
|
|
@ -365,6 +383,10 @@ int medmysql_insert_cdrs(cdr_entry_t *entries, u_int64_t count, struct medmysql_
|
|
|
|
|
CDRPRINT("','");
|
|
|
|
|
CDRESCAPE(e->destination_dialed);
|
|
|
|
|
CDRPRINT("','");
|
|
|
|
|
CDRESCAPE(e->peer_auth_user);
|
|
|
|
|
CDRPRINT("','");
|
|
|
|
|
CDRESCAPE(e->peer_auth_realm);
|
|
|
|
|
CDRPRINT("','");
|
|
|
|
|
CDRESCAPE(e->call_type);
|
|
|
|
|
CDRPRINT("','");
|
|
|
|
|
CDRESCAPE(e->call_status);
|
|
|
|
|