How to use asterisk-manager - 3 common examples

To help you get started, we’ve selected a few asterisk-manager examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wreiske / asteriskmonitor / server / server.js View on Github external
save_ami: function (host, port, user, pass) {
            if (!Meteor.userId() || !Roles.userIsInRole(Meteor.userId(), ['admin'])) {
                throw new Meteor.Error("not-authorized");
            }
            check(host, String);
            check(port, String);
            check(user, String);
            check(pass, String);

            const ami = new asterisk(
                port,
                host,
                user,
                pass,
                true); // This parameter determines whether events are emitted.

            if (ami) {
                ami.keepConnected();
                ami.on('error', function (err) {
                    console.log('ERROR', err);
                });
                ami.action({
                        'action': 'ping'
                    },
                    Meteor.bindEnvironment((err, res) => {
                        if (err) {
github wreiske / asteriskmonitor / server / server.js View on Github external
function StartAMI() {
    const amiserver = ServerSettings.find({
        'module': 'ami'
    }).fetch()[0];

    if (amiserver) {
        if (amiserver.port && amiserver.host && amiserver.user && amiserver.pass) {
            const ami = new asterisk(
                amiserver.port,
                amiserver.host,
                amiserver.user,
                amiserver.pass,
                true); // This parameter determines whether events are emited.
            ami.keepConnected();
            /*
            TODO:
            Create different collections for each event type or use the AmiLog for everything and then filter events?

            A list of event names can be found at
            https://wiki.asterisk.org/wiki/display/AST/Asterisk+11+AMI+Events
            */

            //AmiLog._ensureIndex( { 'starmon_timestamp': 1 }, { expireAfterSeconds: 60 } );
            ami.on('managerevent', Meteor.bindEnvironment(function (evt) {
github wreiske / asteriskmonitor / server / server.js View on Github external
conference_mute_user: function (bridgeuniqueid, bridge, channel) {
            if (!Meteor.userId()) {
                throw new Meteor.Error("not-authorized");
            }
            check(bridge, Number);
            check(channel, String);

            var amiserver = ServerSettings.find({
                'module': 'ami'
            }).fetch()[0];

            if (amiserver) {
                if (amiserver.port && amiserver.host && amiserver.user && amiserver.pass) {
                    var ami = new asterisk(
                        amiserver.port,
                        amiserver.host,
                        amiserver.user,
                        amiserver.pass,
                        true);
                    ami.action({
                        'action': 'confbridgemute',
                        'conference': bridge,
                        'channel': channel,
                    }, Meteor.bindEnvironment(function (err, res) {
                        if (err) {
                            throw new Meteor.Error('conf-mute-error', err);
                        }
                        ConferenceMembers.update({
                            'bridgeuniqueid': bridgeuniqueid,
                            'usernum': user_id,

asterisk-manager

A node.js module for interacting with the Asterisk Manager API.

Unrecognized
Latest version published 3 years ago

Package Health Score

54 / 100
Full package analysis

Popular asterisk-manager functions