> 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/sip-and-voip/toolpack-monitoring-sip-simulator.md).

# Toolpack monitoring sip simulator

![Monitoring generator overview](https://docs.telcobridges.com/w/images/d/d1/Monitoring_generator_overview.png) The Toolpack Monitoring "SIP Simulator" is a behavior that can be attached to a call flow, and that will send simulated SIP messages to a destination host, simulating that a SIP call is being monitored.

The SIP simulator sends SIP messages, but does not expect any reply from the destination. It simulates both sides of the SIP call (simulating a sip "Invite" from one side, then "100-Trying" from the other side, etc.)

It can also send a copy of the monitored legs audio using RTP packets, as indicated in the SDP of the simulated SIP message (Invite, 183-Progress and 200-OK).

### SIP simulator call flow

Once attached to a call flow, the "SIP simulator" behavior will identify the "main" legs of the attached call flow (one incoming and one outgoing), and watch for call state changes of these legs. Corresponding SIP messages are generated.

![SIP simulator call flow](https://docs.telcobridges.com/w/images/b/b4/SIP_simulator_call_flow.png)

#### Attaching to a monitoring call flow

The SIP simulator behavior can be attached to a standard call flow (CTBCAFBrige for example, which deals with a bridge between one incoming and one outgoing call legs).

It can also be attached to a "monitoring" call flow that receives call state change events from an analyzer (like an [ISDN Analyzer](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/isdn-cas/toolpack-monitoring-isdn-analyzer/README.md)).

In both cases, it will generate SIP messages based on the call state changes event received (call accepted, alerting, answered, etc...)

### SIP simulator configuration

The SIP simulator has multiple options that can be configured (from it's "parameters" class for developers, or from the Web Portal for Toolpack Gateway users).

#### RTP generation options

The SIP simulator can send RTP packets that contain a copy of the audio of the monitored call. These RTP packets are sent by a VOIP resource on the [TMedia](https://telcobridges.com/media-gateways/products/tmedia-gateways/) unit.

RTP generation options are:

* The VOIP Media NAP to generate RTP from. "None" will disable RTP generation. This NAP defines:
  * The source IP interface, and port range to use
  * A default "profile"
* A "profile" to use instead of the NAP's default profile. The profile will define:
  * The codec to use (the SDP)
  * The DTMF relay scheme (**Note:** only "in-band" and "RFC-2833" being available with the "SIP simulator")
  * **Note**: The "SIP" options available in the "profile" page in the web portal are ignored here
  * Audio options (volume control, voice activity detection)
  * RTCP options
  * IP header "TOS" field

#### SIP generation options

The "SIP Simulator" will send SIP packets from the application using the following "source" options:

* Source "host" IP interface (or "ANY" to choose by subnet matching or default gateway)
* Source UDP port
* IP header "TOS" field for SIP packets

#### SIP messages formatting

The "SIP Simulator" offers configurable SIP messages content, which will be used when necessary by the "SIP Simulator"

* The simulated "from" IP address and port (can be "fictive" IP address representing one "side" of the call)
* The simulated "to" IP address and port (can be "fictive" IP address representing one "side" of the call)
* The SIP message text of each SIP message, built using [well-known variables](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/sip-voip/toolpack-monitoring-sip-simulator-variables/README.md), and user-defined variables.
  * From caller:
    * SIP INVITE
    * SIP ACK (after the INVITE 200 OK)
    * SIP BYE
    * SIP CANCEL
    * SIP 200 OK (after BYE)
    * SIP ACK (after 487)
  * From callee:
    * SIP 100 Trying
    * SIP 183 Session Progress
    * SIP 200 OK
    * SIP Decline
    * SIP BYE
    * SIP 200 OK (after BYE or CANCEL)
    * SIP 487 Request Terminated

#### Example SIP message configuration

```
INVITE sip:#{called}@#{callee_sip_ip}:#{callee_sip_port} SIP/2.0
Call-ID:#{call_id}
X-Monitored-Sender:#{sender_label}:#{sender}
X-Isdn-Info:interface-id:#{isdn_interface_id};channel-number:#{isdn_channel_number}
X-Example-Var:#{example_var}
To:<sip:#{sip_to}>
From:#{calling_display}<sip:#{sip_from}>;tag=#{caller_tag}
Remote-Party-ID:#{calling_private_display}<sip:#{calling_private}@#{caller_sip_ip}:#{caller_sip_port}>;party=calling;screen=#{calling_screening};privacy=#{calling_presentation};noa=#{calling_noa}
Privacy:#{calling_privacy}
Contact:sip:#{calling}@#{caller_sip_ip}:#{caller_sip_port}
Via:SIP/2.0/UDP #{caller_sip_ip}:#{caller_sip_port};branch=#{branch};rport
User-to-User:#{uui};encoding=text;purpose=isdn-interwork;content=isdn-uui
Date:#{date}
Timestamp:#{timestamp}
CSeq:#{cseq}
Max-Forwards:70
```

1. {caller\_content}

For more information about available variables used to generate the SIP messages (SIP headers and body), read the following article: [SIP Simulator messages formatting variables](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/sip-voip/toolpack-monitoring-sip-simulator-variables/README.md)

#### SIP and RTP destination

The generated SIP messages are sent to the specified IP address and port.

The generated RTP packets are sent to the specified IP address (can be different from SIP destination IP address), using a port chosen from the NAP's port ranges, and indicated to the remote equipment through the SDP in the SIP messages ("INVITE", "183-Progress" and "200-OK").

### Using multiple destinations

If necessary, multiple redundant destinations can be configured. Each destination includes:

* SIP destination IP and port
* RTP destination IP
* Optional destination "TCP" polling IP and port
* A priority

#### Destination polling

To determine which destination is available, a "ping" will be made toward the destination SIP IP address.

In addition to the "ping", a "TCP" polling can be performed, by attempting a TCP connection to the given IP address and port.

A destination is considered available if the "ping" and the "TCP connection polling" (if used) both succeed.

The available destination with the highest priority will be chosen.

### Configuring SIP Simulators in Toolpack Web Portal

Developers can use SIP Simulators in their application by using class CTBCAFSipSimulator to define SIP simulator parameters and allocate SIP sender socket, and attach behavior CTBCAFCallBehaviorSipSimulator to their call flow.

Non-developers that use Toolpack system with built-in Gateway application can also use SIP Simulators and attach them to ISDN analyzers.

For more information and step-by-step screen shots of the configuration of SIP Simulators, 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/sip-and-voip/toolpack-monitoring-sip-simulator.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.
