> 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/apis-and-integration/sip-redirection-script-contacts-parameters.md).

# SIP Redirection Script Contacts Parameters

#### ***Applies to version(s): v2.8 and above***

This pages show an example of multiple SIP redirect in term of how the routing script is executed and with which `params[:contacts]` parameters.

![SIP Multiple Redirect Callflow](https://docs.telcobridges.com/w/images/d/dc/SIP_Multiple_Redirect_Callflow.png)

#### 1. Incoming call

The routing script is executed when an incoming call is received. The routing script executes its logic to find the matching route(s) from the routing table and provides the outgoing call parameters for each route found. The outgoing call is placed to **A**. The `params[:contacts]` parameter is empty with **:index=0**:

```
contacts = params[ :contacts ]
contacts = {:index=>"0", :source_indexes=>"nil"}
```

**Note**: The `params[:contacts]` parameter above is provisioned for any call type.

#### 2. Redirect to 6661

**"A"** requests to redirect the call (302 Moved Temporarily). The call is directed to contact 6661. The routing script is executed a 2nd time with the `params[:call]` hash filled with the information from the inbound call. call = params\[ :call ] -> Information from original inbound call, with exception of call\[ :called ]

```
call[ :called ]                 -> Replaced by the contact number (6661).
```

`params[:contacts]` parameter is filled with the contact list and **index=1**:

```
contacts = params[ :contacts ]
contacts = {
''':index=>"1",'''
```

> list=>\[ {:called\_number=>"6660", :priority=>"1000", :is\_number\_ported=>"0", :sip\_uri=>"", raw\_data=>"", :expiration=>"3600"}, {:called\_number=>"6661", :priority=>"1000", :is\_number\_ported=>"0", :sip\_uri=>"sip:6661\@192.168.215.127", raw\_data=>"\<sip:6661\@192.168.215.127>", :expiration=>"3600"} {:called\_number=>"6662", :priority=>"1000", :is\_number\_ported=>"0", :sip\_uri=>"sip:6662\@192.168.215.128", raw\_data=>"\<sip:6662\@192.168.215.128>", :expiration=>"3600"}, {:called\_number=>"6663", :priority=>"1000", :is\_number\_ported=>"0", :sip\_uri=>"sip:6663\@192.168.215.129", raw\_data=>"\<sip:6663\@192.168.215.129>", :expiration=>"3600"} ], source\_indexes=>"nil,0,0,0" }

#### 3. Redirect to 6662

The call is rejected by **"B"** with "480 Temporarily unavailable". The call is directed to contact 6662. The routing script is executed a third time with the `params[:call]` hash filled with the information from the inbound call. call = params\[ :call ] -> Information from original inbound call, with exception of call\[ :called ]

```
call[ :called ]                 -> Replaced by the contact number (6662).
```

`params[:contacts]` parameter is filled with the contact list and **index=2**:

```
contacts = params[ :contacts ]
contacts = {
''':index=>"2"''',
```

> list=>\[ {:called\_number=>"6660", :priority=>"1000", :is\_number\_ported=>"0", :sip\_uri=>"", raw\_data=>"", :expiration=>"3600"}, {:called\_number=>"6661", :priority=>"1000", :is\_number\_ported=>"0", :sip\_uri=>"sip:6661\@192.168.215.127", raw\_data=>"\<sip:6661\@192.168.215.127>", :expiration=>"3600"} {:called\_number=>"6662", :priority=>"1000", :is\_number\_ported=>"0", :sip\_uri=>"sip:6662\@192.168.215.128", raw\_data=>"\<sip:6662\@192.168.215.128>", :expiration=>"3600"}, {:called\_number=>"6663", :priority=>"1000", :is\_number\_ported=>"0", :sip\_uri=>"sip:6663\@192.168.215.129", raw\_data=>"\<sip:6663\@192.168.215.129>", :expiration=>"3600"} ], source\_indexes=>"nil,0,0,0" }

