telnyx 5.66.0 → 5.67.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -0
- data/README.md +1 -1
- data/lib/telnyx/lib/websocket/base.rb +260 -0
- data/lib/telnyx/lib/websocket/speech_to_text_stream_params.rb +108 -0
- data/lib/telnyx/lib/websocket/speech_to_text_ws.rb +166 -0
- data/lib/telnyx/lib/websocket/stt_server_event.rb +91 -0
- data/lib/telnyx/lib/websocket/text_to_speech_stream_params.rb +87 -0
- data/lib/telnyx/lib/websocket/text_to_speech_ws.rb +289 -0
- data/lib/telnyx/lib/websocket/tts_server_event.rb +108 -0
- data/lib/telnyx/lib/websocket/websocket_error.rb +39 -0
- data/lib/telnyx/lib/websocket.rb +51 -0
- data/lib/telnyx/resources/terms_of_service/number_reputation.rb +1 -1
- data/lib/telnyx/version.rb +1 -1
- data/rbi/telnyx/lib/websocket/speech_to_text_stream_params.rbi +55 -0
- data/rbi/telnyx/lib/websocket/speech_to_text_ws.rbi +43 -0
- data/rbi/telnyx/lib/websocket/stt_server_event.rbi +43 -0
- data/rbi/telnyx/lib/websocket/text_to_speech_stream_params.rbi +60 -0
- data/rbi/telnyx/lib/websocket/text_to_speech_ws.rbi +47 -0
- data/rbi/telnyx/lib/websocket/tts_server_event.rbi +57 -0
- data/rbi/telnyx/lib/websocket/websocket_error.rbi +25 -0
- data/rbi/telnyx/lib/websocket.rbi +8 -0
- metadata +33 -2
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Telnyx
|
|
4
|
+
module Lib
|
|
5
|
+
module WebSocket
|
|
6
|
+
class SttServerEvent
|
|
7
|
+
sig { returns(String) }
|
|
8
|
+
attr_accessor :type
|
|
9
|
+
|
|
10
|
+
sig { returns(T.nilable(String)) }
|
|
11
|
+
attr_accessor :transcript
|
|
12
|
+
|
|
13
|
+
sig { returns(T.nilable(T::Boolean)) }
|
|
14
|
+
attr_accessor :is_final
|
|
15
|
+
|
|
16
|
+
sig { returns(T.nilable(Float)) }
|
|
17
|
+
attr_accessor :confidence
|
|
18
|
+
|
|
19
|
+
sig { returns(T.nilable(String)) }
|
|
20
|
+
attr_accessor :error
|
|
21
|
+
|
|
22
|
+
sig { returns(T::Hash[Symbol, T.untyped]) }
|
|
23
|
+
attr_accessor :raw_data
|
|
24
|
+
|
|
25
|
+
sig { params(data: T::Hash[Symbol, T.untyped]).void }
|
|
26
|
+
def initialize(data)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
sig { params(json: String).returns(SttServerEvent) }
|
|
30
|
+
def self.from_json(json)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
sig { returns(T::Boolean) }
|
|
34
|
+
def transcript?
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
sig { returns(T::Boolean) }
|
|
38
|
+
def error?
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Telnyx
|
|
4
|
+
module Lib
|
|
5
|
+
module WebSocket
|
|
6
|
+
class TextToSpeechStreamParams
|
|
7
|
+
sig { returns(T.nilable(String)) }
|
|
8
|
+
attr_accessor :voice
|
|
9
|
+
|
|
10
|
+
sig { returns(T.nilable(String)) }
|
|
11
|
+
attr_accessor :voice_provider
|
|
12
|
+
|
|
13
|
+
sig { returns(T.nilable(String)) }
|
|
14
|
+
attr_accessor :output_format
|
|
15
|
+
|
|
16
|
+
sig { returns(T.nilable(Integer)) }
|
|
17
|
+
attr_accessor :sample_rate
|
|
18
|
+
|
|
19
|
+
sig { returns(T.nilable(String)) }
|
|
20
|
+
attr_accessor :language
|
|
21
|
+
|
|
22
|
+
sig { returns(T.nilable(Float)) }
|
|
23
|
+
attr_accessor :speaking_rate
|
|
24
|
+
|
|
25
|
+
sig { returns(T.nilable(String)) }
|
|
26
|
+
attr_accessor :client_ref
|
|
27
|
+
|
|
28
|
+
sig do
|
|
29
|
+
params(
|
|
30
|
+
voice: T.nilable(String),
|
|
31
|
+
voice_provider: T.nilable(String),
|
|
32
|
+
output_format: T.nilable(String),
|
|
33
|
+
sample_rate: T.nilable(Integer),
|
|
34
|
+
language: T.nilable(String),
|
|
35
|
+
speaking_rate: T.nilable(Float),
|
|
36
|
+
client_ref: T.nilable(String)
|
|
37
|
+
).void
|
|
38
|
+
end
|
|
39
|
+
def initialize(
|
|
40
|
+
voice: nil,
|
|
41
|
+
voice_provider: nil,
|
|
42
|
+
output_format: nil,
|
|
43
|
+
sample_rate: nil,
|
|
44
|
+
language: nil,
|
|
45
|
+
speaking_rate: nil,
|
|
46
|
+
client_ref: nil
|
|
47
|
+
)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
sig { returns(T::Hash[String, String]) }
|
|
51
|
+
def to_query_params
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
sig { returns(String) }
|
|
55
|
+
def to_query_string
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Telnyx
|
|
4
|
+
module Lib
|
|
5
|
+
module WebSocket
|
|
6
|
+
class TextToSpeechWS
|
|
7
|
+
sig { returns(Telnyx::Client) }
|
|
8
|
+
attr_reader :client
|
|
9
|
+
|
|
10
|
+
sig { returns(TextToSpeechStreamParams) }
|
|
11
|
+
attr_reader :params
|
|
12
|
+
|
|
13
|
+
sig { returns(T::Boolean) }
|
|
14
|
+
attr_reader :connected
|
|
15
|
+
|
|
16
|
+
sig do
|
|
17
|
+
params(
|
|
18
|
+
client: Telnyx::Client,
|
|
19
|
+
params: TextToSpeechStreamParams
|
|
20
|
+
).void
|
|
21
|
+
end
|
|
22
|
+
def initialize(client, params)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
sig { params(timeout: Integer).void }
|
|
26
|
+
def wait_for_open(timeout: 30)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
sig { params(text: String, is_final: T::Boolean).void }
|
|
30
|
+
def send_text(text, is_final: false)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
sig { void }
|
|
34
|
+
def flush
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
sig { void }
|
|
38
|
+
def close
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
sig { params(event: String, block: T.proc.void).void }
|
|
42
|
+
def on(event, &block)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Telnyx
|
|
4
|
+
module Lib
|
|
5
|
+
module WebSocket
|
|
6
|
+
class TtsServerEvent
|
|
7
|
+
sig { returns(String) }
|
|
8
|
+
attr_accessor :type
|
|
9
|
+
|
|
10
|
+
sig { returns(T.nilable(String)) }
|
|
11
|
+
attr_accessor :audio
|
|
12
|
+
|
|
13
|
+
sig { returns(T.nilable(String)) }
|
|
14
|
+
attr_accessor :text
|
|
15
|
+
|
|
16
|
+
sig { returns(T.nilable(T::Boolean)) }
|
|
17
|
+
attr_accessor :is_final
|
|
18
|
+
|
|
19
|
+
sig { returns(T.nilable(T::Boolean)) }
|
|
20
|
+
attr_accessor :cached
|
|
21
|
+
|
|
22
|
+
sig { returns(T.nilable(Integer)) }
|
|
23
|
+
attr_accessor :time_to_first_audio_frame_ms
|
|
24
|
+
|
|
25
|
+
sig { returns(T.nilable(String)) }
|
|
26
|
+
attr_accessor :error
|
|
27
|
+
|
|
28
|
+
sig { returns(T::Hash[Symbol, T.untyped]) }
|
|
29
|
+
attr_accessor :raw_data
|
|
30
|
+
|
|
31
|
+
sig { params(data: T::Hash[Symbol, T.untyped]).void }
|
|
32
|
+
def initialize(data)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
sig { params(json: String).returns(TtsServerEvent) }
|
|
36
|
+
def self.from_json(json)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
sig { returns(T::Boolean) }
|
|
40
|
+
def audio_chunk?
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
sig { returns(T::Boolean) }
|
|
44
|
+
def final?
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
sig { returns(T::Boolean) }
|
|
48
|
+
def error?
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
sig { returns(T.nilable(String)) }
|
|
52
|
+
def audio_bytes
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Telnyx
|
|
4
|
+
module Lib
|
|
5
|
+
module WebSocket
|
|
6
|
+
class WebSocketError < StandardError
|
|
7
|
+
sig { returns(T.nilable(T::Hash[Symbol, T.untyped])) }
|
|
8
|
+
attr_accessor :raw_data
|
|
9
|
+
|
|
10
|
+
sig { returns(T.nilable(StandardError)) }
|
|
11
|
+
attr_accessor :cause
|
|
12
|
+
|
|
13
|
+
sig do
|
|
14
|
+
params(
|
|
15
|
+
message: String,
|
|
16
|
+
raw_data: T.nilable(T::Hash[Symbol, T.untyped]),
|
|
17
|
+
cause: T.nilable(StandardError)
|
|
18
|
+
).void
|
|
19
|
+
end
|
|
20
|
+
def initialize(message, raw_data: nil, cause: nil)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: telnyx
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.
|
|
4
|
+
version: 5.67.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Telnyx
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-03-
|
|
11
|
+
date: 2026-03-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: cgi
|
|
@@ -38,6 +38,20 @@ dependencies:
|
|
|
38
38
|
- - ">="
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: websocket-client-simple
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0.8'
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0.8'
|
|
41
55
|
description: Official Telnyx SDK for Ruby developers. Integrate Voice, SMS, MMS, WhatsApp,
|
|
42
56
|
Fax, Wireless IoT, SIP Trunking, Call Control, Number Management, and Emergency
|
|
43
57
|
Services — all built on Telnyx's private carrier-grade cloud.
|
|
@@ -80,6 +94,15 @@ files:
|
|
|
80
94
|
- lib/telnyx/internal/type/unknown.rb
|
|
81
95
|
- lib/telnyx/internal/util.rb
|
|
82
96
|
- lib/telnyx/lib/webhook_verification.rb
|
|
97
|
+
- lib/telnyx/lib/websocket.rb
|
|
98
|
+
- lib/telnyx/lib/websocket/base.rb
|
|
99
|
+
- lib/telnyx/lib/websocket/speech_to_text_stream_params.rb
|
|
100
|
+
- lib/telnyx/lib/websocket/speech_to_text_ws.rb
|
|
101
|
+
- lib/telnyx/lib/websocket/stt_server_event.rb
|
|
102
|
+
- lib/telnyx/lib/websocket/text_to_speech_stream_params.rb
|
|
103
|
+
- lib/telnyx/lib/websocket/text_to_speech_ws.rb
|
|
104
|
+
- lib/telnyx/lib/websocket/tts_server_event.rb
|
|
105
|
+
- lib/telnyx/lib/websocket/websocket_error.rb
|
|
83
106
|
- lib/telnyx/models.rb
|
|
84
107
|
- lib/telnyx/models/access_ip_address_create_params.rb
|
|
85
108
|
- lib/telnyx/models/access_ip_address_delete_params.rb
|
|
@@ -2720,6 +2743,14 @@ files:
|
|
|
2720
2743
|
- rbi/telnyx/internal/type/union.rbi
|
|
2721
2744
|
- rbi/telnyx/internal/type/unknown.rbi
|
|
2722
2745
|
- rbi/telnyx/internal/util.rbi
|
|
2746
|
+
- rbi/telnyx/lib/websocket.rbi
|
|
2747
|
+
- rbi/telnyx/lib/websocket/speech_to_text_stream_params.rbi
|
|
2748
|
+
- rbi/telnyx/lib/websocket/speech_to_text_ws.rbi
|
|
2749
|
+
- rbi/telnyx/lib/websocket/stt_server_event.rbi
|
|
2750
|
+
- rbi/telnyx/lib/websocket/text_to_speech_stream_params.rbi
|
|
2751
|
+
- rbi/telnyx/lib/websocket/text_to_speech_ws.rbi
|
|
2752
|
+
- rbi/telnyx/lib/websocket/tts_server_event.rbi
|
|
2753
|
+
- rbi/telnyx/lib/websocket/websocket_error.rbi
|
|
2723
2754
|
- rbi/telnyx/models.rbi
|
|
2724
2755
|
- rbi/telnyx/models/access_ip_address_create_params.rbi
|
|
2725
2756
|
- rbi/telnyx/models/access_ip_address_delete_params.rbi
|