marcelog / PAMI

PHP Asterisk Manager Interface ( AMI ) supports synchronous command ( action )/ responses and asynchronous events using the pattern observer-listener. Supports commands with responses with multiple events. Very suitable for development of operator consoles and / or asterisk / channels / peers monitoring through SOA, etc
http://marcelog.github.com/PAMI
Apache License 2.0
405 stars 281 forks source link

Logoff action #35

Closed yegortokmakov closed 12 years ago

yegortokmakov commented 12 years ago

Logoff action causes exception "Error reading" from file PAMI/Client/Impl/ClientImpl.php in function getMessages. It is because in

            if ($read === false || feof($this->_socket)) {
                throw new ClientException('Error reading');
            }

feof() is true. last message from AMI is:

string(83) "Response: Goodbye ActionID: 1345305085.9158 Message: Thanks for all the fish.

"

please, help me with tha issue.

now I have to do

            try{
                $pamiClient->close();  
            }catch (Exception $e) {}
marcelog commented 12 years ago

Hello Yegor, thanks for the feedback!

Are you sure you are not somehow calling $pamiClient->process() after closing? Because that's the only way that I can reproduce this (i.e: If I dont call process() after close(), I dont get the exception)

yegortokmakov commented 12 years ago

Hello, Marcelo! Thank you for your development. No, close() is he last action I do. Tomorrow I will send you peace of my code so we can look throw it.

2012/8/18 Marcelo Gornstein notifications@github.com

Hello Yegor, thanks for the feedback!

Are you sure you are not somehow calling $pamiClient->process() _after_closing? Because that's the only way that I can reproduce this (i.e: If I dont call process() after close(), I dont get the exception)

— Reply to this email directly or view it on GitHubhttps://github.com/marcelog/PAMI/issues/35#issuecomment-7846642.

clinttepe commented 9 years ago

I am also having this issue with recently installed PAMI, Asterisk 1.8.10.1, and PHP 5.3.10-1ubuntu3.18 (yes I read the README and applied the fix for the issue described). The generated error comes from ClientImpl.php:236

First part of my stack trace:

object(PAMI\Message\Event\FullyBootedEvent)#6 (5) { ["rawContent":protected]=> string(63) "Event: FullyBooted Privilege: system,all Status: Fully Booted" ["lines":protected]=> array(0) { } ["variables":protected]=> array(0) { } ["keys":protected]=> array(3) { ["event"]=> string(11) "FullyBooted" ["privilege"]=> string(10) "system,all" ["status"]=> string(12) "Fully Booted" } ["createdDate":protected]=> int(1434031315) } object(PAMI\Message\Event\PeerStatusEvent)#5 (5) { ["rawContent":protected]=> string(126) "Event: PeerStatus Privilege: system,all ChannelType: SIP Peer: SIP/205 PeerStatus: Registered Address:
clinttepe commented 9 years ago

Tried another server (PHP 5.5.12 and Asterisk 11.11.0) and got similar results.