node.js - Asterisk 11 active calls event over AMI -
data have: num , num , duration, codec, context, hold status
ofc in realtime update
i using node.js + nami
what best way information?
tried use action status(), gives me not full information call , if run every second browser dies.
here 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; (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); }); });
you need start daemon collect newexten, link, unlink, hangup events , create list of channels. http://www.voip-info.org/wiki/view/asterisk+manager+events
also can action command "core show channels" "core show channel xxxxx", asterisk die if alot of that.
http://www.voip-info.org/wiki/view/asterisk+manager+api+action+command
Comments
Post a Comment