Skip to main content
A Number is a phone number on a Trunk. It tells Routr where to send calls that arrive for it, and it is the caller ID for outbound calls that use it.

Fields

The API response also includes trunk, the object that trunkRef points to.

Constraints

  • name is required and must be 1 to 60 characters.
  • telUrl must be E.164: tel:+ followed by 2 to 15 digits, the first not 0. Otherwise the create answers INVALID_ARGUMENT: telUrl "<x>" is not E.164: use tel:+ followed by 2 to 15 digits, the first not 0; or set spec.data.enforceE164Numbers: false, and the Data API’s files backend logs the same text with the Number’s ref and exits. With spec.data.enforceE164Numbers: false, telUrl only has to start with tel:, as in Routr 2. The rule applies when a Number is created, or loaded from files; telUrl can’t be updated, so stored Numbers are never checked again.
  • telUrl must be unique and up to 60 characters. The files backend refuses to load two Numbers with the same telUrl.
  • countryIsoCode must be a country libphonenumber has a numbering plan for, in any case (gb works). XX, ZZ and three-letter codes such as GBR are rejected with INVALID_ARGUMENT: countryIsoCode "<x>" is not a country with a numbering plan; the files backend logs the same text with the Number’s ref and exits.
  • Each alias is 1 to 60 letters, digits, or + * . _ -. Otherwise: alias "<a>" is invalid: use 1 to 60 letters, digits or + * . _ -. An alias is compared exactly, including case, with the Request-URI user, and tried after every form of the number.
  • An alias is unique among the Numbers of the same Trunk: alias "<a>" is already used by Number <ref> on this Trunk. The check runs when a create or update sends aliases, and when an update moves a Number to another Trunk; a rejected write changes nothing. The files backend checks every Number when it loads and exits on a violation. Two Trunks can use the same alias.
  • On update, a non-empty aliases list replaces the stored aliases, clearAliases: true removes them all, and an update that sends neither keeps them. extraHeaders works the same way with clearExtraHeaders: true.
  • An alias is matched only on the Number’s own Trunk, so a Number with no Trunk is never matched by alias.
  • In YAML, quote each alias (["01234"]): unquoted, 01234 is read as a number and the file is rejected.
  • aorLink must start with sip: or backend:. In YAML it must be 5 to 255 characters; in pgdata it can be up to 323.
  • sessionAffinityHeader and each extraHeaders[].name may contain only letters, digits, and dashes, and can’t end with a dash. In pgdata, each extraHeaders[].value must be non-empty. The YAML schema requires neither name nor value.
  • In YAML, metadata.geoInfo must be present. The loader reads it for every Number.
  • When extended.accessKeyId is set, a Peer can use this Number for peer-to-pstn calls only if its request carries the same value in X-Access-Key-Id.

How Connect uses a Number

  • from-pstn: a call from the Number’s Trunk goes to the endpoints registered under aorLink, with extraHeaders added and X-DID-Number set to the Number’s +E.164. The carrier doesn’t have to write the number exactly as telUrl: Connect also matches the same digits without the +, the Number’s national and international forms, read with its countryIsoCode, and last its aliases. Only the Trunk’s own Numbers are searched, so a Number with no Trunk gets no calls from the PSTN. See the order.
  • agent-to-pstn: a Domain egress policy selects the Number. Its Trunk carries the call, and its telUrl becomes the caller ID in P-Asserted-Identity and Remote-Party-ID.
  • peer-to-pstn: the Peer names the Number in the X-DOD-Number header, as the telUrl without tel:.
  • On agent-to-pstn and peer-to-pstn calls, the Number’s countryIsoCode is the country the Trunk’s number formats read and write the numbers in.

YAML example

The following Number routes calls to a Peer and keeps calls with the same X-Room-Id on one instance.

rctl equivalent

Run the interactive create command and answer the prompts. Enter aliases as a comma-separated list, and extra headers as comma-separated Name:value pairs.
See rctl numbers for the prompts and the other actions.

SDK equivalent

The following call creates the same Number through the API.