Phone Number API
The Phone Number API allows you to manage phone numbers for your agents. You can list all phone numbers associated with your account, attach phone numbers to agents, and detach phone numbers from agents.
Note
List Phone Numbers
Parameters
Page number for pagination.
Number of items per page.
Example
1
2
3
4
5
6
7
8
9
10
import os
from omnidimension import Client
# Initialize the client
api_key = os.environ.get('OMNIDIM_API_KEY')
client = Client(api_key)
# List all phone numbers with pagination
response = client.phone_number.list(page=1, page_size=10)
print(response)Attach Phone Number to Agent
Parameters
ID of the phone number to attach.
ID of the agent to attach the phone number to.
Example
1
2
3
4
5
6
7
8
9
10
11
12
import os
from omnidimension import Client
# Initialize the client
api_key = os.environ.get('OMNIDIM_API_KEY')
client = Client(api_key)
# Attach a phone number to an agent
phone_number_id = 123 # Replace with your phone number ID
agent_id = 456 # Replace with your agent ID
response = client.phone_number.attach(phone_number_id, agent_id)
print(response)Note
Detach Phone Number
Parameters
ID of the phone number to detach.
Example
1
2
3
4
5
6
7
8
9
10
11
import os
from omnidimension import Client
# Initialize the client
api_key = os.environ.get('OMNIDIM_API_KEY')
client = Client(api_key)
# Detach a phone number from its associated agent
phone_number_id = 123 # Replace with your phone number ID
response = client.phone_number.detach(phone_number_id)
print(response)Note
Import Twilio Number
Parameters
The Twilio phone number to import (including country code).
Your Twilio Account SID.
Your Twilio Auth Token.
Optional custom name for the phone number.
Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import os
from omnidimension import Client
# Initialize the client
api_key = os.environ.get('OMNIDIM_API_KEY')
client = Client(api_key)
# Import an existing Twilio number
response = client.phone_number.import_twilio_number(
phone_number="+1234567890",
account_sid="AC1234567890abcdef1234567890abcdef",
account_token="your_twilio_auth_token",
name="My Twilio Number" # Optional
)
print(response)Note
Import Exotel Number
Parameters
The Exotel phone number to import.
Your Exotel API key.
Your Exotel API token.
Your Exotel subdomain.
Your Exotel Account SID.
Your Exotel App ID.
Optional custom name for the phone number.
Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import os
from omnidimension import Client
# Initialize the client
api_key = os.environ.get('OMNIDIM_API_KEY')
client = Client(api_key)
# Import an existing Exotel number
response = client.phone_number.import_exotel_number(
exotel_phone_number="02261234567",
exotel_api_key="your_exotel_api_key",
exotel_api_token="your_exotel_api_token",
exotel_subdomain="your_subdomain",
exotel_account_sid="your_account_sid",
exotel_app_id="your_app_id",
name="My Exotel Number" # Optional
)
print(response)Note
Import SIP Trunk
Parameters
The phone number associated with the SIP trunk (E.164 format, e.g. +1234567890).
The SIP server hostname or IP address (e.g. sip.yourprovider.com).
A unique identifier name for the SIP trunk.
Optional display name for the phone number.
SIP server port. Defaults to 5060.
SIP authentication username.
SIP authentication password.
Prefix to prepend when dialing out through this trunk. When set, the country code is automatically stripped from the number before the prefix is applied (e.g. prefix "0" turns "+919876543210" into "09876543210").
Whether to strip the leading + from the phone number when dialing.
Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import os
from omnidimension import Client
# Initialize the client
api_key = os.environ.get('OMNIDIM_API_KEY')
client = Client(api_key)
# Import a SIP trunk
response = client.phone_number.import_sip_number(
phone_number="+1234567890",
sip_host="sip.yourprovider.com",
sip_trunk_name="my-sip-trunk",
name="My SIP Number", # Optional
sip_port=5060, # Optional, defaults to 5060
sip_username="user123", # Optional
sip_password="secret", # Optional
)
print(response)