Yate::Install("chan.disconnected", 75, "id", $ourcallid); onStartup($ev); } else { Yate::Output("Invalid assist: '{$ourcallid}' -> '{$callto}'"); $ourcallid = false; } break; case "chan.hangup": // We were hung up. Do any cleanup and exit. onHangup($ev); $ourcallid = false; break; case "chan.disconnected": // Our party disconnected and we're ready to hang up. // We should reconnect before this message is acknowledged if (onDisconnect($ev, $ev->GetValue("reason"))) { $ev->handled = true; } break; } /* This is extremely important. We MUST let messages return, handled or not */ if ($ev !== false) { $ev->Acknowledge(); } break; case "answer": // Yate::Debug("PHP Answered: " . $ev->name . " id: " . $ev->id); break; case "installed": // Yate::Debug("PHP Installed: " . $ev->name);
/** * Removes a client and all references in case of timeout/error. * @param object $client The client object to remove. */ public function removeClientOnError($client) { // remove reference in clients app: if (method_exists($this->_hook, 'onDisconnect')) { $this->_hook > onDisconnect((int) $client->getClientSocket()); } $resource = $client->getClientSocket(); $clientId = $client->getClientId(); $clientIp = $client->getClientIp(); $clientPort = $client->getClientPort(); $this->_removeIpFromStorage($client->getClientIp()); if (isset($this->_requestStorage[$clientId])) { unset($this->_requestStorage[$clientId]); } unset($this->clients[(int) $resource]); $index = array_search($resource, $this->allsockets); unset($this->allsockets[$index], $client); // trigger status application: if ($this->getApplication('status') !== false) { $this->getApplication('status')->clientDisconnected($clientIp, $clientPort); } unset($resource, $clientId, $clientIp, $clientPort); }