<commit_before>adhearsion-drb
=======

adhearsion-drb is an Adhearsion Plugin providing DRb connectivity. It allows third party ruby clients to connect to an Adhearsion instance for RPC.

Requirements
------------

* Adhearsion 2.0+

Install
-------

Add `adhearsion-drb` to your Adhearsion app's Gemfile.

Configuration
-------------

In your Adhearsion app configuration file, add the following values:

```ruby
Adhearsion.config[:adhearsion_drb] do |config|
  config.host = "DRb service host"
  config.port = "DRB service port".to_i
  config.acl.allow = ["127.0.0.1"] # list of allowed IPs (optional)
  config.acl.deny = [] # list of denied IPs (optional)
  config.shared_object = some_shared_object
end
```

The `shared_object` in the config is the endpoint to which a 3rd-party client will be bound on connection. The most basic scenario looks something like this:

```ruby
class DrbEndpoint
  def foo
    :bar
  end
end

Adhearsion.config.adhearsion_drb.shared_object = DrbEndpoint.new
```

with the following client:

```ruby
require 'drb'
adhearsion_api = DRbObject.new_with_uri 'druby://localhost:9050'
p adhearsion_api.foo
```

When the Adhearsion application is running, and the client script runs, it should print `:foo` to stdout.

A more useful example to return the number of active calls:

```ruby
class DrbEndpoint
  def call_count
    Adhearsion.active_calls.count
  end
end
```

Or to trigger an outbound call:

```ruby
class DrbEndpoint
  def place_call(number, provider)
    Adhearsion::OutboundCall.originate "SIP/#{number}@#{provider}", controller: FooController
  end
end
```

NB: Be careful not to define `#call` on your shared object, else it will be evaluated by the config system incorrectly.

Author
------

Original author: [<NAME>](https://github.com/juandebravo)

Links
-----
* [Source](https://github.com/adhearsion/adhearsion-drb)
* [Documentation](http://rdoc.info/github/adhearsion/adhearsion-drb/master/frames)
* [Bug Tracker](https://github.com/adhearsion/adhearsion-drb/issues)

Note on Patches/Pull Requests
-----------------------------<commit_msg>Return simple objects from DRb calls<commit_after>adhearsion-drb
=======

adhearsion-drb is an Adhearsion Plugin providing DRb connectivity. It allows third party ruby clients to connect to an Adhearsion instance for RPC.

Requirements
------------

* Adhearsion 2.0+

Install
-------

Add `adhearsion-drb` to your Adhearsion app's Gemfile.

Configuration
-------------

In your Adhearsion app configuration file, add the following values:

```ruby
Adhearsion.config[:adhearsion_drb] do |config|
  config.host = "DRb service host"
  config.port = "DRB service port".to_i
  config.acl.allow = ["127.0.0.1"] # list of allowed IPs (optional)
  config.acl.deny = [] # list of denied IPs (optional)
  config.shared_object = some_shared_object
end
```

The `shared_object` in the config is the endpoint to which a 3rd-party client will be bound on connection. The most basic scenario looks something like this:

```ruby
class DrbEndpoint
  def foo
    :bar
  end
end

Adhearsion.config.adhearsion_drb.shared_object = DrbEndpoint.new
```

with the following client:

```ruby
require 'drb'
adhearsion_api = DRbObject.new_with_uri 'druby://localhost:9050'
p adhearsion_api.foo
```

When the Adhearsion application is running, and the client script runs, it should print `:foo` to stdout.

A more useful example to return the number of active calls:

```ruby
class DrbEndpoint
  def call_count
    Adhearsion.active_calls.count
  end
end
```

Or to trigger an outbound call:

```ruby
class DrbEndpoint
  def place_call(number, provider)
    call = Adhearsion::OutboundCall.originate "SIP/#{number}@#{provider}", controller: FooController
    call.id
  end
end
```

NB: Be careful not to define `#call` on your shared object, else it will be evaluated by the config system incorrectly.

Author
------

Original author: [<NAME>](https://github.com/juandebravo)

Links
-----
* [Source](https://github.com/adhearsion/adhearsion-drb)
* [Documentation](http://rdoc.info/github/adhearsion/adhearsion-drb/master/frames)
* [Bug Tracker](https://github.com/adhearsion/adhearsion-drb/issues)

Note on Patches/Pull Requests
-----------------------------
{'fraction_non_alphanumeric': 0.13033175355450238, 'fraction_numerical': 0.006161137440758294, 'mean_word_length': 3.8854166666666665, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2414899', 'n_tokens_mistral': 1434, 'n_tokens_neox': 1371, 'n_words': 425}