Expect to receive a SIP INVITE

 @param [Hash] opts A set of options containing SIPp <recv> element attributes
541048
def receive_invite(opts = {})
      recv(opts.merge(request: 'INVITE', rrs: true)) do |recv|
        action = doc.create_element('action') do |action|
          action << doc.create_element('ereg') do |ereg|
            ereg['regexp'] = '<sip:(.*)>.*;tag=([^;]*)'
            ereg['search_in'] = 'hdr'
            ereg['header'] = 'From:'
            ereg['assign_to'] = 'dummy,remote_addr,remote_tag'
          end
          action << doc.create_element('ereg') do |ereg|
            ereg['regexp'] = '<sip:(.*)>'
            ereg['search_in'] = 'hdr'
            ereg['header'] = 'To:'
            ereg['assign_to'] = 'dummy,local_addr'
          end
          action << doc.create_element('assignstr') do |assignstr|
            assignstr['assign_to'] = "call_addr"
            assignstr['value']     = "[$local_addr]"
          end
        end
        recv << action
      end
      # These variables (except dummy) will only be used if we initiate a hangup
      @reference_variables += %w(dummy remote_addr remote_tag local_addr call_addr)
    end
1113387
def notify(message, message_opts = {})
      if _client?
        return unless enabled?
      else
        return unless active?
      end

      @detected.available.each do |notifier|
        notifier.notify(message, message_opts.dup)
      end
    end
890568
function(opts){
    opts = opts || {};

    this.db = opts.db;

    this.config = {
        maxConnection : opts.maxConnection || DEFAULT_MAX_CONNECTION,
        connectionIdleTimeout : opts.connectionIdleTimeout || DEFAULT_CONNECTION_IDLE_TIMEOUT,
        maxPendingTask : opts.maxPendingTask || DEFAULT_MAX_PENDING_TASK,
        reconnectInterval : opts.reconnectInterval || DEFAULT_RECONNECT_INTERVAL,

        // allow concurrent request inside one connection, internal use only
        concurrentInConnection : opts.concurrentInConnection || false,

        // {shardId : {host : '127.0.0.1', port : 31017}}
        shards : opts.shards || {},
    };

    if(this.config.concurrentInConnection){
        this.config.maxConnection = 1;
    }

    var shardIds = Object.keys(this.config.shards);
    if(shardIds.length === 0){
        throw new Error('please specify opts.shards');
    }

    var shards = {};
    shardIds.forEach(function(shardId){
        shards[shardId] = {
            connections : {}, // {connId : connection}
            freeConnections : {}, // {connId : true}
            connectionTimeouts : {}, // {connId : timeout}
            pendingTasks : [],
            reconnectInterval : null,
        };
    });
    this.shards = shards;

    this.openConnectionLock = new AsyncLock({Promise : P, maxPending : 10000});
    this.collections = {};
}
125893
function get( opts, clbk ) {
	var chunks;
	var count;
	var eFLG;
	var out;
	var len;
	var i;

	count = 0;

	// Determine how to chunk requests to prevent query string length errors...
	chunks = chunk( opts.packages, MAXCHARS );
	len = chunks.length;
	out = new Array( len );
	for ( i = 0; i < len; i++ ) {
		// WARNING: we assume that downstream consumers won't mutate the options object such that shared state is a problem. If we are paranoid, we should use `utils-copy` to create a fresh request options object each iteration.
		opts.packages = chunks[ i ].join( ',' );
		request( opts, next( i ) );
	}
	/**
	* FUNCTION: next( idx )
	*	Returns a callback to be invoked upon completing a request.
	*
	* @private
	* @param {Number} idx - chunk index
	* @returns {Function} callback
	*/
	function next( idx ) {
		/**
		* FUNCTION: next( error, data )
		*	Callback invoked upon completing a request.
		*
		* @private
		* @param {Error|Null} error - error object
		* @param {String} data - response data
		* @returns {Void}
		*/
		return function next( error, data ) {
			if ( eFLG ) {
				return;
			}
			if ( error ) {
				if ( error.status !== 404 ) {
					eFLG = true;
					return done( error );
				}
				data = error;
			}
			data = normalize( chunks[ idx ], data );
			data = transform( chunks[ idx ], data );

			out[ idx ] = data;

			done();
		}; // end FUNCTION next()
	} // end FUNCTION next()

	/**
	* FUNCTION: done( error )
	*	Callback invoked upon completing all requests.
	*
	* @private
	* @param {Error|Null} error - error object
	* @returns {Void}
	*/
	function done( error ) {
		if ( error ) {
			return clbk( error );
		}
		count += 1;
		if ( count === len ) {
			clbk( null, concat( out ) );
		}
	} // end FUNCTION done()
}
456327
function Chat (client, opts) {
  var self = this
  if (!(self instanceof Chat)) return new Chat(client, opts)
  if (!opts) opts = {}

  self.client = client
}
904201
function(opts) {
				opts = opts || {};

				$.blockUI({
					message: $m,
					fadeIn : typeof opts.fadeIn  !== 'undefined' ? opts.fadeIn  : 700,
					fadeOut: typeof opts.fadeOut !== 'undefined' ? opts.fadeOut : 1000,
					timeout: typeof opts.timeout !== 'undefined' ? opts.timeout : timeout,
					centerY: false,
					showOverlay: false,
					onUnblock: onClose,
					css: $.blockUI.defaults.growlCSS
				});
			}
84846
function InvItem(type, hash) {
  if (!(this instanceof InvItem))
    return new InvItem(type, hash);

  this.type = type;
  this.hash = hash;
}
751342
function (conn, opts) {
            opts = opts || {};
            var s = opts.prepare, self = this;
            if (s) {
                return this.__logConnectionExecute(conn, comb("XA END %s").format(this.literal(s))).chain(function () {
                    return self.__logConnectionExecute(comb("XA PREPARE %s").format(self.literal(s)));
                });
            } else {
                return this._super(arguments);
            }
        }
461092
function Listener(opts) {
  var hash;

  Transform.call(this);
  opts = opts || {};

  hash = crypto.createHash('sha1', opts.delimiter || 'jambalaya');
  hash.setEncoding('hex');
  hash.end();

  this.buffer = new Buffer('');
  this.delimiter = new Buffer('<' + hash.read().substr(0, 10) + '>');
  this.tag_open = false;
}
579015
function RegistryClientV1(opts) {
    var self = this;
    assert.object(opts, 'opts');
    assert.string(opts.name, 'opts.name');
    assert.optionalObject(opts.log, 'opts.log');
    assert.optionalString(opts.username, 'opts.username');
    assert.optionalString(opts.password, 'opts.password');
    assert.optionalBool(opts.insecure, 'opts.insecure');
    assert.optionalString(opts.scheme, 'opts.scheme');
    // TODO: options to control the trust db for CA verification
    // TODO add passing through other restify options
    // Restify/Node HTTP client options.
    // opt.agent (optional, bool or object)
    assert.optionalString(opts.userAgent, 'opts.userAgent');
    // opts.proxy (optional, bool or object or string);

    this.log = opts.log
        ? opts.log.child({
                component: 'registry',
                serializers: restifyClients.bunyan.serializers
            })
        : bunyan.createLogger({
                name: 'registry',
                serializers: restifyClients.bunyan.serializers
            });

    this.insecure = Boolean(opts.insecure);
    this.repo = common.parseRepo(opts.name);
    if (opts.scheme) {
        this.repo.index.scheme = opts.scheme;
    } else if (common.isLocalhost(this.repo.index.name)) {
        // Per docker.git:registry/config.go#NewServiceConfig we special
        // case localhost to allow HTTP. Note that this lib doesn't do
        // the "try HTTPS, then fallback to HTTP if allowed" thing that
        // docker-docker does, we'll just prefer HTTP for localhost.
        this.repo.index.scheme = 'http';
    }

    if (opts.username && opts.password) {
        var buffer = new Buffer(opts.username + ':' + opts.password, 'utf8');
        this._authorization = 'Basic ' + buffer.toString('base64');
    }
    this._ensuredSession = false;
    this._cookieJar = new tough.CookieJar();

    this._indexUrl = common.urlFromIndex(this.repo.index);

    this._commonHttpClientOpts = {
        log: this.log,
        agent: opts.agent,
        proxy: opts.proxy,
        rejectUnauthorized: !this.insecure,
        userAgent: opts.userAgent || common.DEFAULT_USERAGENT
    };
    this._clientsToClose = [];

    Object.defineProperty(this, '_indexApi', {
        get: function () {
            if (self.__indexApi === undefined) {
                self.__indexApi = self._createClient('json', self._indexUrl);
            }
            return this.__indexApi;
        }
    });

    /*
     * The registry endpoint can vary. By default one can infer it from
     * the repo. E.g. "quay.io/foo" has a registry host of "quay.io". For
     * repos not specifying and index, e.g. "busybox" or "trentm/blah", the
     * default index is "index.docker.io", for which the default registry host
     * is registry-1.docker.io.
     *
     * Typically that is all you need. However two others things can happen:
     * - The `listRepoImgs` response can redirect to a totally different
     *   registry. E.g. Docker Hub does this for the "rhel7" image. And/or:
     * - The `listRepoImgs` can (typically does, always does?) include a
     *   X-Docker-Endpoints header with a registry host to use.
     *   See `_ensureSession` below.
     *
     * The properties below are to lazily determine and use the registry
     * URL after `_ensureSession` has been run to provide redirects and/or
     * endpoints.
     */
    Object.defineProperty(this, '_registryUrl', {
        get: function () {
            assert.ok(self._ensuredSession,
                'getting _registryUrl before session');
            if (self.__registryUrl === undefined) {
                if (self._endpoints && self._endpoints.length > 0) {
                    self.__registryUrl = self._endpoints[0];
                } else if (self.repo.index.official) {
                    self.__registryUrl = DEFAULT_REGISTRY_URL_V1;
                } else {
                    self.__registryUrl = common.urlFromIndex(self.repo.index);
                }
                self.log.trace({_registryUrl: self.__registryUrl},
                    'set _registryUrl');
            }
            return self.__registryUrl;
        }
    });
    Object.defineProperty(this, '_registryHost', {
        get: function () {
            if (self.__registryHost === undefined) {
                self.__registryHost = mod_url.parse(self._registryUrl).host;
            }
            return self.__registryHost;
        }
    });
    Object.defineProperty(this, '_registryApi', {
        get: function () {
            if (self.__registryApi === undefined) {
                self.__registryApi = self._createClient(
                    'json', self._registryUrl);
            }
            return self.__registryApi;
        }
    });
}
525735
function resolveForkOptions(opts) {
  opts = opts || {};

  var processExecArgv = process.execArgv.join(' ');
  var inspectorActive = processExecArgv.indexOf('--inspect') !== -1;
  var debugBrk = processExecArgv.indexOf('--debug-brk') !== -1;

  var execArgv = [];
  if (inspectorActive) {
    execArgv.push('--inspect=' + opts.debugPort);

    if (debugBrk) {
      execArgv.push('--debug-brk');
    }
  }

  return assign({}, opts, {
    forkArgs: opts.forkArgs,
    forkOpts: assign({}, opts.forkOpts, {
      execArgv: (opts.forkOpts && opts.forkOpts.execArgv || [])
      .concat(execArgv)
    })
  });
}
612015
function Mailer(opts) {
	opts = opts || {};
	var smtp = opts.smtp;
	if(!smtp) { throw new TypeError("bad arguments"); }
	this._transport = nodemailer.createTransport("SMTP", smtp);
	this._transport_sendMail = Q.nbind(this._transport.sendMail, this._transport);
	this._transport_close = Q.nbind(this._transport.close, this._transport);
}
383066
def parse_opts(opts)
      REQUIRED_OPTS.each do |opt|
        raise "#{opt.inspect} option not provided" if opts[opt].nil?
      end

      rafka_opts = opts.reject { |k| k == :redis || k == :librdkafka }

      redis_opts = REDIS_DEFAULTS.dup.merge(opts[:redis] || {})
      redis_opts.merge!(
        rafka_opts.select { |k| [:host, :port, :id].include?(k) }
      )

      [rafka_opts, redis_opts]
    end
633264
def ack_answer(opts = {})
      msg = <<-BODY

ACK [next_url] SIP/2.0
Via: SIP/2.0/[transport] #{@adv_ip}:[local_port];branch=[branch]
From: "#{@from_user}" <sip:#{@from_user}@#{@adv_ip}:[local_port]>;tag=[call_number]
To: <sip:#{to_addr}>[peer_tag_param]
Call-ID: [call_id]
CSeq: [cseq] ACK
Contact: <sip:[$local_addr];transport=[transport]>
Max-Forwards: 100
User-Agent: #{USER_AGENT}
Content-Length: 0
[routes]
      BODY
      send msg, opts
      start_media
    end
708067
function(opts) {
      opts = opts || {};
      var path = opts.path || this.path,
          callback = opts.callback,
          method = opts.method || this.method,
          ws = getWebsocketPlugin(),
          transports = app.config.transports,
          self = this,
          i = 0,
          error,
          response;

      if (ws) {
        if (transports && transports.length > 0) {
          async.whilst(
            function () {
              return (i < transports.length);
            },
            function (done) {
              self.doConnect(transports[i], method, path, function (err, res) {
                error = err;
                response = res;
                if (!err && res) {
                  i = transports.length;
                } else {
                  i++;
                  if (i < transports.length) {
                    delete self.request;
                  }
                }
                done();
              });
            },
            function (err) {
              callback(err || error, response);
            }
          );
        } else {
          error = 'no transport available';
          log.error('%s %s', app.name, error);
          callback(error);
        }
      } else {
        this.doConnect('http', method, path, callback);
      }
      return this;
    }
1171110
function (opts) {
    // prepare properties
    this.actionQueue = [];
    this.config = opts.config;
    this.lastCalledUrl = null;
    this.driverStatus = {};
    this.sessionStatus = {};
    // store injcted options in object properties
    this.events = opts.events;
    this.reporterEvents = opts.reporter;
    this.browserName = opts.browser;
    return this;
  }
661353
function(opts) {
  if(!opts) opts = {};
  var libpath = opts['path'];

  this._emitter = new events.EventEmitter();
  this._library = this.createLibrary(libpath);
  this._initCrypto(opts);
  this._options = this._createToxOptions(opts);
  this._initNew(this._options);
  this._initCallbacks();

  // Create a child ToxOld if specified for old groupchat functionality
  if(opts.old === true) {
    this._toxold = new ToxOld({ path: libpath, tox: this });
  }
}