Changeset 2745

Show
Ignore:
Timestamp:
02/16/10 12:09:40 (2 years ago)
Author:
areski
Message:

Feature : add setting on agi-conf callback_reduce_balance - Define the amount to reduce the balance on Callback

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/AGI/a2billing.php

    r2702 r2745  
    4040error_reporting(E_ALL ^ (E_NOTICE | E_WARNING)); 
    4141 
    42 include_once (dirname(__FILE__)."/lib/Class.Table.php"); 
     42include (dirname(__FILE__)."/lib/Class.Table.php"); 
    4343include (dirname(__FILE__)."/lib/Class.A2Billing.php"); 
    4444include (dirname(__FILE__)."/lib/Class.RateEngine.php"); 
     
    820820                        // DIVIDE THE AMOUNT OF CREDIT BY 2 IN ORDER TO AVOID NEGATIVE BALANCE IF THE USER USE ALL HIS CREDIT 
    821821                        $orig_credit = $A2B -> credit; 
    822                         $A2B -> credit = $A2B->credit / 2; 
     822 
     823                        if ($A2B->agiconfig['callback_reduce_balance'] > 0 && $A2B->credit > $A2B->agiconfig['callback_reduce_balance']) { 
     824                                $A2B->credit = $A2B->credit - $A2B->agiconfig['callback_reduce_balance']; 
     825                        } else { 
     826                                $A2B->credit = $A2B->credit / 2; 
     827                        } 
    823828                         
    824829                        $stat_channel = $agi->channel_status($A2B-> channel); 
     
    826831                                                        "[status_channel=$status_channel]:[ORIG_CREDIT : ".$orig_credit." - CUR_CREDIT - : ".$A2B -> credit. 
    827832                                                        " - CREDIT MIN_CREDIT_2CALL : ".$A2B->agiconfig['min_credit_2call']."]"); 
    828  
    829                         //if ($stat_channel["result"]!= $status_channel && ($A2B -> CC_TESTING!=1)) { 
    830                         //      break; 
    831                         //} 
    832  
     833                         
    833834                        if( !$A2B->enough_credit_to_call()) { 
    834835                                // SAY TO THE CALLER THAT IT DEOSNT HAVE ENOUGH CREDIT TO MAKE A CALL 
  • trunk/DataBase/mysql-5.x/UPDATE-a2billing-v1.5.1-to-v1.6.0.sql

    r2737 r2745  
    139139 
    140140 
     141 
     142INSERT INTO cc_config ( config_title, config_key, config_value, config_description, config_valuetype, config_listvalues, config_group_title) VALUES 
     143( 'Callback Reduce Balance', 'callback_reduce_balance', '1', 'Define the amount to reduce the balance on Callback in order to make sure that the B leg wont alter the account into a negative value.', 0, NULL, 'agi-conf1'); 
     144 
     145 
    141146UPDATE cc_version SET version = '1.6.0'; 
    142147