Adding YouMail script to Routing scripts

From TBwiki
(Difference between revisions)
Jump to: navigation, search
(Page creation)
 
(Updated YouMail page)
Line 4: Line 4:
  
 
== Requirements for this script  ==
 
== Requirements for this script  ==
# The management interface must have an external access to reach the YouMail server. All HTTPS requests will come from the management interface.
+
# 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 [https://www.youmail.com/ YouMail] to get a Security ID (SID) and an API key. Trial accounts are available.
 +
<br>
  
 
== Add '''youmail_spam_risk.rb''' Scripts in system<br>  ==
 
== Add '''youmail_spam_risk.rb''' Scripts in system<br>  ==
Line 10: Line 12:
 
{| cellpadding="5" border="1" class="wikitable"
 
{| cellpadding="5" border="1" class="wikitable"
 
|-
 
|-
! width="200" style="background: rgb(239, 239, 239) none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;" |Capture DTMF Script
+
! width="200" style="background: rgb(239, 239, 239) none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;" |YouMail spam risk ruby script
 
|-
 
|-
 
| valign="top" |
 
| valign="top" |
*[[Media:R_n_cdr.zip|R_n_cdr.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_C|Import Customized Routing Script]]
  
== Setting up '''Routing Number''' 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.<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>
 +
[[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>
  
First, go to the routing script section of the Web portal  
+
<br>
 +
Go to the routing script section of the Web portal  
 
<pre>Gateway -&gt; Routing scripts -&gt; Example Scripts -&gt; simple_routing_sbc.rb [Edit]
 
<pre>Gateway -&gt; Routing scripts -&gt; Example Scripts -&gt; simple_routing_sbc.rb [Edit]
 
</pre>  
 
</pre>  
 
Four things need to be added. At the start of the script:<br>  
 
Four things need to be added. At the start of the script:<br>  
<pre>require 'r_n_cdr'
+
<pre>require 'youmail_spam_risk'
 
</pre>  
 
</pre>  
 
In the main class:<br>  
 
In the main class:<br>  
<pre>include RnCdr
+
<pre>include YouMailSpamRisk
 
</pre>  
 
</pre>  
<pre>before_filter :method => :RN_cdr
+
<pre>   after_filter :method                     => :filter_by_https_spam_risk,
</pre>  
+
                :server_url                  => "https://dataapi.youmail.com/api/v2/",
<pre>after_remap_filter :method => :Swap_back
+
                :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
 
</pre>  
 
</pre>  
 
<br>  
 
<br>  
The final script will look like this:
+
The final 'Main' script will look like this:
 
<pre>
 
<pre>
 
require 'base_routing'
 
require 'base_routing'
require 'r_n_cdr'
+
require 'youmail_spam_risk'
  
 
class SimpleRouting < BaseRouting
 
class SimpleRouting < BaseRouting
   include RnCdr
+
   include YouMailSpamRisk
 
    
 
    
  before_filter :method => :RN_cdr
 
 
 
   route_match :call_field_name => :called
 
   route_match :call_field_name => :called
 
   route_match :call_field_name => :calling
 
   route_match :call_field_name => :calling
 
   route_match :call_field_name => :nap
 
   route_match :call_field_name => :nap
 +
 +
  after_filter :method                      => :filter_by_https_spam_risk,
 +
              :server_url                  => "https://dataapi.youmail.com/api/v2/",
 +
              :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 => :called, :route_field_name => :remapped_called
 
   route_remap :call_field_name => :calling, :route_field_name => :remapped_calling
 
   route_remap :call_field_name => :calling, :route_field_name => :remapped_calling
 
   route_remap :call_field_name => :nap, :route_field_name => :remapped_nap
 
   route_remap :call_field_name => :nap, :route_field_name => :remapped_nap
  
  after_remap_filter :method => :Swap_back
 
 
end
 
end
</pre>
+
</pre>
== Update Text CDR Configuration <br>  ==
+
To have the Routing Number (RN) in the CDR logs, add these fields:
+
Gateway -> Text CDR parameters -> CDR format (Start): ,RN='@{ScriptAttribute:RN}'
+
Gateway -> Text CDR parameters -> CDR format (End):  ,RN='@{ScriptAttribute:RN}'
+
And replace the called fields:
+
Gateway -> Text CDR parameters -> CDR format (Start): ,Called='@{ScriptAttribute:Called2}'
+
Gateway -> Text CDR parameters -> CDR format (End):  ,Called='@{ScriptAttribute:Called2}'
+
See instructions here: [[Text_Call_Detail_Records]]  <br>
+
 
+
== Configure LNP Settings ==
+
LNP settings need to be:
+
profiles -> Outgoing calls LNP mode: Relay LNP Information
+
profiles -> Incoming calls LNP mode: Forward LNP from incoming to outgoing call
+
See instructions here: [[Modify_LNP_profile_D]]  <br>
+

Revision as of 14:05, 8 February 2021

Contents

Applies to version(s): v3.1, v3.2

This shows how to add youmail_spam_risk.rb script to any Routing scripts.

Requirements for this script

  1. 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.
  2. 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

Setting up YouMail spam risk Scripts

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.
Main scripts.png
You can also copy/paste the content of the main file and create a new 'Main' Script using the Create New Script File menu


Go to the routing script section of the Web portal

Gateway -> Routing scripts -> Example Scripts -> simple_routing_sbc.rb [Edit]

Four 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/v2/",
                :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/v2/",
               :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
Personal tools