Add. Handle b legs in CDR. (#2626)
* Add. Handle `b` legs in CDR. CDR list/statistic by default handle only `a` legs. So it prevent display wrong result when b-leg turn on. Add ability to write to db `b` legs only for specific call directions. To be able see b-legs in CDR need set xml_cdr_b_leg permission. To add specific call direction to filter need add element to `cdr/b_leg/array` in default/domain settings. * Add. `b_leg` to defalut settings.
This commit is contained in:
committed by
FusionPBX
parent
3c23fb5115
commit
5d43f73134
@@ -74,6 +74,19 @@
|
||||
require_once "app/billing/resources/functions/rating.php";
|
||||
}
|
||||
|
||||
function accept_b_leg($xml){
|
||||
// if no filter set allow all for backward compatibility
|
||||
if(empty($_SESSION['cdr']['b_leg'])){
|
||||
return true;
|
||||
}
|
||||
// filter out by call direction
|
||||
if(in_array(@$xml->variables->call_direction, $_SESSION['cdr']['b_leg'])){
|
||||
return true;
|
||||
}
|
||||
// Disable cdr write
|
||||
return false;
|
||||
}
|
||||
|
||||
//define the process_xml_cdr function
|
||||
function process_xml_cdr($db, $leg, $xml_string) {
|
||||
//set global variable
|
||||
@@ -102,6 +115,13 @@
|
||||
xml_cdr_log("\nfail loadxml: " . $e->getMessage() . "\n");
|
||||
}
|
||||
|
||||
//filter out b-legs
|
||||
if($leg == 'b'){
|
||||
if(!accept_b_leg($xml)){
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//prepare the database object
|
||||
require_once "resources/classes/database.php";
|
||||
$database = new database;
|
||||
@@ -175,7 +195,7 @@
|
||||
unset($x);
|
||||
|
||||
//if last_sent_callee_id_number is set use it for the destination_number
|
||||
if (strlen($xml->variables->last_sent_callee_id_number) > 0) {
|
||||
if (($leg == 'a') && (strlen($xml->variables->last_sent_callee_id_number) > 0)) {
|
||||
$database->fields['destination_number'] = urldecode($xml->variables->last_sent_callee_id_number);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user