jambonz-python-sdk 0.2.0__py3-none-any.whl

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.
Files changed (119) hide show
  1. jambonz_python_sdk-0.2.0.dist-info/METADATA +179 -0
  2. jambonz_python_sdk-0.2.0.dist-info/RECORD +119 -0
  3. jambonz_python_sdk-0.2.0.dist-info/WHEEL +4 -0
  4. jambonz_sdk/__init__.py +52 -0
  5. jambonz_sdk/_signature.py +73 -0
  6. jambonz_sdk/client/__init__.py +15 -0
  7. jambonz_sdk/client/api.py +241 -0
  8. jambonz_sdk/schema/callbacks/amd.schema.json +50 -0
  9. jambonz_sdk/schema/callbacks/base.schema.json +29 -0
  10. jambonz_sdk/schema/callbacks/call-status.schema.json +22 -0
  11. jambonz_sdk/schema/callbacks/conference-status.schema.json +24 -0
  12. jambonz_sdk/schema/callbacks/conference-wait.schema.json +11 -0
  13. jambonz_sdk/schema/callbacks/conference.schema.json +11 -0
  14. jambonz_sdk/schema/callbacks/dequeue.schema.json +19 -0
  15. jambonz_sdk/schema/callbacks/dial-dtmf.schema.json +18 -0
  16. jambonz_sdk/schema/callbacks/dial-hold.schema.json +22 -0
  17. jambonz_sdk/schema/callbacks/dial-refer.schema.json +28 -0
  18. jambonz_sdk/schema/callbacks/dial.schema.json +31 -0
  19. jambonz_sdk/schema/callbacks/enqueue-wait.schema.json +17 -0
  20. jambonz_sdk/schema/callbacks/enqueue.schema.json +27 -0
  21. jambonz_sdk/schema/callbacks/gather-partial.schema.json +54 -0
  22. jambonz_sdk/schema/callbacks/gather.schema.json +60 -0
  23. jambonz_sdk/schema/callbacks/listen.schema.json +21 -0
  24. jambonz_sdk/schema/callbacks/llm.schema.json +30 -0
  25. jambonz_sdk/schema/callbacks/message.schema.json +35 -0
  26. jambonz_sdk/schema/callbacks/pipeline-turn.schema.json +109 -0
  27. jambonz_sdk/schema/callbacks/play.schema.json +36 -0
  28. jambonz_sdk/schema/callbacks/session-new.schema.json +143 -0
  29. jambonz_sdk/schema/callbacks/session-reconnect.schema.json +9 -0
  30. jambonz_sdk/schema/callbacks/session-redirect.schema.json +38 -0
  31. jambonz_sdk/schema/callbacks/sip-refer-event.schema.json +20 -0
  32. jambonz_sdk/schema/callbacks/sip-refer.schema.json +22 -0
  33. jambonz_sdk/schema/callbacks/sip-request.schema.json +27 -0
  34. jambonz_sdk/schema/callbacks/transcribe-translation.schema.json +24 -0
  35. jambonz_sdk/schema/callbacks/transcribe.schema.json +46 -0
  36. jambonz_sdk/schema/callbacks/tts-streaming-event.schema.json +77 -0
  37. jambonz_sdk/schema/callbacks/verb-status.schema.json +57 -0
  38. jambonz_sdk/schema/components/actionHook.schema.json +36 -0
  39. jambonz_sdk/schema/components/actionHookDelayAction.schema.json +37 -0
  40. jambonz_sdk/schema/components/amd.schema.json +68 -0
  41. jambonz_sdk/schema/components/auth.schema.json +18 -0
  42. jambonz_sdk/schema/components/bidirectionalAudio.schema.json +22 -0
  43. jambonz_sdk/schema/components/fillerNoise.schema.json +25 -0
  44. jambonz_sdk/schema/components/llm-base.schema.json +94 -0
  45. jambonz_sdk/schema/components/recognizer-assemblyAiOptions.schema.json +66 -0
  46. jambonz_sdk/schema/components/recognizer-awsOptions.schema.json +52 -0
  47. jambonz_sdk/schema/components/recognizer-azureOptions.schema.json +32 -0
  48. jambonz_sdk/schema/components/recognizer-cobaltOptions.schema.json +34 -0
  49. jambonz_sdk/schema/components/recognizer-customOptions.schema.json +27 -0
  50. jambonz_sdk/schema/components/recognizer-deepgramOptions.schema.json +147 -0
  51. jambonz_sdk/schema/components/recognizer-elevenlabsOptions.schema.json +39 -0
  52. jambonz_sdk/schema/components/recognizer-gladiaOptions.schema.json +8 -0
  53. jambonz_sdk/schema/components/recognizer-googleOptions.schema.json +35 -0
  54. jambonz_sdk/schema/components/recognizer-houndifyOptions.schema.json +53 -0
  55. jambonz_sdk/schema/components/recognizer-ibmOptions.schema.json +54 -0
  56. jambonz_sdk/schema/components/recognizer-nuanceOptions.schema.json +150 -0
  57. jambonz_sdk/schema/components/recognizer-nvidiaOptions.schema.json +39 -0
  58. jambonz_sdk/schema/components/recognizer-openaiOptions.schema.json +59 -0
  59. jambonz_sdk/schema/components/recognizer-sonioxOptions.schema.json +46 -0
  60. jambonz_sdk/schema/components/recognizer-speechmaticsOptions.schema.json +100 -0
  61. jambonz_sdk/schema/components/recognizer-verbioOptions.schema.json +46 -0
  62. jambonz_sdk/schema/components/recognizer.schema.json +216 -0
  63. jambonz_sdk/schema/components/synthesizer.schema.json +82 -0
  64. jambonz_sdk/schema/components/target.schema.json +105 -0
  65. jambonz_sdk/schema/components/vad.schema.json +48 -0
  66. jambonz_sdk/schema/jambonz-app.schema.json +113 -0
  67. jambonz_sdk/schema/verbs/alert.schema.json +34 -0
  68. jambonz_sdk/schema/verbs/answer.schema.json +22 -0
  69. jambonz_sdk/schema/verbs/conference.schema.json +107 -0
  70. jambonz_sdk/schema/verbs/config.schema.json +221 -0
  71. jambonz_sdk/schema/verbs/deepgram_s2s.schema.json +81 -0
  72. jambonz_sdk/schema/verbs/dequeue.schema.json +51 -0
  73. jambonz_sdk/schema/verbs/dial.schema.json +200 -0
  74. jambonz_sdk/schema/verbs/dialogflow.schema.json +148 -0
  75. jambonz_sdk/schema/verbs/dtmf.schema.json +49 -0
  76. jambonz_sdk/schema/verbs/dub.schema.json +103 -0
  77. jambonz_sdk/schema/verbs/elevenlabs_s2s.schema.json +81 -0
  78. jambonz_sdk/schema/verbs/enqueue.schema.json +53 -0
  79. jambonz_sdk/schema/verbs/gather.schema.json +190 -0
  80. jambonz_sdk/schema/verbs/google_s2s.schema.json +42 -0
  81. jambonz_sdk/schema/verbs/hangup.schema.json +36 -0
  82. jambonz_sdk/schema/verbs/leave.schema.json +22 -0
  83. jambonz_sdk/schema/verbs/listen.schema.json +127 -0
  84. jambonz_sdk/schema/verbs/llm.schema.json +44 -0
  85. jambonz_sdk/schema/verbs/message.schema.json +82 -0
  86. jambonz_sdk/schema/verbs/openai_s2s.schema.json +42 -0
  87. jambonz_sdk/schema/verbs/pause.schema.json +36 -0
  88. jambonz_sdk/schema/verbs/pipeline.schema.json +240 -0
  89. jambonz_sdk/schema/verbs/play.schema.json +96 -0
  90. jambonz_sdk/schema/verbs/redirect.schema.json +34 -0
  91. jambonz_sdk/schema/verbs/rest_dial.schema.json +113 -0
  92. jambonz_sdk/schema/verbs/s2s.schema.json +39 -0
  93. jambonz_sdk/schema/verbs/say.schema.json +107 -0
  94. jambonz_sdk/schema/verbs/sip-decline.schema.json +58 -0
  95. jambonz_sdk/schema/verbs/sip-refer.schema.json +58 -0
  96. jambonz_sdk/schema/verbs/sip-request.schema.json +54 -0
  97. jambonz_sdk/schema/verbs/stream.schema.json +103 -0
  98. jambonz_sdk/schema/verbs/tag.schema.json +41 -0
  99. jambonz_sdk/schema/verbs/transcribe.schema.json +57 -0
  100. jambonz_sdk/schema/verbs/ultravox_s2s.schema.json +41 -0
  101. jambonz_sdk/types/__init__.py +139 -0
  102. jambonz_sdk/types/components.py +250 -0
  103. jambonz_sdk/types/rest.py +59 -0
  104. jambonz_sdk/types/session.py +55 -0
  105. jambonz_sdk/types/verbs.py +572 -0
  106. jambonz_sdk/validator.py +107 -0
  107. jambonz_sdk/verb_builder.py +316 -0
  108. jambonz_sdk/verb_builder.pyi +1133 -0
  109. jambonz_sdk/verb_registry.py +102 -0
  110. jambonz_sdk/webhook/__init__.py +10 -0
  111. jambonz_sdk/webhook/middleware.py +63 -0
  112. jambonz_sdk/webhook/response.py +43 -0
  113. jambonz_sdk/websocket/__init__.py +15 -0
  114. jambonz_sdk/websocket/audio_client.py +11 -0
  115. jambonz_sdk/websocket/audio_stream.py +151 -0
  116. jambonz_sdk/websocket/client.py +165 -0
  117. jambonz_sdk/websocket/endpoint.py +193 -0
  118. jambonz_sdk/websocket/router.py +87 -0
  119. jambonz_sdk/websocket/session.py +259 -0
