Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 17th, 2012  |  syntax: None  |  size: 2.42 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. PHP AMI Connection - saving incoming and outgoing calls to a database is not working
  2. if($givenkey = array_search("Context: from-internal", $content)){
  3.             $calleridKey = $givenkey + 1;
  4.             $idSIP = $givenkey - 1;
  5.             $dialNumber = str_replace("Extension: 0","31",$content[$calleridKey]);
  6.             $dialNumber = str_replace("Extension: ", "", $dialNumber);
  7.             $fromSIP = str_replace("Channel: SIP/", "", $content[$idSIP]);
  8.             $fromSIP = substr($fromSIP, 0, 2);
  9.             $dialTime = date('r');
  10.  
  11.             $uitgaand = array(
  12.                             "Phonenumber"   => $dialNumber,
  13.                             "Type"          => "Uitgaand",
  14.                             "datetime"      => $dialTime,
  15.                             "SIP"           => $fromSIP
  16.                             );
  17.        
  18. if($givenkey = array_search("AppData: Using CallerID ", $content)){
  19.             if(array_search("Channel: SIP/31000000000", $content)+5 == $InCallKey = array_search("AppData: Using CallerID", $content)){
  20.                     $calleridNum = explode('"',str_replace('AppData: Using CallerID "',"",$content[$InCallKey]));
  21.                     $pickupSource = array_search("Source: SIP/31000000000", $content);
  22.                     if($pickupSource+1 == $pickupKey = array_search("Destination: SIP/", $content)){
  23.                             $pickupBy =  str_replace("Destination: SIP/","",$content[$pickupkey]);
  24.                             $pickupBy = substr($pickupBy, 0, 2);
  25.                             $dialTime = date('r');        
  26.                             $inkomend = array(
  27.                                             "Phonenumber" => $calleridNum[0],
  28.                                             "Type"          => "Binnenkomend",
  29.                                             "datetime"      => $dialTime,
  30.                                             "SIP"           => $pickupBy
  31.                                             );
  32.        
  33. PHP Notice:  fwrite(): send of 16 bytes failed with errno=32 Broken pipe in /var/www/html/phpami/AMILoader.php on line 147
  34. Net_AsteriskManagerException: Authorisation failed in /var/www/html/phpami/AMILoader.php on line 173
  35. #0 /var/www/html/phpami/AMILoader.php(173): Net_AsteriskManager-login('GEBRUIKERSNAAM','WACHTWOORD')
  36. #1 /var/www/html/phpami/AMILoader.php(306): Net_AsteriskManager-_sendCommand('Action: Ping???...')
  37. #2 /var/www/html/phpami/AMILoader.php(543): Net_AsteriskManager->ping()
  38. #3 {main}