> For the complete documentation index, see [llms.txt](https://prosbcdocs.telcobridges.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://prosbcdocs.telcobridges.com/telecom-references/apis-and-integration/adding-youmail-script-to-routing-scripts.md).

# Adding YouMail Script to Routing Scripts

> **Applies to:** ProSBC 3.1, 3.2

This article describes how to add **youmail\_spam\_risk.rb** script to any Routing scripts.

### Requirements for this script

* Devices must be installed with release 3.1.113 or later.
* The management interface must have an external access to reach the YouMail server. All HTTPS requests will come from the management interface. **tbchangeip** command can be used from the console of the ProSBC or TMG devices to configure the DNS server.
* Need to have an account at [YouMail](https://www.youmail.com/) to get a Security ID (SID) and an API key. Trial accounts are available.

### Add **youmail\_spam\_risk.rb** Scripts in system

Download this file:

| YouMail spam risk ruby script                                                                  |
| ---------------------------------------------------------------------------------------------- |
| \*[Youmail\_spam\_risk.rb](https://docs.telcobridges.com/w/images/3/36/Youmail_spam_risk.zip‎) |

Then upload it in the system with these instructions: [Import Customized Routing Script](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/api/import-customized-routing-script/README.md)

You can also copy/paste the content of the main file and create a new 'Main' Script using the **Create New Script File** menu

### Setting up **YouMail spam risk** Scripts

To set up a Filter, the main script needs to be modified. The main script can be either simple\_routing.rb, simple\_routing\_sbc.rb, or any other script with the 'Main' type.

![Main scripts](https://docs.telcobridges.com/w/images/e/e3/Main_scripts.png%E2%80%8E)

Go to the routing script section of the Web portal

```
Gateway -&gt; Routing scripts -&gt; simple_routing_sbc.rb [Edit]
```

Three things need to be added. At the start of the script:

```
require 'youmail_spam_risk'
```

In the main class:

```
include YouMailSpamRisk
```

```
   after_filter :method                      => :filter_by_https_spam_risk,
                :server_url                  => "https://dataapi.youmail.com/api/v3/lookup/phone",
                :data_api_sid                => "abc123",  # Need to get the sid and key from YouMail
                :data_api_key                => "abc123",
                :default_score               => 0,
                :sl_timeout_ms               => 2000,
                :order_by_score              => false
```

The final 'Main' script will look like this:

```
require 'base_routing'
require 'youmail_spam_risk'

class SimpleRouting < BaseRouting
  include YouMailSpamRisk

  route_match :call_field_name => :called
  route_match :call_field_name => :calling
  route_match :call_field_name => :nap

  after_filter :method                      => :filter_by_https_spam_risk,
               :server_url                  => "https://dataapi.youmail.com/api/v3/lookup/phone",
               :data_api_sid                => "abc123", # Need to get the sid and key from YouMail
               :data_api_key                => "abc123",
               :default_score               => 0,
               :sl_timeout_ms               => 2000,
               :order_by_score              => false

  route_remap :call_field_name => :called, :route_field_name => :remapped_called
  route_remap :call_field_name => :calling, :route_field_name => :remapped_calling
  route_remap :call_field_name => :nap, :route_field_name => :remapped_nap

end
```

There may be other scripts called by this 'Main' script. This is normal.

### Adding New max\_spam\_risk\_level Variable

You need to add a new custom column to use this script. There is a default value created and it can be changed in each route afterwards.

```
Gateway -&gt; Routes -&gt; Create New Route Column
```

**Name**: max\_spam\_risk\_level **Type attributes**: integer **Default**: 0

The result will look like this:

![Max spam route column](https://docs.telcobridges.com/w/images/7/7b/Max_spam_route_column.png%E2%80%8E%E2%80%8E)

You can then go in each route and change this value. '2' will be accept all calls, no matter what. '0' will be to accept only calls validated by YouMail.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://prosbcdocs.telcobridges.com/telecom-references/apis-and-integration/adding-youmail-script-to-routing-scripts.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
