Skip to content

Commit

Permalink
add cutomerdirectory name in cdr
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathias WOLFF committed Dec 22, 2017
1 parent 4b78b6b commit 114806a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion install/resources/fs/config/scripts/import-csv.pl
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
}
# print " total_cost : $totalcost \n\n";

my $insert_str = "insert into $pg_table (customer_id, customer_ip, uuid, caller_id_number, destination_number, chan_name, start_stamp, answered_stamp, end_stamp, duration, read_codec, write_codec, hangup_cause, hangup_cause_q850, gateway_id, cost_rate, prefix, country, rate, init_block, block_min_duration, lcr_carrier_id_id, ratecard_id_id, lcr_group_id_id, sip_user_agent, sip_rtp_rxstat, sip_rtp_txstat, bleg_uuid, switchname, switch_ipv4, hangup_disposition, effectiv_duration, sip_hangup_cause, effective_duration, billsec, total_sell, total_cost, sell_destination, cost_destination, customerdirectory_id_id) values ( \'".$fields[0]."\', \'".$fields[1]."\', \'".$fields[2]."\', \'".$fields[3]."\', \'".$fields[4]."\', \'".$fields[5]."\', \'".$fields[6]."\', ".$fields[7].", \'".$fields[8]."\', \'".$fields[9]."\', \'".$fields[10]."\', \'".$fields[11]."\', \'".$fields[12]."\', \'".$fields[13]."\', ".$fields[14].", \'".$fields[15]."\', \'".$fields[16]."\', \'".$fields[17]."\', \'".$fields[18]."\', \'".$fields[19]."\', \'".$fields[20]."\', ".$fields[21].", ".$fields[22].", ".$fields[23].", \'".$fields[24]."\', \'".$fields[25]."\', \'".$fields[26]."\', \'".$fields[27]."\', \'".$host."\', \'".$addr."\', \'".$fields[30]."\', \'".$fields[31]."\', \'".$fields[32]."\', \'".$effectiveduration."\', \'".$billsec."\', \'".$totalsell."\', \'".$totalcost."\', \'".$fields[33]."\', \'".$fields[34]."\', \'".$fields[35]."\');";
my $insert_str = "insert into $pg_table (customer_id, customer_ip, uuid, caller_id_number, destination_number, chan_name, start_stamp, answered_stamp, end_stamp, duration, read_codec, write_codec, hangup_cause, hangup_cause_q850, gateway_id, cost_rate, prefix, country, rate, init_block, block_min_duration, lcr_carrier_id_id, ratecard_id_id, lcr_group_id_id, sip_user_agent, sip_rtp_rxstat, sip_rtp_txstat, bleg_uuid, switchname, switch_ipv4, hangup_disposition, effectiv_duration, sip_hangup_cause, effective_duration, billsec, total_sell, total_cost, sell_destination, cost_destination, customerdirectory_id) values ( \'".$fields[0]."\', \'".$fields[1]."\', \'".$fields[2]."\', \'".$fields[3]."\', \'".$fields[4]."\', \'".$fields[5]."\', \'".$fields[6]."\', ".$fields[7].", \'".$fields[8]."\', \'".$fields[9]."\', \'".$fields[10]."\', \'".$fields[11]."\', \'".$fields[12]."\', \'".$fields[13]."\', ".$fields[14].", \'".$fields[15]."\', \'".$fields[16]."\', \'".$fields[17]."\', \'".$fields[18]."\', \'".$fields[19]."\', \'".$fields[20]."\', ".$fields[21].", ".$fields[22].", ".$fields[23].", \'".$fields[24]."\', \'".$fields[25]."\', \'".$fields[26]."\', \'".$fields[27]."\', \'".$host."\', \'".$addr."\', \'".$fields[30]."\', \'".$fields[31]."\', \'".$fields[32]."\', \'".$effectiveduration."\', \'".$billsec."\', \'".$totalsell."\', \'".$totalcost."\', \'".$fields[33]."\', \'".$fields[34]."\', \'".$fields[35]."\');";
# print $insert_str."\n";
my $sth = $dbh->prepare($insert_str);
$sth->execute();
Expand Down
2 changes: 1 addition & 1 deletion install/resources/fs/config/scripts/pyfreebilling_dp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ if (session:ready() == true) then
log("No corresponding destnum sip account found for didout", "warning")
else
execute("set", "sip_h_X-PyFB-SIPAccountId=" .. dnsipcode["name"])
myvarbridge = myvarbridge .. ",sip_account_id="..dnsipcode["trunk_id"]
myvarbridge = myvarbridge .. ",sip_account_id="..dnsipcode["name"]
end
end
myvarbridge = myvarbridge .. ",nibble_increment="..rate["block_min_duration"]
Expand Down
7 changes: 5 additions & 2 deletions pyfreebilling/cdr/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ class CDR(models.Model):
max_length=10,
help_text=_(u"""Postal code, INSEE code ... for routing
urgency number to the right urgency call center."""))
customerdirectory_id = models.ForeignKey(
CustomerDirectory,
customerdirectory_id = models.CharField(
max_length=50,
null=True,
verbose_name=_(u"sip account"))
rctype = models.CharField(
Expand All @@ -251,6 +251,9 @@ class Meta:
db_table = 'cdr'
app_label = 'cdr'
ordering = ('start_stamp', 'customer')
indexes = [
models.Index(fields=['customerdirectory_id']),
]
verbose_name = _(u"CDR")
verbose_name_plural = _(u"CDRs")

Expand Down

0 comments on commit 114806a

Please sign in to comment.