Jump to content

foinf

Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by foinf

  1. Hello, thanks for your response. Could you provide a sample code or example or at least a few lines of code which Illustrate how to use the modern technique instead of using SOAP?

     

    The documentation (which i have quoted as a link in the OP) only illustrated the call using soap.

  2. 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.

     

    3oOVoZv.png

×
×
  • Create New...