[asterisk-bugs] [JIRA] (ASTERISK-26421) Segmentation Fault with ARI originate into mixing bridge with 43 clients

Andrew Nagy (JIRA) noreply at issues.asterisk.org
Mon Oct 17 11:37:02 CDT 2016


    [ https://issues.asterisk.org/jira/browse/ASTERISK-26421?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=232741#comment-232741 ] 

Andrew Nagy edited comment on ASTERISK-26421 at 10/17/16 11:36 AM:
-------------------------------------------------------------------

I don't see us generating that uuid anywhere.

However in the official node library for ari (which we use). It does use node-uuid which generates a uuid: 

https://github.com/asterisk/node-ari-client/blob/0d31568c3b6ed895f988b954716c5d1233f8b1a4/package.json#L30
https://github.com/asterisk/node-ari-client/blob/99146554786d8e7d8a5e868c0640d93e22952c3a/lib/resources.js#L84


Here is the source of our application:
{code}
var ampconf = {'FPBX_ARI_USER':'freepbxuser', 'FPBX_ARI_PASSWORD': '074cdbe438331c9622910f803249ac99'};
var express = require('express');
var Q = require('q');
var app = express();
var ari = null;
var client = require('ari-client');
var bridgelist = [];
var channellist = [];
//Express Server
app.get('/', function(req, res) {
    var bridge = req.query['bridge'];
    var number = req.query['number'];
  createBridge({'bridgeName':bridge,'number':number})
  .then(originateCall)
  .catch(function(err){console.log(err)});
    res.send('frobulated');
});
app.listen(3001);
console.log('Listening on port 3001...');
//Ari Connection
//
client.connect('http://localhost:8088', ampconf["FPBX_ARI_USER"], ampconf["FPBX_ARI_PASSWORD"])
  .then(function (ariconn) {
    ari = ariconn
      ari.start('smsconference');
  })
  .catch(function (err) {
    throw err;
  });
function createBridge(options){
  var bridgeName = options['bridgeName'];
  var number = options['number'];
  var deferred = Q.defer();
  console.log(bridgeExist(bridgeName));
  if(bridgeExist(bridgeName)){
    deferred.resolve({'bridgeName':bridgeName, 'number':number});
    return deferred.promise;
  }
  bridgelist[bridgeName] = bridgeName;
  ari.bridges.createWithId({
    bridgeId: bridgeName,
    type: 'mixing, dtmf_events, proxy_media'
  })
  .then(function (bridge) {
    console.log('bridge created ' + bridge.id);
        /*
        bridge.on('ChannelLeftBridge', function(event, instances) {
            if(bridge.channels.length === 0){
                bridge.destroy(function (err) {
                    delete bridgelist[bridgeName];
                });
            }
        });
        */
    deferred.resolve({'bridgeName':bridgeName, 'number':number});
  })
  .catch(function (err) {
    deferred.reject(new Error(err));
  });
  return deferred.promise;
}
function bridgeExist(bridgeName){
  if(typeof bridgelist[bridgeName] == "undefined"){
    return false;
  } else{
    return true;
  }
}
function originateCall(options){
  var bridgeName = options['bridgeName'];
  var number = options['number'];
  var deferred = Q.defer();
  var channel = ari.Channel();
  channel.originate({endpoint: 'local/'+number+'@from-internal', app: 'smsconference', appArgs: 'dialed', formats:'ulaw'})
  .then(function (channel) {
    channel.answer(function(err){
      channel.on('StasisStart', function (event, channel) {
        if(typeof channellist[bridgeName] == "undefined"){
          channellist[bridgeName] = []
        }
        channellist[bridgeName].push(channel.id);
        addToBridge({'bridgeName':bridgeName, 'number':channel});
      });
      deferred.resolve({'bridgeName':bridgeName, 'number':channel});
    });
    console.log("Answered "+ number);
  })
  .catch(function (err) {
    deferred.reject(new Error("Couldn't call "+ number));
  });
  return deferred.promise;
}
function addToBridge(options){
  var bridgeName = options['bridgeName'];
  var channelID = options['number'];
  var deferred = Q.defer();
  ari.bridges.addChannel({
    bridgeId: bridgeName,
    channel: channellist[bridgeName]
  })
  .then(function () {
    console.log("added "+channelID.id+" to "+bridgeName);
    deferred.resolve({'bridgeName':bridgeName, 'number':number});
  })
  .catch(function (err) {
    deferred.reject(new Error("Couldn't add "+channelID.id+" to "+bridgeName));
  });
  return deferred.promise;
}
{code}


was (Author: tm1000):
Here is the source to the ARI application: http://wiki.freepbx.org/pages/viewpage.action?pageId=69599350

I don't see us generating that uuid anywhere.

However in the official node library for ari (which we use). It does use node-uuid which generates a uuid: 

https://github.com/asterisk/node-ari-client/blob/0d31568c3b6ed895f988b954716c5d1233f8b1a4/package.json#L30
https://github.com/asterisk/node-ari-client/blob/99146554786d8e7d8a5e868c0640d93e22952c3a/lib/resources.js#L84

> Segmentation Fault with ARI originate into mixing bridge with 43 clients
> ------------------------------------------------------------------------
>
>                 Key: ASTERISK-26421
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-26421
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>    Affects Versions: 13.11.2
>            Reporter: Andrew Nagy
>            Assignee: Mark Michelson
>            Severity: Minor
>         Attachments: backtrace.txt
>
>
> Asterisk crashed in the middle of our dangerous demo. We setup a system that would get an SMS then make an outbound call and bridge that call in. At around 43 calls Asterisk was at about 177% cpu. Since we lost the Dangerous Demo because of an Asterisk crash we'd like this moved to our L4 support for immediate fixing. Then please bring back everyone for Astricon's Dangerous Demos so that we can try this again and win, of course.
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> .
> Just kidding. This is not a priority I am just attaching the backtrace incase it's relevant for anyone.
> Thanks for all you do and thank for Astricon and Asterisk!



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list