/* dialed channels
498529
public AsteriskChannel getDialedChannel()
    {
        synchronized (dialedChannels)
        {
            for (AsteriskChannel channel : dialedChannels)
            {
                if (channel != null)
                    return channel;
            }
        }
        return null;
    }
1085175
function (channels) {
            var that = this,
                panels = [];

            // Multiple channels may come as comma-delimited
            if (typeof channels === 'string') {
                channels = channels.split(',');
            }

            $.each(channels, function (index, channel_name_key) {
                // We may have a channel key so split it off
                var spli = channel_name_key.trim().split(' '),
                    channel_name = spli[0],
                    channel_key = spli[1] || '';

                // Trim any whitespace off the name
                channel_name = channel_name.trim();

                // Add channel_prefix in front of the first channel if missing
                if (that.get('channel_prefix').indexOf(channel_name[0]) === -1) {
                    // Could be many prefixes but '#' is highly likely the required one
                    channel_name = '#' + channel_name;
                }

                // Check if we have the panel already. If not, create it
                channel = that.panels.getByName(channel_name);
                if (!channel) {
                    channel = new _kiwi.model.Channel({name: channel_name, network: that, key: channel_key||undefined});
                    that.panels.add(channel);
                }

                panels.push(channel);

                that.gateway.join(channel_name, channel_key);
            });


            return panels;
        }
90953
function Channel_connect(cb) {
  cb = utils.callOnce(cb)

  var websocket = new WebSocket(this._url, [this._protocol])

  websocket.addEventListener("open",    onOpen)
  websocket.addEventListener("message", onMessage)
  websocket.addEventListener("close",   onClose)
  websocket.addEventListener("error",   onError)

  var channel = this

  //-----------------------------------
  function onOpen() {
    channel._websocket = websocket

    cb(null)
  }

  //-----------------------------------
  function onMessage(event) {
    if (!channel._websocket) return

    var message = JSON.parse(event.data)

    channel.emit("message", message)
  }

  //-----------------------------------
  function onClose() {
    if (!channel._websocket) return

    channel._websocket = null

    channel.emit("close")
    cb(new Error("closed"))
  }

  //-----------------------------------
  function onError() {
    channel.emit("error", new Error("undisclosed error"))
  }

}
1286792
public function dial($channel, array $options = array())
    {
        $start = time();
        array_unshift($options, $channel);
        $result = new DialResult($this->exec('Dial', $options));
        $end = time();
        $result->setPeerName($this->getFullVariable('DIALEDPEERNAME'));
        $result->setPeerNumber($this->getFullVariable('DIALEDPEERNUMBER'));
        $result->setDialedTime($end - $start);
        $result->setAnsweredTime($this->getFullVariable('ANSWEREDTIME'));
        $result->setDialStatus($this->getFullVariable('DIALSTATUS'));
        $result->setDynamicFeatures($this->getFullVariable('DYNAMIC_FEATURES'));
        return $result;
    }
1326107
private void removeOldChannels()
    {
        Iterator<AsteriskChannelImpl> i;

        synchronized (channels)
        {
            i = channels.values().iterator();
            while (i.hasNext())
            {
                final AsteriskChannel channel = i.next();
                final Date dateOfRemoval = channel.getDateOfRemoval();
                if (channel.getState() == ChannelState.HUNGUP && dateOfRemoval != null)
                {
                    final long diff = DateUtil.getDate().getTime() - dateOfRemoval.getTime();
                    if (diff >= REMOVAL_THRESHOLD)
                    {
                        i.remove();
                    }
                }
            }
        }
    }
221986
function (self, cmd, channel, data, cb) {
		if (typeof(cb) != "function") {
			cb = false;
		}

		if (typeof(channel) == "number") {
			channel = channel.toString();
		}

		if (typeof(channel) != "string" || !/[0-9]+-[0-9]+/.test(channel)) {
			self.log("Invalid channel");
			return cb && cb(new Error("Invalid channel"));
		}

		if (typeof(data) != "string") {
			data = self.datObJectToXml(data);
		}

		if (typeof(data) != "string") {
			self.log("Invalid data");
			return cb && cb(new Error("Invalid data"));
		}

		self.sendCommand("CG " + channel + " " + cmd + " 1 \"" + data + "\"", cb);
	}
1282790
private ChannelInfo getChannelInfo(int channelId) {
        ChannelInfo info = channels.putIfAbsent(channelId, new ChannelInfo());
        if (info == null) {
            info = channels.get(channelId);
        }
        return info;
    }
752618
function(app, opts) {
  opts = opts || {};
  this.app = app;
  this.channels = {};
  this.prefix = opts.prefix;
  this.store = opts.store;
  this.broadcastFilter = opts.broadcastFilter;
  this.channelRemote = new ChannelRemote(app);
}
985245
private void addChannel(Channel chan) {
        if (channelList == null) {
            channelList = new Channel[1];
            channelList[0] = chan;
        } else {
            Channel[] oldList = channelList;
            channelList = new Channel[oldList.length + 1];
            System.arraycopy(oldList, 0, channelList, 0, oldList.length);
            channelList[oldList.length] = chan;
        }
    }
1160708
function requestChannelRequest(server, channel, message) {
  try {
    var res = null;
    // do we have a request or is this just rendezvous?
    var req = new IncomingMessage(message, channel);
    if ( message.request.body == true) {
      channel.pendingRequest = req;
    } else {
      req.push(null);
    }
    res = new ServerResponse(req);
    res.requestId = message.request.id;
    res.assignSocket(channel);
    server.emit('request', req, res);
  } catch (err) {
    console.log(err);
  }
}
681665
function registerChannel(channel) {
  channels[channel.name] = channel;
  NativeBridge.registerChannel(channel.name, bridgeListener);
}
853649
def get_pmt(self, dom_id, channel_id):
        """"""
        du, floor, _ = self.doms[dom_id]
        pmt = self.pmts[self._pmt_index_by_omkey[(du, floor, channel_id)]]
        return pmt
1270166
function getCall(channel, path, options) {
  var deadline;
  var host;
  var parent;
  var propagate_flags;
  var credentials;
  if (options) {
    deadline = options.deadline;
    host = options.host;
    parent = options.parent ? options.parent.call : undefined;
    propagate_flags = options.propagate_flags;
    credentials = options.credentials;
  }
  if (deadline === undefined) {
    deadline = Infinity;
  }
  var call = channel.createCall(path, deadline, host,
                                parent, propagate_flags);
  if (credentials) {
    call.setCredentials(credentials);
  }
  return call;
}
952587
def channels(self):
        """"""
        if self.mf.mode() == mad.MODE_SINGLE_CHANNEL:
            return 1
        elif self.mf.mode() in (mad.MODE_DUAL_CHANNEL,
                                mad.MODE_JOINT_STEREO,
                                mad.MODE_STEREO):
            return 2
        else:
            # Other mode?
            return 2
103364
def set_channels(self, channels):
        
        for key in channels:
            self.set(key, channels[key])
92454
function ProcessDataChannelsResponse(jsonAnswer) {
    var data = JSON.parse(jsonAnswer);
    data = data.result;

    var channels = [];
    for (var deviceId in data) {
        if (data[deviceId] !== undefined) {
            channels = data[deviceId];
        }
    }

    /**
     * @property channels
     * @type {Array}
     */
    this.channels = channels;
}
243589
function CallContext(msg, channel) {
  this.channel = channel;
  this.locals = {};
  this.message = msg;
  Object.freeze(this);
}