Developers Club geek daily blog

2 years, 9 months ago
These holiday days when partly has to spend time at work, but changes are not entered into the working systems any more because "soon holidays who needs your fresh bugs?", it is possible to be engaged in cutting asterisks and snowflakes from paper and small experiments.

Generally, we heard such expression more than once: "my call was kicked as a ball from the operator to the operator, and as a result bounced", and can even once it was told in a fit of temper. Also it was thought, and if to provide a call as the jumping ball from a wall to a wall and as at us several tens calls happen on an asterisk in one step, then it has to look at least funny.

What turned out? Further parts and small video.


How here everything is arranged?

The easiest way. At a call which in the dialplena of an asterisk is executed by the Dial application Dial event rushes to AMI (subevent: begin), and when such call comes to the end, there is Dial event (subevent: end).

I.e. we write the small Web server on node.js which listens to these events in AMI and then transfers them to all browsers which came on a web page and were connected to websockets.

For display of the jumping balls on the web page in html5 canvas we will use konva library. Speed and the direction of the movement, and also color of balls accidental in an admissible interval.

How to set?

I use ubuntu 14.04

1. We clone a repository:

git clone

2. Let's pass into a directory of bounce-call and we will set dependences:

cd bounce-call 
npm install &&bower install

3. We edit the configuration file config.js:

    port: 3100,    //порт веб-сервера
    asterisk: {      // настроить в manager.conf астериска
        host: 'localhost',
        port: 5038,
        username: 'admin',
        password: 'admin'

4. We start the application:

node app.js

And if at you everything turned out, then at you in the browser balls have to begin to fly, appearing at initiation of a challenge and disappearing at end of a challenge. As on video.


What's next?

Colleagues offered interesting additions:

1. to make game as Moorhuhn: got on a ball — the call is complete. But it, you see, somehow does not fit into a framework of high-quality telephone service.

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

Therefore so far I use for contemplation, a raising of mood and understanding that behind each ball there is a conversation where our colleagues communicate, agree, sell, buy and wish to all partners and clients of all good next year.

All of excellent mood!

This article is a translation of the original post at
If you have any questions regarding the material covered in the article above, please, contact the original author of the post.
If you have any complaints about this article or you want this article to be deleted, please, drop an email here:

We believe that the knowledge, which is available at the most popular Russian IT blog, should be accessed by everyone, even though it is poorly translated.
Shared knowledge makes the world better.
Best wishes.

comments powered by Disqus