# Maintenance mode - ProSBC and TMG

## Graceful Shutdown for new incoming calls

This guide outlines the procedure for isolating a Telcobridges TMG or ProSBC systems to perform bleed off active calls for maintenance period.&#x20;

This method allows existing calls to finish naturally while elegantly rejecting all new incoming calls with specific cause codes.

***

### 🛠 Prerequisites

* Access to the Web User Interface.
* Permissions to edit and activate Routing Scripts.
* A defined configuration for testing.  Our example: (e.g., `MSGC_TG_V11_DaveTest`).

***

### 📝 Step 1: Modify the Routing Script

To stop new calls from being processed, you must add a before filter to your main simple\_routing script.rb file. &#x20;

1. Navigate and click >> **Routing Scripts** left-hand side of the menu.&#x20;
2. Click on `simple_routing.rb`.&#x20;

<figure><img src="https://3811773442-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiK3TemJSDhHz3xNMOvvk%2Fuploads%2FQYParHdz0eNGxlJ6RV40%2Frouting_script_1.png?alt=media&#x26;token=2c7e2ec7-4d25-4a48-8823-a182af12c984" alt=""><figcaption></figcaption></figure>

3. Locate the `class SimpleRouting < BaseRouting` definition line within the script.
4. Add the following line as a `before_filter`: right below last Include line. &#x20;

<figure><img src="https://3811773442-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiK3TemJSDhHz3xNMOvvk%2Fuploads%2FPHAsHBSbr9TaNvLrWx4l%2Fabove_include.png?alt=media&#x26;token=9d12f148-839b-4335-aa39-f4b26199c237" alt=""><figcaption></figcaption></figure>

```ruby
before_filter :proc => proc { |p| raise RoutingException, :no_circuit_available }
```

5. Scroll down to the bottom of the simple\_routing.rb script page and save.

<figure><img src="https://3811773442-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiK3TemJSDhHz3xNMOvvk%2Fuploads%2FijYJM0ygWzAg9Q097iZV%2Fsave_script.png?alt=media&#x26;token=9c45e046-74ba-4088-b027-094bbd762748" alt=""><figcaption></figcaption></figure>

6. Validate the configuration change.  Activate the configuration change.&#x20;

<figure><img src="https://3811773442-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiK3TemJSDhHz3xNMOvvk%2Fuploads%2FqWzjmDzjaxv1T5AD7hmc%2Fvalidate%20and%20activate.png?alt=media&#x26;token=7eae6a51-1ae2-4f2a-b722-ea8e1483313f" alt=""><figcaption></figcaption></figure>

Note: Activation of new configuration will NOT terminate active calls.&#x20;

7. Monitor Call Trace Page

<figure><img src="https://3811773442-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiK3TemJSDhHz3xNMOvvk%2Fuploads%2FIQCyqjQqSKmsKYZovu0i%2Fcall_trace.png?alt=media&#x26;token=2c13a277-11b2-4a7c-aae4-35771d4f06cb" alt=""><figcaption></figcaption></figure>

&#x20;8\. Monitor Call Status Page

<figure><img src="https://3811773442-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiK3TemJSDhHz3xNMOvvk%2Fuploads%2FCF2Y4RN2Qk9gsUzRsNHl%2Fcall%20status.png?alt=media&#x26;token=c0d113da-f03f-43c5-af9a-a601a1af041f" alt=""><figcaption></figcaption></figure>

Quick Notes: &#x20;

Insert a # character in front the before\_filter to deactivate the call rejection progress.&#x20;

```
## before_filter :proc => proc { |p| raise RoutingException, :no_circuit_available }
```

You can also modify your cause code to your preference.  <mark style="color:yellow;">no\_circuit\_available</mark>

```
before_filter :proc => proc { |p| raise RoutingException, :no_circuit_available }
```

Reaon Cause Mapping definitions can be found in Web UI >> Profiles >> "Selected Profile" >> Edit Reason Cause Mapping

<figure><img src="https://3811773442-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiK3TemJSDhHz3xNMOvvk%2Fuploads%2FOzH074okZTzJydg6TIpp%2FReasonCodeMapping.png?alt=media&#x26;token=1008f633-f460-4782-be5a-4a593ad0ee32" alt=""><figcaption></figcaption></figure>

Activate Call rejection.  before\_script is working...&#x20;

<figure><img src="https://3811773442-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiK3TemJSDhHz3xNMOvvk%2Fuploads%2FDwUSyejloP6Dv6uSRZF8%2FActive.png?alt=media&#x26;token=3328e8ca-04f0-41af-95db-b47b97af542e" alt=""><figcaption></figcaption></figure>

Deactivate Call rejection. before\_script is not-working...

<figure><img src="https://3811773442-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiK3TemJSDhHz3xNMOvvk%2Fuploads%2FAMEK4ml1FJysejlqCLEj%2FNot_active.png?alt=media&#x26;token=55c6d556-e522-4e98-8874-c12fd6aff36a" alt=""><figcaption></figcaption></figure>

Repeat Step 5 and 6.  Save Script.  Validate and Activate new configuration.&#x20;
