> 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/telecom-concepts/gateway.md).

# gateway

### Started By

Gateway is spawned by [tboamapp](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/api/tboamapp/README.md).

### Role

Gateway Application is used to bridge 2 call legs, according to a set of routes. The Gateway Application receives incoming calls from [toolpack\_engine](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/misc/toolpack-engine/README.md), tries to find a matching route, remaps call parameters if required, and then tells toolpack\_engine to generate an outgoing call.

It is responsible for:

* Handling call flow
* Accepting / rejecting call legs.
* Routing call legs to the destination naps, according to routing script, and call profile parameters
* Sending / writing [CDR](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/concepts/text-call-detail-records/README.md) information.
* Starting play / relay stream for [early media](https://telcobridges.com/learning/sip-trunking/sip-response-codes-complete-guide/).
* Remapping call parameters when required

### High Availability

Gateway is a [Active/Standby](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/misc/active-standby/README.md) type of application. The first instance of the Gateway application to be detected by the [toolpack\_engine](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/misc/toolpack-engine/README.md) will become [active](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/misc/active-standby/README.md) and will be the only instance to take action in the system. In the eventuality where the [active](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/misc/active-standby/README.md) instance is unavailable the [Standby](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/misc/active-standby/README.md) instance will become [active](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/misc/active-standby/README.md). Since there is no preferred instances, the Gateway application don't fall back to the [primary](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/misc/primary-secondary/README.md) host.

### Resynchronization

When becoming [active](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/misc/active-standby/README.md), the Gateway instance retrieves all the [active calls](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/misc/active-calls/README.md) from [Toolpack\_engine](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/misc/toolpack-engine/README.md). The [transient calls](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/misc/transient-calls/README.md) will be released by the [Toolpack\_engine](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/misc/toolpack-engine/README.md).

### Logs

The logs for the Toolpack Gateway Application as follows:

> \[InstallDir]/toolpack/setup/[*SystemId*](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/misc/system-id/README.md)/*MajorVersion*/apps/gateway/ /lib/tb/toolpack/setup/12358/2.3/apps/gateway/ C:\TelcoBridges\toolpack\setup\12358\2.3\apps\gateway\\


---

# 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/telecom-concepts/gateway.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.
