This repository has been archived by the owner on Nov 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
620 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[tools] | ||
node = "16" | ||
python = "3.10" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,13 +3,33 @@ | |
This is the project for WGTwo API docs v0, hosted at [v0.docs.wgtwo.com/](https://v0.docs.wgtwo.com/). | ||
|
||
Prior to 2023-03-29 these docs were hosted on docs.wgtwo.com. | ||
The actual docs.wgtwo.com code can be found in loltel/public-api-docs. | ||
|
||
## Contributing | ||
Check out [CONTRIBUTING.md](CONTRIBUTING.md) and add your content to [docs/](docs/) | ||
|
||
## Prerequisites / install | ||
- Node.js 16.x | ||
- vips (for image processing) `brew install vips` (for any arm/Mac M1+ users) | ||
- python 3.10 | ||
|
||
If you use pyenv and rtx/asdf then this might be enough: | ||
|
||
```shell | ||
brew install vips | ||
npm install | ||
``` | ||
|
||
If not you might also need: | ||
```shell | ||
rtx install [email protected] | ||
rtx install node@16 | ||
brew install vips | ||
npm install | ||
``` | ||
|
||
## Run project | ||
1. `npm install` | ||
2. `npm run develop` | ||
1. `npm run develop` | ||
|
||
## Building | ||
`npm run build` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
title: API reference | ||
topic: number lookup | ||
type: api-reference | ||
roles: | ||
- THIRD_PARTY_DEVELOPER | ||
--- | ||
|
||
<GithubCode fileUrl="https://github.com/working-group-two/wgtwoapis/blob/master/wgtwo/lookup/v0/number_lookup.proto" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
--- | ||
title: Technical guide | ||
topic: number lookup | ||
type: how-to | ||
roles: | ||
- THIRD_PARTY_DEVELOPER | ||
sourceExamples: | ||
- examples/grpcurl/thirdpartydev/number-lookup/provider.sh | ||
- examples/kotlin/thirdpartydev/number-lookup/src/main/kotlin/com/wgtwo/examples/thirdpartydev/provider/Provider.kt | ||
--- | ||
|
||
# Number Lookup API - Technical Guide | ||
|
||
> **This guide will show you how to set up a Number Lookup Provider.** | ||
> | ||
> You should have an understanding of how this works before continuing, | ||
> see [Overview](number-lookup/setup-number-lookup-overview/). | ||
## Prerequisites | ||
|
||
This guide assumes you are able to create a OAuth 2.0 client and get an access token. | ||
|
||
See [Get client access token](https://docs.wgtwo.com/guide/oauth2/get-client-access-token.html) for how to get the | ||
access token. | ||
|
||
> **Note:** <br /> | ||
> For testing using our sandbox endpoint, authentication headers may be skipped. | ||
### Required scope | ||
|
||
`lookup.number:read` | ||
|
||
## How to use the API | ||
When you connect to this API, you will get a stream of number lookup requests for which you should respond with | ||
information about the number. | ||
|
||
<CodeSnippet | ||
:grpcurl="$sourceExamplesMap['examples/grpcurl/thirdpartydev/number-lookup/provider.sh']" | ||
:kotlinDeps="['auth', 'lookup']" | ||
:kotlin=" | ||
$sourceExamplesMap['examples/kotlin/thirdpartydev/number-lookup/src/main/kotlin/com/wgtwo/examples/thirdpartydev/provider/Provider.kt']" | ||
/> | ||
|
||
## Flow | ||
The API is implemented as a bidirectional gRPC service, where the provider responds to requests from the server. | ||
|
||
The Number Provider sets up one or more connections to our API. This connection should use keep-alive, and has a max | ||
connection age of one hour +/- a 10 % jitter. Once max connection age is reached, or any exception occurs, the | ||
connection should be re-established. | ||
|
||
> **Note:** <br /> | ||
> Although the connection is set up from the provider to wg2, all requests are initiated from wg2. | ||
![](~/assets/images/number-lookup-flow.svg) | ||
|
||
Using round-robin, wg2 will send number lookup requests | ||
over these connections for which the provider will respond with the display name. | ||
|
||
Responses will be cached for a period of time to avoid unnecessary requests and latency. | ||
|
||
![](~/assets/images/number-lookup-sequence.svg) | ||
|
||
## Request / Response | ||
|
||
For matching the response to the original request, the provider must include the original request in the response. | ||
|
||
The returned display name may be empty if the provider does not have a display name for the number, and | ||
may be cached for the duration specified. | ||
|
||
### Request | ||
```prototext | ||
NumberLookupRequest { | ||
id: "opaque string" | ||
number { | ||
e164: "+1234567890" | ||
} | ||
} | ||
``` | ||
|
||
### Response | ||
```prototext | ||
NumberLookupResponse { | ||
number_lookup_request { } # Fields omitted for brevity | ||
result { | ||
name: "John Doe" | ||
} | ||
} | ||
``` | ||
|
||
### Response, upstream error | ||
```prototext | ||
NumberLookupResponse { | ||
number_lookup_request { } # Fields omitted for brevity | ||
error { | ||
message: "Database unavailable" | ||
} | ||
} | ||
``` | ||
|
||
## Limitations for display name | ||
|
||
The display name returned must be max 60 characters, and may only contain the following: | ||
|
||
- alphanumeric (`a-z`, `A-Z`, `0-9`) | ||
- ` ` (space), `-`, `_` | ||
- `.`, `!`, `%`, `*`, `'`, `+`, `~`, `` ` `` | ||
|
||
Characters not matching the above will be stripped. | ||
|
||
## Error handling | ||
|
||
If there are no healthy connections for the provider, the provider will be ignored. | ||
|
||
Should the provider fail to respond within the set deadline, it will be treated as if it returned an empty result. | ||
|
||
For upstream errors, the provider must return an error, accompanied by a descriptive, human-readable message. | ||
|
||
## Cache | ||
|
||
As part of the response, the provider can include a cache TTL. | ||
|
||
This is the time in seconds that the display name should be cached on the wg2 side. | ||
If not set, a default cache TTL documented in the proto file will be used. | ||
|
||
```prototext | ||
NumberLookupResponse { | ||
number_lookup_request { } # Fields omitted for brevity | ||
result { | ||
name: "John Doe" | ||
} | ||
# Optional, set to default if not set | ||
cache_control { | ||
max_age { | ||
seconds: 3600 # 1 hour, google.protobuf.Duration | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Recommended gRPC connection settings | ||
|
||
| Setting | Value | Description | | ||
|:--------------------------------|:-----------|------------------------------------| | ||
| keep-alive period | 1 minute | Must be ≥ 1 minute and ≤ 5 minutes | | ||
| keep-alive timeout | 10 seconds | | | ||
| permit keep-alive without calls | true | | | ||
|
||
### Keep-Alive | ||
|
||
The load balancer hosting api.wgtwo.com will silently drop connections if they have been idle for 350 seconds (5m 50s). | ||
|
||
To avoid this, the provider should send a keep-alive message every minute. | ||
|
||
## Continue reading | ||
|
||
* [API reference](/number-lookup/api-reference/) | ||
|
||
## Concepts | ||
|
||
* [gRPC concepts](https://grpc.io/docs/guides/concepts/) | ||
* [Kotlin gRPC tutorial](https://grpc.io/docs/languages/kotlin/basics/) | ||
* [Java gRPC stubs](https://grpc.io/docs/reference/java/generated-code/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
--- | ||
title: Overview | ||
topic: number lookup | ||
type: overview | ||
roles: | ||
- THIRD_PARTY_DEVELOPER | ||
sourceExamples: | ||
- examples/kotlin/thirdpartydev/number-lookup/src/main/kotlin/com/wgtwo/examples/thirdpartydev/provider/Provider.kt | ||
--- | ||
|
||
# Number Lookup API | ||
|
||
This is an API used to connect a number provider to our number lookup service. | ||
|
||
## Intended audience | ||
|
||
This API is designed for third-party phone number information providers. | ||
|
||
This includes phone book services, spam detection services, and any other services that offer insights about phone | ||
numbers. | ||
|
||
## Usage | ||
|
||
When you integrate as a number information provider, you'll receive a lookup request that contains a phone number. | ||
Your task will be to classify them and provide a display name lookup. | ||
|
||
The information you provide will assist wg2 in enhancing the call experience, such as setting the display name for | ||
incoming calls. | ||
|
||
## Include display name as part of call setup | ||
|
||
### Get number information from provider | ||
When a subscriber receives a call over VoLTE, we will check if there is any configured Number Lookup Providers for the | ||
subscriber. | ||
|
||
![](~/assets/images/number-lookup-get-providers.svg) | ||
|
||
During call setup a number lookup request will be sent to each of the enabled Number Lookup Providers, if any. | ||
|
||
![](~/assets/images/number-lookup-overview-flow.svg) | ||
|
||
### Show display name | ||
|
||
If we have received any display name from the providers, we will show it to the subscriber. | ||
|
||
This will be visible in the call screen, as seen in the image below where the display name is "Potential Spam". | ||
|
||
![](~/assets/images/number-lookup-call.png) | ||
|
||
> **Note:** | ||
> If the phone has the number stored as a contact, the phone will typically use this. | ||
## Error handling | ||
|
||
If the provider returns a empty display name (no hit in the phonebook) or fails to respond within the deadline, | ||
the call will be displayed as usual. | ||
|
||
Results will be cached for a period of time to avoid unnecessary requests and latency. | ||
|
||
## Continue reading | ||
|
||
* [Technical Guide](/number-lookup/technical-guide/) | ||
* [API reference](/number-lookup/api-reference/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.