PAMI icon indicating copy to clipboard operation
PAMI copied to clipboard

$asteriskClient->send(new QueueStatusAction()) get error on 2.0.7

Open varlog11 opened this issue 4 years ago • 3 comments

Hello!

$asteriskClient->send(new QueueStatusAction()) get error in the version 2.0.7 ERROR: E_ERROR "Uncaught TypeError: Argument 1 passed to PAMI\Client\Impl\ClientImpl::__construct() must be of the type array, null given, called in vendor/chan-sccp/pami/src/PAMI/Client/Impl/ClientImpl.php:571

In the version 2.0.6 everything works fine.

varlog11 avatar Jan 19 '21 10:01 varlog11

I just ran this:

#!/usr/bin/env php
<?php
/**
 * @category   Asterisk / Demo Config MetaData / Pami
 * @package    Simple Config MetaData Demo
 * @author   Diederik de Groot <[email protected]>
 * @license  http://github.com/dkgroot/PAMI Apache License 2.0
 * Copyright 2016 Diederik de Groot <[email protected]>
 */
if ($argc <5 ) {
    echo "Use: $argv[0] <host> <port> <user> <pass>] ";
    echo "example: $argv[0] 192.168.1.20 5038 admin secret
" ;
    exit (254);
}

declare(ticks=1);
require(implode(DIRECTORY_SEPARATOR, array(
    __DIR__,
    'vendor',
    'autoload.php'
)));
use PAMI\Client\Impl\ClientImpl;
use PAMI\Message\Action\QueueStatusAction;

error_reporting(E_ALL);
ini_set('display_errors', 1);
try
{
    $options = array(
        'log4php.properties' => realpath(__DIR__) . DIRECTORY_SEPARATOR . 'log4php.properties',
        'host' => $argv[1],
        'port' => $argv[2],
        'username' => $argv[3],
        'secret' => $argv[4],
        'connect_timeout' => 2,
        'read_timeout' => 2
    );
    $pami = new ClientImpl($options);
    $pami->open();
    $response = $pami->send(new QueueStatusAction());
    var_dump($response);
    $pami->close();
} catch (Exception $e) {
    echo $e->getMessage() . "\n";
}

And it seems to work just fine. Could it be that you forgot:

$asteriskClient= new ClientImpl($options);
$asteriskClient->open();

dkgroot avatar Jan 21 '21 13:01 dkgroot

Hello! Thanks for the answer. I tested again on a server with DEBIAN 10, PHP 7.3, asterisk 16.15.0 and 18.2.0 and could not get correct work on version 2.0.7. In the attachment I attach the script output when using version 2.0.6. On version 2.0.7 it gives: Read timeout v_2_0_6.txt

varlog11 avatar Feb 20 '21 07:02 varlog11

Hi Varlog, I have finally gotten around to merging some of the PR's and updating the release to v2.0.10 Would you be able to run to test script i committed above ?

dkgroot avatar Nov 27 '21 12:11 dkgroot