Thread: [Astpp-commit] SF.net SVN: astpp:[2232] trunk/scripts/astpp-common.pl
Brought to you by:
darrenkw
From: <dar...@us...> - 2009-02-03 17:15:26
|
Revision: 2232 http://astpp.svn.sourceforge.net/astpp/?rev=2232&view=rev Author: darrenkw Date: 2009-02-03 17:15:20 +0000 (Tue, 03 Feb 2009) Log Message: ----------- Corrected code so that calls where an accountcode does not exist in ASTPP will be marked as being in error. Modified Paths: -------------- trunk/scripts/astpp-common.pl Modified: trunk/scripts/astpp-common.pl =================================================================== --- trunk/scripts/astpp-common.pl 2009-02-02 19:43:38 UTC (rev 2231) +++ trunk/scripts/astpp-common.pl 2009-02-03 17:15:20 UTC (rev 2232) @@ -1727,6 +1727,7 @@ $record = &get_did($astpp_db,$destination) if $carddata->{reseller} eq ""; $record->{comment} = $record->{city} . "," . $record->{province} . "," . $record->{country}; $record->{pattern} = "DID:" . $destination; + $record->{pricelist} = $pricelist; my $branddata = &get_pricelist( $astpp_db, $pricelist); print STDERR "pattern: $record->{pattern}\n" if $record->{pattern}; } @@ -3519,7 +3520,7 @@ my ($astpp_db) = @_; my ( $sql, @brandlist, $result ); $sql = - $astpp_db->prepare("SELECT name FROM callingcardbrands WHERE status = 1 AND reseller IN (NULL,'')"); + $astpp_db->prepare("SELECT name FROM callingcardbrands WHERE status = 1 AND (reseller IS NULL OR reseller = '')"); $sql->execute; while ( $result = $sql->fetchrow_hashref ) { push @brandlist, $result->{name}; @@ -3936,7 +3937,7 @@ $cdr_db->do("UPDATE $config->{asterisk_cdr_table} SET vendor = '0' WHERE disposition REGEXP 'CANCEL'"); } if ($config->{thirdlane_mods} == 1) { - $cdr_db->do("UPDATE cdr SET accountcode = userfield WHERE accountcode IN ('',NULL)"); + $cdr_db->do("UPDATE cdr SET accountcode = userfield WHERE (accountcode IS NULL or accountcode = '')"); } } } @@ -4206,11 +4207,11 @@ print STDERR "disposition: $cdrinfo->{disposition}\n"; print STDERR "----------------------\n"; if(!$vars) { - my $tmp = "UPDATE $config->{asterisk_cdr_table} SET cost = 'none' WHERE uniqueid = " + my $tmp = "UPDATE $config->{asterisk_cdr_table} SET cost = 'error' WHERE uniqueid = " . $uniqueid . " AND cost = 'rating' LIMIT 1"; $cdr_db->do($tmp); } else { - $cdrinfo->{cost} = 'none'; + $cdrinfo->{cost} = 'error'; } } } @@ -4356,13 +4357,13 @@ if (!$sweep || $sweep eq "" ) { $sql = $astpp_db->prepare( -"SELECT number FROM accounts WHERE status < 2 AND reseller IN (NULL,'') AND posttoexternal = 0 " +"SELECT number FROM accounts WHERE status < 2 AND (reseller IS NULL OR reseller = '') AND posttoexternal = 0 " ); } else { $sql = $astpp_db->prepare( -"SELECT number FROM accounts WHERE status < 2 AND reseller IN (NULL,'') AND sweep = " +"SELECT number FROM accounts WHERE status < 2 AND ( reseller IS NULL OR reseller = '') AND sweep = " . $astpp_db->quote($sweep) ); } $sql->execute; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dar...@us...> - 2009-10-02 18:51:18
|
Revision: 2269 http://astpp.svn.sourceforge.net/astpp/?rev=2269&view=rev Author: darrenkw Date: 2009-10-02 18:32:24 +0000 (Fri, 02 Oct 2009) Log Message: ----------- There was an error in the available credit calculations resulting in calls being refused. Modified Paths: -------------- trunk/scripts/astpp-common.pl Modified: trunk/scripts/astpp-common.pl =================================================================== --- trunk/scripts/astpp-common.pl 2009-10-02 16:22:27 UTC (rev 2268) +++ trunk/scripts/astpp-common.pl 2009-10-02 18:32:24 UTC (rev 2269) @@ -3750,11 +3750,12 @@ } print STDERR "Found pattern: $numdata->{pattern}\n" if $config->{debug} == 1; $credit = &accountbalance( $astpp_db, $carddata->{number} ); # Find the available credit to the customer. - print STDERR "Account Balance: $credit" if $config->{debug} == 1; - $credit_limit = $carddata->{credit_limit}; + print STDERR "Account Balance: " . $credit * 10000 if $config->{debug} == 1; + $credit_limit = $carddata->{credit_limit} * 10000; print STDERR "Credit Limit: $credit_limit" if $config->{debug} == 1; - $credit = ($credit * -1) + ($carddata->{credit_limit}); # Add on the accounts credit limit. + $credit = ($credit * -1) + ($credit_limit); # Add on the accounts credit limit. #$credit = $credit / $carddata->{maxchannels} if $carddata->{maxchannels} > 0; + print STDERR "Credit: $credit \n" if $config->{debug} == 1; if ($branddata->{markup} > 0) { $numdata->{connectcost} = $numdata->{connectcost} * ( ( $branddata->{markup} / 10000 ) + 1 ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dar...@us...> - 2009-10-06 03:54:43
|
Revision: 2281 http://astpp.svn.sourceforge.net/astpp/?rev=2281&view=rev Author: darrenkw Date: 2009-10-06 03:54:35 +0000 (Tue, 06 Oct 2009) Log Message: ----------- Clean up the account balance calculations. Modified Paths: -------------- trunk/scripts/astpp-common.pl Modified: trunk/scripts/astpp-common.pl =================================================================== --- trunk/scripts/astpp-common.pl 2009-10-06 03:43:17 UTC (rev 2280) +++ trunk/scripts/astpp-common.pl 2009-10-06 03:54:35 UTC (rev 2281) @@ -1777,7 +1777,7 @@ . $astpp_db->quote($destination) . " RLIKE pattern AND pricelist = " . $astpp_db->quote($pricelist) - . " ORDER BY LENGTH(pattern) DESC"; + . " ORDER BY LENGTH(pattern) DESC LIMIT 1"; print STDERR "$tmp\n" if $config->{debug} == 1; $sql = $astpp_db->prepare($tmp); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dar...@us...> - 2009-11-01 00:42:48
|
Revision: 2297 http://astpp.svn.sourceforge.net/astpp/?rev=2297&view=rev Author: darrenkw Date: 2009-11-01 00:13:47 +0000 (Sun, 01 Nov 2009) Log Message: ----------- Fixed a problem preventing the regular expression from editing the accountcode. Modified Paths: -------------- trunk/scripts/astpp-common.pl Modified: trunk/scripts/astpp-common.pl =================================================================== --- trunk/scripts/astpp-common.pl 2009-10-31 23:55:34 UTC (rev 2296) +++ trunk/scripts/astpp-common.pl 2009-11-01 00:13:47 UTC (rev 2297) @@ -4250,7 +4250,10 @@ $cdrinfo->{dst} = $did; } if ($config->{cdr_regex_accountcode}) { - $cdrinfo->{accountcode} =~ $config->{cdr_regex_accountcode}; + print STDERR "Modify Accountcode\n"; + print STDERR "Original: " . $cdrinfo->{accountcode}; + $cdrinfo->{accountcode} =~ s/$config->{cdr_regex_accountcode}//mg; + print STDERR "Modified: " . $cdrinfo->{accountcode}; } my $carddata = &get_account( $astpp_db, $cdrinfo->{accountcode} ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dar...@us...> - 2010-10-14 02:08:37
|
Revision: 2320 http://astpp.svn.sourceforge.net/astpp/?rev=2320&view=rev Author: darrenkw Date: 2010-10-14 02:08:31 +0000 (Thu, 14 Oct 2010) Log Message: ----------- get_charges sql code was incorrect. It was returning count rather than the list. Modified Paths: -------------- trunk/scripts/astpp-common.pl Modified: trunk/scripts/astpp-common.pl =================================================================== --- trunk/scripts/astpp-common.pl 2010-09-29 03:40:36 UTC (rev 2319) +++ trunk/scripts/astpp-common.pl 2010-10-14 02:08:31 UTC (rev 2320) @@ -5006,7 +5006,7 @@ my ( $tmp,$sql, @chargelist, $record ); if ($params->{startdate} && $params->{enddate}) { $tmp = - "SELECT COUNT(*) FROM cdrs WHERE cardnum = " + "SELECT * FROM cdrs WHERE cardnum = " . $astpp_db->quote($account) . " AND status = 0" . " AND callstart >= DATE(" . $astpp_db->quote($params->{startdate}) . ")" @@ -5014,21 +5014,21 @@ . " ORDER BY callstart"; } elsif ($params->{startdate}) { $tmp = - "SELECT COUNT(*) FROM cdrs WHERE cardnum = " + "SELECT * FROM cdrs WHERE cardnum = " . $astpp_db->quote($account) . " AND status = 0" . " AND callstart >= DATE(" . $astpp_db->quote($params->{startdate}) . ")" . " ORDER BY callstart"; } elsif ($params->{enddate}) { $tmp = - "SELECT COUNT(*) FROM cdrs WHERE cardnum = " + "SELECT * FROM cdrs WHERE cardnum = " . $astpp_db->quote($account) . " AND status = 0" . " AND callstart <= DATE(" . $astpp_db->quote($params->{enddate}) . ")" . " ORDER BY callstart"; } else { $tmp = - "SELECT COUNT(*) FROM cdrs WHERE cardnum = " + "SELECT * FROM cdrs WHERE cardnum = " . $astpp_db->quote($account) . " AND status = 0" . " ORDER BY callstart"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dar...@us...> - 2010-12-31 02:39:27
|
Revision: 2325 http://astpp.svn.sourceforge.net/astpp/?rev=2325&view=rev Author: darrenkw Date: 2010-12-31 02:39:20 +0000 (Fri, 31 Dec 2010) Log Message: ----------- The code to return a correct rate was returing routes that had been disabled. This is incorrect and has been fixed. Modified Paths: -------------- trunk/scripts/astpp-common.pl Modified: trunk/scripts/astpp-common.pl =================================================================== --- trunk/scripts/astpp-common.pl 2010-12-31 02:09:29 UTC (rev 2324) +++ trunk/scripts/astpp-common.pl 2010-12-31 02:39:20 UTC (rev 2325) @@ -1775,7 +1775,7 @@ my ($tmp,$sql,$record); $tmp = "SELECT * FROM routes WHERE " . $astpp_db->quote($destination) - . " RLIKE pattern AND pricelist = " + . " RLIKE pattern AND status = 1 AND pricelist = " . $astpp_db->quote($pricelist) . " ORDER BY LENGTH(pattern) DESC LIMIT 1"; print STDERR "$tmp\n" if $config->{debug} == 1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dar...@us...> - 2011-01-15 21:48:04
|
Revision: 2331 http://astpp.svn.sourceforge.net/astpp/?rev=2331&view=rev Author: darrenkw Date: 2011-01-15 21:47:57 +0000 (Sat, 15 Jan 2011) Log Message: ----------- Add more FreeSWITCH support esp vendor rating support. Modified Paths: -------------- trunk/scripts/astpp-common.pl Modified: trunk/scripts/astpp-common.pl =================================================================== --- trunk/scripts/astpp-common.pl 2011-01-15 21:45:05 UTC (rev 2330) +++ trunk/scripts/astpp-common.pl 2011-01-15 21:47:57 UTC (rev 2331) @@ -98,6 +98,7 @@ . $astpp_db->quote($status) . " WHERE cardnumber = " . $astpp_db->quote( $cardinfo->{cardnumber} ); + print STDERR $sql ."\n"; $astpp_db->do($sql); } @@ -1256,7 +1257,7 @@ my $didinfo = &get_did_reseller($astpp_db,$did,$accountdata->{reseller}); my $did_min_available = $didinfo->{monthlycost} + $didinfo->{setup} + $didinfo->{disconnectionfee}; my $credit = &accountbalance( $astpp_db, $accountdata->{number} ); # Find the available credit to the customer. - print STDERR "Account Balance: $credit" if $config->{debug} == 1; + print STDERR "Account Balance: " . $credit . "\n" if $config->{debug} == 1; $credit = ($credit * -1) + ($accountdata->{credit_limit}); # Add on the accounts credit limit. if ($credit < $did_min_available) { return gettext ("Account: " . $accountdata->{number} . " does not have enough funds available."); @@ -1305,7 +1306,7 @@ } else { my $did_min_available = $didinfo->{monthlycost} + $didinfo->{setup} + $didinfo->{disconnectionfee}; my $credit = &accountbalance( $astpp_db, $accountinfo->{number} ); # Find the available credit to the customer. - print STDERR "Account Balance: $credit" if $config->{debug} == 1; + print STDERR "Account Balance: " . $credit . "\n" if $config->{debug} == 1; $credit = ($credit * -1) + ($accountinfo->{credit_limit}); # Add on the accounts credit limit. if ($credit < $did_min_available) { return gettext ("Account: " . $accountinfo->{number} . " does not have enough funds available."); @@ -1846,9 +1847,9 @@ $record = &search_for_route($astpp_db,$config,$destination,$config->{default_brand}); print STDERR "pattern: $record->{pattern}\n" if $record->{pattern}; } - print STDERR "Route: $record->{comment} Cost: $record->{cost} Pricelist: $record->{pricelist} Pattern: $record->{pattern}\n" if $record; + print STDERR "Route: $record->{comment} Cost: $record->{cost} Pricelist: $record->{pricelist} Pattern: $record->{pattern}\n" if $record->{pattern}; } - if ( $record->{inc} eq "" || $record->{inc} == 0 ) { + if ($record->{inc} &&( $record->{inc} eq "" || $record->{inc} == 0 )) { my $branddata = &get_pricelist( $astpp_db, $pricelist); $record->{inc} = $branddata->{inc}; } @@ -3750,12 +3751,12 @@ } print STDERR "Found pattern: $numdata->{pattern}\n" if $config->{debug} == 1; $credit = &accountbalance( $astpp_db, $carddata->{number} ); # Find the available credit to the customer. - print STDERR "Account Balance: " . $credit * 10000 if $config->{debug} == 1; + print STDERR "Account Balance: " . $credit * 10000 . "\n" if $config->{debug} == 1; $credit_limit = $carddata->{credit_limit} * 10000; - print STDERR "Credit Limit: $credit_limit" if $config->{debug} == 1; + print STDERR "Credit Limit: " . $credit_limit . "\n" if $config->{debug} == 1; $credit = ($credit * -1) + ($credit_limit); # Add on the accounts credit limit. #$credit = $credit / $carddata->{maxchannels} if $carddata->{maxchannels} > 0; - print STDERR "Credit: $credit \n" if $config->{debug} == 1; + print STDERR "Credit: " . $credit . "\n" if $config->{debug} == 1; if ($branddata->{markup} > 0) { $numdata->{connectcost} = $numdata->{connectcost} * ( ( $branddata->{markup} / 10000 ) + 1 ); @@ -3767,22 +3768,15 @@ } if ( $numdata->{cost} > 0 ) { $maxlength = ( ( $credit - $numdata->{connectcost} ) / $numdata->{cost} ); - if ($config->{call_max_length} && $maxlength < $config->{call_max_length} / 1000){ + if ($config->{call_max_length} && ($maxlength > $config->{call_max_length} / 1000)){ + print STDERR "LIMITING CALL TO CONFIG MAX LENGTH \n" if $config->{debug} == 1; $maxlength = $config->{call_max_length} / 1000 / 60; } } else { + print STDERR "CALL IS FREE - ASSIGNING MAX LENGHT \n" if $config->{debug} == 1; $maxlength = $config->{max_free_length}; # If the call is set to be free then assign a max length. } - if ( $numdata->{cost} > 0 ) { - $maxlength = ( ( $credit - $numdata->{connectcost} ) / $numdata->{cost} ); - if ($config->{call_max_length} && $maxlength < $config->{call_max_length} / 1000){ - $maxlength = $config->{call_max_length} / 1000 / 60; - } - } - else { - $maxlength = $config->{max_free_length}; # If the call is set to be free then assign a max length. - } return (1, $maxlength); } @@ -3887,7 +3881,7 @@ $sound->{cardnumber_incorrect} = $location . "astpp-badaccount.gsm"; #Incorrect card number. $sound->{pin} = $location . "astpp-pleasepin.gsm"; #Please enter your pin followed by pound. $sound->{pin_incorrect} = $location . "astpp-invalidpin.gsm"; #Incorrect pin. -$sound->{goodbye} = $location . "goodbye.gsm"; #Goodbye. +$sound->{goodbye} = $location . "conf-goodbye.wav"; #Goodbye. $sound->{destination} = $location . "astpp-phonenum.gsm"; #Please enter the number you wish to dial followed by pound. $sound->{destination_incorrect} = $location . "astcc-badphone.gsm"; #Phone number not found! $sound->{card_inuse} = $location . "astpp-in-use.gsm"; #This card is presently being used. @@ -3898,7 +3892,9 @@ $sound->{sub_currency_plural} = $location . "astpp-cents.gsm"; #cents $sound->{per} = $location . "astpp-per.gsm"; #per $sound->{minute} = $location . "astpp-minute.gsm"; #Minute -$sound->{minutes} = $location . "astpp-minutes.gsm"; #Minutes +#Changed By Joseph Watson +#$sound->{minutes} = $location . "astpp-minutes.gsm"; #Minutes +$sound->{minutes} = $location . "minutes.wav"; #Minutes $sound->{second} = $location . "astpp-second.gsm"; #Second $sound->{seconds} = $location . "astpp-seconds.gsm"; #Seconds $sound->{a_connect_charge} = $location . "astpp-connectcharge.gsm"; #A connect charge of @@ -3918,7 +3914,7 @@ $sound->{noanswer} = $location . "astpp-noanswer-tryagain.gsm"; #There was no answer, Press 1 to try again. $sound->{badnumber} = $location . "astpp-badnumber.gsm"; # "Calls from this location are blocked!" $sound->{used_elsewhere} = $location . "astpp-used-elsewhere.gsm"; # "This location has been used already." -$sound->{goodbye} = $location . "goodbye.gsm"; # "Goodbye" +$sound->{goodbye} = $location . "conf-goodbye.wav"; # "Goodbye" $sound->{callback_performed} = $location . "astpp-callback-performed.gsm"; # "This callback has been performed please disconnect now" $sound->{cardnumber} = $location . "astpp-accountnum.gsm"; #Please enter your card number followed by pound. $sound->{cardnumber_incorrect} = $location . "astpp-badaccount.gsm"; #Incorrect card number. @@ -3927,7 +3923,7 @@ $sound->{point} = $location . "astcc-point.gsm"; #point. $sound->{register_ani} = $location . "astpp-register.gsm"; # "Register ANI to this card? Press 1 for yes or any other key for no." $sound->{card_has_expired} = $location . "astpp_expired.gsm"; #"This card has expired" -$sound->{card_is_empty} = $location . "astpp-empty.gsm"; #This card is empty +$sound->{card_is_empty} = $location . "astpp-card-is-empty.gsm"; #This card is empty $sound->{where_to_call} = $location . "astpp-where-to-call.gsm" ; #Press 1 to receive a call at the number you called from or registered @@ -3996,37 +3992,23 @@ ######## Call Rating ################################ sub cleanup_cdrs_fs() { my ($cdr_db, $config) = @_; - $cdr_db->do("UPDATE $config->{freeswitch_cdr_table} SET cost = '0' WHERE disposition REGEXP 'ORIGINATOR_CANCEL'"); - $cdr_db->do("UPDATE $config->{freeswitch_cdr_table} SET cost = '0' WHERE disposition REGEXP 'CALL_REJECTED'"); - $cdr_db->do("UPDATE $config->{freeswitch_cdr_table} SET cost = '0' WHERE disposition REGEXP 'USER_NOT_REGISTERED'"); - $cdr_db->do("UPDATE $config->{freeswitch_cdr_table} SET cost = '0' WHERE disposition REGEXP 'CHAN_NOT_IMPLEMENTED'"); - $cdr_db->do("UPDATE $config->{freeswitch_cdr_table} SET cost = '0' WHERE disposition REGEXP 'INVALID_NUMBER_FORMAT'"); - $cdr_db->do("UPDATE $config->{freeswitch_cdr_table} SET cost = '0' WHERE disposition REGEXP 'UNALLOCATED_NUMBER'"); - if ($config->{trackvendorcharges} == 1) { - $cdr_db->do("UPDATE $config->{freeswitch_cdr_table} SET vendor = '0' WHERE disposition REGEXP 'ORIGINATOR_CANCEL'"); - $cdr_db->do("UPDATE $config->{freeswitch_cdr_table} SET vendor = '0' WHERE disposition REGEXP 'CALL_REJECTED'"); - $cdr_db->do("UPDATE $config->{freeswitch_cdr_table} SET vendor = '0' WHERE disposition REGEXP 'USER_NOT_REGISTERED'"); - $cdr_db->do("UPDATE $config->{freeswitch_cdr_table} SET vendor = '0' WHERE disposition REGEXP 'CHAN_NOT_IMPLEMENTED'"); - $cdr_db->do("UPDATE $config->{freeswitch_cdr_table} SET vendor = '0' WHERE disposition REGEXP 'INVALID_NUMBER_FORMAT'"); - $cdr_db->do("UPDATE $config->{freeswitch_cdr_table} SET cost = '0' WHERE disposition REGEXP 'UNALLOCATED_NUMBER'"); - } + $cdr_db->do("UPDATE $config->{freeswitch_cdr_table} SET cost = '0',vendor='0' WHERE disposition REGEXP 'ORIGINATOR_CANCEL'"); + $cdr_db->do("UPDATE $config->{freeswitch_cdr_table} SET cost = '0',vendor='0' WHERE disposition REGEXP 'CALL_REJECTED'"); + $cdr_db->do("UPDATE $config->{freeswitch_cdr_table} SET cost = '0',vendor='0' WHERE disposition REGEXP 'USER_NOT_REGISTERED'"); + $cdr_db->do("UPDATE $config->{freeswitch_cdr_table} SET cost = '0',vendor='0' WHERE disposition REGEXP 'CHAN_NOT_IMPLEMENTED'"); + $cdr_db->do("UPDATE $config->{freeswitch_cdr_table} SET cost = '0',vendor='0' WHERE disposition REGEXP 'INVALID_NUMBER_FORMAT'"); + $cdr_db->do("UPDATE $config->{freeswitch_cdr_table} SET cost = '0',vendor='0' WHERE disposition REGEXP 'NORMAL_TEMPORARY_FAILURE'"); + $cdr_db->do("UPDATE $config->{freeswitch_cdr_table} SET cost = '0',vendor='0' WHERE duration = '0' and billsec='0'"); } sub cleanup_cdrs() { my ($cdr_db, $config) = @_; # First we cleanup all calls that are not answered if ($config->{astcdr} == 1) { - $cdr_db->do("UPDATE $config->{asterisk_cdr_table} SET cost = '0' WHERE disposition REGEXP 'NO ANSWER'"); - $cdr_db->do("UPDATE $config->{asterisk_cdr_table} SET cost = '0' WHERE disposition REGEXP 'BUSY'"); - $cdr_db->do("UPDATE $config->{asterisk_cdr_table} SET cost = '0' WHERE disposition REGEXP 'FAILED'"); - $cdr_db->do("UPDATE $config->{asterisk_cdr_table} SET cost = '0' WHERE disposition REGEXP 'CONGESTION'"); - $cdr_db->do("UPDATE $config->{asterisk_cdr_table} SET cost = '0' WHERE disposition REGEXP 'CANCEL'"); - if ($config->{trackvendorcharges} == 1) { - $cdr_db->do("UPDATE $config->{asterisk_cdr_table} SET vendor = '0' WHERE disposition REGEXP 'NO ANSWER'"); - $cdr_db->do("UPDATE $config->{asterisk_cdr_table} SET vendor = '0' WHERE disposition REGEXP 'BUSY'"); - $cdr_db->do("UPDATE $config->{asterisk_cdr_table} SET vendor = '0' WHERE disposition REGEXP 'FAILED'"); - $cdr_db->do("UPDATE $config->{asterisk_cdr_table} SET vendor = '0' WHERE disposition REGEXP 'CONGESTION'"); - $cdr_db->do("UPDATE $config->{asterisk_cdr_table} SET vendor = '0' WHERE disposition REGEXP 'CANCEL'"); - } + $cdr_db->do("UPDATE $config->{asterisk_cdr_table} SET cost = '0',vendor='0' WHERE disposition REGEXP 'NO ANSWER'"); + $cdr_db->do("UPDATE $config->{asterisk_cdr_table} SET cost = '0',vendor='0' WHERE disposition REGEXP 'BUSY'"); + $cdr_db->do("UPDATE $config->{asterisk_cdr_table} SET cost = '0',vendor='0' WHERE disposition REGEXP 'FAILED'"); + $cdr_db->do("UPDATE $config->{asterisk_cdr_table} SET cost = '0',vendor='0' WHERE disposition REGEXP 'CONGESTION'"); + $cdr_db->do("UPDATE $config->{asterisk_cdr_table} SET cost = '0',vendor='0' WHERE disposition REGEXP 'CANCEL'"); if ($config->{thirdlane_mods} == 1) { $cdr_db->do("UPDATE $config->{cdr_table} SET accountcode = userfield WHERE (accountcode IS NULL or accountcode = '')"); } @@ -4058,6 +4040,7 @@ sub rating() { # This routine recieves a specific cdr and takes care of rating it and of marking it as rated. It bills resellers as appropriate. my ( $astpp_db, $cdr_db, $config, $cdrinfo, $carddata, $vars, @output ) = @_; my ( $increment, $numdata, $package, $notes, $status ); + $status = 0; print STDERR "----------------------------------------------------------------\n"; print STDERR "uniqueid: $cdrinfo->{uniqueid}, cardno: $carddata->{number}, phoneno: $cdrinfo->{dst}, Userfield: $cdrinfo->{userfield}\n"; @@ -4070,7 +4053,6 @@ # print STDERR "Destination: $cdrinfo->{dst} \n"; # } $numdata = &get_route( $astpp_db, $config, $cdrinfo->{dst}, $carddata->{pricelist}, $carddata, $cdrinfo->{userfield} ); - print STDERR "PATTERN: $numdata->{pattern}"; if ( !$numdata->{pattern} ) { &save_cdr( $config, $cdr_db, $cdrinfo->{uniqueid}, "error",$cdrinfo->{dst} ) if !$vars && $config->{astcdr} == 1; print STDERR "ERROR - ERROR - ERROR - ERROR - ERROR \n"; @@ -4078,7 +4060,7 @@ print STDERR "----------------------------------------------------------------\n"; } else { - print STDERR "FOUND A MATCHING PATTERN.\n"; + print STDERR "FOUND A MATCHING PATTERN: $numdata->{pattern}"; my $branddata = &get_pricelist( $astpp_db, $carddata->{pricelist} ); print STDERR "pricelistData: $branddata->{name} $branddata->{markup} $branddata->{inc} $branddata->{status}\n"; @@ -4260,6 +4242,7 @@ print STDERR "----------------------\n"; } elsif ( $cdrinfo->{accountcode} ) { + $status = 0; $status = &rating( $astpp_db, $cdr_db,$config, $cdrinfo, $carddata, $vars); $cdrinfo = &get_cdr( $config, $cdr_db, $uniqueid ) if !$vars; if ( $status == 1 ) { @@ -4344,10 +4327,10 @@ my ( $astpp_db, $cdr_db, $config, $phrase, $uniqueid, $vars ) = @_; my ($sql,$tmp); print STDERR "Vendor Rating Uniqueid: " . $uniqueid . "\n"; - if(!$uniqueid) { - $tmp = "SELECT * FROM $config->{freeswitch_cdr_table} WHERE vendor IN ('error','none')"; - } else { + if($uniqueid) { $tmp = "SELECT * FROM $config->{freeswitch_cdr_table} WHERE uniqueid = '$uniqueid'"; + } else { + $tmp = "SELECT * FROM $config->{freeswitch_cdr_table} WHERE vendor IN ('error','none')"; } print STDERR $tmp . "\n" if $config->{debug} == 1; $sql = $cdr_db->prepare($tmp); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |