> 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-nap-grouping-script.md).

# Adding NAP Grouping Script

> **Applies to:** Tmedia 2.9, 2.10, 3.0, 3.1

This article describe how to add **NAP Grouping** script to any Routing scripts.

**Script description**

This filter is used to dynamically generate routes from a Regex. The trick is to use the NAP names to identify which NAPs are in the same group. The example in the file provides information about "SIP\_. *"Use instead "/GROUPA\_.*/".

For example:

* GROUPA\_SIP\_NAP\_10\_10\_10\_10
* GROUPA\_SIP\_NAP\_10\_10\_10\_11
* GROUPA\_SIP\_NAP\_10\_10\_10\_12
* GROUPB\_SIP\_NAP\_10\_10\_20\_20
* GROUPB\_SIP\_NAP\_10\_10\_20\_21
* GROUPC\_SIP\_NAP\_10\_10\_30\_30

Then, in your routes, you can use the Route Column "additional\_naps" to put /GROUPA\_.\*/

**Add&#x20;*****NAP Grouping*****&#x20;Scripts in the system**

| Download this file                                                                   |
| ------------------------------------------------------------------------------------ |
| \*[multiple\_naps.rb](https://docs.telcobridges.com/w/images/c/c0/Multiple_naps.zip) |

**Setting up&#x20;*****NAP Grouping*****&#x20;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.

Go to the routing script section of the Web portal

```
Gateway -&gt; Routing scripts -&gt; Example Scripts -&gt; simple_routing.rb [Edit]
```

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

```
require 'multiple_naps'
```

In the main class:

```
include MultipleNaps
```

```
before_filter :method => :multiple_naps
```

The final script will look like this:

```
require 'base_routing'
require 'multiple_naps'

class SimpleRouting < BaseRouting
  include MultipleNaps
  before_filter :method => :multiple_naps

  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
```

**Adding New Custom Variable**

You must add a custom column to use this script.

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

**Name**: additional\_naps **Type attributes**: text '''


---

# 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-nap-grouping-script.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.
