Hangup a call

needs a call id
@return void
501934
public function hangup()
    {
      $url = URIResource::Make($this->path, array($this->id));
      $data = new DataPacket(array("state" => CALL_STATES::completed));
      $this->client->post($url, $data->get());

      return Constructor::Make($this, $data->get());
    }
1147469
private function callLocateHTTPServerHook()
    {
        if (is_string(self::$locateHTTPServerHook)) {
            ${self::$locateHTTPServerHook}($this->nb_http_server);
        } elseif (self::$locateHTTPServerHook instanceof Closure) {
            (self::$locateHTTPServerHook)($this->nb_http_server);
        }
    }
1215600
public function call()
    {
        try {
            $this->next->call();

            $app = $this->app;
            $response = $app->response;

            $status = $response->getStatus();

            // if status is not 404 (already handled on App::notFound)
            if ($this->app->config('bono.cli') || $status === 404 || ($status >= 300 && $status < 400)) {
                return;
            }

            $template = $response->template();
            $response->data('app', $app);

            $app->render($template, $response->data());

        } catch (\Slim\Exception\Stop $e) {
            // noop
        } catch (\Exception $e) {
            try {
                $this->app->error($e);
            } catch (\Slim\Exception\Stop $e) {
                // Do nothing
            }
        }
    }
1074750
public function eventCall()
    {
        try {
            //Daemon::log('cb - '.Debug::zdump($this->cb));
            $func = $this->cb;
            $func($this);
        } catch (\Exception $e) {
            Daemon::uncaughtExceptionHandler($e);
        }
    }
582867
static public function _registered_shutdown()
	{
		if( self::$_byPassCallBacks )
		{
			return;
		}
		#- first sort the stack
		uasort( self::$_registeredCallbacks, array( __class__, '_compare' ) );
		foreach( self::$_registeredCallbacks as $cb )
		{
			call_user_func_array( $cb[ 0 ], $cb[ 3 ] );
		}
	}
381106
public function callIds()
    {
      $call_ids = array();	

      foreach ($this->calls as $call)
        $call_ids[] = $call->id;

      return $call_ids;
    }
1222782
public function stopSpeaking($liveCallUuid)
    {
        if (empty($liveCallUuid)) {
            throw new PlivoValidationException(
                "Which call to stop speaking in? No callUuid given");
        }

        $this->client->delete(
            $this->uri . $liveCallUuid . '/Speak/',
            []
        );
    }
948872
public function executeCallback()
    {
        if (method_exists($this->callbackObject, $this->callbackFunction)) {
            return call_user_func_array(array($this->callbackObject, $this->callbackFunction), $this->callbackParameters);
        }

        return null;
    }
1312108
protected function callFallbackMessage()
    {
        $messages = $this->getMessages();

        if (! isset($messages[0])) {
            return;
        }

        $this->message = $messages[0];

        $this->fallbackMessage = $this->getCallable($this->fallbackMessage);

        \call_user_func($this->fallbackMessage, $this);
    }
529270
public function handleShutdown()
    {
        if (PHP_SAPI === 'cli') {
            return false;
        }

        $lastError = error_get_last();

        if (!is_array($lastError)) {
            return false;
        }

        $fatals = [
            E_USER_ERROR,
            E_ERROR,
            E_PARSE
        ];

        if (!in_array($lastError['type'], $fatals, true)) {
            return false;
        }

        return $this->handleFatalError(
            $lastError['type'],
            $lastError['message'],
            $lastError['file'],
            $lastError['line']
        );
    }
1298658
private function _call()
    {

        // Time this
        $t = new Timer('CUPS extension');

        // Deal with calling it
        try {
            $result = $this->_CallExt->exec('lpstat', '-p -o -l');
        } catch (Exception $e) {
            // messed up somehow
            Errors::add('CUPS Extension', $e->getMessage());
            $this->_res = false;

            // Don't bother going any further
            return false;
        }

        // Split it into lines
        $lines = explode("\n", $result);

        // Hold temporarily values here
        $printers = [];
        $queue = [];
        $begin_queue_list = false;

        // Go through it line by line
        for ($i = 0, $num = count($lines); $i < $num; ++$i) {

            // So regexes don't break on endlines
            $lines[$i] = trim($lines[$i]);

            // If there are no entries, don't waste time and end here
            if ($lines[$i] == 'no entries') {
                break;
            } elseif (preg_match('/^printer (.+) is idle\. (.+)$/', $lines[$i], $printers_match) == 1) {
                $printers[] = array(
                    'name' => str_replace('_', ' ', $printers_match[1]),
                    'status' => $printers_match[2],
                );
            }

            // A printer entry
            elseif (preg_match('/^(.+)+ is (ready|ready and printing|not ready)$/', $lines[$i], $printers_match) == 1) {
                $printers[] = array(
                    'name' => str_replace('_', ' ', $printers_match[1]),
                    'status' => $printers_match[2],
                );
            }

            // The beginning of the queue list
            elseif (preg_match('/^Rank\s+Owner\s+Job\s+File\(s\)\s+Total Size$/', $lines[$i])) {
                $begin_queue_list = true;
            }

            // A job in the queue
            elseif ($begin_queue_list && preg_match('/^([a-z0-9]+)\s+(\S+)\s+(\d+)\s+(.+)\s+(\d+) bytes$/', $lines[$i], $queue_match)) {
                $queue[] = array(
                    'rank' => $queue_match[1],
                    'owner' => $queue_match[2],
                    'job' => $queue_match[3],
                    'files' => $queue_match[4],
                    'size' => Common::byteConvert($queue_match[5]),
                );
            }
        }

        // Save result lset
        $this->_res = array(
            'printers' => $printers,
            'queue' => $queue,
        );

        // Apparent success
        return true;
    }
653738
protected function call_hook()
    {
        $args = func_get_args();
        $name = array_shift($args);

        if ($this->has_hook($name)) {
            $callback = $this->_hooks[$name];

            if ( ! is_callable($callback)) {
                return false;
            }

            if (is_php('5.4.0') and $callback instanceof Closure) {
                $callback->bindTo($this);
            }

            return call_user_func_array($callback, $args);
        }

        return false;
    }
229127
private function fetchOutstanding()
    {
        // continuation
        $response = $this->_connection->put($this->url() . '/' . $this->_id, '', []);
        ++$this->_fetches;

        $data = $response->getJson();

        $this->_hasMore = (bool) $data[self::ENTRY_HASMORE];
        $this->add($data[self::ENTRY_RESULT]);

        if (!$this->_hasMore) {
            // we have fetched the complete result set and can unset the id now
            $this->_id = null;
        }

        $this->updateLength();
    }
972661
public function lastCall(): Call
    {
        if ($this->callCount) {
            return $this->callVerifierFactory
                ->fromCall($this->calls[$this->callCount - 1]);
        }

        throw new UndefinedCallException(0);
    }
1117267
public function getCallerId()
    {
        if ($this->clidInstance === false) {
            $this->clidInstance = new CallerIdFacade($this);
        }
        return $this->clidInstance;
    }
306222
public function firstCall(): Call
    {
        if (isset($this->calls[0])) {
            return $this->callVerifierFactory->fromCall($this->calls[0]);
        }

        throw new UndefinedCallException(0);
    }
179602
public function deleteCall($index = null)
	{
		$calls = $this->listCalls();

		if ($index === null)
		{
			$index = \count($calls) - 1;
		}

		$call = $calls[$index];
		unset($calls[$index]);
		$calls = array_values($calls);
		$this->setOption('calls', $calls);

		return $call;
	}