-
Notifications
You must be signed in to change notification settings - Fork 278
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
PAMI Disconnect and read Code #77
Comments
It seems asterisk is closing the connection, you should be able to find out more information in the asterisk logs |
That is right, i want asterisk manager connection to be closed. but i am getting above error, |
You are closing the connection but the loop keeps calling the process() method, you should get out of that loop if you want to end the program. |
can you please let me know how to get out of that loop after close the connection. Thanks |
this is not a pami issue, closing this one then. |
@marcelog So where can I find the solution for this issue |
I am using PAMI to get Asterisk Manager Events. please see my code below. I wanted to get $event->getDialStatus() == 'ANSWER' of Dial Event and as condition true, i want Asterisk Manager to be disconnected and read the remaining code. in other words i just want to get some events store in DB and move to remaining after that. currently i am getting following error. Thanks.
'127.0.0.1', 'scheme' => 'tcp://', 'port' => 5038, 'username' => 'ncs', 'secret' => 'ncs', 'connect_timeout' => 10000, 'read_timeout' => 10000 ); $pamiClient = new PamiClient($pamiClientOptions); // Open the connection $pamiClient->open(); use PAMI\Message\Event\EventMessage; use PAMI\Message\Event\DialEvent; $pamiClient->registerEventListener(function (EventMessage $event) { print_r($event); }, function ($event) { $re = $event instanceof DialEvent && $event->getDialStatus() == 'ANSWER'; if ($re){ echo "Found Event\n"; global $pamiClient; $pamiClient->close(); } } ); $running = true; while($running) { $pamiClient->process(); usleep(1000); } echo "Code Ended>>>>>>>>>>>>>>>>>>> Read This Line\n"; ?>PHP Fatal error: Uncaught exception 'PAMI\Client\Exception\ClientException' with message 'Error reading' in /usr/share/pear/PAMI/Client/Impl/ClientImpl.php:236
Stack trace:
#0 /usr/share/pear/PAMI/Client/Impl/ClientImpl.php(258): PAMI\Client\Impl\ClientImpl->getMessages()
#1 /scripts/pami.php(95): PAMI\Client\Impl\ClientImpl->process()
#2 {main}
thrown in /usr/share/pear/PAMI/Client/Impl/ClientImpl.php on line 236
The text was updated successfully, but these errors were encountered: