Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
varlog11 opened this issue Jan 19, 2021 · 3 comments
Open

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

varlog11 opened this issue Jan 19, 2021 · 3 comments
Assignees
Labels

Comments

@varlog11
Copy link

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.

@dkgroot dkgroot self-assigned this Jan 21, 2021
@dkgroot dkgroot added the bug label Jan 21, 2021
@dkgroot
Copy link
Member

dkgroot commented Jan 21, 2021

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();

@varlog11
Copy link
Author

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

@dkgroot
Copy link
Member

dkgroot commented Nov 27, 2021

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants