Skip to content

Phone numbers and SIP

MoreVoice reaches the phone network over SIP: you bring the lines your carrier gives you, and MoreVoice answers and places calls on them. A connection is one such line. The phone numbers of your account are the numbers those connections answer and call from. Once a line is connected, inbound routes decide who answers each number.

There are two kinds:

Kind (type) How calls reach MoreVoice
SIP trunk (trunk) Your carrier sends calls straight to MoreVoice’s address. It usually trusts IP addresses, so a username is only needed when the trunk uses digest authentication.
Registration account (registration) MoreVoice registers to your provider like a desk phone, with a username and a password, and the provider sends calls to that registration. A cloud PBX extension is a registration account.

Connections speak plain SIP over UDP with G.711 audio: A-law (pcma, the standard in Israel and Europe) and μ-law (pcmu, the standard in the US). Every connection runs through the same engine: AI agents, routing, recordings and limits work the same way. backend: "freeswitch" runs a connection through the optional FreeSWITCH front end instead of the built-in SIP stack; nothing else changes.

Give your carrier MoreVoice’s SIP address (the dashboard shows it under SettingsSIP / Phone, in the Phone system card), then create the connection with the carrier’s host and the addresses it sends calls from:

Terminal window
# Connect a SIP trunk: your carrier sends calls to MoreVoice, from these IP addresses only. Live keys only.
curl https://api.morevoice.ai/v1/connections \
-H "Authorization: Bearer $MOREVOICE_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"name": "Main trunk",
"type": "trunk",
"host": "sip.carrier.example.com",
"inbound_acl": ["198.51.100.0/24"],
"caller_ids": ["+97231234567", "+97231234568"],
"default_caller_id": "+97231234567",
"max_channels": 30,
"inbound_reserve_pct": 20,
"max_cps": 5,
"overflow_policy": "unavailable"
}'
Field What it does
host, port The carrier’s SIP host and port (5060 by default).
inbound_acl The addresses, single or CIDR ranges, that may send calls on this connection besides host.
caller_ids The numbers the carrier lets you present on outbound calls. They also become phone numbers of your account.
default_caller_id The caller ID of an outbound call that names none.
max_channels Calls in progress at once on the connection; 0 means no limit.
inbound_reserve_pct A share of the channels outbound calls can’t take, so customers can always get through.
max_cps New outbound calls per second.
overflow_policy The answer when no channel is free: busy (486 Busy) or unavailable (503, which lets a carrier with a backup route fail over).
answer_inbound false refuses every inbound call on the connection with 486 Busy.
inbound_assistant_id The assistant that answers when no inbound route matches a call.

A registration account needs the provider’s host, the account’s username and its password. register: true keeps the registration alive, renewing it every register_expires_seconds (300 by default):

Terminal window
# A registration account: MoreVoice registers to your provider like a desk phone. The password is write-only.
curl https://api.morevoice.ai/v1/connections \
-H "Authorization: Bearer $MOREVOICE_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"name": "Office line",
"type": "registration",
"host": "pbx.provider.example.com",
"username": "0312345670",
"password": "'"$SIP_PASSWORD"'",
"register": true,
"max_channels": 4
}'
# After you change the account at the provider, register again now and read the result.
curl -X POST https://api.morevoice.ai/v1/connections/$CONNECTION_ID/register \
-H "Authorization: Bearer $MOREVOICE_API_KEY" \
-H "Idempotency-Key: $(uuidgen)"

The password is write-only: no answer ever contains it, and password_set says whether one is stored. To change it, send a new password; to remove it, send null. POST /v1/connections/{id}/register registers again at once, for example after you changed the account at the provider, and answers with the state right after the attempt.

MoreVoice accepts a new inbound call (INVITE) only when it comes from the connection’s host or from an address in its inbound_acl. Anything else is refused with 403 Forbidden, so nobody can reach your assistants by sending calls to MoreVoice’s address directly. When several connections could own a call (two extensions of the same PBX, for example), MoreVoice picks the one whose username or caller IDs match the dialled number.

Every connection carries its live status:

status.state Meaning
registered A registration account is registered and ready.
listening A trunk is ready to receive calls.
registering A registration is in progress.
incomplete Settings are missing (a host, a username).
failed The last registration failed: status.error says why.
disabled The connection is switched off (enabled: false).

active_calls counts the calls on the connection right now. Subscribe to the connection.status_changed event to hear when a registration goes up or down.

Changes to a connection apply to the next call; calls in progress are not affected. A connection that carries calls can’t be deleted (409).

GET /v1/phone_numbers lists the numbers of your account, whatever their source:

source Where the number comes from
connection A number of one of your SIP connections: its caller_ids, and the numbers your inbound routes match exactly.
provisioned A number bought through MoreVoice.
sandbox A test-mode number on the virtual carrier (test keys list only these).
Terminal window
# The numbers on your account: their source, whether they answer inbound calls, and whether they can be a caller ID.
curl "https://api.morevoice.ai/v1/phone_numbers?limit=100" \
-H "Authorization: Bearer $MOREVOICE_API_KEY"

inbound says whether calls to the number are answered, and inbound_route_id names the route that answers them. outbound_caller_id says whether the number can be presented on outbound calls. To call from a number, pass its ID as from_number_id when you create a call: it picks the connection and the caller ID together.

Numbers bought or ported through MoreVoice (source: provisioned) are ordered in the dashboard, on the SettingsPhone numbers tab (see the help centre), or bought with a live key (below), and your systems hear about them through the events number.provisioned, number.released, number.port_foc_scheduled, number.port_completed and number.port_rejected (see the event catalogue). In test mode, POST /v1/phone_numbers gives you a sandbox number to dial with POST /v1/test_helpers/inbound_calls.

When number purchases are enabled for your organisation, a live key can buy a number itself:

  1. GET /v1/phone_numbers/available lists the numbers on offer, in number order, with your monthly_price and any setup_price. Filter with area_code (for example 03 or 073) or contains.
  2. POST /v1/phone_numbers with the item’s id as available_id (or its number), an optional label, and at most one of assistant_id, flow_id or inbound_route_id for its inbound calls (none: your most recently updated assistant). The answer is the new number (201), and number.provisioned follows.

The number is billed monthly at its price from the next billing anniversary, plus the setup fee if it has one, exactly as when you buy it in the dashboard. Send an Idempotency-Key: a retry with the same key resumes the same order instead of buying a second number. A number someone else took meanwhile answers 409 number_unavailable (pick another one), and a plan limit or a prepaid balance that doesn’t cover the first month answers 402. Without purchases enabled, both operations answer 403 feature_unavailable; test keys get sandbox numbers as before.

When number porting is enabled for your organisation, a live key can ask to move Israeli numbers you hold at another provider to MoreVoice Telephony. In Israel a port goes through the carriers by hand: you sign a letter of authorization (LOA), our staff check the request and send it to the carrier, and the carrier sets the date.

  1. Upload the signed LOA and the latest invoice from your current provider with POST /v1/files (purpose: "port_document"; a PDF, JPEG or PNG of up to 10 MB, as a multipart file part or base64 JSON). Each answer is a file_… id. A file is used once, and an unused one is deleted after 7 days.
  2. POST /v1/ports with the numbers (fixed-line, 07x or mobile, up to 50), current_carrier, the account_holder (name and either id_number or company_id), optionally account_number, billing_address and requested_date, and the two file ids as loa_file_id and invoice_file_id. The port is sent at once (201, status: "submitted").
  3. Follow it with GET /v1/ports/{id} or the number.port_updated event, which carries previous_status on every change. POST /v1/ports/{id}/cancel withdraws it while cancellable is true.
status Meaning
submitted Sent, waiting for our review.
in_review Our staff are checking the request and its documents.
submitted_to_carrier The request is with the carrier, waiting for a date.
scheduled The carrier set the date: port_date is when the numbers move.
completed The numbers are phone numbers of your account (number.port_completed, one event per number), and their monthly fee starts.
docs_required Another document is needed: the timeline note says which. Fix it in the dashboard.
rejected Refused: rejection_reason says why (number.port_rejected).
cancelled Withdrawn.

