[Astpp-commit] SF.net SVN: astpp:[2260] trunk
Brought to you by:
darrenkw
From: <dar...@us...> - 2009-09-24 01:54:09
|
Revision: 2260 http://astpp.svn.sourceforge.net/astpp/?rev=2260&view=rev Author: darrenkw Date: 2009-09-24 01:53:56 +0000 (Thu, 24 Sep 2009) Log Message: ----------- More Freeswitch improvements especially relating to rating calls. Modified Paths: -------------- trunk/freeswitch/astpp-callingcards.pl trunk/freeswitch/astpp-fs-monitor.pl trunk/modules/ASTPP/lib/ASTPP.pm trunk/scripts/astpp-common.pl trunk/scripts/astpp-rate-engine.pl trunk/templates/account-create.tpl trunk/web_interface/astpp-admin.cgi Modified: trunk/freeswitch/astpp-callingcards.pl =================================================================== --- trunk/freeswitch/astpp-callingcards.pl 2009-09-23 04:31:30 UTC (rev 2259) +++ trunk/freeswitch/astpp-callingcards.pl 2009-09-24 01:53:56 UTC (rev 2260) @@ -472,11 +472,13 @@ $session->execute( "export", "NEWCALL=1" ); $session->execute( "export", "DESTINATION=$stats{destination}" ); &exit_program(); + return 1; } elsif ( $whatnow == 2 ) { $session->execute( "export", "NEWCALL=1" ); $session->execute( "export", "DESTINATION=" ); &exit_program(); + return 1; } elsif ( $whatnow == 3 ) { $session->streamFile( $sound->{goodbye} ); @@ -500,7 +502,8 @@ . $astpp_db->quote( $stats{answered_time} ) . ")" ); $stats{total_time} = tv_interval( $stats{start_time} ); - exit(1); +# exit(1); + return 1; } sub print_console() #Dump string to the console @@ -585,7 +588,8 @@ if ( $cardinfo->{status} != 1 ) { $session->streamFile( $sound->{goodbye} ); $session->hangup(); - exit(1); +# exit(1); + return 1; } } @@ -606,7 +610,8 @@ if ( $pin != $cardinfo->{pin} ) { $session->streamFile( $sound->{pin_incorrect} ); $session->streamFile( $sound->{goodbye} ); - exit(0); +# exit(1); + return 1; } } &check_card($cardinfo) if $cc == 0; Modified: trunk/freeswitch/astpp-fs-monitor.pl =================================================================== --- trunk/freeswitch/astpp-fs-monitor.pl 2009-09-23 04:31:30 UTC (rev 2259) +++ trunk/freeswitch/astpp-fs-monitor.pl 2009-09-24 01:53:56 UTC (rev 2260) @@ -138,6 +138,8 @@ if $myhash->{'variable_last_app'} eq ""; $myhash->{'variable_last_arg'} = "" if $myhash->{'variable_last_arg'} eq ""; + $myhash->{'variable_caller_id'} = "N/A" + if $myhash->{'variable_caller_id'} eq ""; my $tmp = "INSERT INTO `fscdr` (`accountcode`, `src`, `dst`, `dcontext`, `clid`," . "`channel`, `dstchannel`, `lastapp`, `lastdata`, `calldate`, `answerdate`," Modified: trunk/modules/ASTPP/lib/ASTPP.pm =================================================================== --- trunk/modules/ASTPP/lib/ASTPP.pm 2009-09-23 04:31:30 UTC (rev 2259) +++ trunk/modules/ASTPP/lib/ASTPP.pm 2009-09-24 01:53:56 UTC (rev 2260) @@ -582,7 +582,7 @@ sub debug #Prints debugging if appropriate # { -my ($self, %arg) = @_; + my ($self, %arg) = @_; $self->{_verbosity_item_level} = $arg{verbosity} if $arg{verbosity}; print STDERR $arg{debug} . "\n" if $arg{debug} && $self->{_verbosity_item_level} <= $self->{_verbosity_level}; $self->{_asterisk_agi}->verbose($arg{debug} . "\n" , $self->{_verbosity_level}) if $arg{debug} && $self->{_asterisk_agi} && $self->{_verbosity_item_level} <= $self->{_verbosity_level}; Modified: trunk/scripts/astpp-common.pl =================================================================== --- trunk/scripts/astpp-common.pl 2009-09-23 04:31:30 UTC (rev 2259) +++ trunk/scripts/astpp-common.pl 2009-09-24 01:53:56 UTC (rev 2260) @@ -3838,80 +3838,80 @@ my ($astpp_db) = @_; my $sound; $sound->{no_responding} = - "astpp-down"; #The calling card platform is down, please try again later. + "astpp-down.gsm"; #The calling card platform is down, please try again later. $sound->{cardnumber} = - "astpp-accountnum"; #Please enter your card number followed by pound. -$sound->{cardnumber_incorrect} = "astpp-badaccount"; #Incorrect card number. -$sound->{pin} = "astpp-pleasepin"; #Please enter your pin followed by pound. -$sound->{pin_incorrect} = "astpp-invalidpin"; #Incorrect pin. -$sound->{goodbye} = "goodbye"; #Goodbye. + "astpp-accountnum.gsm"; #Please enter your card number followed by pound. +$sound->{cardnumber_incorrect} = "astpp-badaccount.gsm"; #Incorrect card number. +$sound->{pin} = "astpp-pleasepin.gsm"; #Please enter your pin followed by pound. +$sound->{pin_incorrect} = "astpp-invalidpin.gsm"; #Incorrect pin. +$sound->{goodbye} = "goodbye.gsm"; #Goodbye. $sound->{destination} = - "astpp-phonenum"; #Please enter the number you wish to dial followed by pound. -$sound->{destination_incorrect} = "astcc-badphone"; #Phone number not found! -$sound->{card_inuse} = "astpp-in-use"; #This card is presently being used. -$sound->{call_will_cost} = "astpp-willcost"; #This call will cost: -$sound->{main_currency} = "astpp-dollar"; #Dollar -$sound->{sub_currency} = "astpp-cent"; #Cent -$sound->{main_currency_plural} = "astpp-dollars"; #Dollars -$sound->{sub_currency_plural} = "astpp-cents"; #cents -$sound->{per} = "astpp-per"; #per -$sound->{minute} = "astpp-minute"; #Minute -$sound->{minutes} = "astpp-minutes"; #Minutes -$sound->{second} = "astpp-second"; #Second -$sound->{seconds} = "astpp-seconds"; #Seconds -$sound->{a_connect_charge} = "astpp-connectcharge"; #A connect charge of -$sound->{will_apply} = "astpp-willapply"; #Will apply + "astpp-phonenum.gsm"; #Please enter the number you wish to dial followed by pound. +$sound->{destination_incorrect} = "astcc-badphone.gsm"; #Phone number not found! +$sound->{card_inuse} = "astpp-in-use.gsm"; #This card is presently being used. +$sound->{call_will_cost} = "astpp-willcost.gsm"; #This call will cost: +$sound->{main_currency} = "astpp-dollar.gsm"; #Dollar +$sound->{sub_currency} = "astpp-cent.gsm"; #Cent +$sound->{main_currency_plural} = "astpp-dollars.gsm"; #Dollars +$sound->{sub_currency_plural} = "astpp-cents.gsm"; #cents +$sound->{per} = "astpp-per.gsm"; #per +$sound->{minute} = "astpp-minute.gsm"; #Minute +$sound->{minutes} = "astpp-minutes.gsm"; #Minutes +$sound->{second} = "astpp-second.gsm"; #Second +$sound->{seconds} = "astpp-seconds.gsm"; #Seconds +$sound->{a_connect_charge} = "astpp-connectcharge.gsm"; #A connect charge of +$sound->{will_apply} = "astpp-willapply.gsm"; #Will apply $sound->{please_wait_will_connect} = - "astpp-please-wait-while-i-connect"; #Please wait while I connect your call -$sound->{card_is_empty} = "astpp-card-is-empty"; #This card is empty. + "astpp-please-wait-while-i-connect.gsm"; #Please wait while I connect your call +$sound->{card_is_empty} = "astpp-card-is-empty.gsm"; #This card is empty. $sound->{card_has_balance_of} = - "astpp-this-card-has-a-balance-of"; #Card has a balance of: -$sound->{card_has_expired} = "astpp-card-has-expired"; #This card has expired. -$sound->{call_will_last} = "astpp-this-call-will-last"; #This call will last: + "astpp-this-card-has-a-balance-of.gsm"; #Card has a balance of: +$sound->{card_has_expired} = "astpp-card-has-expired.gsm"; #This card has expired. +$sound->{call_will_last} = "astpp-this-call-will-last.gsm"; #This call will last: $sound->{not_enough_credit} = - "astpp-not-enough-credit"; #You do not have enough credit + "astpp-not-enough-credit.gsm"; #You do not have enough credit $sound->{call_completed} = - "astpp-call-completed"; #This call has been completed. + "astpp-call-completed.gsm"; #This call has been completed. $sound->{astpp_callingcard_menu} = - "astpp-callingcard-menu" + "astpp-callingcard-menu.gsm" ; #Press one if you wish to place another call, press 2 for your card balance, or press 3 to hangup -$sound->{busy} = "astpp-busy-tryagain"; #Number was busy, Press 1 to try again. -$sound->{cancelled} = "astpp-cancelled-tryagain"; #Call was cancelled. +$sound->{busy} = "astpp-busy-tryagain.gsm"; #Number was busy, Press 1 to try again. +$sound->{cancelled} = "astpp-cancelled-tryagain.gsm"; #Call was cancelled. $sound->{congested} = - "astpp-congested-tryagain"; #Number was congested, Press 1 to try again. + "astpp-congested-tryagain.gsm"; #Number was congested, Press 1 to try again. $sound->{noanswer} = - "astpp-noanswer-tryagain"; #There was no answer, Press 1 to try again. + "astpp-noanswer-tryagain.gsm"; #There was no answer, Press 1 to try again. $sound->{badnumber} = - "astpp-badnumber"; # "Calls from this location are blocked!" + "astpp-badnumber.gsm"; # "Calls from this location are blocked!" $sound->{used_elsewhere} = - "astpp-used-elsewhere"; # "This location has been used already." -$sound->{goodbye} = "goodbye"; # "Goodbye" + "astpp-used-elsewhere.gsm"; # "This location has been used already." +$sound->{goodbye} = "goodbye.gsm"; # "Goodbye" $sound->{callback_performed} = - "astpp-callback-performed"; # "This callback has been performed please disconnect now" + "astpp-callback-performed.gsm"; # "This callback has been performed please disconnect now" $sound->{cardnumber} = - "astpp-accountnum"; #Please enter your card number followed by pound. -$sound->{cardnumber_incorrect} = "astpp-badaccount"; #Incorrect card number. -$sound->{pin} = "astpp-pleasepin"; #Please enter your pin followed by pound. -$sound->{pin_incorrect} = "astpp-invalidpin"; #Incorrect pin. -$sound->{point} = "astcc-point"; #point. + "astpp-accountnum.gsm"; #Please enter your card number followed by pound. +$sound->{cardnumber_incorrect} = "astpp-badaccount.gsm"; #Incorrect card number. +$sound->{pin} = "astpp-pleasepin.gsm"; #Please enter your pin followed by pound. +$sound->{pin_incorrect} = "astpp-invalidpin.gsm"; #Incorrect pin. +$sound->{point} = "astcc-point.gsm"; #point. $sound->{register_ani} = - "astpp-register" + "astpp-register.gsm" ; # "Register ANI to this card? Press 1 for yes or any other key for no." -$sound->{card_has_expired} = "astpp_expired"; #"This card has expired" -$sound->{card_is_empty} = "astpp-empty"; #This card is empty +$sound->{card_has_expired} = "astpp_expired.gsm"; #"This card has expired" +$sound->{card_is_empty} = "astpp-empty.gsm"; #This card is empty $sound->{where_to_call} = - "astpp-where-to-call" + "astpp-where-to-call.gsm" ; #Press 1 to receive a call at the number you called from or registered #Otherwise enter the number you wish to be called at. $sound->{number_to_register} = - "astpp-number-to-register"; #Press 1 to register the number you called from. + "astpp-number-to-register.gsm"; #Press 1 to register the number you called from. #Otherwise enter the number you wish to register. -$sound->{card_has_been_refilled} = "astpp-card-has-been-refilled"; # Your card has been refilled. -$sound->{card_to_refill} = "astpp-card-to-refill"; #please enter the card number you wish to refill followed +$sound->{card_has_been_refilled} = "astpp-card-has-been-refilled.gsm"; # Your card has been refilled. +$sound->{card_to_refill} = "astpp-card-to-refill.gsm"; #please enter the card number you wish to refill followed # by the pound sign. -$sound->{card_to_empty} = "astpp-card-to-empty"; #please enter the card number you wish to empty into your card +$sound->{card_to_empty} = "astpp-card-to-empty.gsm"; #please enter the card number you wish to empty into your card # followed by the pound sign. -$sound->{astpp_please_pin_card_empty} = "astpp-please-pin-card-empty"; #please enter the pin number for the card +$sound->{astpp_please_pin_card_empty} = "astpp-please-pin-card-empty.gsm"; #please enter the pin number for the card # you wish to empty followed by the pound # sign. return $sound; @@ -3965,6 +3965,21 @@ ######## 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'"); + 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'"); + } +} sub cleanup_cdrs() { my ($cdr_db, $config) = @_; # First we cleanup all calls that are not answered Modified: trunk/scripts/astpp-rate-engine.pl =================================================================== --- trunk/scripts/astpp-rate-engine.pl 2009-09-23 04:31:30 UTC (rev 2259) +++ trunk/scripts/astpp-rate-engine.pl 2009-09-24 01:53:56 UTC (rev 2260) @@ -61,6 +61,7 @@ if ($softswitch eq "freeswitch") { $cdr_table = $config->{freeswitch_cdr_table}; $ASTPP->debug("Rating calls for FreeSwitch", $verbosity); + &cleanup_cdrs_fs($cdr_db, $config); } else { $cdr_table = $config->{asterisk_cdr_table}; $ASTPP->debug("Rating calls for Asterisk", $verbosity); Modified: trunk/templates/account-create.tpl =================================================================== --- trunk/templates/account-create.tpl 2009-09-23 04:31:30 UTC (rev 2259) +++ trunk/templates/account-create.tpl 2009-09-24 01:53:56 UTC (rev 2260) @@ -9,7 +9,7 @@ <td>Password</td> <td>Pricelist</td> <td>Billing Schedule</td> - <td>Credit Limit in<TMPL_VAR NAME="default_currency"></td> + <td>Credit Limit in <TMPL_VAR NAME="default_currency"></td> <td>Timezone</td> </tr> <tr class="rowone"> Modified: trunk/web_interface/astpp-admin.cgi =================================================================== --- trunk/web_interface/astpp-admin.cgi 2009-09-23 04:31:30 UTC (rev 2259) +++ trunk/web_interface/astpp-admin.cgi 2009-09-24 01:53:56 UTC (rev 2260) @@ -157,7 +157,7 @@ my @output = ("STDERR"); # "LOGFILE" ); my @language = all_language_codes; @language = sort @language; -my @currency; +#my @currency; my @deviceprotocol = ("SIP"); my @countries = all_country_names(); @countries = sort @countries; @@ -1421,7 +1421,7 @@ \n"; if ( $params->{answered} == 1 ) { $tmp = - " SELECT * from cdr where disposition = 'ANSWERED'" + " SELECT * from fscdr where disposition IN ('ANSWERED','NORMAL_CLEARING')" . " and calldate >= " . $cdr_db->quote($sd) . " and calldate <= " @@ -1430,7 +1430,7 @@ } else { $tmp = - " SELECT * from cdr where calldate >= " + " SELECT * from fscdr where calldate >= " . $cdr_db->quote($sd) . " and calldate <= " . $cdr_db->quote($ed); @@ -2026,7 +2026,7 @@ push( @account_ip_list, \%row ); } $template->param( account_ip_list => \@account_ip_list ); - $template->param( currency => $currency[0] ); + $template->param( currency => $config->{currency} ); ## List the SIP/IAX2 devices belonging to this account. ## my @account_device_list; @@ -2462,7 +2462,7 @@ freeswitch_context => $config->{freeswitch_context}, vm_password => $params->{accountpassword}, password => $params->{accountpassword}, - sip-ext-prepend => $config->{sip_ext_prepend}, + sip_ext_prepend => $config->{sip_ext_prepend}, ); $status .= "<br>"; if ( $config->{email} == 1 && $params->{accounttype} == 0 ) { @@ -2541,7 +2541,7 @@ $template->param( currency_menu => popup_menu( -name => "currency", - -values => \@currency + -values => $config->{currency} ) ); $template->param( @@ -2567,6 +2567,7 @@ ) ); $template->param( status => $status ); + $template->param( default_currency => $config->{currency} ); return $template->output; } @@ -3417,7 +3418,7 @@ . gettext("Brand") . "</td><td>" . gettext("Value") - . " $currency[0]" + . " $config->{currency}" . "</td><td>" . gettext("Used") . "</td><td>" @@ -3599,7 +3600,7 @@ . gettext("Pricelist") . "</td><td>" . gettext("Value") - . " $currency[0]" + . " $config->{currency}" . "</td><td>" . gettext("Used") . "</td><td>" @@ -3694,7 +3695,7 @@ . gettext("Length in Seconds") . "</td><td>" . gettext("Cost") - . "($currency[0]) </td></tr>"; + . "($config->{currency}) </td></tr>"; $sql = $astpp_db->prepare( "SELECT * FROM callingcardcdrs WHERE cardnumber = " . $astpp_db->quote( param('number') ) ); @@ -4000,9 +4001,9 @@ ); my $sql_select = -"SELECT * FROM cdr WHERE cost IN( 'error','rating') OR (accountcode IS NULL OR accountcode = '') AND cost ='none' ORDER BY calldate"; +"SELECT * FROM fscdr WHERE cost IN( 'error','rating') OR (accountcode IS NULL OR accountcode = '') AND cost ='none' ORDER BY calldate"; my $sql_count = -"SELECT COUNT(*) FROM cdr WHERE cost IN ( 'error','rating') OR (accountcode IS NULL OR accountcode = '') AND cost ='none'"; +"SELECT COUNT(*) FROM fscdr WHERE cost IN ( 'error','rating') OR (accountcode IS NULL OR accountcode = '') AND cost ='none'"; my ( $sql, $pagination ) = $ASTPP->pagination( sql_select => $sql_select, @@ -4701,7 +4702,7 @@ . "</td><td>" . popup_menu( -name => "currency", - -values => \@currency, + -values => $config->{currency}, -default => $accountinfo->{currency} ) . "</td><td>" @@ -5690,7 +5691,7 @@ -values => \@accountlist, ); $template->param( accountlist => $accountmenu ); - $template->param( currency => $config->{currency_name} ); + $template->param( currency => $config->{currency} ); $template->param( status => $status ); return $template->output; } @@ -8971,10 +8972,16 @@ ) . "</td><td>" . textfield( + -name => 'cost', + -size => 20, + -default => $record->{cost} + ) + . "</td><td>" + . textfield( -name => 'precedence', -size => 2, -default => $record->{precedence} - ) . "</td><td>"; + ); my @resellers = &list_resellers($astpp_db); $ASTPP->debug( user => $param->{username}, @@ -11214,7 +11221,7 @@ } $template->param( status => $status ); $template->param( pricelists => $pricelists ); - $template->param( currency => $currency ); + $template->param( currency => $config->{currency} ); $template->param( language => $language ); $template->param( context => $config->{booth_context} ); $template->param( default_currency => $config->{currency} ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |