Make sure the database connection is available
This commit is contained in:
parent
2ae77071e2
commit
67da2f2a3d
|
|
@ -110,20 +110,22 @@
|
||||||
file_put_contents($pid_file, getmypid());
|
file_put_contents($pid_file, getmypid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//import the call detail records from HTTP POST or file system
|
//import the call detail records from HTTP POST or file system
|
||||||
$cdr = new xml_cdr;
|
$cdr = new xml_cdr;
|
||||||
|
|
||||||
//get the cdr record
|
//get the cdr record
|
||||||
$xml_cdr_dir = $settings->get('switch', 'log').'/xml_cdr';
|
$xml_cdr_dir = $settings->get('switch', 'log').'/xml_cdr';
|
||||||
|
|
||||||
//loop through
|
//service loop
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
||||||
//import the call detail records from HTTP POST or file system
|
//make sure the database connection is available
|
||||||
if (!$cdr) {
|
while (!$database->is_connected()) {
|
||||||
$cdr = new xml_cdr;
|
//connect to the database
|
||||||
|
$database->connect();
|
||||||
|
|
||||||
|
//sleep for a moment
|
||||||
|
usleep(100000);
|
||||||
}
|
}
|
||||||
|
|
||||||
//find and process cdr records
|
//find and process cdr records
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue