<commit_before>[![Build Status](https://secure.travis-ci.org/grasshoppergroup/adhearsion-cpa.png?branch=master)](http://travis-ci.org/grasshoppergroup/adhearsion-cpa) [![Coverage Status](https://coveralls.io/repos/grasshoppergroup/adhearsion-cpa/badge.png?branch=master)](https://coveralls.io/r/grasshoppergroup/adhearsion-cpa?branch=master)

# Adhearsion-CPA

This plugin aims to provide CPA detection..

## Compatibility

* Asterisk - no
* FS/Event Socket - no
* FS/[mod_rayo](https://wiki.freeswitch.org/wiki/Mod_rayo) - yes

To use currently, you'll have to specify a feature branch of [punchblock](https://github.com/adhearsion/punchblock/tree/feature/cpa_fax) in your Gemfile:

```ruby
gem 'punchblock', github: "adhearsion/punchblock", branch: "feature/cpa_fax"
```

## Usage

## More Information

Specification: [rayo-cpa](https://github.com/rayo/xmpp/blob/rayo/extensions/inbox/rayo-cpa.xml)

## Credits
<commit_msg>Add usage example to readme<commit_after>[![Build Status](https://secure.travis-ci.org/grasshoppergroup/adhearsion-cpa.png?branch=master)](http://travis-ci.org/grasshoppergroup/adhearsion-cpa) [![Coverage Status](https://coveralls.io/repos/grasshoppergroup/adhearsion-cpa/badge.png?branch=master)](https://coveralls.io/r/grasshoppergroup/adhearsion-cpa?branch=master)

# Adhearsion-CPA

This plugin aims to provide CPA detection..

## Compatibility

* Asterisk - no
* FS/Event Socket - no
* FS/[mod_rayo](https://wiki.freeswitch.org/wiki/Mod_rayo) - yes

To use currently, you'll have to specify a feature branch of [punchblock](https://github.com/adhearsion/punchblock/tree/feature/cpa_fax) in your Gemfile:

```ruby
gem 'punchblock', github: "adhearsion/punchblock", branch: "feature/cpa_fax"
```

## Usage

```ruby
class BeepOrNoBeepController < Adhearsion::CallController
  def run
    answer
    say "Try to imitate a fax machine"
    tone = detect_tone(:fax, timeout: 5)
    if tone
      say "Good job! You sound just like a #{tone.type}"
    else
      say "Nope, you didn't make a convincing enough beep"
    end
  end
end
```

You can also watch for more than one tone type:
```ruby
say "Something is beeping" if detect_tone(:fax, :modem, :beep, timeout: 5)
```

## More Information

Specification: [rayo-cpa](https://github.com/rayo/xmpp/blob/rayo/extensions/inbox/rayo-cpa.xml)

## Credits

{'fraction_non_alphanumeric': 0.1461108723678556, 'fraction_numerical': 0.0008594757198109154, 'mean_word_length': 4.923664122137405, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 12, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, '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': '549738', 'n_tokens_mistral': 898, 'n_tokens_neox': 841, 'n_words': 163}