Skip to content

Commit

Permalink
Realtime Billing
Browse files Browse the repository at this point in the history
  • Loading branch information
devangn authored Jan 2, 2018
1 parent 39d92b2 commit ffa0de1
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions freeswitch/fs/lib/astpp.cdr.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,13 @@ function get_reseller_cdr_string($dataVariable, $accountid, $account_type, $actu
* @param integer $entity_id
*/
function update_balance($user_id, $amount, $entity_id, $logger, $db) {
/*We already billed everyone by nibble billing */

/*$math_sign = ($entity_id == 0 || $entity_id == 1) ? '-' : '+';
$query = "UPDATE accounts SET balance=IF(posttoexternal=1,balance+" . $amount . ",balance-" . $amount . ") WHERE id=" . $user_id;
$logger->log ( "Balance update : " . $query );
$db->run ( $query );*/
/*If not realtime billing */
if ($this->config ['realtime_billing'] == '1') {
$math_sign = ($entity_id == 0 || $entity_id == 1) ? '-' : '+';
$query = "UPDATE accounts SET balance=IF(posttoexternal=1,balance+" . $amount . ",balance-" . $amount . ") WHERE id=" . $user_id;
$logger->log ( "Balance update : " . $query );
$db->run ( $query );
}
}

// Normalize rate string which we are getting from dialplan
Expand Down

0 comments on commit ffa0de1

Please sign in to comment.