[Astpp-commit] SF.net SVN: astpp:[2265] trunk/freeswitch
Brought to you by:
darrenkw
From: <dar...@us...> - 2009-10-01 02:57:45
|
Revision: 2265 http://astpp.svn.sourceforge.net/astpp/?rev=2265&view=rev Author: darrenkw Date: 2009-10-01 02:57:30 +0000 (Thu, 01 Oct 2009) Log Message: ----------- Callingcards are working as of now. Modified Paths: -------------- trunk/freeswitch/astpp-callingcards.pl trunk/freeswitch/astpp-fs-cdr-xml.pl Modified: trunk/freeswitch/astpp-callingcards.pl =================================================================== --- trunk/freeswitch/astpp-callingcards.pl 2009-09-28 15:43:12 UTC (rev 2264) +++ trunk/freeswitch/astpp-callingcards.pl 2009-10-01 02:57:30 UTC (rev 2265) @@ -428,13 +428,12 @@ trunk_name => $route->{trunk} ); my ( $dialedtime, $uniqueid, $answeredtime, $clid ); - $session->execute( "export", "CALLINGCARDS=1" ); if ( $cc == 1 ) { - $session->execute( "export", "ACCOUNTCODE=CC:$cardinfo->{number}" ); + $session->execute( "export", "accountcode=$cardinfo->{number}" ); } else { $session->execute( "export", - "ACCOUNTCODE=CC:$cardinfo->{cardnumber}" ); + "callingcard=$cardinfo->{cardnumber}" ); } $session->execute( "bridge", "$data_string" ); return 1; Modified: trunk/freeswitch/astpp-fs-cdr-xml.pl =================================================================== --- trunk/freeswitch/astpp-fs-cdr-xml.pl 2009-09-28 15:43:12 UTC (rev 2264) +++ trunk/freeswitch/astpp-fs-cdr-xml.pl 2009-10-01 02:57:30 UTC (rev 2265) @@ -63,7 +63,7 @@ my $data = $xml->XMLin($params->{cdr}); # print output -#print STDERR Dumper($data); +print STDERR Dumper($data); my $tmp = "INSERT INTO " . $config->{freeswitch_cdr_table} . "(accountcode,src,dst,dcontext,clid,channel,dstchannel,lastapp," @@ -162,32 +162,34 @@ print STDERR "VENDOR CHARGES: " . $config->{trackvendorcharges} . "\n"; &vendor_process_rating_fs( $astpp_db, $cdr_db, $config, "none", $data->{callflow}->{caller_profile}->{uuid},"" ) if $config->{trackvendorcharges} == 1; -&process_callingcard_cdr if $data->{variables}->{CALLINGCARDS} == 1; +&process_callingcard_cdr if $data->{variables}->{callingcard}; sub process_callingcard_cdr() { my ( $cardinfo, $brandinfo, $numberinfo, $pricelistinfo,$cc ); - my $cardnumber = substr( $data->{variables}->{accountcode}, 3 ); + my $destination = $data->{callflow}->{caller_profile}->{destination_number}; + $destination =~ s/@.*//g; + my $cardnumber = $data->{variables}->{callingcard}; $cardinfo = &get_callingcard( $astpp_db, $cardnumber, $config ); if ( !$cardinfo ) { $cardinfo = &get_account_cc( $astpp_db, $cardnumber ); $cc = 1 if $cardinfo; } -$brandinfo = &get_cc_brand( $astpp_db, $cardinfo->{brand} ) if $cc == 0; -if ($brandinfo->{reseller}) { - $config = &load_config_db_reseller($astpp_db,$config,$brandinfo->{reseller}); -} -$config = &load_config_db_brand($astpp_db,$config,$cardinfo->{brand}); -$pricelistinfo = &get_pricelist( $astpp_db, $brandinfo->{pricelist} ) - if $cc == 0; -$pricelistinfo = &get_pricelist( $astpp_db, $cardinfo->{pricelist} ) - if $cc == 1; + $brandinfo = &get_cc_brand( $astpp_db, $cardinfo->{brand} ) if $cc == 0; + if ($brandinfo->{reseller}) { + $config = &load_config_db_reseller($astpp_db,$config,$brandinfo->{reseller}); + } + $config = &load_config_db_brand($astpp_db,$config,$cardinfo->{brand}); + $pricelistinfo = &get_pricelist( $astpp_db, $brandinfo->{pricelist} ) + if $cc == 0; + $pricelistinfo = &get_pricelist( $astpp_db, $cardinfo->{pricelist} ) + if $cc == 1; print STDERR "THIS IS A CALLINGCARD CALL! \n"; print STDERR "CARD: $cardinfo->{cardnumber} \n"; print STDERR "CARD: $cardnumber \n"; $numberinfo = &get_route( $astpp_db, $config, - $data->{callflow}->{caller_profile}->{destination_number}, + $destination, $brandinfo->{pricelist}, $cardinfo ); if ( $data->{variables}->{billsec} > 0 ) @@ -235,14 +237,14 @@ ( ( $cardinfo->{min_length_pennies} * 100 ) + $charge ); } - + print STDERR "CARDNUMBER: " . $cardinfo->{cardnumber}; &write_callingcard_cdr( $astpp_db, $config, $cardinfo, uri_unescape($data->{variables}->{caller_id}), - $data->{callflow}->{caller_profile}->{destination_number}, - $data->{variables}->{hangup_cause}, + $destination, + uri_unescape($data->{variables}->{hangup_cause}), uri_unescape($data->{variables}->{start_stamp}), $charge, $data->{variables}->{billsec} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |