📜 ⬆️ ⬇️

Asterisk: every bell as a bouncing ball

In these pre-holiday days, when one has to partly spend time at work, but changes to work systems are no longer made, for “soon holidays, who needs your fresh bugs?”, You can do cutting out stars and paper snowflakes and small experiments.

In general, we have heard such an expression more than once: “my call was kicked like a ball from an operator to an operator, and in the end they kicked it off,” or maybe even they themselves once said this in their hearts. And it was thought, but if you imagine a bell as a jumping ball from wall to wall, and since we have several dozen calls on an asterisk all at once, this should look at least amusing.

What happened? Further details and a small video.
')
image

How is everything here?


The easiest way. When a call is made by the Dial application in the asterisk by the Dial application, a Dial event (subevent: begin) is thrown in AMI, and when such a call ends, the Dial event (subevent: end) occurs.

Those. we write a small web server to node.js, which listens to these events in AMI and then sends them to all browsers that went to the web page and connected to websockets.

To display the jumping balls on the web page in html5 canvas, we use the konva library. The speed and direction of movement, as well as the color of the balls are random in the allowed interval.

How to install?


I use ubuntu 14.04

1. Clone the repository:

git clone https://github.com/antirek/bounce-call.git 

2. Go to the bounce-call directory and install the dependencies:

 cd bounce-call npm install && bower install 

3. Edit the config.js file:

 { port: 3100, // - asterisk: { //   manager.conf  host: 'localhost', port: 5038, username: 'admin', password: 'admin' } }; 

4. Run the application:

 node app.js 

And if everything worked out for you, then balls should start flying in your browser, appearing at the initiation of the call and disappearing at the end of the call. Like the video.



Repository: github.com/antirek/bounce-call

What's next?


Colleagues offered interesting additions:

1. make a game like Moorhuhn: hit the ball - the call is over. But this, you see, somehow does not fit into the framework of high-quality telephone service.

2. change the color of the ball depending on the status of the call or the duration of waiting for an answer. But there are other software products for monitoring service quality.

Therefore, while I use it to contemplate, raise my mood and realize that behind every ball there is a conversation where our colleagues communicate, agree, sell, buy and wish all partners and customers all the best next year.

All good mood!

Source: https://habr.com/ru/post/274155/


All Articles