I have a server with PHP, APACHE and Asterisk service installed for voip based communication.
I used PAMI library and created a socket connection using Stream Sockets and created an event listener which connects to Asterisk and listens to events that comes from it. Currently, I am accessing the script from browser so it means it constantly processing and any event that happens is displayed on the screen but definitely it will be running as server php script.
Now Whatever events I read, I need to parse and send the information to the frontend. So a user when logins and clicks on operator panel which will have list of extensions that are there. Now the extensions can be busy, unavailable or idle and their status will update based on the events that I read. The operator panel is accessed by frontend user to I need a way to send events from server to frontend. I could also do this separately by creating a socket server and using websocket html5 functionality.
I am still clueless as to how can these two different listeners on different ports can communicate and pass the information ?
Any guidance will be greatly appreciated.
What I have tried:
One solution I tried is saving the parsed events in database in while listening to events and then accessing them in another event listener to display in front. But if possible, I want to do this without the overhead of storing and accessing from database.