# Inbound Processing Region API - SipDomain

In the context of the Inbound Processing Region API, a SipDomain resource represents the routing configuration for a particular Programmable Voice [SIP Domain](/docs/voice/tutorials/how-to-add-programmability-to-your-existing-sip-network).

By adjusting the value of the `voice_region` property, you can control which [Twilio Region](/docs/global-infrastructure/understanding-twilio-regions) will process and store data related to inbound calls for the SIP Domain.

> \[!WARNING]
>
> Changes to this resource may take up to 5 minutes to take effect. When you change the routing to a new Region for a SIP domain then it does not mean that the SIP Domain will be created automatically in the new Region. You will have to manually create the SIP Domain in the new Region with the same configuration.

## SipDomain Properties

```json
{"type":"object","refName":"routes.v2.sip_domain","modelName":"routes_v2_sip_domain","properties":{"sip_domain":{"type":"string","nullable":true},"url":{"type":"string","format":"uri","nullable":true},"sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^QQ[0-9a-fA-F]{32}$","nullable":true},"account_sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^AC[0-9a-fA-F]{32}$","nullable":true},"friendly_name":{"type":"string","nullable":true},"voice_region":{"type":"string","nullable":true},"date_created":{"type":"string","format":"date-time","nullable":true},"date_updated":{"type":"string","format":"date-time","nullable":true}}}
```

## Fetch a SipDomain's current Inbound Processing Region configuration

`GET https://routes.twilio.com/v2/SipDomains/{SipDomain}`

### Path parameters

```json
[{"name":"SipDomain","in":"path","description":"","schema":{"type":"string"},"required":true}]
```

Fetch a SipDomain's current Inbound Processing Region configuration

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function fetchSipDomain() {
  const sipDomain = await client.routes.v2
    .sipDomains("example.sip.twilio.com")
    .fetch();

  console.log(sipDomain.voiceRegion);
}

fetchSipDomain();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

sip_domain = client.routes.v2.sip_domains("example.sip.twilio.com").fetch()

print(sip_domain.voice_region)
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Routes.V2;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var sipDomain = await SipDomainResource.FetchAsync(pathSipDomain: "example.sip.twilio.com");

        Console.WriteLine(sipDomain.VoiceRegion);
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.routes.v2.SipDomain;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        SipDomain sipDomain = SipDomain.fetcher("example.sip.twilio.com").fetch();

        System.out.println(sipDomain.getVoiceRegion());
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	resp, err := client.RoutesV2.FetchSipDomain("example.sip.twilio.com")
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		if resp.VoiceRegion != nil {
			fmt.Println(*resp.VoiceRegion)
		} else {
			fmt.Println(resp.VoiceRegion)
		}
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$sip_domain = $twilio->routes->v2
    ->sipDomains("example.sip.twilio.com")
    ->fetch();

print $sip_domain->voiceRegion;
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

sip_domain = @client
             .routes
             .v2
             .sip_domains('example.sip.twilio.com')
             .fetch

puts sip_domain.voice_region
```

```bash
# Install the twilio-cli from https://twil.io/cli

twilio api:routes:v2:sip-domains:fetch \
   --sip-domain example.sip.twilio.com
```

```bash
curl -X GET "https://routes.twilio.com/v2/SipDomains/example.sip.twilio.com" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "url": "https://routes.twilio.com/v2/SipDomains/test.sip.twilio.com",
  "account_sid": "AC00000000000000000000000000000000",
  "sid": "QQ00000000000000000000000000000000",
  "sip_domain": "example.sip.twilio.com",
  "friendly_name": "string",
  "voice_region": "string",
  "date_created": "2022-06-02T22:33:47Z",
  "date_updated": "2022-06-02T22:33:47Z"
}
```

## Update a SipDomain's Inbound Processing Region configuration

`POST https://routes.twilio.com/v2/SipDomains/{SipDomain}`

### Path parameters

```json
[{"name":"SipDomain","in":"path","description":"","schema":{"type":"string"},"required":true}]
```

### Request body parameters

```json
{"schema":{"type":"object","title":"UpdateSipDomainRequest","properties":{"VoiceRegion":{"type":"string","description":""},"FriendlyName":{"type":"string","description":""}}},"examples":{"update":{"value":{"lang":"json","value":"{\n  \"FriendlyName\": \"friendly_name\",\n  \"VoiceRegion\": \"au1\"\n}","meta":"","code":"{\n  \"FriendlyName\": \"friendly_name\",\n  \"VoiceRegion\": \"au1\"\n}","tokens":[["{","#C9D1D9"],"\n  ",["\"FriendlyName\"","#7EE787"],[":","#C9D1D9"]," ",["\"friendly_name\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"VoiceRegion\"","#7EE787"],[":","#C9D1D9"]," ",["\"au1\"","#A5D6FF"],"\n",["}","#C9D1D9"]],"annotations":[],"themeName":"github-dark","style":{"color":"#c9d1d9","background":"#0d1117"}}}},"encodingType":"application/x-www-form-urlencoded","conditionalParameterMap":{}}
```

Update a SipDomain's Inbound Processing Region configuration

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function updateSipDomain() {
  const sipDomain = await client.routes.v2
    .sipDomains("example.sip.twilio.com")
    .update({ voiceRegion: "au1" });

  console.log(sipDomain.voiceRegion);
}

updateSipDomain();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

sip_domain = client.routes.v2.sip_domains("example.sip.twilio.com").update(
    voice_region="au1"
)

print(sip_domain.voice_region)
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Routes.V2;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var sipDomain = await SipDomainResource.UpdateAsync(
            voiceRegion: "au1", pathSipDomain: "example.sip.twilio.com");

        Console.WriteLine(sipDomain.VoiceRegion);
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.routes.v2.SipDomain;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        SipDomain sipDomain = SipDomain.updater("example.sip.twilio.com").setVoiceRegion("au1").update();

        System.out.println(sipDomain.getVoiceRegion());
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	routes "github.com/twilio/twilio-go/rest/routes/v2"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	params := &routes.UpdateSipDomainParams{}
	params.SetVoiceRegion("au1")

	resp, err := client.RoutesV2.UpdateSipDomain("example.sip.twilio.com",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		if resp.VoiceRegion != nil {
			fmt.Println(*resp.VoiceRegion)
		} else {
			fmt.Println(resp.VoiceRegion)
		}
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$sip_domain = $twilio->routes->v2
    ->sipDomains("example.sip.twilio.com")
    ->update(["voiceRegion" => "au1"]);

print $sip_domain->voiceRegion;
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

sip_domain = @client
             .routes
             .v2
             .sip_domains('example.sip.twilio.com')
             .update(voice_region: 'au1')

puts sip_domain.voice_region
```

```bash
# Install the twilio-cli from https://twil.io/cli

twilio api:routes:v2:sip-domains:update \
   --sip-domain example.sip.twilio.com \
   --voice-region au1
```

```bash
curl -X POST "https://routes.twilio.com/v2/SipDomains/example.sip.twilio.com" \
--data-urlencode "VoiceRegion=au1" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "url": "https://routes.twilio.com/v2/SipDomains/test.sip.twilio.com",
  "sip_domain": "example.sip.twilio.com",
  "sid": "QQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "friendly_name": "friendly_name",
  "voice_region": "au1",
  "date_created": "2020-08-07T22:29:24Z",
  "date_updated": "2020-08-07T22:29:24Z"
}
```
