# DNS Query

### Introduction

Similarly to ENUM query, starting with release 3.1, it is possible to issue DNS Query requests to DNS servers from routing scripts. This could be used to skip the ENUM Query part when the called uri is already known but still need to get the matching outgoing NAP, NAP proxy IP and port. To do so, the params\[:dns\_query] object must be filled with the required DNS Query attributes params\[:dns\_query]\[:fqdn] and [an exception must be raised](/configuration-details/configuration-by-web-portal-category/routing-scripts/development-guides-and-tutorials/dns-query.md) with reason :dns\_query\_required.

When DNS Query completes, the routing script is called again with the result. The params\[:dns\_query] object will be filled with the DNS Query attributes from the responses. The DNS query responses are available through params\[:dns\_query]\[:responses\_list] call parameters:

***

> params\[:dns\_query]\[:responses\_list] \[{:nap=>"NAP\_UDP", :nap\_proxy\_ip=>"10.3.14.191", :nap\_proxy\_port=>"8080", :transport=>"UDP", :order=>"100", :preference=>"1", :priority=>"0", :weight=>"5"}, {:nap=>"NAP\_TCP", :nap\_proxy\_ip=>"10.3.14.192", :nap\_proxy\_port=>"8081", :transport=>"TCP", :order=>"100", :preference=>"2", :priority=>"1", :weight=>"10"}]

***

### Add dynamic routes

Similarly to ENUM Query, the DNS query could also create dynamic routes base on DNS query responses. This could be requested using the "add\_dynamic\_routes" call parameter:

***

> params\[:dns\_query]\[:add\_dynamic\_routes] = true

***

The "base\_routing.rb" script version should be greater then 1.37 in order to allow dynamic routes creation base on DNS query responses.

When requesting to add\_dynamic\_routes, the dns\_query responses are used to create routes. Make sure that your configuration include a route with remapped\_nap = "Registered or DNS users". A route will be created for each DNS query responses. The routes "remapped\_nap" takes NAP value from DNS query responses.

It is required to modify main routing script (i.e. simple\_routing\_sbc.rb) to forward IP/port values from params\[:routes] to params\[:call] like we are doing for NAP. See following example:

***

> ... # This will select the outgoing NAP for this call according to the "remapped\_nap" route parameter route\_remap :call\_field\_name => :nap, :route\_field\_name => :remapped\_nap
>
> \# This will select the outgoing NAP proxy ip address for this call according to the "remapped\_nap\_proxy\_ip" route parameter route\_remap :call\_field\_name => :nap\_proxy\_ip, :route\_field\_name => :remapped\_nap\_proxy\_ip
>
> \# This will select the outgoing NAP proxy port for this call according to the "remapped\_nap\_proxy\_port" route parameter route\_remap :call\_field\_name => :nap\_proxy\_port, :route\_field\_name => :remapped\_nap\_proxy\_port ...

<br>


---

# 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/routing-scripts/development-guides-and-tutorials/dns-query.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.