#### 4. Redirect to 6664

**"C"** requests to redirect the call (second redirection). The call is directed to contact 6664. The routing script is executed a fourth time with the `params[:call]` hash filled with the information from the inbound call. call = params\[ :call ] -> Information from original inbound call, with exception of call\[ :called ]

```
call[ :called ]                 -> Replaced by the contact number (6664).
```

A new contact is added to `params[:contacts]` parameter and *'index=3* is set': contacts = params\[ :contacts ] contacts = { ''':index=>"3"''',

> list=>\[ {:called\_number=>"6660", :priority=>"1000", :is\_number\_ported=>"0", :sip\_uri=>"", raw\_data=>"", :expiration=>"3600"}, {:called\_number=>"6661", :priority=>"1000", :is\_number\_ported=>"0", :sip\_uri=>"sip:6661\@192.168.215.127", raw\_data=>"\<sip:6661\@192.168.215.127>", :expiration=>"3600"} {:called\_number=>"6662", :priority=>"1000", :is\_number\_ported=>"0", :sip\_uri=>"sip:6662\@192.168.215.128", raw\_data=>"\<sip:6662\@192.168.215.128>", :expiration=>"3600"}, '''{:called\_number=>"6664", :priority=>"1000", :is\_number\_ported=>"0", :sip\_uri=>"sip:6664\@192.168.215.150",''' ''':raw\_data=>"<sip:6664@192.168.215.150>", :expiration=>"3600"}''' {:called\_number=>"6663", :priority=>"1000", :is\_number\_ported=>"0", :sip\_uri=>"sip:6663\@192.168.215.129", raw\_data=>"\<sip:6663\@192.168.215.129>", :expiration=>"3600"}, ], ''':source\_indexes=>"nil,0,0,2,0"''' }

`params[:contacts][:source_indexes]` is set to:

> source\_indexes=>"nil,0,0,0,2

"2" means that the 5th contact from the contact list was requested by the contact index 2 (sip:6662\@192.168.215.128)

#### 5. Redirect to 6663

The call is rejected by **"D"** with "480 Temporarily unavailable". The call is directed to contact 6663. The routing script is executed a fifth time with the `params[:call]` hash filled with the information from the inbound call. call = params\[ :call ] -> Information from original inbound call, with exception of call\[ :called ]

```
call[ :called ]                 -> Replaced by the contact number (6663).
```

`params[:contacts]` parameter is filled with the contact list and **index=4**: contacts = params\[ :contacts ] contacts = { ''':index=>"4"''',

> list=>\[ {:called\_number=>"6660", :priority=>"1000", :is\_number\_ported=>"0", :sip\_uri=>"", raw\_data=>"", :expiration=>"3600"}, {:called\_number=>"6661", :priority=>"1000", :is\_number\_ported=>"0", :sip\_uri=>"sip:6661\@192.168.215.127", raw\_data=>"\<sip:6661\@192.168.215.127>", :expiration=>"3600"} {:called\_number=>"6662", :priority=>"1000", :is\_number\_ported=>"0", :sip\_uri=>"sip:6662\@192.168.215.128", raw\_data=>"\<sip:6662\@192.168.215.128>", :expiration=>"3600"}, {:called\_number=>"6664", :priority=>"1000", :is\_number\_ported=>"0", :sip\_uri=>"sip:6664\@192.168.215.150", ':raw\_data=>"<sip:6664@192.168.215.150>", :expiration=>"3600"} {:called\_number=>"6663", :priority=>"1000", :is\_number\_ported=>"0", :sip\_uri=>"sip:6663\@192.168.215.129", raw\_data=>"\<sip:6663\@192.168.215.129>", :expiration=>"3600"}, ], source\_indexes=>"nil,0,0,2,0" }


---

# 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/apis-and-integration/sip-redirection-script-contacts-parameters.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.
