How can i show the result of filter events in real time instead of showing after loop?
This is my code
<?php
require __DIR__ . '/pami/vendor/autoload.php';
use PAMI\Client\Impl\ClientImpl as PamiClient;
use PAMI\Message\Event\EventMessage;
use PAMI\Listener\IEventListener;
use PAMI\Message\Event\DialEvent;
use PAMI\Message\Event\DialBeginEvent;
use PAMI\Message\Event\DialEndEvent;
use PAMI\Message\Event\HangupEvent;
use PAMI\Message\Event\NewchannelEvent;
$pamiClientOptions = array(
'host' => 'host',
'scheme' => 'tcp://',
'port' => 5038,
'username' => 'user',
'secret' => 'pwd',
'connect_timeout' => 1000,
'read_timeout' => 1000
);
$pamiClient = new PamiClient($pamiClientOptions);
// Open the connection
$pamiClient->open();
#echo'hello';
$pamiClient->registerEventListener(
function (EventMessage $event) {
return
$event instanceof NewchannelEvent &&
print('end call to extention :' . $event->getExtension("Exten") . ' from: ' . $event->getCallerIDNum("CallerIDNum"));
}
);
$running = true;
// Main loop
$running = true;
while($running) {
$pamiClient->process();
usleep(1000);
}
// Close the connection
$pamiClient->close();
?>
@marcelog, do you know how to do it?
I'm not quite sure what you mean by "show the events in real time". Your event loop there is running at a millisecond frequency; that seems pretty real time to me. I'm probably misunderstanding your question, though.
Everytime i make a call the events show after the loop is done, not while the loop is running
On Fri, Jun 29, 2018, 1:19 AM Matt Styles [email protected] wrote:
I'm not quite sure what you mean by "show the events in real time". Your event loop there is running at a millisecond frequency; that seems pretty real time to me. I'm probably misunderstanding your question, though.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/marcelog/PAMI/issues/167#issuecomment-401250264, or mute the thread https://github.com/notifications/unsubscribe-auth/Ak-XZ4gp9MCRYIohYPP_vlKSoRa2VMxIks5uBbjRgaJpZM4TwCMe .
My problem is, I'm sending this data through a WebSocket. I can send some data with actions, by with event i can't, just becouse i cound't get my ws_user to send de message when a event happen.
@jrivas111 what do you mean by "after the loop is done"? In the code you posted the loop never ends.
@davicfg are you saying your event listener function is never invoked for events?
It ends after 30 seconds
On Fri, Jun 29, 2018, 11:27 PM Matt Styles [email protected] wrote:
@jrivas111 https://github.com/jrivas111 what do you mean by "after the loop is done"? In the code you posted the loop never ends.
@davicfg https://github.com/davicfg are you saying your event listener function is never invoked for events?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/marcelog/PAMI/issues/167#issuecomment-401514142, or mute the thread https://github.com/notifications/unsubscribe-auth/Ak-XZ12rlZyYYPSgDVEiNh9ClntwlYMnks5uBvARgaJpZM4TwCMe .
Frist off all thank you @jrivas111 to help me.
@jrivas111, it's very strange, becouse i call 5 times the method process from ClientImpl, butg in the end it's all wrong, because sometimes i don't get all the Queuecallerjoin events. I know this 'couse I'm looking to the logs from asterisk and i can see that a caller join a queue, but in the instance of ClientImpl doesn't show me. This is my problem.