@@ -0,0 +1,250 @@
1
+ """Shared component type definitions matching jambonz JSON schemas.
2
+
3
+ All TypedDict keys use the exact same names as the jambonz JSON schemas
4
+ (camelCase where applicable) to ensure serialization compatibility.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ from typing import Any, TypedDict, Union
10
+
11
+
12
+ class Auth(TypedDict, total=False):
13
+ """Authentication credentials."""
14
+
15
+ username: str
16
+ password: str
17
+ apiKey: str
18
+ agent_id: str
19
+ api_key: str
20
+
21
+
22
+ class ActionHookObject(TypedDict, total=False):
23
+ """ActionHook as an object with URL and options."""
24
+
25
+ url: str
26
+ method: str # "GET" | "POST"
27
+ basicAuth: Auth
28
+
29
+
30
+ # ActionHook can be a simple URL string or an object
31
+ ActionHook = Union[str, ActionHookObject]
32
+
33
+
34
+ class Synthesizer(TypedDict, total=False):
35
+ """Text-to-speech configuration."""
36
+
37
+ vendor: str
38
+ label: str
39
+ language: str
40
+ voice: str | dict[str, Any]
41
+ fallbackVendor: str
42
+ fallbackLabel: str
43
+ fallbackLanguage: str
44
+ fallbackVoice: str | dict[str, Any]
45
+ engine: str # "standard" | "neural" | "generative" | "long-form"
46
+ gender: str # "MALE" | "FEMALE" | "NEUTRAL"
47
+ options: dict[str, Any]
48
+
49
+
50
+ class Vad(TypedDict, total=False):
51
+ """Voice Activity Detection configuration."""
52
+
53
+ enable: bool
54
+ voiceMs: int
55
+ silenceMs: int
56
+ strategy: str
57
+ mode: int # 0-3
58
+ vendor: str # "webrtc" | "silero"
59
+ threshold: float # 0-1
60
+ speechPadMs: int
61
+
62
+
63
+ class Recognizer(TypedDict, total=False):
64
+ """Speech-to-text recognition configuration."""
65
+
66
+ vendor: str
67
+ label: str
68
+ language: str
69
+ fallbackVendor: str
70
+ fallbackLabel: str
71
+ fallbackLanguage: str
72
+ vad: Vad
73
+ autogeneratePrompt: bool
74
+ hints: list[str]
75
+ hintsBoost: float
76
+ altLanguages: list[str]
77
+ profanityFilter: bool
78
+ interim: bool
79
+ singleUtterance: bool
80
+ dualChannel: bool
81
+ separateRecognitionPerChannel: bool
82
+ punctuation: bool
83
+ enhancedModel: bool
84
+ words: bool
85
+ diarization: bool
86
+ diarizationMinSpeakers: int
87
+ diarizationMaxSpeakers: int
88
+ interactionType: str
89
+ naicsCode: int
90
+ identifyChannels: bool
91
+ vocabularyName: str
92
+ vocabularyFilterName: str
93
+ filterMethod: str # "remove" | "mask" | "tag"
94
+ model: str
95
+ outputFormat: str # "simple" | "detailed"
96
+ profanityOption: str # "masked" | "removed" | "raw"
97
+ requestSnr: bool
98
+ initialSpeechTimeoutMs: int
99
+ azureServiceEndpoint: str
100
+ azureSttEndpointId: str
101
+ asrDtmfTerminationDigit: str
102
+ asrTimeout: int
103
+ fastRecognitionTimeout: int
104
+ minConfidence: float
105
+ deepgramOptions: dict[str, Any]
106
+ googleOptions: dict[str, Any]
107
+ awsOptions: dict[str, Any]
108
+ azureOptions: dict[str, Any]
109
+ nuanceOptions: dict[str, Any]
110
+ ibmOptions: dict[str, Any]
111
+ nvidiaOptions: dict[str, Any]
112
+ sonioxOptions: dict[str, Any]
113
+ cobaltOptions: dict[str, Any]
114
+ assemblyAiOptions: dict[str, Any]
115
+ speechmaticsOptions: dict[str, Any]
116
+ openaiOptions: dict[str, Any]
117
+ houndifyOptions: dict[str, Any]
118
+ gladiaOptions: dict[str, Any]
119
+ elevenlabsOptions: dict[str, Any]
120
+ verbioOptions: dict[str, Any]
121
+ customOptions: dict[str, Any]
122
+
123
+
124
+ class FromHeader(TypedDict, total=False):
125
+ """SIP From header override."""
126
+
127
+ user: str
128
+ host: str
129
+
130
+
131
+ class Target(TypedDict, total=False):
132
+ """Call target for the dial verb."""
133
+
134
+ type: str # "phone" | "sip" | "user" | "teams"
135
+ number: str
136
+ sipUri: str
137
+ name: str
138
+ tenant: str
139
+ trunk: str
140
+ confirmHook: ActionHook
141
+ method: str # "GET" | "POST"
142
+ headers: dict[str, str]
143
+ from_: FromHeader # Note: 'from' is reserved in Python
144
+ auth: Auth
145
+ vmail: bool
146
+ overrideTo: str
147
+ proxy: str
148
+
149
+
150
+ class AmdTimers(TypedDict, total=False):
151
+ """AMD timer configuration."""
152
+
153
+ noSpeechTimeoutMs: int
154
+ decisionTimeoutMs: int
155
+ toneTimeoutMs: int
156
+ greetingCompletionTimeoutMs: int
157
+
158
+
159
+ class Amd(TypedDict, total=False):
160
+ """Answering machine detection configuration."""
161
+
162
+ actionHook: ActionHook
163
+ thresholdWordCount: int
164
+ digitCount: int
165
+ timers: AmdTimers
166
+ recognizer: Recognizer
167
+
168
+
169
+ class BidirectionalAudio(TypedDict, total=False):
170
+ """Bidirectional audio streaming configuration."""
171
+
172
+ enabled: bool
173
+ streaming: bool
174
+ sampleRate: int
175
+
176
+
177
+ class FillerNoise(TypedDict, total=False):
178
+ """Filler noise configuration."""
179
+
180
+ enable: bool
181
+ url: str
182
+ startDelaySecs: int
183
+
184
+
185
+ class ActionHookDelayAction(TypedDict, total=False):
186
+ """Configuration for handling slow webhook responses."""
187
+
188
+ enabled: bool
189
+ noResponseTimeout: int
190
+ noResponseGiveUpTimeout: int
191
+ retries: int
192
+ actions: list[dict[str, Any]]
193
+
194
+
195
+ class McpServer(TypedDict, total=False):
196
+ """MCP server configuration."""
197
+
198
+ url: str
199
+ auth: dict[str, Any]
200
+ roots: list[dict[str, Any]]
201
+
202
+
203
+ class LlmBase(TypedDict, total=False):
204
+ """Shared properties for LLM/S2S verbs."""
205
+
206
+ vendor: str
207
+ model: str
208
+ auth: Auth
209
+ connectOptions: dict[str, Any]
210
+ llmOptions: dict[str, Any]
211
+ mcpServers: list[McpServer]
212
+ actionHook: ActionHook
213
+ eventHook: ActionHook
214
+ toolHook: ActionHook
215
+ events: list[str]
216
+
217
+
218
+ class BargeIn(TypedDict, total=False):
219
+ """Barge-in configuration."""
220
+
221
+ enable: bool
222
+ sticky: bool
223
+ actionHook: ActionHook
224
+ input: list[str]
225
+ minBargeinWordCount: int
226
+
227
+
228
+ class TtsStream(TypedDict, total=False):
229
+ """TTS streaming configuration."""
230
+
231
+ enable: bool
232
+ synthesizer: Synthesizer
233
+
234
+
235
+ class NoiseIsolation(TypedDict, total=False):
236
+ """Noise isolation configuration."""
237
+
238
+ enable: bool
239
+ vendor: str
240
+ level: int
241
+ model: str
242
+
243
+
244
+ class TurnTaking(TypedDict, total=False):
245
+ """Turn-taking detection configuration."""
246
+
247
+ enable: bool
248
+ vendor: str
249
+ threshold: float
250
+ model: str
@@ -0,0 +1,59 @@
1
+ """REST API request/response types."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any, TypedDict
6
+
7
+
8
+ class CreateCallRequest(TypedDict, total=False):
9
+ """Request body for creating an outbound call."""
10
+
11
+ from_: str # Serialized as 'from'
12
+ to: dict[str, Any] # Target object
13
+ call_hook: str
14
+ call_status_hook: str
15
+ timeout: int
16
+ tag: dict[str, Any]
17
+ headers: dict[str, str]
18
+ caller_name: str
19
+
20
+
21
+ class ListCallsFilter(TypedDict, total=False):
22
+ """Filter parameters for listing calls."""
23
+
24
+ direction: str # "inbound" | "outbound"
25
+ from_: str
26
+ to: str
27
+ callStatus: str
28
+
29
+
30
+ class CallStatus(TypedDict, total=False):
31
+ """Call status information."""
32
+
33
+ call_sid: str
34
+ account_sid: str
35
+ application_sid: str
36
+ direction: str
37
+ from_: str
38
+ to: str
39
+ call_id: str
40
+ sip_status: int
41
+ call_status: str
42
+ duration: int
43
+
44
+
45
+ class CallInfo(TypedDict, total=False):
46
+ """Full call information returned by the API."""
47
+
48
+ call_sid: str
49
+ account_sid: str
50
+ application_sid: str
51
+ direction: str
52
+ from_: str
53
+ to: str
54
+ call_id: str
55
+ sip_status: int
56
+ call_status: str
57
+ caller_name: str
58
+ duration: int
59
+ trace_id: str
@@ -0,0 +1,55 @@
1
+ """Call session and WebSocket message types."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from enum import Enum
6
+ from typing import Any, TypedDict
7
+
8
+
9
+ class CallDirection(str, Enum):
10
+ """Call direction."""
11
+
12
+ INBOUND = "inbound"
13
+ OUTBOUND = "outbound"
14
+
15
+
16
+ class CallSession(TypedDict, total=False):
17
+ """Call session data received on session:new."""
18
+
19
+ call_sid: str
20
+ account_sid: str
21
+ application_sid: str
22
+ direction: str # "inbound" | "outbound"
23
+ from_: str # Serialized as 'from'
24
+ to: str
25
+ call_id: str
26
+ sip_status: int
27
+ sip: dict[str, Any]
28
+ env_vars: dict[str, str]
29
+ defaults: dict[str, Any]
30
+ customerData: dict[str, Any]
31
+
32
+
33
+ class WsMessageType(str, Enum):
34
+ """WebSocket message types from jambonz."""
35
+
36
+ SESSION_NEW = "session:new"
37
+ SESSION_REDIRECT = "session:redirect"
38
+ SESSION_RECONNECT = "session:reconnect"
39
+ SESSION_ADULTING = "session:adulting"
40
+ VERB_HOOK = "verb:hook"
41
+ VERB_STATUS = "verb:status"
42
+ CALL_STATUS = "call:status"
43
+ LLM_TOOL_CALL = "llm:tool-call"
44
+ LLM_EVENT = "llm:event"
45
+ TTS_TOKENS_RESULT = "tts:tokens-result"
46
+ TTS_STREAMING_EVENT = "tts:streaming-event"
47
+
48
+
49
+ class WsMessage(TypedDict, total=False):
50
+ """WebSocket message structure."""
51
+
52
+ type: str
53
+ msgid: str
54
+ hook: str
55
+ data: dict[str, Any]