@fonoster/common 0.6.2 → 0.7.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.
@@ -45,9 +45,9 @@ message Acl {
45
45
  // The list of denied IP addresses
46
46
  repeated string deny = 4;
47
47
  // The date the Acl was created
48
- int64 created_at = 5;
48
+ int32 created_at = 5;
49
49
  // The date the Acl was last updated
50
- int64 updated_at = 6;
50
+ int32 updated_at = 6;
51
51
  }
52
52
 
53
53
  // The request message for the Acl.CreateAcl method
@@ -20,9 +20,6 @@ syntax = "proto3";
20
20
 
21
21
  package fonoster.agents.v1beta2;
22
22
 
23
- import "domains.proto";
24
- import "credentials.proto";
25
-
26
23
  // The Agents service definition
27
24
  service Agents {
28
25
  // Create a new Agent
@@ -39,6 +36,22 @@ service Agents {
39
36
 
40
37
  // The message for a new Agent
41
38
  message Agent {
39
+ message Domain {
40
+ // The unique identifier of the Domain
41
+ string ref = 1;
42
+ // The name of the Domain
43
+ string name = 2;
44
+ // The domain of the Domain
45
+ string domain_uri = 3;
46
+ }
47
+ message Credentials {
48
+ // The unique identifier of the Credentials
49
+ string ref = 1;
50
+ // The friendly name of the Credentials
51
+ string name = 2;
52
+ // The username of the Credentials
53
+ string username = 3;
54
+ }
42
55
  // The unique identifier of the Agent
43
56
  string ref = 1;
44
57
  // The name of the Agent
@@ -50,17 +63,17 @@ message Agent {
50
63
  // The enabled status of the Agent
51
64
  bool enabled = 5;
52
65
  // The created_at timestamp of the Agent
53
- int64 created_at = 6;
66
+ int32 created_at = 6;
54
67
  // The updated_at timestamp of the Agent
55
- int64 updated_at = 7;
68
+ int32 updated_at = 7;
56
69
  // The maximum number of contacts that can be created for this Agent
57
70
  int32 max_contacts = 8;
58
71
  // Value to override the expires requested by the Agent
59
72
  int32 expires = 9;
60
73
  // The domain of the Agent
61
- fonoster.domains.v1beta2.Domain domain = 10;
74
+ Domain domain = 10;
62
75
  // The credentials of the Agent
63
- fonoster.credentials.v1beta2.Credentials credentials = 11;
76
+ Credentials credentials = 11;
64
77
  }
65
78
 
66
79
  // The request message for Agents.CreateAgent
@@ -150,6 +163,6 @@ message ListAgentsResponse {
150
163
  }
151
164
 
152
165
  enum Privacy {
153
- PRIVATE = 0;
154
- NONE = 1;
166
+ NONE = 0;
167
+ PRIVATE = 1;
155
168
  }
@@ -60,7 +60,7 @@ message Application {
60
60
  // Application type
61
61
  ApplicationType type = 3;
62
62
  // Endpoint for programmable voice
63
- string app_endpoint = 4;
63
+ string endpoint = 4;
64
64
  // Text to speech product
65
65
  ProductContainer text_to_speech = 5;
66
66
  // Speech to text product
@@ -68,9 +68,9 @@ message Application {
68
68
  // Conversation product
69
69
  ProductContainer conversation = 7;
70
70
  // Creation time
71
- int64 created_at = 8;
71
+ int32 created_at = 8;
72
72
  // Update time
73
- int64 updated_at = 9;
73
+ int32 updated_at = 9;
74
74
  }
75
75
 
76
76
  // Request to create a new application
@@ -80,7 +80,7 @@ message CreateApplicationRequest {
80
80
  // Application type
81
81
  ApplicationType type = 2;
82
82
  // App URL for programmable voice
83
- string app_endpoint = 3;
83
+ string endpoint = 3;
84
84
  // Text to speech product
85
85
  ProductContainer text_to_speech = 4;
86
86
  // Speech to text product
@@ -126,7 +126,7 @@ message UpdateApplicationRequest {
126
126
  // Application type
127
127
  ApplicationType type = 3;
128
128
  // App URL for programmable voice
129
- string app_endpoint = 4;
129
+ string endpoint = 4;
130
130
  // Text to speech product
131
131
  ProductContainer text_to_speech = 5;
132
132
  // Speech to text product
@@ -20,9 +20,6 @@ syntax = "proto3";
20
20
 
21
21
  package fonoster.calls.v1beta2;
22
22
 
23
- // TODO: Consider using Timestamp instead of int64
24
- // import "google/protobuf/timestamp.proto";
25
-
26
23
  // Calls service definition
27
24
  service Calls {
28
25
  // Call a number and returns the call status
@@ -36,59 +33,44 @@ service Calls {
36
33
  }
37
34
 
38
35
  enum CallType {
39
- PROGRAMMABLE = 0;
40
- SIP_TRUNKING = 1;
41
- }
42
-
43
- enum HangupCause {
44
- NORMAL_CLEARING = 0;
45
- CALL_REJECTED = 1;
46
- UNALLOCATED = 2;
47
- NO_USER_RESPONSE = 3;
48
- NO_ROUTE_DESTINATION = 4;
49
- NO_ANSWER = 5;
50
- USER_BUSY = 6;
51
- NOT_ACCEPTABLE_HERE = 7;
52
- SERVICE_UNAVAILABLE = 8;
53
- INVALID_NUMBER_FORMAT = 9;
54
- UNKNOWN = 10;
36
+ SIP_ORIGINATED = 0;
37
+ API_ORIGINATED = 1;
55
38
  }
56
39
 
57
40
  enum CallStatus {
58
- QUEUED = 0;
59
- RINGING = 1;
60
- IN_PROGRESS = 2;
61
- COMPLETED = 3;
62
- FAILED = 4;
63
- BUSY = 5;
64
- // TODO: Refactor to avoid clash with HangupCause
65
- // NO_ANSWER = 6;
66
- CANCELED = 7;
67
- REJECTED = 8;
68
- TIMEOUT = 9;
69
- // TODO: Refactor to avoid clash with HangupCause
70
- // UNKNOWN = 10;
41
+ UNKNOWN = 0;
42
+ NORMAL_CLEARING = 1;
43
+ CALL_REJECTED = 2;
44
+ UNALLOCATED = 3;
45
+ NO_USER_RESPONSE = 4;
46
+ NO_ROUTE_DESTINATION = 5;
47
+ NO_ANSWER = 6;
48
+ USER_BUSY = 7;
49
+ NOT_ACCEPTABLE_HERE = 8;
50
+ SERVICE_UNAVAILABLE = 9;
51
+ INVALID_NUMBER_FORMAT = 10;
71
52
  }
72
53
 
73
54
  enum CallDirection {
74
- INBOUND = 0;
75
- OUTBOUND = 1;
55
+ FROM_PSTN = 0;
56
+ TO_PSTN = 1;
57
+ INTRA_NETWORK = 2;
76
58
  }
77
59
 
78
60
  // Message for a Call Detail Record
79
61
  message CallDetailRecord {
80
62
  // The unique identifier of the Call
81
63
  string ref = 1;
64
+ // Call identifier from the SIP stack
65
+ string call_id = 2;
82
66
  // The call type
83
- CallType type = 2;
67
+ CallType type = 3;
84
68
  // The call status
85
- CallStatus status = 3;
86
- // Hangup cause
87
- HangupCause hangup_cause = 4;
69
+ CallStatus status = 4;
88
70
  // Start time of the call
89
- int64 started_at = 5;
71
+ int32 started_at = 5;
90
72
  // End time of the call
91
- int64 ended_at = 6;
73
+ int32 ended_at = 6;
92
74
  // The from number (E.164 format or SIP URI)
93
75
  string from = 7;
94
76
  // The to number (E.164 format or SIP URI)
@@ -107,11 +89,13 @@ message CreateCallRequest {
107
89
  string to = 2;
108
90
  // Optional application reference
109
91
  string app_ref = 3;
92
+ // Optional timeout in seconds
93
+ int32 timeout = 4;
110
94
  }
111
95
 
112
96
  // The response message for Calls.Call
113
97
  message CreateCallResponse {
114
- // The refence of the call
98
+ // The reference of the call
115
99
  string ref = 1;
116
100
  }
117
101
 
@@ -157,8 +141,16 @@ message TrackCallRequest {
157
141
 
158
142
  // The response message for Calls.TrackCall
159
143
  message TrackCallResponse {
160
- // The refence of the call
161
- string ref = 1;
162
- // The call status
163
- CallStatus status = 2;
144
+ // The status of the dial
145
+ enum Status {
146
+ TRYING = 0;
147
+ CANCEL = 1;
148
+ ANSWER = 2;
149
+ BUSY = 3;
150
+ PROGRESS = 4;
151
+ NOANSWER = 5;
152
+ // Maps from Asterisk's CHANUNAVAIL and CONGESTION
153
+ FAILED = 6;
154
+ }
155
+ Status status = 1;
164
156
  }
@@ -42,12 +42,10 @@ message Credentials {
42
42
  string name = 2;
43
43
  // The username of the Credentials
44
44
  string username = 3;
45
- // The password of the Credentials
46
- string password = 4;
47
45
  // The time the Credentials was created
48
- int64 created_at = 5;
46
+ int32 created_at = 4;
49
47
  // The time the Credentials was updated
50
- int64 updated_at = 6;
48
+ int32 updated_at = 5;
51
49
  }
52
50
 
53
51
  // The request message for the Credentials.CreateCredentials method
@@ -37,15 +37,15 @@ service Domains {
37
37
  // The message for the Domain resource
38
38
  message Domain {
39
39
  // The unique identifier of the Domain
40
- string ref = 2;
40
+ string ref = 1;
41
41
  // The name of the Domain
42
- string name = 3;
42
+ string name = 2;
43
43
  // The URI of the Domain
44
- string domain_uri = 4;
44
+ string domain_uri = 3;
45
45
  // The date of creation of the Domain
46
- int64 created_at = 5;
46
+ int32 created_at = 4;
47
47
  // The date of the last update
48
- int64 updated_at = 6;
48
+ int32 updated_at = 5;
49
49
  }
50
50
 
51
51
  // EgressPolicy defines the policy for egress traffic
@@ -35,8 +35,7 @@ service Identity {
35
35
 
36
36
  // User specific actions
37
37
  rpc CreateUser (CreateUserRequest) returns (CreateUserResponse) {}
38
- // TODO: Should get the User instead of GetUserResponse (renaming)
39
- rpc GetUser (GetUserRequest) returns (GetUserResponse) {}
38
+ rpc GetUser (GetUserRequest) returns (User) {}
40
39
  rpc UpdateUser (UpdateUserRequest) returns (UpdateUserResponse) {}
41
40
  rpc DeleteUser (DeleteUserRequest) returns (DeleteUserResponse) {}
42
41
 
@@ -141,13 +140,13 @@ message GetUserRequest {
141
140
  string ref = 1;
142
141
  }
143
142
 
144
- message GetUserResponse {
143
+ message User {
145
144
  string ref = 1;
146
145
  string email = 2;
147
146
  string name = 3;
148
147
  string avatar = 4;
149
- int64 created_at = 5;
150
- int64 updated_at = 6;
148
+ int32 created_at = 5;
149
+ int32 updated_at = 6;
151
150
  }
152
151
 
153
152
  message UpdateUserRequest {
@@ -173,8 +172,8 @@ message Workspace {
173
172
  string ref = 1;
174
173
  string name = 2;
175
174
  string owner_ref = 3;
176
- int64 created_at = 4;
177
- int64 updated_at = 5;
175
+ int32 created_at = 4;
176
+ int32 updated_at = 5;
178
177
  }
179
178
 
180
179
  // ApiKey Resources
@@ -223,8 +222,8 @@ message ApiKey {
223
222
  string access_key_id = 2;
224
223
  string role = 3;
225
224
  int32 expires_at = 4;
226
- int64 created_at = 5;
227
- int64 updated_at = 6;
225
+ int32 created_at = 5;
226
+ int32 updated_at = 6;
228
227
  }
229
228
 
230
229
  // Token Exchange Resources
@@ -20,8 +20,6 @@ syntax = "proto3";
20
20
 
21
21
  package fonoster.numbers.v1beta2;
22
22
 
23
- import "trunks.proto";
24
-
25
23
  // The Numbers service definition
26
24
  service Numbers {
27
25
  // Create a new Number
@@ -38,6 +36,12 @@ service Numbers {
38
36
 
39
37
  // The message for the Number resource
40
38
  message Number {
39
+ message Trunk {
40
+ // The unique identifier of the Trunk
41
+ string ref = 1;
42
+ // The name of the Trunk
43
+ string name = 2;
44
+ }
41
45
  // The unique identifier of the Number
42
46
  string ref = 1;
43
47
  // The name of the Number
@@ -51,11 +55,11 @@ message Number {
51
55
  // The country_iso_code of the Number
52
56
  string country_iso_code = 6;
53
57
  // The date when the Number was created
54
- int64 created_at = 7;
58
+ int32 created_at = 7;
55
59
  // The date when the Number was last updated
56
- int64 updated_at = 8;
60
+ int32 updated_at = 8;
57
61
  // The trunk this number is associated with
58
- fonoster.trunks.v1beta2.Trunk trunk = 9;
62
+ Trunk trunk = 9;
59
63
  // This dictates how the number will handle incoming calls
60
64
  oneof ingress_handler {
61
65
  // The call will be forwarded to this agent
@@ -43,9 +43,9 @@ message Secret {
43
43
  // The actual secret
44
44
  string secret = 3;
45
45
  // The time the Secret was created
46
- int64 created_at = 4;
46
+ int32 created_at = 4;
47
47
  // The time the Secret was updated
48
- int64 updated_at = 5;
48
+ int32 updated_at = 5;
49
49
  }
50
50
 
51
51
  // The request message for the Secrets.CreateSecret method
@@ -20,9 +20,6 @@ syntax = "proto3";
20
20
 
21
21
  package fonoster.trunks.v1beta2;
22
22
 
23
- import "acls.proto";
24
- import "credentials.proto";
25
-
26
23
  // The Trunks service definition
27
24
  service Trunks {
28
25
  // Create a new Trunk
@@ -57,6 +54,24 @@ message TrunkURI {
57
54
 
58
55
  // The message for the Trunk resource
59
56
  message Trunk {
57
+ message Acl {
58
+ // The reference of the AccessControlList
59
+ string ref = 1;
60
+ // The name of the AccessControlList
61
+ string name = 2;
62
+ // The list of IP addresses that are allowed to access the Trunks
63
+ repeated string allow = 3;
64
+ // The list of IP addresses that are denied to access the Trunks
65
+ repeated string deny = 4;
66
+ }
67
+ message Credentials {
68
+ // The reference of the Credentials
69
+ string ref = 1;
70
+ // The name of the Credentials
71
+ string name = 2;
72
+ // The username of the Credentials
73
+ string username = 3;
74
+ }
60
75
  // The reference of the Trunk
61
76
  string ref = 1;
62
77
  // The name of the Trunk
@@ -66,15 +81,15 @@ message Trunk {
66
81
  // The URI for inbound requests
67
82
  string inbound_uri = 4;
68
83
  // The date and time when the Trunk was created
69
- int64 created_at = 5;
84
+ int32 created_at = 5;
70
85
  // The date and time when the Trunk was last updated
71
- int64 updated_at = 6;
86
+ int32 updated_at = 6;
72
87
  // The list of IP addresses that are allowed to access the Trunks
73
- fonoster.acls.v1beta2.Acl access_control_list = 7;
88
+ Acl access_control_list = 7;
74
89
  // The credentials to use when authenticating with the Trunk
75
- fonoster.credentials.v1beta2.Credentials inbound_credentials = 8;
90
+ Credentials inbound_credentials = 8;
76
91
  // The credentials to use when authenticating with the Provider
77
- fonoster.credentials.v1beta2.Credentials outbound_credentials = 9;
92
+ Credentials outbound_credentials = 9;
78
93
  // The list of URIs for the Trunk
79
94
  repeated TrunkURI uris = 10;
80
95
  }
@@ -250,6 +250,7 @@ message DialStatus {
250
250
  BUSY = 3;
251
251
  PROGRESS = 4;
252
252
  NOANSWER = 5;
253
+ // Maps from Asterisk's CHANUNAVAIL and CONGESTION
253
254
  FAILED = 6;
254
255
  }
255
256
  Status status = 2;
@@ -326,6 +327,38 @@ message StreamPayload {
326
327
  string message = 6;
327
328
  }
328
329
 
330
+ // Request for Stream Gather
331
+ message StartStreamGatherRequest {
332
+ // The session reference generated by the Media Server
333
+ string session_ref = 1;
334
+
335
+ // The source of the gather
336
+ enum StreamGatherSource {
337
+ SPEECH = 0;
338
+ DTMF = 1;
339
+ SPEECH_AND_DTMF = 2;
340
+ }
341
+ StreamGatherSource source = 2;
342
+ }
343
+
344
+ // Request to stop a Stream Gather
345
+ message StopStreamGatherRequest {
346
+ // The session reference generated by the Media Server
347
+ string session_ref = 1;
348
+ }
349
+
350
+ // Response to Stream Gather request
351
+ message StreamGatherPayload {
352
+ // The session reference generated by the Media Server
353
+ string session_ref = 1;
354
+
355
+ // The gathered speech or a single digit
356
+ oneof content {
357
+ string speech = 2;
358
+ string digit = 3;
359
+ }
360
+ }
361
+
329
362
  // VoiceInStream is the input stream for the voice service
330
363
  message VoiceInStream {
331
364
  oneof content {
@@ -369,7 +402,16 @@ message VoiceInStream {
369
402
  StartStreamResponse start_stream_response = 13;
370
403
 
371
404
  // Message for the bidirectional streams
372
- StreamPayload stream_payload = 154;
405
+ StreamPayload stream_payload = 14;
406
+
407
+ // Response to start a stream gather
408
+ VerbResponse start_stream_gather_response = 15;
409
+
410
+ // Response to stop a stream gather
411
+ VerbResponse stop_stream_gather_response = 16;
412
+
413
+ // Message with payload for the stream gather
414
+ StreamGatherPayload stream_gather_payload = 17;
373
415
  }
374
416
  }
375
417
 
@@ -417,5 +459,11 @@ message VoiceOutStream {
417
459
 
418
460
  // Message for the bidirectional streams
419
461
  StreamPayload stream_payload = 16;
462
+
463
+ // Request to start a stream gather
464
+ StartStreamGatherRequest start_stream_gather_request = 17;
465
+
466
+ // Request to stop a stream gather
467
+ StopStreamGatherRequest stop_stream_gather_request = 18;
420
468
  }
421
469
  }
@@ -0,0 +1,22 @@
1
+ import { VoiceGender, VoiceLanguage } from "./types";
2
+ declare enum DeepgramVoice {
3
+ AURA_ASTERIA_EN = "aura-asteria-en",
4
+ AURA_LUNA_EN = "aura-luna-en",
5
+ AURA_STELLA_EN = "aura-stella-en",
6
+ AURA_ATHENA_EN = "aura-athena-en",
7
+ AURA_HERA_EN = "aura-hera-en",
8
+ AURA_ORION_EN = "aura-orion-en",
9
+ AURA_ARCAS_EN = "aura-arcas-en",
10
+ AURA_PERSEUS_EN = "aura-perseus-en",
11
+ AURA_ANGUS_EN = "aura-angus-en",
12
+ AURA_ORPHEUS_EN = "aura-orpheus-en",
13
+ AURA_HELIOS_EN = "aura-helios-en",
14
+ AURA_ZEUS_EN = "aura-zeus-en"
15
+ }
16
+ declare const DeepgramVoiceDetails: {
17
+ name: DeepgramVoice;
18
+ displayName: string;
19
+ languageCode: VoiceLanguage;
20
+ gender: VoiceGender;
21
+ }[];
22
+ export { DeepgramVoice, DeepgramVoiceDetails };
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeepgramVoiceDetails = exports.DeepgramVoice = void 0;
4
+ /* eslint-disable sonarjs/no-duplicate-string */
5
+ /*
6
+ * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
7
+ * http://github.com/fonoster/fonoster
8
+ *
9
+ * This file is part of Fonoster
10
+ *
11
+ * Licensed under the MIT License (the "License");
12
+ * you may not use this file except in compliance with
13
+ * the License. You may obtain a copy of the License at
14
+ *
15
+ * https://opensource.org/licenses/MIT
16
+ *
17
+ * Unless required by applicable law or agreed to in writing, software
18
+ * distributed under the License is distributed on an "AS IS"BASIS,
19
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
+ * See the License for the specific language governing permissions and
21
+ * limitations under the License.
22
+ */
23
+ const types_1 = require("./types");
24
+ var DeepgramVoice;
25
+ (function (DeepgramVoice) {
26
+ DeepgramVoice["AURA_ASTERIA_EN"] = "aura-asteria-en";
27
+ DeepgramVoice["AURA_LUNA_EN"] = "aura-luna-en";
28
+ DeepgramVoice["AURA_STELLA_EN"] = "aura-stella-en";
29
+ DeepgramVoice["AURA_ATHENA_EN"] = "aura-athena-en";
30
+ DeepgramVoice["AURA_HERA_EN"] = "aura-hera-en";
31
+ DeepgramVoice["AURA_ORION_EN"] = "aura-orion-en";
32
+ DeepgramVoice["AURA_ARCAS_EN"] = "aura-arcas-en";
33
+ DeepgramVoice["AURA_PERSEUS_EN"] = "aura-perseus-en";
34
+ DeepgramVoice["AURA_ANGUS_EN"] = "aura-angus-en";
35
+ DeepgramVoice["AURA_ORPHEUS_EN"] = "aura-orpheus-en";
36
+ DeepgramVoice["AURA_HELIOS_EN"] = "aura-helios-en";
37
+ DeepgramVoice["AURA_ZEUS_EN"] = "aura-zeus-en";
38
+ })(DeepgramVoice || (exports.DeepgramVoice = DeepgramVoice = {}));
39
+ const DeepgramVoiceDetails = [
40
+ {
41
+ name: DeepgramVoice.AURA_ASTERIA_EN,
42
+ displayName: "Asteria",
43
+ languageCode: types_1.VoiceLanguage.EN_US,
44
+ gender: types_1.VoiceGender.FEMALE
45
+ },
46
+ {
47
+ name: DeepgramVoice.AURA_LUNA_EN,
48
+ displayName: "Luna",
49
+ languageCode: types_1.VoiceLanguage.EN_US,
50
+ gender: types_1.VoiceGender.FEMALE
51
+ },
52
+ {
53
+ name: DeepgramVoice.AURA_STELLA_EN,
54
+ displayName: "Stella",
55
+ languageCode: types_1.VoiceLanguage.EN_US,
56
+ gender: types_1.VoiceGender.FEMALE
57
+ },
58
+ {
59
+ name: DeepgramVoice.AURA_ATHENA_EN,
60
+ displayName: "Athena",
61
+ languageCode: types_1.VoiceLanguage.EN_GB,
62
+ gender: types_1.VoiceGender.FEMALE
63
+ },
64
+ {
65
+ name: DeepgramVoice.AURA_HERA_EN,
66
+ displayName: "Hera",
67
+ languageCode: types_1.VoiceLanguage.EN_US,
68
+ gender: types_1.VoiceGender.FEMALE
69
+ },
70
+ {
71
+ name: DeepgramVoice.AURA_ORION_EN,
72
+ displayName: "Orion",
73
+ languageCode: types_1.VoiceLanguage.EN_US,
74
+ gender: types_1.VoiceGender.MALE
75
+ },
76
+ {
77
+ name: DeepgramVoice.AURA_ARCAS_EN,
78
+ displayName: "Arcas",
79
+ languageCode: types_1.VoiceLanguage.EN_US,
80
+ gender: types_1.VoiceGender.MALE
81
+ },
82
+ {
83
+ name: DeepgramVoice.AURA_PERSEUS_EN,
84
+ displayName: "Perseus",
85
+ languageCode: types_1.VoiceLanguage.EN_US,
86
+ gender: types_1.VoiceGender.MALE
87
+ },
88
+ {
89
+ name: DeepgramVoice.AURA_ANGUS_EN,
90
+ displayName: "Angus",
91
+ languageCode: types_1.VoiceLanguage.EN_IE,
92
+ gender: types_1.VoiceGender.MALE
93
+ },
94
+ {
95
+ name: DeepgramVoice.AURA_ORPHEUS_EN,
96
+ displayName: "Orpheus",
97
+ languageCode: types_1.VoiceLanguage.EN_US,
98
+ gender: types_1.VoiceGender.MALE
99
+ },
100
+ {
101
+ name: DeepgramVoice.AURA_HELIOS_EN,
102
+ displayName: "Helios",
103
+ languageCode: types_1.VoiceLanguage.EN_GB,
104
+ gender: types_1.VoiceGender.MALE
105
+ },
106
+ {
107
+ name: DeepgramVoice.AURA_ZEUS_EN,
108
+ displayName: "Zeus",
109
+ languageCode: types_1.VoiceLanguage.EN_US,
110
+ gender: types_1.VoiceGender.MALE
111
+ }
112
+ ];
113
+ exports.DeepgramVoiceDetails = DeepgramVoiceDetails;
@@ -1,3 +1,4 @@
1
1
  export * from "./GoogleVoices";
2
2
  export * from "./AzureVoices";
3
+ export * from "./DeepgramVoices";
3
4
  export * from "./types";
package/dist/tts/index.js CHANGED
@@ -34,4 +34,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
34
34
  */
35
35
  __exportStar(require("./GoogleVoices"), exports);
36
36
  __exportStar(require("./AzureVoices"), exports);
37
+ __exportStar(require("./DeepgramVoices"), exports);
37
38
  __exportStar(require("./types"), exports);
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.datesMapper = void 0;
4
4
  const datesMapper = (item) => {
5
5
  var _a, _b;
6
- return (Object.assign(Object.assign({}, item), { createdAt: (_a = item === null || item === void 0 ? void 0 : item.createdAt) === null || _a === void 0 ? void 0 : _a.getTime(), updatedAt: (_b = item === null || item === void 0 ? void 0 : item.updatedAt) === null || _b === void 0 ? void 0 : _b.getTime() }));
6
+ return (Object.assign(Object.assign({}, item), { createdAt: ((_a = item === null || item === void 0 ? void 0 : item.createdAt) === null || _a === void 0 ? void 0 : _a.getTime()) / 1000, updatedAt: ((_b = item === null || item === void 0 ? void 0 : item.updatedAt) === null || _b === void 0 ? void 0 : _b.getTime()) / 1000 }));
7
7
  };
8
8
  exports.datesMapper = datesMapper;
@@ -15,5 +15,6 @@ var DialStatus;
15
15
  DialStatus["BUSY"] = "BUSY";
16
16
  DialStatus["PROGRESS"] = "PROGRESS";
17
17
  DialStatus["NOANSWER"] = "NOANSWER";
18
+ // Maps from Asterisk's CHANUNAVAIL and CONGESTION
18
19
  DialStatus["FAILED"] = "FAILED";
19
20
  })(DialStatus || (exports.DialStatus = DialStatus = {}));
@@ -0,0 +1,15 @@
1
+ import { VerbRequest, VerbResponse } from "./Verb";
2
+ declare enum StreamGatherSource {
3
+ SPEECH = "speech",
4
+ DTMF = "dtmf",
5
+ SPEECH_AND_DTMF = "speech,dtmf"
6
+ }
7
+ type StreamGatherOptions = {
8
+ source?: StreamGatherSource;
9
+ };
10
+ type StartStreamGatherRequest = VerbRequest & StreamGatherOptions;
11
+ type StreamGatherPayload = VerbResponse & {
12
+ speech?: string;
13
+ digit?: string;
14
+ };
15
+ export { StreamGatherSource, StreamGatherPayload, StartStreamGatherRequest, StreamGatherOptions };
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StreamGatherSource = void 0;
4
+ var StreamGatherSource;
5
+ (function (StreamGatherSource) {
6
+ StreamGatherSource["SPEECH"] = "speech";
7
+ StreamGatherSource["DTMF"] = "dtmf";
8
+ StreamGatherSource["SPEECH_AND_DTMF"] = "speech,dtmf";
9
+ })(StreamGatherSource || (exports.StreamGatherSource = StreamGatherSource = {}));
@@ -9,3 +9,4 @@ export * from "./PlayDtmf";
9
9
  export * from "./Record";
10
10
  export * from "./Say";
11
11
  export * from "./Stream";
12
+ export * from "./StreamGather";
@@ -43,3 +43,4 @@ __exportStar(require("./PlayDtmf"), exports);
43
43
  __exportStar(require("./Record"), exports);
44
44
  __exportStar(require("./Say"), exports);
45
45
  __exportStar(require("./Stream"), exports);
46
+ __exportStar(require("./StreamGather"), exports);
@@ -6,11 +6,12 @@ import { PlayDtmfRequest } from "./PlayDtmf";
6
6
  import { RecordRequest, RecordResponse } from "./Record";
7
7
  import { SayRequest, SayResponse } from "./Say";
8
8
  import { StartStreamRequest, StartStreamResponse, StopStreamRequest, StreamPayload } from "./Stream";
9
+ import { StartStreamGatherRequest, StreamGatherPayload } from "./StreamGather";
9
10
  import { VerbRequest, VerbResponse, VoiceRequest } from "./Verb";
10
11
  import { GrpcError } from "../GrpcError";
11
- declare const DATA: "data";
12
- declare const END: "end";
13
- declare const ERROR: "error";
12
+ declare const DATA = "data";
13
+ declare const END = "end";
14
+ declare const ERROR = "error";
14
15
  declare enum StreamEvent {
15
16
  DATA = "data",
16
17
  END = "end",
@@ -42,12 +43,17 @@ declare enum StreamContent {
42
43
  START_STREAM_REQUEST = "startStreamRequest",
43
44
  START_STREAM_RESPONSE = "startStreamResponse",
44
45
  STOP_STREAM_REQUEST = "stopStreamRequest",
45
- STREAM_PAYLOAD = "streamPayload"
46
+ STREAM_PAYLOAD = "streamPayload",
47
+ START_STREAM_GATHER_REQUEST = "startStreamGatherRequest",
48
+ START_STREAM_GATHER_RESPONSE = "startStreamGatherResponse",
49
+ STOP_STREAM_GATHER_REQUEST = "stopStreamGatherRequest",
50
+ STOP_STREAM_GATHER_RESPONSE = "stopStreamGatherResponse",
51
+ STREAM_GATHER_PAYLOAD = "streamGatherPayload"
46
52
  }
47
53
  type VoiceClientConfig = {
48
54
  appRef: string;
49
55
  accessKeyId: string;
50
- appEndpoint: string;
56
+ endpoint: string;
51
57
  ingressNumber: string;
52
58
  callerName: string;
53
59
  callerNumber: string;
@@ -73,6 +79,9 @@ type VoiceIn = {
73
79
  };
74
80
  startStreamResponse?: StartStreamResponse;
75
81
  streamPayload?: StreamPayload;
82
+ streamGatherPayload?: StreamGatherPayload;
83
+ startStreamGatherResponse?: VerbResponse;
84
+ stopStreamGatherResponse?: VerbResponse;
76
85
  };
77
86
  type VoiceOut = {
78
87
  answerRequest?: VerbRequest;
@@ -89,10 +98,13 @@ type VoiceOut = {
89
98
  startStreamRequest?: StartStreamRequest;
90
99
  stopStreamRequest?: StopStreamRequest;
91
100
  streamPayload?: StreamPayload;
101
+ startStreamGatherRequest?: StartStreamGatherRequest;
102
+ stopStreamGatherRequest?: VerbRequest;
92
103
  };
93
104
  type BaseVoiceStream<T, W> = {
94
105
  removeListener: (e: StreamEvent, cb: (voice: T) => void) => void;
95
106
  on: (e: StreamEvent, cb: (voice: T) => void) => void;
107
+ once: (e: StreamEvent, cb: (voice: T) => void) => void;
96
108
  write: (voice: W) => void;
97
109
  end: () => void;
98
110
  };
@@ -41,4 +41,9 @@ var StreamContent;
41
41
  StreamContent["START_STREAM_RESPONSE"] = "startStreamResponse";
42
42
  StreamContent["STOP_STREAM_REQUEST"] = "stopStreamRequest";
43
43
  StreamContent["STREAM_PAYLOAD"] = "streamPayload";
44
+ StreamContent["START_STREAM_GATHER_REQUEST"] = "startStreamGatherRequest";
45
+ StreamContent["START_STREAM_GATHER_RESPONSE"] = "startStreamGatherResponse";
46
+ StreamContent["STOP_STREAM_GATHER_REQUEST"] = "stopStreamGatherRequest";
47
+ StreamContent["STOP_STREAM_GATHER_RESPONSE"] = "stopStreamGatherResponse";
48
+ StreamContent["STREAM_GATHER_PAYLOAD"] = "streamGatherPayload";
44
49
  })(StreamContent || (exports.StreamContent = StreamContent = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fonoster/common",
3
- "version": "0.6.2",
3
+ "version": "0.7.0",
4
4
  "description": "Common library for Fonoster projects",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/fonoster#readme",
@@ -18,7 +18,7 @@
18
18
  "clean": "rimraf ./dist node_modules tsconfig.tsbuildinfo"
19
19
  },
20
20
  "dependencies": {
21
- "@fonoster/logger": "^0.6.2",
21
+ "@fonoster/logger": "^0.7.0",
22
22
  "@grpc/grpc-js": "~1.10.6",
23
23
  "@grpc/proto-loader": "^0.7.12",
24
24
  "grpc-health-check": "^2.0.2",
@@ -42,5 +42,5 @@
42
42
  "devDependencies": {
43
43
  "@types/nodemailer": "^6.4.14"
44
44
  },
45
- "gitHead": "9b55399d2906479d826a53a5e3bd10206aaaa86d"
45
+ "gitHead": "afa950ace3b1d022b6dc8be0c3b87a6b8a5ba3c5"
46
46
  }