@gemies/sdk 10.15.0 → 10.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/package.json +1 -1
- package/src/calls.ts +43 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @gemies/sdk
|
|
2
2
|
|
|
3
|
+
## 10.16.0
|
|
4
|
+
|
|
5
|
+
### Phone calls a person approves
|
|
6
|
+
|
|
7
|
+
`@gemies/sdk/calls` gains the `proposed` and `expired` statuses and their events,
|
|
8
|
+
`proposalExpiresAt`, the `remote_hangup` and `busy` end reasons, the phone error codes, and the
|
|
9
|
+
shapes of the channel and caller ID routes (`CallChannelsState`, `CallerIdState`,
|
|
10
|
+
`StartedCallerIdVerification`). The contract and what a client still has to draw are in Gemies
|
|
11
|
+
`docs/calls-api.md`.
|
|
12
|
+
|
|
3
13
|
## 10.15.0
|
|
4
14
|
|
|
5
15
|
### A gemie can call
|
package/package.json
CHANGED
package/src/calls.ts
CHANGED
|
@@ -16,12 +16,14 @@ export const CALL_DIRECTIONS = ['outbound', 'inbound'] as const;
|
|
|
16
16
|
export type CallDirection = (typeof CALL_DIRECTIONS)[number];
|
|
17
17
|
|
|
18
18
|
export const CALL_STATUSES = [
|
|
19
|
+
'proposed',
|
|
19
20
|
'ringing',
|
|
20
21
|
'active',
|
|
21
22
|
'ended',
|
|
22
23
|
'failed',
|
|
23
24
|
'declined',
|
|
24
25
|
'missed',
|
|
26
|
+
'expired',
|
|
25
27
|
] as const;
|
|
26
28
|
export type CallStatus = (typeof CALL_STATUSES)[number];
|
|
27
29
|
|
|
@@ -29,9 +31,12 @@ export const CALL_END_REASONS = [
|
|
|
29
31
|
'gemie_hangup',
|
|
30
32
|
'conversation_ended',
|
|
31
33
|
'user_hangup',
|
|
34
|
+
'remote_hangup',
|
|
32
35
|
'declined',
|
|
36
|
+
'busy',
|
|
33
37
|
'missed',
|
|
34
38
|
'cancelled',
|
|
39
|
+
'expired',
|
|
35
40
|
'max_duration',
|
|
36
41
|
'idle_timeout',
|
|
37
42
|
'credits_exhausted',
|
|
@@ -49,21 +54,29 @@ export const CALL_ERROR_CODES = [
|
|
|
49
54
|
'not_found',
|
|
50
55
|
'not_ringing',
|
|
51
56
|
'not_live',
|
|
57
|
+
'not_pending',
|
|
52
58
|
'call_in_progress',
|
|
53
59
|
'rate_limited',
|
|
54
60
|
'voice_plan_required',
|
|
55
61
|
'not_configured',
|
|
56
62
|
'not_enabled',
|
|
63
|
+
'caller_id_required',
|
|
64
|
+
'number_not_allowed',
|
|
65
|
+
'number_unavailable',
|
|
66
|
+
'credits_exhausted',
|
|
67
|
+
'provider_error',
|
|
57
68
|
] as const;
|
|
58
69
|
export type CallErrorCode = (typeof CALL_ERROR_CODES)[number];
|
|
59
70
|
|
|
60
71
|
export const CALL_EVENTS = [
|
|
72
|
+
'call.proposed',
|
|
61
73
|
'call.ringing',
|
|
62
74
|
'call.accepted',
|
|
63
75
|
'call.declined',
|
|
64
76
|
'call.missed',
|
|
65
77
|
'call.ended',
|
|
66
78
|
'call.failed',
|
|
79
|
+
'call.expired',
|
|
67
80
|
] as const;
|
|
68
81
|
export type CallEventName = (typeof CALL_EVENTS)[number];
|
|
69
82
|
|
|
@@ -82,6 +95,8 @@ export interface CallWire {
|
|
|
82
95
|
readonly to: string | null;
|
|
83
96
|
readonly from: string | null;
|
|
84
97
|
readonly createdAt: string;
|
|
98
|
+
/** When a `proposed` call becomes `expired`. */
|
|
99
|
+
readonly proposalExpiresAt: string | null;
|
|
85
100
|
readonly ringExpiresAt: string | null;
|
|
86
101
|
readonly answeredAt: string | null;
|
|
87
102
|
readonly endedAt: string | null;
|
|
@@ -105,3 +120,31 @@ export interface CallEventData {
|
|
|
105
120
|
export interface CallErrorBody {
|
|
106
121
|
readonly error: { readonly code: CallErrorCode; readonly message: string };
|
|
107
122
|
}
|
|
123
|
+
|
|
124
|
+
/** `GET /calls/channels`. */
|
|
125
|
+
export interface CallChannelsState {
|
|
126
|
+
readonly app: { readonly status: 'available' };
|
|
127
|
+
readonly phone: {
|
|
128
|
+
readonly status: 'available' | 'caller_id_required' | 'not_configured';
|
|
129
|
+
readonly phoneNumber: string | null;
|
|
130
|
+
};
|
|
131
|
+
readonly own_number: { readonly status: 'not_enabled' };
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** `GET /calls/caller-id`'s `callerId`: the number the person calls from. */
|
|
135
|
+
export interface CallerIdState {
|
|
136
|
+
readonly configured: boolean;
|
|
137
|
+
readonly phoneNumber: string | null;
|
|
138
|
+
readonly pendingPhoneNumber: string | null;
|
|
139
|
+
readonly pendingExpiresAt: string | null;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* `POST /calls/caller-id { phoneNumber }`: the provider rings the number, and whoever answers types
|
|
144
|
+
* `validationCode` on its keypad. Show the code.
|
|
145
|
+
*/
|
|
146
|
+
export interface StartedCallerIdVerification {
|
|
147
|
+
readonly validationCode: string;
|
|
148
|
+
readonly phoneNumber: string;
|
|
149
|
+
readonly expiresAt: string;
|
|
150
|
+
}
|