> 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/isdn-and-cas/toolpack-monitoring-isdn-analyzer.md).

# Toolpack Monitoring ISDN Analyzer

![Monitoring isdn analyzer](https://docs.telcobridges.com/w/images/7/79/Monitoring_isdn_analyzer.png) Toolpack ISDN Analyzer is a class that uses Media-only legs and monitoring API to capture HDLC frames from ISDN D-channel timeslot.

The captured ISDN HDLC frames are analyzed, to identify Q.921 and Q.931 frames from the HDLC frames.

Then, ISDN calls are identified from the analyzed Q.931 packets.

### Capturing each direction of each D-Channel

The ISDN analyzer will allocate a pair of TDM media-only call legs for each Line service of the ISDN stack that has a D-Channel (primary D-Channel, and backup D-Channel if appropriate).

* The primary Line service of the ISDN stack holds the primary D-channel (timeslot 16 for E1, timeslot 24 for T1/J1).
* For NFAS ISDN stacks, multiple Line services are used. An optional backup D-channel may be present among these line services.

### Typical ISDN analyzer call flow

A typical ISDN analyzer call goes as follows:

* ISDN Q.931 "SETUP" message is detected
  * ISDN IEs are analyzed to extract relevant information
    * Call id
    * Channel identification
    * Calling/called numbers
    * And others...
  * A new "analyzed" call context is created, bound with the call id
* ISDN Q.931 "PROCEEDING" is detected
  * The call changes to "accepted" state
* ISDN Q.931 "ALERTING" is detected
  * The call changes to "alerting" state
* ISDN Q.931 "CONNECT" is detected
  * The call changes to "answered" state
* ISDN Q.931 "DISCONNECT" is detected
  * The call changes to "terminating" state
* ISDN Q.931 "RELEASE" is detected
  * The call changes to "terminated" state
* ISDN Q.931 "RELEASE\_COMPLETE" is detected
  * The call context is destroyed

#### Forwarding analyzed call states to application

Each analyzer has been provided a pointer to a "parent" application (a "user") to inform of call state changes.

This "user" is a class that implement the interface ITBCAFAnalyzerUser.

This interface will provide the "user" with the following callbacks from the analyzer, to report new calls and state changes:

* OnAnalyzerCallLegPresent: A new ISDN call was detected
* OnAnalyzerCallLegAccepted: A ISDN call is now "accepted"
* OnAnalyzerCallLegAlerting: A ISDN call is now "alerting" (ringing)
* OnAnalyzerCallLegAnswered: A ISDN call is now "answered"
* OnAnalyzerCallLegTerminating: A ISDN call is now "terminating"
* OnAnalyzerCallLegTerminated: A ISDN call is now terminated
* OnAnalyzerCallLegSuppInfo: Other ISDN message (non call-state affecting) was received

It's up to the user application to decide what should be done with analyzed calls and state changes.

### Line Service Pairs

ISDN analyzer is configured using "Line Service Pairs". In fact, in a monitoring environment, a monitored trunk is "tapped", and each direction of the trunk is "forked" and connected to the monitoring equipment (this is done by using a "Monitoring Patch Panel", provided by TelcoBridges).

Thus, each monitored trunk will be received twice on the monitoring equipment (one for each direction).

A "Line Service Pair" is indicating which Line services, on the monitoring equipment, correspond to the two directions of the same monitored trunk.

The ISDN analyzer is then configured using these "Line Service Pairs", and so it knows which line service to monitor for each direction of each monitored trunk.

### Configuring ISDN analyzers in Toolpack Web Portal

Developers can use ISDN analzyers in their application by using the class CTBCAFAnalyzerIsdn (which uses parameters defined by CTBCAFAnalyzerIsdnParams).

Non-developers that use Toolpack system with built-in Gateway application can also use ISDN analyzers to generate CDR logs or generate corresponding "monitoring" SIP calls to an external monitoring equipment.

For more information and step-by-step screen shots of the configuration of ISDN analyzers, please refer to the [Web Portal Tutorial Guide v2.9](https://github.com/telcobridges-main/tmedia-wiki/tree/main/tmedia/configuration/tmedia-tsig-and-tdev-web-portal-2-9-tutorial-guide/README.md).


---

# 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/isdn-and-cas/toolpack-monitoring-isdn-analyzer.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.
