> ## Documentation Index
> Fetch the complete documentation index at: https://www.vobiz.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Twilio to Vobiz Code: Phone Numbers and Conferences

> Side-by-side Twilio and Vobiz code for searching and buying a phone number, and for managing a conference - members, mute, hold, remove, end and recording.

Part of the [Twilio to Vobiz code snippets](https://www.vobiz.ai/docs/compare/twilio/code-snippets): each task shows the **Twilio** code and the equivalent **Vobiz** code in Python and Node - copy the Vobiz tab. The snippets use the `client` from [Set up the client](https://www.vobiz.ai/docs/compare/twilio/code-snippets#set-up-the-client).

> [!NOTE]
>
> Set your credentials once: `AUTH_ID` is your Vobiz Auth ID (`MA_…`), `AUTH_TOKEN` is your Auth Token. In the Vobiz SDK, `api_key` **is** the Auth ID, and every account-scoped method takes that `auth_id` explicitly.

## Search and buy a phone number

Twilio searches the live carrier catalog with `available_phone_numbers('US').local.list(...)`, reads `.phone_number` off a result, then provisions it with `incoming_phone_numbers.create(phone_number=...)`. Vobiz browses ready-to-buy stock with `list_inventory_numbers(...)` and buys by E.164 with `purchase_from_inventory(...)` - a deterministic two-step flow where the E.164 number is the key.

| Step | Twilio | Vobiz |
| - | - | - |
| Search | `available_phone_numbers('US').local.list(limit=1)` | `phone_numbers.list_inventory_numbers(AUTH_ID, country='US')` |
| Read the number | `available[0].phone_number` | `available.numbers[0].e164` |
| Buy | `incoming_phone_numbers.create(phone_number=number)` | `phone_numbers.purchase_from_inventory(AUTH_ID, e164=number)` |

```python Twilio · Python theme={null}
available = client.available_phone_numbers('US').local.list(limit=1)
number = available[0].phone_number   # e.g. '+14155551234'
incoming = client.incoming_phone_numbers.create(phone_number=number)
```

```python Vobiz · Python theme={null}
available = client.phone_numbers.list_inventory_numbers(AUTH_ID, country='US')
number = available.numbers[0].e164   # e.g. '+14155551234'
bought = client.phone_numbers.purchase_from_inventory(AUTH_ID, e164=number)
```

```javascript Twilio · Node theme={null}
const available = await client.availablePhoneNumbers('US').local.list({ limit: 1 });
const number = available[0].phoneNumber;   // e.g. '+14155551234'
const incoming = await client.incomingPhoneNumbers.create({ phoneNumber: number });
```

```javascript Vobiz · Node theme={null}
const available = await client.phoneNumbers.listInventoryNumbers(AUTH_ID, { country: 'US' });
const number = available.numbers[0].e164;   // e.g. '+14155551234'
const bought = await client.phoneNumbers.purchaseFromInventory(AUTH_ID, { e164: number });
```

## Manage a conference

Twilio tracks a room by its `CF…` SID and each leg by its `CallSid`. Vobiz uses the **room name** as the join key and a `member_id` per participant - `get_conference` returns the room details **and** its member list in one call, and every control is its own verb.

| Task | Twilio | Vobiz |
| - | - | - |
| Get the room and its members | `client.conferences("CF…")`, then `participants.list()` | `conferences.get_conference(AUTH_ID, conference_name=...)` |
| Mute a participant | `participants("CA…").update(muted=True)` | `conference_members.mute_member(AUTH_ID, conference_name=..., member_id=...)` |
| Play hold audio to a participant | `participants("CA…").update(hold=True, hold_url=...)` | `conference.play_audio_member(AUTH_ID, conference_name=..., member_id=..., url=...)` |
| Stop that audio | - | `conference.stop_audio_member(AUTH_ID, conference_name=..., member_id=...)` |
| Remove a participant | `participants("CA…").delete()` | `conference.kick_member(AUTH_ID, conference_name=..., member_id=...)` |
| End the room | `conf.update(status="completed")` | `conferences.delete_conference(AUTH_ID, conference_name=...)` |
| End every room | - | `conferences.delete_all_conferences(AUTH_ID)` |

```python Twilio · Python theme={null}
conf = client.conferences("CFxxxxxxxx")

# Who is in the room?
for p in conf.participants.list():
    print(p.call_sid, "muted:", p.muted)

# Mute, hold, and remove one participant
conf.participants("CAaaaa").update(muted=True)
conf.participants("CAaaaa").update(hold=True, hold_url="https://example.com/hold.mp3")
conf.participants("CAaaaa").delete()

# End the whole conference
conf.update(status="completed")
```

```python Vobiz · Python theme={null}
# Who is in the room? get_conference returns members + room details together
room = client.conferences.get_conference(AUTH_ID, conference_name="SalesRoom")
for m in room["members"]:
    print(m["member_id"], "muted:", m["muted"])

# Mute a member; hold = play audio to just that member, stop returns them to the room
client.conference_members.mute_member(AUTH_ID, conference_name="SalesRoom", member_id="MEMBER_1")
client.conference.play_audio_member(AUTH_ID, conference_name="SalesRoom",
                                    member_id="MEMBER_1", url="https://example.com/hold.mp3")
client.conference.stop_audio_member(AUTH_ID, conference_name="SalesRoom", member_id="MEMBER_1")
client.conference.kick_member(AUTH_ID, conference_name="SalesRoom", member_id="MEMBER_1")

# End one room, or every active room at once
client.conferences.delete_conference(AUTH_ID, conference_name="SalesRoom")
client.conferences.delete_all_conferences(AUTH_ID)
```

Record the whole room on demand by name - start and stop whenever you like:

| | Twilio | Vobiz |
| - | - | - |
| Start | `record="record-from-start"` on the `<Conference>` verb | `conference_recording.start_conference_recording(AUTH_ID, conference_name=..., file_format=..., callback_url=...)` |
| Stop | - | `conference_recording.stop_conference_recording(AUTH_ID, conference_name=...)` |
| Recording callback | `recordingStatusCallback` | `callback_url` |

```python Twilio · Python theme={null}
# Twilio sets recording on the <Conference> verb:
#   <Conference record="record-from-start"
#               recordingStatusCallback="https://example.com/rec">SalesRoom</Conference>
```

```python Vobiz · Python theme={null}
client.conference_recording.start_conference_recording(
    AUTH_ID, conference_name="SalesRoom",
    file_format="mp3", callback_url="https://example.com/rec")
client.conference_recording.stop_conference_recording(AUTH_ID, conference_name="SalesRoom")
```

The full per-verb map - mute/unmute, deaf/undeaf, kick/hangup, and the `<Conference>` element - is in [Conferences](https://www.vobiz.ai/docs/compare/twilio/conferences.md).

## More Twilio to Vobiz code snippets

* [Set up the client and make an outbound call](https://www.vobiz.ai/docs/compare/twilio/code-snippets)
* [Answer calls with XML](https://www.vobiz.ai/docs/compare/twilio/code-snippets/answer-calls.md)
* [Live calls](https://www.vobiz.ai/docs/compare/twilio/code-snippets/live-calls.md)
* [Call records, webhooks and errors](https://www.vobiz.ai/docs/compare/twilio/code-snippets/call-records-webhooks-errors.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.