A task appeared to display information on incoming calls to the operator on the web interface (accordingly, immediately search for a client in the database). Having smoked the Internet, I stopped at WebSocket server (cboden / ratchet) with a bunch of ARI (greenfieldtech-nirs / phpari).

  1. Is it worth it to implement all this in pure php?
  2. How to put in one EventLoop server and ari client? Can anyone come across such a problem when you need to organize two or more interacting threads in php
  3. Whether php will not work working continuously working in the stream (heard with this until everything is bad)?
  4. And maybe score on the points above and write everything in java or python?
  • Why websocket? In my project I used AMI. The communication interface has stolen from the asternic and fop projects. - gecube pm
  • @gecube, asternic dumb thing. I watched how the rial time was organized there ajax + php communicating with the asteriska base. Evil in its purest form. Web sockets so that the server can send information by itself, rather than jerking ajax again with a script every second - ArchDemon

2 answers 2

$ariClient = new BasicStasisApplication('test'); $app = new Ratchet\App('localhost', 8080, '127.0.0.1', $ariClient->loop); 

In general, it was necessary to take EventLoop from ari and give it to ratchet. The benefit of the latter supports such a thing.

P.S. It was subsequently decided to abandon ARI and switch to AMI from marcelog / pami .

  • if you add links to ARI and AMI so that future generations don’t have to google, I’ll obscure - strangeqargo
  • @strangeqargo, well, added some links ... - ArchDemon pm

1 and 3) No, PHP will not fall if there are no leaks in the extensions you use, which is unlikely.

4) write on anything, if you are sure that in the office where you work you will be able to maintain your code after you are dumped for another job.

I am more than sure that there are a million recipes on the topic of working with asterisks via php on the Internet, and I am more than sure that you don’t really need a website for these tasks, and if you need a highload call center support, then consult with bosses / colleagues in what language to write, since there is no regulation.

PS though, maybe a ratchet (looked at it) and a good idea. Write in the language in which you write better; after implementation, in case of problems, you can easily rewrite it in another language / attach crutches in the original