Changeset 128

Show
Ignore:
Timestamp:
08/05/07 14:16:17 (1 year ago)
Author:
areski
Message:

FEATURE CHANGE : change say rate - play format : the cost of the call is 7 dollars and 50 cents per minutes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/A2Billing_AGI/libs_a2billing/Class.A2Billing.php

    r127 r128  
    800800                        return -1; 
    801801                } 
    802                 $this->agiconfig['say_rateinitial']=1; 
     802                 
    803803                if ($this->agiconfig['say_rateinitial']==1){ 
    804                         $this -> fct_say_rate ($agi, $RateEngine->ratecard_obj[0][12] * 100);   // say rate in cents 
     804                        $this -> fct_say_rate ($agi, $RateEngine->ratecard_obj[0][12]); 
    805805                } 
    806806                 
     
    12001200 
    12011201        /** 
    1202          *      Function to play the rate in cents 
    1203          *      format : "7 point 5 cents per minute
     1202         *     Function to play the initial rate 
     1203         *  format : "the cost of the call is 7 dollars and 50 cents per minutes
    12041204         * 
    12051205         *  @param object $agi 
     
    12081208         **/ 
    12091209        function fct_say_rate ($agi, $rate){ 
    1210  
    1211                 $this -> debug( WRITELOG, $agi, __FILE__, __LINE__, "[SAY RATE ::> ".$rate."]"); 
    1212  
     1210                 
    12131211                global $currencies_list; 
    1214  
     1212                 
    12151213                if (isset($this->agiconfig['agi_force_currency']) && strlen($this->agiconfig['agi_force_currency'])==3) 
    12161214                {  
     
    12181216                } 
    12191217                 
     1218                $this -> debug( VERBOSE | WRITELOG, $agi, __FILE__, __LINE__, "[CURRENCY : $this->currency]"); 
    12201219                if (!isset($currencies_list[strtoupper($this->currency)][2]) || !is_numeric($currencies_list[strtoupper($this->currency)][2])) $mycur = 1; 
    12211220                else $mycur = $currencies_list[strtoupper($this->currency)][2]; 
    1222                 $rate_cur = $rate / $mycur; 
    1223                 $cents = intval($rate_cur); 
    1224                 $units = round(($rate_cur - $cents) * 1E4); 
    1225                 while ($units != 0 && $units % 10 == 0) $units /= 10; 
    1226                  
    1227                 // say 'the rate is' 
    1228                 //$agi->stream_file('the-rate-is'); 
    1229  
    1230                 $agi->say_number($cents); 
    1231                 if ($units > 0) { 
    1232                         $agi->stream_file('point'); 
    1233                         $agi->say_digits($units); 
    1234                 } 
    1235                 $agi->stream_file('cents-per-minute'); 
     1221                $credit_cur = $rate / $mycur; 
     1222                 
     1223                list($units,$cents)=split('[.]', $credit_cur); 
     1224                if (strlen($cents)>2) $cents=substr($cents,0,2); 
     1225                if ($units=='') $units=0; 
     1226                if ($cents=='') $cents=0; 
     1227                elseif (strlen($cents)==1) $cents.= '0'; 
     1228                 
     1229                if (isset($this->agiconfig['currency_association_internal'][strtolower($this->currency)])){ 
     1230                        $unit_audio = $this->agiconfig['currency_association_internal'][strtolower($this->currency)]; 
     1231                }else{ 
     1232                        $unit_audio = $this->agiconfig['currency_association_internal']['all']; 
     1233                }                                
     1234                $cent_audio = 'prepaid-cents'; 
     1235                 
     1236                 
     1237                // say 'the cost of the call is ' 
     1238                $agi-> stream_file('prepaid-cost-call', '#'); 
     1239                 
     1240                if ($units==0 && $cents==0){ 
     1241                        $agi -> say_number(0);                           
     1242                        $agi -> stream_file($unit_audio, '#'); 
     1243                } else { 
     1244                        if ($units >= 1){ 
     1245                                $agi -> say_number($units); 
     1246                                $agi -> stream_file($unit_audio, '#'); 
     1247                        } 
     1248                         
     1249                        if ($units > 0 && $cents > 0){ 
     1250                                $agi -> stream_file('vm-and', '#'); 
     1251                        } 
     1252                        if ($cents>0){ 
     1253                                $agi -> say_number($cents); 
     1254                                $agi -> stream_file($cent_audio, '#'); 
     1255                        } 
     1256                } 
     1257                // say 'per minutes' 
     1258                $agi-> stream_file('prepaid-per-minutes', '#'); 
    12361259        } 
    12371260 


Google