Two way communication to developer Operator Panel

I have a server which has PHP, Apache and Asterisk installed on same server which acts as communication server. Now I am using PAMI library which creates an event listener(Connection 1) which listens to events from Asterisk using Stream sockets. So when I execute this file using browser it display the events which takes place. This file will need to be run as a PHP job from backend which will continuously read events.

My second part involves sending this information to front end without requesting again and again i.e without multiple AJAX call. So I assume I will have to make another socket connection through which I can send the events, parse it and send it to front end i.e. Connection 2

So to pass data from Connection 1 to Connection 2 will I have to store the information first in a database or file or can directly send it from memory as I assume there the events will be stored temporarily?

I am not sure If I am heading in right direction or just something else which is simple can be done or something else that can be used to achieve this goal?

Why do you need two connections? Can’t the frontend talk the service that emits the events directly.

To answer your question, there is nothing wrong with sending data from one connection to another directly without a file or database in the middle. Of course it depends on what your goal is. If you want people to go back on time obviously you need to have that data stored somewhere.

Thank you so much for reverting.

Server1 - Asterisk Communication Server
Server2 - PHP/Apache

I need to create an Operator Panel which will list all events incurred on Asterisk Server. I was told I cannot connect directly to Server1. So I created a EventListener on Server2 which listens to Server1 and fetches events.
So logically I need to send those events to front end and it should be a server sent. Now to do this, I will need socket connection with the client browser and Server2. So to do this I will have to create a server file which creates a sockets and will keep on running continuously as back end process.

So there will be two connections and two event listeners.

  • one constantly listening to events from Server1
  • a Socket server which again will have a infinite loop to send data to client browser

That is why, I am looking for a help or may be some approach guidance which needs to be adhered to in this situation.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.