> 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/protocols/cas-r1-loopstart-network.md).

# CAS R1 LOOPSTART NETWORK

Loopstart is a CAS R1 variant.

Loopstart is an asymmetrical variant where a user and network sides must be face to face.

Current page describes the Loopstart network variant, see the following page for documentation about [Loop start user side](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/protocols/cas-r1-loopstart-user/README.md) variant.

You can find general documentation about CASR1 scripts in Toolpack in the following page:[CASr1\_scripting](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/isdn-cas/casr1-scripting/README.md).

### Overview

In the Loopstart variant, network side is sending CAS bit B, used to make the user's phone ring, while it receives CAS bit A from user side to report user's phone as "on hook" or "off hook".

Initial CAS bits values:

* Bit A (from user) is 1 ("on hook")
* Bit B (from network) is 1 ("ringer off")

Summary of the Loopstart call flow:

* Call establishment:
  * User calling:
    * Network side detects bit A changes to 1, indicating that user's phone is "off hook"
    * Network side sends a dial tone
    * Network side collects the digits entered by the user
    * Network side stops the dial tone (upon first digit)
    * Network side proceed with the call
  * Network calling:
    * Network side changes bit B to 0 ("ringer on") to make user's phone ring
    * Network side toggles bit B from 0 to 1 (0 for 2 seconds, 1 for 4 seconds)
    * Network side detects bit A changes to 1, indicating that user's phone is "off hook"
    * Network side changes bit B back to 1
* Call termination (user side only, network has no way to terminate the call):
  * Network side detects bit A changes to 0, indicating that user's phone is "on hook"

Note: There is no way, in Loopstart variant, for network side to report when the call is answered, or terminated. The caller considers the call answered when the ring tone ends and when someone starts talking. The caller considers the call terminated when the conversation is over, or when it no more hears the remote party.

### Configuration

#### Choosing tone type

With CAS R1, DNIS (called number) can be sent using either DTMF or MFR1 tones.

To specify the type of tones to use, use the following constant:

```
TONE_USE_DTMF			= 1
```

**Detection of DNIS**

Configuration of reception of DNIS is controlled by the following variables:

```
	DNIS = {
		prefix = "*",
		suffix = "#",
		expected_digits = 0,
		inter_digit_timeout = 5000,
	},
```

Note that prefix and suffix are rarely used in this variant, as most of the time the user side is not a telephony equipment, but rather a user that manually presses the digits on it's phone. In that case, the prefix will simply be ignored by the CASR1 stack, and the suffix will simply not be reached, causing the "inter\_digit\_timeout" to trigger and confirm that DNIS complete.

When Network side makes outgoing call toward the user, DNIS is not sent at all, and thus prefix/suffix don't apply to transmission of DNIS in this variant.

Please read detailed information about configuration of ANI/DNIS reception and transmission using the variables above:

* [Options for receiving DNIS](https://github.com/telcobridges-main/tmedia-wiki/tree/main/reference/isdn-cas/casr1-scripting/README.md#action-wait-ani)

### Detailed information about the Loopstart network side script and state machines

For more detailed information about how this script is implemented (various states, and options), please refer to the "loopstart\_network.lua" script provided with Toolpack.


---

# 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/protocols/cas-r1-loopstart-network.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.
