diff --git a/rate-o-mat.pl b/rate-o-mat.pl index 0a48e52..53bcccf 100755 --- a/rate-o-mat.pl +++ b/rate-o-mat.pl @@ -511,10 +511,7 @@ EOS "offpeak_init_rate, offpeak_init_interval, ". "offpeak_follow_rate, offpeak_follow_interval, ". "billing_zones_history_id, use_free_time ". - "FROM billing.billing_fees_history WHERE billing_profile_id = ? ". - "AND bf_id IS NOT NULL AND type = ? ". - "AND direction = ? AND ? REGEXP(source) AND ? REGEXP(destination) ". - "ORDER BY LENGTH(destination) DESC, LENGTH(source) DESC LIMIT 1" + "FROM billing.billing_fees_history WHERE id = billing.get_billing_fee(?,?,?,?,?,null)" ) or FATAL "Error preparing profile info statement: ".$billdbh->errstr; $sth_lnp_profile_info = $billdbh->prepare( @@ -524,10 +521,7 @@ EOS "offpeak_init_rate, offpeak_init_interval, ". "offpeak_follow_rate, offpeak_follow_interval, ". "billing_zones_history_id, use_free_time ". - "FROM billing.billing_fees_history WHERE billing_profile_id = ? ". - "AND bf_id IS NOT NULL AND type = ? ". - "AND direction = ? AND destination = ? ". - "LIMIT 1" + "FROM billing.billing_fees_history WHERE id = billing.get_billing_fee(?,?,?,null,?,\"exact_destination\")" ) or FATAL "Error preparing LNP profile info statement: ".$billdbh->errstr; $sth_offpeak = $billdbh->prepare("select ". @@ -1471,7 +1465,7 @@ sub get_billing_info { $sth = $sth_billing_info_network; $sth->execute($contract_id, $start, $source_ip) or FATAL "Error executing billing info statement: ".$sth->errstr; - $label = "and $source_ip"; + $label = " and address $source_ip"; } else { $sth = $sth_billing_info; $sth->execute($contract_id, $start) or @@ -2667,6 +2661,9 @@ RATING_DURATION_FOUND: $cdr->{destination_user_id}." for cdr ".$cdr->{id}."\n"; } else { # TODO what about transit calls? + # TODO ngcp 6.5 + # calculate source carrier (peering) costs + # calculate destination carrier (peering) costs } } diff --git a/t/rateomat-34-freecash.t b/t/rateomat-34-freecash.t index 59ff6a8..94f9c40 100644 --- a/t/rateomat-34-freecash.t +++ b/t/rateomat-34-freecash.t @@ -39,7 +39,7 @@ foreach my $prepaid ((0,1)) { #0,1)) { Utils::Api::datetime_from_string($caller->{first_interval}->{stop})); is(Utils::Api::get_cash_balance($caller->{customer})->{ratio},$caller_ratio,"caller ratio $caller_ratio"); - Utils::Api::set_time($begin->clone->add(days => 10)); + #Utils::Api::set_time($begin->clone->add(days => 10)); my $callee = Utils::Api::setup_subscriber($provider,$provider->{subscriber_fees}->[1]->{profile},$balance,{ cc => 888, ac => '2', sn => '' }); my $callee_ratio = _get_free_ratio(Utils::Api::datetime_from_string($callee->{customer}->{create_timestamp}), Utils::Api::datetime_from_string($callee->{first_interval}->{start}),