The pbx_soap() function call shown below is taking way too long to respond.
Here's the body of the soap_call has as suggested by the abstract code body given here :
https://wiki.snomone.com/index.php?title=Access_to_the_Database#Abstract_Code_to_access_the_pbxnsip_database
function pbx_soap($req) {
$start = microtime(true);
global $dbadr, $dbport, $dbdebug;
$dbhandle = fsockopen($dbadr, $dbport, $errno, $errstr);
if (!$dbhandle) {
echo "error hash";
if($dbdebug) echo "$errstr ($errno)<br>\n";
return;
}
$request = "POST /soap.xml HTTP/1.1\r\n";
$request .= "Content-Type: text/xml\r\n";
$request .= "Content-Length: " . strlen($req) . "\r\n";
$request .= "Connection: close\r\n\r\n";
$request .= $req;
//echo $request;
//exit;
fputs($dbhandle, $request);
$data = "";
$count=0;
while(!feof($dbhandle)) {
$count++;
$data.=fread($dbhandle, 128);
}
fclose($dbhandle);
$pos = strpos($data,"\r\n\r\n");
if($pos != false) {
$body = substr($data, $pos);
return $body;
}
} // pbx_soap
Every call takes about 6 seconds (As determined by using microtimers.)
Also, the following statistics show how much time is being spent on the pbx_soap calls GREATLY slowing down the web apps.