Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * port: port server
- * host: host server
- * username: username for authentication
- * password: username's password for authentication
- * events: this parameter determines whether events are emited.
- **/
- var ami = new require('asterisk-manager')('5038', '----', 'LOGIN', 'YOUR_PASS', true);
- // In case of any connectiviy problems we got you coverd.
- ami.keepConnected();
- ami.on('connect', function (evt) {
- });
- ami.on('response', function (evt) {
- });
- // Listen for any/all AMI events.
- ami.on('managerevent', function (evt) {
- // console.log(evt);
- //Убиваем звонки )
- // ami.action({
- // 'action':'Hangup',
- // 'channel': evt.channel,
- // 'Uniqueid': evt.uniqueid,
- // 'cause': '17',
- // 'cause-txt': 'User busy'
- // }, function(err, res) {
- // console.log(res);
- // });
- // Переадресовываем
- // ami.action({
- // 'action': 'redirect',
- // 'channel': evt.channel,
- // 'context': 'office',
- // 'exten': '103', //куда будем переадресовывать
- // // 'ExtraExten': '113',
- // 'priority': '1',
- // 'ExtraPriority': '2'
- // }, function (err, res) {
- // console.log(res);
- // });
- //Звоним абоненту
- // ami.action({
- // 'action': 'originate',
- // 'channel': "SIP/112",
- // 'exten': '113',
- // 'context': 'office',
- // 'priority': '1'
- // }, function (err, res) {
- // console.log(res);
- // });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement