# Adding Label Routing to a Routing Script

To implement label routing on any routing script, do the following:

1- Click Routing script in the navigation panel.

<br>

<figure><img src="https://docs.telcobridges.com/w/images/f/f4/CreateRoutingScript_0.png" alt=""><figcaption></figcaption></figure>

\
2- Edit your main script

<br>

<figure><img src="https://docs.telcobridges.com/w/images/6/65/AddLabelRouting_0.png" alt=""><figcaption></figcaption></figure>

\
3- Add the following three lines to the script:

At the top of the page

```
require 'routesets_digit_analyzer'
```

Following your main class definition

```
include RoutesetsDigitAnalyzer
```

Add before filter in your main class

```
before_filter :method => :routesets_digit_analyzer, :trie_order => :called
```

\
4- Click 'Save'

### Example

```
require 'base_routing'
require 'routesets_digit_analyzer'                                                # <- Add this line here

class my_script < BaseRouting
  include RoutesetsDigitAnalyzer                                                  # <- Add this line here
  
  before_filter :method => :routesets_digit_analyzer, :trie_order => :called      # <- Add this line here
  route_match :call_field_name => :called
  route_match :call_field_name => :calling
  route_match :call_field_name => :nap
  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

@@routing = my_script.new

def init_routes( routes )
  @@routing.init routes
end

def route( call, nap_list )
  @@routing.route call, nap_list
end
```

### Related Action

[How to Setup Filters](https://docs.telcobridges.com/wiki/How_to_Setup_Filters)


---

# Agent Instructions: 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:

```
GET https://prosbcdocs.telcobridges.com/configuration-details/configuration-by-web-portal-category/call-routing/adding-label-routing-to-a-routing-script.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
