Actions

Adding YouMail script to Routing scripts: Difference between revisions

No edit summary
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=== '''''Applies to version(s): v3.1, v3.2''''' ===
{{DISPLAYTITLE:Adding YouMail Script to Routing Scripts}}
{{DISPLAYTITLE:Adding YouMail script to Routing Scripts instructions - INCOMPLETE}}
{| class="wikitable"
This shows how to add '''youmail_spam_risk.rb''' script to any Routing scripts.  
|-
|rowspan="3"|This article applies to:
|'''Product'''
|'''Version'''
|-
|ProSBC
|3.1, 3.2
|}
 
This article describes how to add '''youmail_spam_risk.rb''' script to any Routing scripts.  


== Requirements for this script  ==
== Requirements for this script  ==
Line 18: Line 27:
*[[Media:Youmail_spam_risk.zip‎|Youmail_spam_risk.rb]]
*[[Media:Youmail_spam_risk.zip‎|Youmail_spam_risk.rb]]
|}
|}
Then upload it in the system with these instructions:
Then upload it in the system with these instructions:
[[Import_Customized_Routing_Script_C|Import Customized Routing Script]]
[[Import_Customized_Routing_Script_C|Import Customized Routing Script]] <br>
You can also copy/paste the content of the main file and create a new 'Main' Script using the '''Create New Script File''' menu  <br>


== Setting up '''YouMail spam risk''' Scripts<br>  ==
== Setting up '''YouMail spam risk''' Scripts<br>  ==


To setup 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.<br>  
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.<br>  
[[Image:Main_scripts.png‎|400px]] <br>
[[Image:Main_scripts.png‎|400px]] <br>
You can also copy/paste the content of the main file and create a new 'Main' Script using the '''Create New Script File''' menu <br>


<br>
<br>
Line 31: Line 41:
<pre>Gateway -&gt; Routing scripts -&gt; simple_routing_sbc.rb [Edit]
<pre>Gateway -&gt; Routing scripts -&gt; simple_routing_sbc.rb [Edit]
</pre>  
</pre>  
Three things need to be added. At the start of the script:<br>  
Three things need to be added. At the start of the script:<br>  
<pre>require 'youmail_spam_risk'
<pre>require 'youmail_spam_risk'
</pre>  
</pre>  
In the main class:<br>  
In the main class:<br>  
<pre>include YouMailSpamRisk
<pre>include YouMailSpamRisk
</pre>  
</pre>
<pre>  after_filter :method                      => :filter_by_https_spam_risk,
<pre>  after_filter :method                      => :filter_by_https_spam_risk,
                 :server_url                  => "https://dataapi.youmail.com/api/v2/",
                 :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_sid                => "abc123",  # Need to get the sid and key from YouMail
                 :data_api_key                => "abc123",
                 :data_api_key                => "abc123",
Line 45: Line 58:
                 :order_by_score              => false
                 :order_by_score              => false
</pre>  
</pre>  
<br>  
<br>
The final 'Main' script will look like this:
The final 'Main' script will look like this:
<pre>
<pre>
Line 59: Line 73:


   after_filter :method                      => :filter_by_https_spam_risk,
   after_filter :method                      => :filter_by_https_spam_risk,
               :server_url                  => "https://dataapi.youmail.com/api/v2/",
               :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_sid                => "abc123", # Need to get the sid and key from YouMail
               :data_api_key                => "abc123",
               :data_api_key                => "abc123",
Line 73: Line 87:
</pre>
</pre>


There may be other scripts called by this 'Main' script, this is normal.
There may be other scripts called by this 'Main' script. This is normal.
 
 
== Adding New max_spam_risk_level Variable <br>  ==
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.
<pre>Gateway -&gt; Routes -&gt; Create New Route Column</pre>
 
'''Name''': max_spam_risk_level<br>'''Type attributes''': integer<br>'''Default''': 0 <br>
 
The result will look like this:<br>
[[Image:Max_spam_route_column.png‎‎|400px]] <br>
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.

Latest revision as of 13:46, 19 September 2023

This article applies to: Product Version
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 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

Then upload it in the system with these instructions: Import Customized Routing Script
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.


Go to the routing script section of the Web portal

Gateway -> Routing scripts -> 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 -> Routes -> Create New Route Column

Name: max_spam_risk_level
Type attributes: integer
Default: 0

The result will look like this:

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.