pinecallDocs
Phone & supervision / pinecall numbers

pinecall numbers

The org's numbers and where they point.

pinecall numbers list
pinecall numbers available [--account <id>]
pinecall numbers import <+34…, address or Meta id> --agent <slug> [--account <id>] [--channel phone|whatsapp|sms|email|messenger|instagram] [--move] [--app <name>] [--dry-run]
pinecall numbers buy --country <XX> [--area <digits>] --agent <slug> [--channel phone|whatsapp|sms] [--dry-run]
pinecall numbers drop <+34…, address or Meta id> [--channel phone|whatsapp|sms|email|messenger|instagram]

Adding a number to the org from a terminal is numbers import: the number is one an account of the org owns, and the account itself is kept first with carriers add when the org does not hold it yet. A Twilio number reaching an agent is these two lines, and nothing else:

Terminal
$ pinecall carriers add twilio --account-sid AC0123… --user SK4567…   # once, the secret on stdin
$ pinecall numbers import +34910000000 --agent clinica-norte          # the number, to the agent
$ pinecall numbers import +34910000000 --agent clinica-norte --move   # off the trunk it is on now, then here

An org with several accounts names the one that owns the number, with --account and the id carriers list prints. Without it the gateway cannot choose and answers 409 the org has 2 carrier accounts (AC0123…, AC9876…): name one of them; the verb prints that and the flag to add.

Terminal
$ pinecall numbers import +34910000001 --agent clinica-norte --account AC9876…

An address may be read by an app's flows instead of answered by its agent: --app <name>, with --channel email, sends each email to that app as the event mail.received, and opens no conversation (a portal's notices, an order; docs.pinecall.io/concepts/app-flows/, "An email starts a flow"). The list says app <name> (flows) where it would name the agent; importing the address again without --app gives it back to the agent.

Terminal
$ pinecall numbers import avisos@acme.example --agent front-desk --channel email --app front-desk

An agent gets an address of the deployment's own domain with numbers address, as buy gets it a number: pinecall numbers address <word> --agent <slug> [--app <name>] [--label <name>] makes <word>.<org>@<domain> on the deployment's mail host, keeps its mailbox for the org and routes it; with --app its emails go to that app's flows. numbers drop <address> lets it go and removes the mailbox. A deployment whose operator set no mail host answers that it gives out no addresses.

Terminal
$ pinecall numbers address avisos --agent front-desk --app front-desk
  route: avisos.acme@agents.pinecall.io to front-desk in the sandbox: done

One number answers on several channels, each its own route with its own agent: the phone, WhatsApp and SMS. --channel says which is being added, and what the number answers on the others stays as it is. SMS is a number of a Twilio account: importing it has Twilio post the number's messages to Pinecall, and the agent's replies go out from the same number through that account.

Terminal
$ pinecall numbers import +14155550134 --agent front-desk --channel sms --dry-run
  twilio: +14155550134's messages posted to this box: to do
  route: +14155550134 to front-desk in the sandbox: to do
  nothing written: drop --dry-run to do it
$ pinecall numbers import +14155550134 --agent front-desk --channel sms --prod
$ pinecall numbers drop +14155550134 --channel sms --prod      # the phone goes on ringing

A number whose messages already go to another service is refused naming where (409 …'s messages go to https://… now): --move takes them. In the United States a number sends SMS only once its Twilio account registered it for A2P 10DLC; until then Twilio accepts the reply and reports it undelivered (error 30034), which the call's log shows as message.status.

Which numbers there are to import is numbers available (GET /v1/numbers/available): every number the org's Twilio accounts own, every page of Twilio's, as a table: the number, its name at the carrier when someone gave it one (Twilio's default, the number written out, is left out), the account only when the org holds several, and routed here, another org's or not routed here for the environment asked, in that order. --account asks one account of several. It is per environment: a number production routes reads not routed here in the sandbox, so look with --prod before importing one there.

not routed here is not free. The list knows what this org routes in this environment and which numbers another org of this deployment routes (another org's: not importable here until that org lets it go), and nothing about a number held on another trunk of the same Twilio account: that one is found out at import, as a 409 naming the trunk and asking for move (numbers import … --move takes it off there first). numbers import <number> --agent <slug> --dry-run is the check, and a 409 is a number to leave alone. A SIP peer owns what it owns and lists nothing; its import takes the number as typed.

Terminal
$ pinecall numbers available --prod
twilio · 2 numbers
NUMBER        HERE
+13158182774  routed here
+16814413619  not routed here
  → pinecall numbers import <number> --agent <slug> --dry-run checks one

A number is one environment's and reaches one agent: it is imported where it answers, and list shows that environment's — the sandbox's, or production's with --prod. No verb here moves a number between the two; the console's Numbers screen does (PUT /v1/numbers/{number}/env, which re-routes the carrier's trunk), because a number is a route in one environment's table and a carrier call that matched two would be refused.

import takes a number the org's carrier account already owns and points it here: the carrier's trunk, the SFU's trunk, the route — --dry-run prints those steps and writes nothing, which is what you read before letting the gateway touch a carrier account. drop forgets the route and takes the number off the SFU trunk; the carrier account keeps it, so nobody is un-bought by a typo. Whose corner a ring lands in, once an environment is answering it, is line.

An org with no number of its own buys one with numbers buy (POST /v1/numbers/buy): the deployment buys a local voice number in --country (two letters) and, when given, --area on its own Twilio account — never one of the org's — and points it at the agent, in the environment the verb acts in. --dry-run names the number it would buy and buys nothing; read it first. A bought number counts against the org's numbers limit in that environment, and an imported one never does; the verb ends with the count:

Terminal
$ pinecall numbers buy --country US --area 415 --agent clinica-norte --dry-run --prod
  Twilio: buy +14155550000: to do
  …
  bought numbers in this env: 0 of 2
  nothing bought: drop --dry-run to buy +34915550000

A deployment that holds no Twilio account of its own sells none: 503. A country Twilio has no local voice number for is 404, and a limit reached is 429 with the count. list marks a bought number bought here, and an imported one with the account it lives in.