A peer to peer phone relay network built on top of yggdrasil. Every box is reachable from any yggdrasil node running this service, not only from members of the same clan. ## Numbers Each box gets a random 6 digit number (100000-999999) when its vars are generated. The number is signed with the box's yggdrasil private key, so a number is cryptographically bound to the yggdrasil address it belongs to; nobody can claim a number for an address they do not own. Regenerate the `phonebox` vars to get a new number. Dialing from a phone plugged into the ATA: | dialed | reaches | | ------------- | ------------------------------------------ | | `NNNNNN` | the phone on box `NNNNNN` (line `00`) | | `NNNNNNXX` | line `XX` on box `NNNNNN` | | `00`, `01`... | local lines on this box | | `888` | fax of the current number directory | | `000` | fax echo test | | `999` | hello world | Caller ID on the callee is the caller's box number followed by its line, so calling it back works. ## Directory There is no central registry. Each box runs a serf agent on yggdrasil port 7946 that gossips its signed number record (`number`, `key`, `sig`, `owner` tags) to every other box it knows about. On every membership change the `phonebox-sync` handler verifies all records and writes the resulting `number -> yggdrasil address` map to `/run/phonebox/numbers/`, which the asterisk dialplan reads at call time. Bootstrapping: boxes of the same clan join each other automatically. To connect to boxes outside the clan add one of their yggdrasil addresses to `extraPeers`; after the first successful join the agent remembers the whole membership in `/var/lib/phonebox/serf.snapshot` and rejoins on its own. `serf members -rpc-addr 127.0.0.1:7373` shows the live directory.