1

Data I would like to have: Num From , Num To , Duration, Codec, Context, Hold status

ofc in realtime update

I using node.js + nami

what the best way to get this information?

tried use an action Status(), but this gives me not full information about call and if I run it every second browser dies.

here is what I have:

updateCallList();
function updateCallList() {
    socket.emit('GET_ACTIVE_CALLS', function(calls) {
        $("#callsList").find("tr:gt(0)").remove();
        if (calls.response != 'Success') return;
        var calls = calls.events;
        for (call in calls) {
            if (calls[call].privilege == 'Call') {

            var callFrom     = calls[call].calleridnum + '<' + calls[call].calleridname + '>';
            var callTo       = calls[call].extension;
            var callDuration = calls[call].seconds;
            var callRoute    = calls[call].context;

            var tmpRow = '<tr>';
            tmpRow = tmpRow + '<td>' + callFrom     + '</td>';
            tmpRow = tmpRow + '<td>' + callTo       + '</td>';
            tmpRow = tmpRow + '<td>' + callDuration + '</td>';
            tmpRow = tmpRow + '<td>' + callRoute    + '</td>';
            tmpRow = tmpRow + '</tr>';

            $('#callsList tr:last').after(tmpRow);
        }
    }
    setInterval(function(){
        updateCallList();
    },1000);
});

}

server side

socket.on('GET_ACTIVE_CALLS', function (callback) {
    action = new namiLib.Actions.Status();
    nami.send(action, function (response) {
        callback(response);
    });
});
user840250
  • 727
  • 1
  • 8
  • 20

1 Answers1

1

You need start daemon which will collect NewExten, Link, Unlink, Hangup events and create list of channels. http://www.voip-info.org/wiki/view/asterisk+manager+events

Also you can do action command with "core show channels" "core show channel XXXXX", but asterisk will die if you do alot of that.

http://www.voip-info.org/wiki/view/Asterisk+Manager+API+Action+Command

arheops
  • 15,544
  • 1
  • 21
  • 27