zmarius81 / asterisk.io

node.js asterisk pbx io
41 stars 25 forks source link

How to pass server with an action ? #7

Open mohitharrak opened 6 years ago

mohitharrak commented 6 years ago

Hello All,

My astmanproxy server is linked to two asterisk servers.

Now i want to execute an action Queuepause from node js code , I want to execute this action on the secod server linked to astmanproxy server. But how can i pass the ip address of asterisk server through node js code ?

Below is code i am using:

ami.action(
            'QueuePause',
            {
                Interface: 'SIP/301@Kam-SBC',
                Paused: true,
                Queue: '1003_italk-support',
                Reason: 'home'
            },
            function (data) {
                if (data.Response == 'Error') {
                    logger.log('info', 'server.js: Park Error: ' + JSON.stringify(data))

                    return;
                }

                logger.log('info', 'server.js: Park Response: ' + JSON.stringify(data));
            }
        );
zmarius81 commented 6 years ago

Hi

You can create multiple instances for your servers.

ami1 for server 1, ami2 for server 2 and so on.

Sent from my iPhone

On 2 Dec 2017, at 19:10, mohit khanna notifications@github.com wrote:

Hello All,

My astmanproxy server is linked to two asterisk servers.

Now i want to execute an action Queuepause from node js code , I want to execute this action on the secod server linked to astmanproxy server. But how can i pass the ip address of asterisk server through node js code ?

Below is code i am using:

ami.action( 'QueuePause', { Interface: 'SIP/301@Kam-SBC', Paused: true, Queue: '1003_italk-support', Reason: 'home' }, function (data) { if (data.Response == 'Error') { logger.log('info', 'server.js: Park Error: ' + JSON.stringify(data))

                return;
            }

            logger.log('info', 'server.js: Park Response: ' + JSON.stringify(data));
        }
    );

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

mohitharrak commented 6 years ago

Do you mean to create two instances on node js ? Or do you want to create seperate astmanproxy for 2 asterisk servers ?

zmarius81 commented 6 years ago

Hi

My library is designed to use directly an Asterisk server.

Because of the astmanproxy nodejs/asterisk.io does not know on witch asterisk is connected.

No. 2 instances is not necessary (first question) Can be a solution ... don’t like it (second question)

Simple solution. Lets say you have asterisk 1, 2 and 3. Every of them have IP1, IP2 and IP3 and a user manager configured. Follow my source code example and instead of one “ami” variable (also called object, I like intance) create 3 of them for every asterisk. So, ami1 -> IP1, ...... ami3 -> IP3

This way you can manage multiple asterisks with one nodejs app.

Let me know if you need more info.

Cheers

Sent from my iPhone

On 3 Dec 2017, at 21:45, mohit khanna notifications@github.com wrote:

Do you mean to create two instances on node js ? Or do you want to create seperate astmanproxy for 2 asterisk servers ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.