Toll-free, shared-cost and premium numbers (1-800, 1-700 …) and foreign numbers can’t be ported (400, param: "numbers"). A number that is already on MoreVoice or in another open port answers 409 with details.reason, and so does a twenty-first port in progress. Ported numbers arrive routed like a new number; point them at an assistant with inbound routes. Without porting enabled every operation answers 403 feature_unavailable, and test keys get 403 live_only.

When number releases are enabled for your organisation, a live key can release one of your numbers with DELETE /v1/phone_numbers/{id} (otherwise it answers 501; release numbers in the dashboard).

  • The number stops answering calls: its inbound route goes with it, whatever it answered with (an assistant, a flow, a queue or a person).
  • A number bought through MoreVoice goes back to the platform. Its monthly fee stops: no further month is billed, and the month already billed is not refunded. A number of your own SIP connection is removed from the connection’s caller IDs, and the inbound routes that match it exactly are deleted.
  • While campaigns present it as caller ID, caller-ID pools hold it, desk phones present it or other inbound routes match it, the answer is 409 number_in_use, and details.uses lists them. ?force=true detaches it from all of them first: the campaigns and phones fall back to the line’s default caller ID.
  • number.released follows. Releasing a released number again answers 200. A release can’t be undone: the number may go to another customer.
Terminal window
# Release a number. While campaigns, caller-ID pools, desk phones or other routes use it, the answer is
# 409 number_in_use with details.uses; add ?force=true to detach it from them and release it anyway.
curl -X DELETE https://api.morevoice.ai/v1/phone_numbers/$PHONE_NUMBER_ID \
-H "Authorization: Bearer $MOREVOICE_API_KEY"

A call can present a number that isn’t on your account, such as your office line, once you prove you control it. When caller-ID verification is enabled for your organisation, POST /v1/caller_ids with the phone_number (E.164) starts a verification: we call the number and ask whoever answers to type the 6-digit verification_code from the answer on the phone’s keypad. Show them the code; the call never says it. The code works for 10 minutes and for one entry.

Terminal window
# Verify your office line as a caller ID: we call it, and whoever answers types the code on the phone's keypad.
curl https://api.morevoice.ai/v1/caller_ids \
-H "Authorization: Bearer $MOREVOICE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"phone_number": "+97235550100", "friendly_name": "Head office"}'
# Show the answer's verification_code to the person at that phone. Then wait for caller_id.verified, or read it:
curl https://api.morevoice.ai/v1/caller_ids/$CALLER_ID \
-H "Authorization: Bearer $MOREVOICE_API_KEY"

The outcome arrives as caller_id.verified or caller_id.failed (with a failure_reason: wrong_code, no_answer, no_input, expired, call_failed or superseded). A verified number can be the caller_id of POST /v1/calls and of campaigns, on your own connections and on MoreVoice Telephony; an unverified one is still refused. GET /v1/caller_ids lists them, and DELETE /v1/caller_ids/{id} stops presenting one.

  • Limits: 3 verification calls a day per number, and 10 a day and 3 in any 10 minutes per organisation (429 rate_limited, with details.scope).
  • Refused: a number not in E.164, an emergency or premium-rate number (400 parameter_invalid), and your own numbers, which need no verification, or one already verified (409 caller_id_exists).
  • Retries: POST /v1/caller_ids isn’t replayed under an Idempotency-Key, because its answer holds the code. A retry starts a new verification, and the older one fails as superseded.
  • Cost: the verification call isn’t billed to your organisation.
  1. Open SettingsSIP / Phone. The Phone system card turns the SIP stack on and shows its public address. Give this address to your carrier for a trunk.

  2. Click New SIP trunk or New SIP account, fill in the host and the credentials from your carrier, set Max channels, Reserved for inbound, Max calls / second and Allowed inbound IPs, and click Save connection.

  3. Add inbound routes for the numbers on the line, and call one of them.