@framers/agentos-ext-voice-telnyx 0.1.0 → 0.1.1

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/LICENSE ADDED
@@ -0,0 +1,98 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
10
+
11
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
12
+
13
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
14
+
15
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
16
+
17
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
18
+
19
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
20
+
21
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
22
+
23
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
24
+
25
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
26
+
27
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
28
+
29
+ 2. Grant of Copyright License.
30
+
31
+ Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
32
+
33
+ 3. Grant of Patent License.
34
+
35
+ Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
36
+
37
+ 4. Redistribution.
38
+
39
+ You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
40
+
41
+ (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
42
+
43
+ (b) You must cause any modified files to carry prominent notices stating that You changed the files; and
44
+
45
+ (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
46
+
47
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
48
+
49
+ You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
50
+
51
+ 5. Submission of Contributions.
52
+
53
+ Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
54
+
55
+ 6. Trademarks.
56
+
57
+ This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
58
+
59
+ 7. Disclaimer of Warranty.
60
+
61
+ Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
62
+
63
+ 8. Limitation of Liability.
64
+
65
+ In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
66
+
67
+ 9. Accepting Warranty or Additional Liability.
68
+
69
+ While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
70
+
71
+ END OF TERMS AND CONDITIONS
72
+
73
+ APPENDIX: How to apply the Apache License to your work.
74
+
75
+ To apply the Apache License to your work, attach the following
76
+ boilerplate notice, with the fields enclosed by brackets "[]"
77
+ replaced with your own identifying information. (Don't include
78
+ the brackets!) The text should be enclosed in the appropriate
79
+ comment syntax for the file format. We also recommend that a
80
+ file or class name and description of purpose be included on the
81
+ same "printed page" as the copyright notice for easier
82
+ identification within third-party archives.
83
+
84
+ Copyright (c) 2025 Framers
85
+
86
+ Licensed under the Apache License, Version 2.0 (the "License");
87
+ you may not use this file except in compliance with the License.
88
+ You may obtain a copy of the License at
89
+
90
+ http://www.apache.org/licenses/LICENSE-2.0
91
+
92
+ Unless required by applicable law or agreed to in writing, software
93
+ distributed under the License is distributed on an "AS IS" BASIS,
94
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
95
+ See the License for the specific language governing permissions and
96
+ limitations under the License.
97
+
98
+
@@ -0,0 +1,56 @@
1
+ /**
2
+ * @fileoverview IVoiceCallProvider implementation for Telnyx Call Control v2.
3
+ *
4
+ * Normalizes Telnyx-specific webhook events and call control operations
5
+ * into the AgentOS voice provider contract consumed by {@link CallManager}.
6
+ *
7
+ * @module @framers/agentos-ext-voice-telnyx/TelnyxVoiceProvider
8
+ */
9
+ import type { IVoiceCallProvider, InitiateCallInput, InitiateCallResult, HangupCallInput, PlayTtsInput } from '@framers/agentos';
10
+ import type { WebhookContext, WebhookParseResult, WebhookVerificationResult } from '@framers/agentos';
11
+ import { TelnyxVoiceService, type TelnyxServiceConfig } from './TelnyxVoiceService';
12
+ export declare class TelnyxVoiceProvider implements IVoiceCallProvider {
13
+ readonly name: "telnyx";
14
+ private readonly service;
15
+ private readonly config;
16
+ constructor(service: TelnyxVoiceService, config: TelnyxServiceConfig);
17
+ /**
18
+ * Verify a Telnyx webhook using Ed25519 signature.
19
+ *
20
+ * Telnyx sends two headers for verification:
21
+ * - `telnyx-signature-v2`: Base64-encoded Ed25519 signature
22
+ * - `telnyx-signature-timestamp`: Unix timestamp string
23
+ *
24
+ * The signed content is: `${timestamp}|${rawBody}`
25
+ */
26
+ verifyWebhook(ctx: WebhookContext): WebhookVerificationResult;
27
+ /**
28
+ * Parse a Telnyx webhook payload into normalized call events.
29
+ *
30
+ * Maps Telnyx Call Control v2 event types to the AgentOS
31
+ * NormalizedCallEvent discriminated union.
32
+ */
33
+ parseWebhookEvent(ctx: WebhookContext): WebhookParseResult;
34
+ /**
35
+ * Initiate an outbound call via Telnyx Call Control v2.
36
+ *
37
+ * For 'notify' mode, the caller answers and the speak command is issued
38
+ * via a subsequent webhook handler. For 'conversation' mode, a
39
+ * bidirectional media stream is established.
40
+ */
41
+ initiateCall(input: InitiateCallInput): Promise<InitiateCallResult>;
42
+ /**
43
+ * Hang up an active call via Telnyx Call Control v2.
44
+ */
45
+ hangupCall(input: HangupCallInput): Promise<void>;
46
+ /**
47
+ * Play TTS audio into an active call via the Telnyx speak command.
48
+ */
49
+ playTts(input: PlayTtsInput): Promise<void>;
50
+ /**
51
+ * Extract a single header value from the headers record.
52
+ * Handles both string and string[] header values.
53
+ */
54
+ private getHeader;
55
+ }
56
+ //# sourceMappingURL=TelnyxVoiceProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TelnyxVoiceProvider.d.ts","sourceRoot":"","sources":["../src/TelnyxVoiceProvider.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,YAAY,EACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAEV,cAAc,EACd,kBAAkB,EAClB,yBAAyB,EAC1B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAqEpF,qBAAa,mBAAoB,YAAW,kBAAkB;IAC5D,QAAQ,CAAC,IAAI,EAAG,QAAQ,CAAU;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAC7C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsB;gBAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,mBAAmB;IAOpE;;;;;;;;OAQG;IACH,aAAa,CAAC,GAAG,EAAE,cAAc,GAAG,yBAAyB;IAoC7D;;;;;OAKG;IACH,iBAAiB,CAAC,GAAG,EAAE,cAAc,GAAG,kBAAkB;IA6F1D;;;;;;OAMG;IACG,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAmCzE;;OAEG;IACG,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvD;;OAEG;IACG,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAUjD;;;OAGG;IACH,OAAO,CAAC,SAAS;CAQlB"}
@@ -0,0 +1,223 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ /**
4
+ * @fileoverview IVoiceCallProvider implementation for Telnyx Call Control v2.
5
+ *
6
+ * Normalizes Telnyx-specific webhook events and call control operations
7
+ * into the AgentOS voice provider contract consumed by {@link CallManager}.
8
+ *
9
+ * @module @framers/agentos-ext-voice-telnyx/TelnyxVoiceProvider
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.TelnyxVoiceProvider = void 0;
13
+ /** Telnyx hangup cause codes that map to specific terminal states. */
14
+ const HANGUP_CAUSE_MAP = {
15
+ 'normal_clearing': 'call-completed',
16
+ 'originator_cancel': 'call-hangup-user',
17
+ 'normal': 'call-completed',
18
+ 'busy': 'call-busy',
19
+ 'no_answer': 'call-no-answer',
20
+ 'timeout': 'call-no-answer',
21
+ 'call_rejected': 'call-failed',
22
+ 'user_busy': 'call-busy',
23
+ 'unallocated_number': 'call-failed',
24
+ 'normal_temporary_failure': 'call-error',
25
+ 'recovery_on_timer_expire': 'call-no-answer',
26
+ };
27
+ // ============================================================================
28
+ // Provider Implementation
29
+ // ============================================================================
30
+ class TelnyxVoiceProvider {
31
+ constructor(service, config) {
32
+ this.name = 'telnyx';
33
+ this.service = service;
34
+ this.config = config;
35
+ }
36
+ // ── Webhook Processing ──
37
+ /**
38
+ * Verify a Telnyx webhook using Ed25519 signature.
39
+ *
40
+ * Telnyx sends two headers for verification:
41
+ * - `telnyx-signature-v2`: Base64-encoded Ed25519 signature
42
+ * - `telnyx-signature-timestamp`: Unix timestamp string
43
+ *
44
+ * The signed content is: `${timestamp}|${rawBody}`
45
+ */
46
+ verifyWebhook(ctx) {
47
+ const publicKey = this.config.publicKey;
48
+ // If no public key configured, skip verification (development mode)
49
+ if (!publicKey) {
50
+ return { valid: true };
51
+ }
52
+ const signature = this.getHeader(ctx.headers, 'telnyx-signature-v2');
53
+ const timestamp = this.getHeader(ctx.headers, 'telnyx-signature-timestamp');
54
+ if (!signature || !timestamp) {
55
+ return {
56
+ valid: false,
57
+ error: 'Missing telnyx-signature-v2 or telnyx-signature-timestamp header',
58
+ };
59
+ }
60
+ const body = typeof ctx.body === 'string' ? ctx.body : ctx.body.toString('utf-8');
61
+ const isValid = this.service.verifyWebhook(body, signature, timestamp, publicKey);
62
+ if (!isValid) {
63
+ return { valid: false, error: 'Ed25519 signature verification failed' };
64
+ }
65
+ // Check timestamp freshness (reject webhooks older than 5 minutes)
66
+ const timestampMs = parseInt(timestamp, 10) * 1000;
67
+ const now = Date.now();
68
+ const MAX_AGE_MS = 5 * 60 * 1000;
69
+ if (Math.abs(now - timestampMs) > MAX_AGE_MS) {
70
+ return { valid: false, error: 'Webhook timestamp is stale (>5 minutes)' };
71
+ }
72
+ return { valid: true };
73
+ }
74
+ /**
75
+ * Parse a Telnyx webhook payload into normalized call events.
76
+ *
77
+ * Maps Telnyx Call Control v2 event types to the AgentOS
78
+ * NormalizedCallEvent discriminated union.
79
+ */
80
+ parseWebhookEvent(ctx) {
81
+ const body = typeof ctx.body === 'string' ? ctx.body : ctx.body.toString('utf-8');
82
+ let payload;
83
+ try {
84
+ payload = JSON.parse(body);
85
+ }
86
+ catch {
87
+ return { events: [], rawData: { error: 'Invalid JSON body' } };
88
+ }
89
+ const { data } = payload;
90
+ if (!data || !data.event_type || !data.payload) {
91
+ return { events: [], rawData: payload };
92
+ }
93
+ const baseEvent = {
94
+ eventId: data.id,
95
+ providerCallId: data.payload.call_control_id,
96
+ timestamp: data.occurred_at ? new Date(data.occurred_at).getTime() : Date.now(),
97
+ };
98
+ const events = [];
99
+ switch (data.event_type) {
100
+ case 'call.initiated':
101
+ events.push({ ...baseEvent, kind: 'call-ringing' });
102
+ break;
103
+ case 'call.answered':
104
+ events.push({ ...baseEvent, kind: 'call-answered' });
105
+ break;
106
+ case 'call.hangup': {
107
+ const cause = data.payload.hangup_cause ?? 'normal_clearing';
108
+ const source = data.payload.hangup_source;
109
+ // Determine terminal state from hangup cause and source
110
+ let kind;
111
+ if (source === 'caller' || source === 'callee') {
112
+ // If the remote party (the human) hung up
113
+ kind = source === 'callee' && data.payload.direction === 'outgoing'
114
+ ? 'call-hangup-user'
115
+ : HANGUP_CAUSE_MAP[cause] ?? 'call-completed';
116
+ }
117
+ else {
118
+ kind = HANGUP_CAUSE_MAP[cause] ?? 'call-completed';
119
+ }
120
+ if (kind === 'call-completed') {
121
+ events.push({ ...baseEvent, kind: 'call-completed' });
122
+ }
123
+ else if (kind === 'call-hangup-user') {
124
+ events.push({ ...baseEvent, kind: 'call-hangup-user' });
125
+ }
126
+ else if (kind === 'call-busy') {
127
+ events.push({ ...baseEvent, kind: 'call-busy' });
128
+ }
129
+ else if (kind === 'call-no-answer') {
130
+ events.push({ ...baseEvent, kind: 'call-no-answer' });
131
+ }
132
+ else if (kind === 'call-failed') {
133
+ events.push({ ...baseEvent, kind: 'call-failed', reason: cause });
134
+ }
135
+ else if (kind === 'call-error') {
136
+ events.push({ ...baseEvent, kind: 'call-error', error: cause });
137
+ }
138
+ break;
139
+ }
140
+ case 'call.machine.detection.ended': {
141
+ const result = data.payload.result;
142
+ if (result === 'machine' || result === 'fax') {
143
+ events.push({ ...baseEvent, kind: 'call-voicemail' });
144
+ }
145
+ // If result is 'human', no event — call proceeds normally
146
+ break;
147
+ }
148
+ case 'streaming.started': {
149
+ events.push({
150
+ ...baseEvent,
151
+ kind: 'media-stream-connected',
152
+ streamSid: data.payload.stream_url ?? data.id,
153
+ });
154
+ break;
155
+ }
156
+ // call.speak.started, call.speak.ended, streaming.stopped,
157
+ // call.bridged, call.recording.saved — no normalized event needed
158
+ default:
159
+ break;
160
+ }
161
+ return { events, rawData: payload };
162
+ }
163
+ // ── Call Control ──
164
+ /**
165
+ * Initiate an outbound call via Telnyx Call Control v2.
166
+ *
167
+ * For 'notify' mode, the caller answers and the speak command is issued
168
+ * via a subsequent webhook handler. For 'conversation' mode, a
169
+ * bidirectional media stream is established.
170
+ */
171
+ async initiateCall(input) {
172
+ try {
173
+ const connectionId = this.config.connectionId;
174
+ const result = await this.service.createCall(connectionId, input.fromNumber, input.toNumber, input.webhookUrl, {
175
+ answeringMachineDetection: input.mode === 'notify',
176
+ streamUrl: input.mode === 'conversation' ? input.mediaStreamUrl : undefined,
177
+ streamTrack: 'inbound_track',
178
+ clientState: JSON.stringify({
179
+ callId: input.callId,
180
+ mode: input.mode,
181
+ message: input.message,
182
+ notifyVoice: input.notifyVoice,
183
+ }),
184
+ });
185
+ return {
186
+ providerCallId: result.callControlId,
187
+ success: true,
188
+ };
189
+ }
190
+ catch (err) {
191
+ return {
192
+ providerCallId: '',
193
+ success: false,
194
+ error: err instanceof Error ? err.message : String(err),
195
+ };
196
+ }
197
+ }
198
+ /**
199
+ * Hang up an active call via Telnyx Call Control v2.
200
+ */
201
+ async hangupCall(input) {
202
+ await this.service.hangupCall(input.providerCallId);
203
+ }
204
+ /**
205
+ * Play TTS audio into an active call via the Telnyx speak command.
206
+ */
207
+ async playTts(input) {
208
+ await this.service.speakText(input.providerCallId, input.text, input.voice);
209
+ }
210
+ // ── Private Helpers ──
211
+ /**
212
+ * Extract a single header value from the headers record.
213
+ * Handles both string and string[] header values.
214
+ */
215
+ getHeader(headers, name) {
216
+ const value = headers[name] ?? headers[name.toLowerCase()];
217
+ if (Array.isArray(value))
218
+ return value[0];
219
+ return value;
220
+ }
221
+ }
222
+ exports.TelnyxVoiceProvider = TelnyxVoiceProvider;
223
+ //# sourceMappingURL=TelnyxVoiceProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TelnyxVoiceProvider.js","sourceRoot":"","sources":["../src/TelnyxVoiceProvider.ts"],"names":[],"mappings":";AAAA,cAAc;AACd;;;;;;;GAOG;;;AAiEH,sEAAsE;AACtE,MAAM,gBAAgB,GAAgD;IACpE,iBAAiB,EAAE,gBAAgB;IACnC,mBAAmB,EAAE,kBAAkB;IACvC,QAAQ,EAAE,gBAAgB;IAC1B,MAAM,EAAE,WAAW;IACnB,WAAW,EAAE,gBAAgB;IAC7B,SAAS,EAAE,gBAAgB;IAC3B,eAAe,EAAE,aAAa;IAC9B,WAAW,EAAE,WAAW;IACxB,oBAAoB,EAAE,aAAa;IACnC,0BAA0B,EAAE,YAAY;IACxC,0BAA0B,EAAE,gBAAgB;CAC7C,CAAC;AAEF,+EAA+E;AAC/E,0BAA0B;AAC1B,+EAA+E;AAE/E,MAAa,mBAAmB;IAK9B,YAAY,OAA2B,EAAE,MAA2B;QAJ3D,SAAI,GAAG,QAAiB,CAAC;QAKhC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,2BAA2B;I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,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,CAC1B,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,KAAK,CACZ,CAAC;IACJ,CAAC;IAED,wBAAwB;IAExB;;;OAGG;IACK,SAAS,CACf,OAAsD,EACtD,IAAY;QAEZ,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QAC3D,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;QAC1C,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAtOD,kDAsOC"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * @fileoverview Telnyx Call Control v2 SDK wrapper.
3
+ *
4
+ * Handles Telnyx client lifecycle, outbound call creation, hangup,
5
+ * in-call TTS via the speak command, and Ed25519 webhook verification.
6
+ *
7
+ * @module @framers/agentos-ext-voice-telnyx/TelnyxVoiceService
8
+ */
9
+ export interface TelnyxServiceConfig {
10
+ /** Telnyx API v2 key. */
11
+ apiKey: string;
12
+ /** Telnyx Call Control Application connection ID. */
13
+ connectionId: string;
14
+ /** Ed25519 public key for webhook signature verification (base64-encoded). */
15
+ publicKey?: string;
16
+ /** Default E.164 "from" number for outbound calls. */
17
+ fromNumber?: string;
18
+ }
19
+ export declare class TelnyxVoiceService {
20
+ private client;
21
+ private running;
22
+ private readonly config;
23
+ constructor(config: TelnyxServiceConfig);
24
+ /**
25
+ * Initialize the Telnyx SDK client via dynamic import.
26
+ * Uses dynamic import to avoid bundling issues with the telnyx package
27
+ * and to allow lazy-loading.
28
+ */
29
+ initialize(): Promise<void>;
30
+ /**
31
+ * Shut down the service and release the client reference.
32
+ */
33
+ shutdown(): Promise<void>;
34
+ get isRunning(): boolean;
35
+ /**
36
+ * Create an outbound call via Telnyx Call Control v2.
37
+ *
38
+ * @param connectionId - Telnyx connection ID (overrides config default).
39
+ * @param from - E.164 "from" number.
40
+ * @param to - E.164 "to" number.
41
+ * @param webhookUrl - URL for Telnyx to send call events to.
42
+ * @param options - Additional options for call creation.
43
+ * @returns The call_control_id assigned by Telnyx.
44
+ */
45
+ createCall(connectionId: string, from: string, to: string, webhookUrl: string, options?: {
46
+ answeringMachineDetection?: boolean;
47
+ streamUrl?: string;
48
+ streamTrack?: 'inbound_track' | 'outbound_track' | 'both_tracks';
49
+ clientState?: string;
50
+ }): Promise<{
51
+ callControlId: string;
52
+ callSessionId: string;
53
+ }>;
54
+ /**
55
+ * Hang up a call by its call_control_id.
56
+ */
57
+ hangupCall(callControlId: string): Promise<void>;
58
+ /**
59
+ * Speak text into an active call via the Telnyx speak command.
60
+ *
61
+ * @param callControlId - The call_control_id.
62
+ * @param text - Text to speak (plain text or SSML).
63
+ * @param voice - Telnyx voice name (default: 'female' / 'en-US').
64
+ * @param payloadType - 'text' or 'ssml' (default: 'text').
65
+ */
66
+ speakText(callControlId: string, text: string, voice?: string, payloadType?: 'text' | 'ssml'): Promise<void>;
67
+ /**
68
+ * Verify a Telnyx webhook using Ed25519 signature verification.
69
+ *
70
+ * Telnyx signs webhooks with Ed25519. The signature is in the
71
+ * `telnyx-signature-v2` header and the timestamp in
72
+ * `telnyx-signature-timestamp`. The signed content is:
73
+ * `${timestamp}|${body}`
74
+ *
75
+ * @param body - Raw request body as string.
76
+ * @param signature - Base64-encoded Ed25519 signature from header.
77
+ * @param timestamp - Timestamp string from header.
78
+ * @param publicKey - Base64-encoded Ed25519 public key.
79
+ * @returns Whether the signature is valid.
80
+ */
81
+ verifyWebhook(body: string, signature: string, timestamp: string, publicKey: string): boolean;
82
+ private ensureInitialized;
83
+ }
84
+ //# sourceMappingURL=TelnyxVoiceService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TelnyxVoiceService.d.ts","sourceRoot":"","sources":["../src/TelnyxVoiceService.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAQH,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;IACH,aAAa,CACX,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,OAAO;IA8BV,OAAO,CAAC,iBAAiB;CAK1B"}
@@ -0,0 +1,202 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ /**
4
+ * @fileoverview Telnyx Call Control v2 SDK wrapper.
5
+ *
6
+ * Handles Telnyx client lifecycle, outbound call creation, hangup,
7
+ * in-call TTS via the speak command, and Ed25519 webhook verification.
8
+ *
9
+ * @module @framers/agentos-ext-voice-telnyx/TelnyxVoiceService
10
+ */
11
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ var desc = Object.getOwnPropertyDescriptor(m, k);
14
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
15
+ desc = { enumerable: true, get: function() { return m[k]; } };
16
+ }
17
+ Object.defineProperty(o, k2, desc);
18
+ }) : (function(o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ o[k2] = m[k];
21
+ }));
22
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
23
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
24
+ }) : function(o, v) {
25
+ o["default"] = v;
26
+ });
27
+ var __importStar = (this && this.__importStar) || (function () {
28
+ var ownKeys = function(o) {
29
+ ownKeys = Object.getOwnPropertyNames || function (o) {
30
+ var ar = [];
31
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
32
+ return ar;
33
+ };
34
+ return ownKeys(o);
35
+ };
36
+ return function (mod) {
37
+ if (mod && mod.__esModule) return mod;
38
+ var result = {};
39
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
40
+ __setModuleDefault(result, mod);
41
+ return result;
42
+ };
43
+ })();
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ exports.TelnyxVoiceService = void 0;
46
+ const node_crypto_1 = require("node:crypto");
47
+ // ============================================================================
48
+ // Service
49
+ // ============================================================================
50
+ class TelnyxVoiceService {
51
+ constructor(config) {
52
+ this.client = null;
53
+ this.running = false;
54
+ this.config = config;
55
+ }
56
+ // ── Lifecycle ──
57
+ /**
58
+ * Initialize the Telnyx SDK client via dynamic import.
59
+ * Uses dynamic import to avoid bundling issues with the telnyx package
60
+ * and to allow lazy-loading.
61
+ */
62
+ async initialize() {
63
+ if (this.running)
64
+ return;
65
+ try {
66
+ // Dynamic import — the telnyx package exports a factory function
67
+ const telnyxModule = await Promise.resolve().then(() => __importStar(require('telnyx')));
68
+ const TelnyxFactory = telnyxModule.default ?? telnyxModule;
69
+ // The telnyx SDK is callable in CommonJS usage (factory), but typings may
70
+ // model it as a constructable class. Support both shapes.
71
+ let client;
72
+ try {
73
+ client = TelnyxFactory(this.config.apiKey);
74
+ }
75
+ catch {
76
+ client = new TelnyxFactory(this.config.apiKey);
77
+ }
78
+ this.client = client;
79
+ this.running = true;
80
+ }
81
+ catch (err) {
82
+ throw new Error(`[TelnyxVoiceService] Failed to initialize Telnyx client: ${err instanceof Error ? err.message : String(err)}`);
83
+ }
84
+ }
85
+ /**
86
+ * Shut down the service and release the client reference.
87
+ */
88
+ async shutdown() {
89
+ this.client = null;
90
+ this.running = false;
91
+ }
92
+ get isRunning() {
93
+ return this.running;
94
+ }
95
+ // ── Call Control ──
96
+ /**
97
+ * Create an outbound call via Telnyx Call Control v2.
98
+ *
99
+ * @param connectionId - Telnyx connection ID (overrides config default).
100
+ * @param from - E.164 "from" number.
101
+ * @param to - E.164 "to" number.
102
+ * @param webhookUrl - URL for Telnyx to send call events to.
103
+ * @param options - Additional options for call creation.
104
+ * @returns The call_control_id assigned by Telnyx.
105
+ */
106
+ async createCall(connectionId, from, to, webhookUrl, options) {
107
+ this.ensureInitialized();
108
+ const params = {
109
+ connection_id: connectionId,
110
+ to,
111
+ from,
112
+ webhook_url: webhookUrl,
113
+ webhook_url_method: 'POST',
114
+ };
115
+ if (options?.answeringMachineDetection) {
116
+ params.answering_machine_detection = 'detect';
117
+ }
118
+ if (options?.streamUrl) {
119
+ params.stream_url = options.streamUrl;
120
+ params.stream_track = options.streamTrack ?? 'inbound_track';
121
+ }
122
+ if (options?.clientState) {
123
+ params.client_state = Buffer.from(options.clientState).toString('base64');
124
+ }
125
+ const result = await this.client.calls.create(params);
126
+ return {
127
+ callControlId: result.data.call_control_id,
128
+ callSessionId: result.data.call_session_id,
129
+ };
130
+ }
131
+ /**
132
+ * Hang up a call by its call_control_id.
133
+ */
134
+ async hangupCall(callControlId) {
135
+ this.ensureInitialized();
136
+ await this.client.calls.hangup(callControlId);
137
+ }
138
+ /**
139
+ * Speak text into an active call via the Telnyx speak command.
140
+ *
141
+ * @param callControlId - The call_control_id.
142
+ * @param text - Text to speak (plain text or SSML).
143
+ * @param voice - Telnyx voice name (default: 'female' / 'en-US').
144
+ * @param payloadType - 'text' or 'ssml' (default: 'text').
145
+ */
146
+ async speakText(callControlId, text, voice, payloadType) {
147
+ this.ensureInitialized();
148
+ await this.client.calls.speak(callControlId, {
149
+ payload: text,
150
+ voice: voice ?? 'female',
151
+ language: 'en-US',
152
+ payload_type: payloadType ?? 'text',
153
+ });
154
+ }
155
+ // ── Webhook Verification ──
156
+ /**
157
+ * Verify a Telnyx webhook using Ed25519 signature verification.
158
+ *
159
+ * Telnyx signs webhooks with Ed25519. The signature is in the
160
+ * `telnyx-signature-v2` header and the timestamp in
161
+ * `telnyx-signature-timestamp`. The signed content is:
162
+ * `${timestamp}|${body}`
163
+ *
164
+ * @param body - Raw request body as string.
165
+ * @param signature - Base64-encoded Ed25519 signature from header.
166
+ * @param timestamp - Timestamp string from header.
167
+ * @param publicKey - Base64-encoded Ed25519 public key.
168
+ * @returns Whether the signature is valid.
169
+ */
170
+ verifyWebhook(body, signature, timestamp, publicKey) {
171
+ try {
172
+ const signedPayload = `${timestamp}|${body}`;
173
+ // Construct the DER-encoded Ed25519 public key
174
+ // Ed25519 public keys are 32 bytes; DER prefix for Ed25519 is fixed
175
+ const ED25519_DER_PREFIX = Buffer.from('302a300506032b6570032100', 'hex');
176
+ const rawKey = Buffer.from(publicKey, 'base64');
177
+ const derKey = Buffer.concat([ED25519_DER_PREFIX, rawKey]);
178
+ const verifier = (0, node_crypto_1.createVerify)('Ed25519');
179
+ // Node.js createVerify with Ed25519 doesn't use a separate digest
180
+ // but we need to use the verify API with the key object
181
+ verifier.update(signedPayload);
182
+ verifier.end();
183
+ const keyObject = require('node:crypto').createPublicKey({
184
+ key: derKey,
185
+ format: 'der',
186
+ type: 'spki',
187
+ });
188
+ return verifier.verify(keyObject, Buffer.from(signature, 'base64'));
189
+ }
190
+ catch {
191
+ return false;
192
+ }
193
+ }
194
+ // ── Private ──
195
+ ensureInitialized() {
196
+ if (!this.client) {
197
+ throw new Error('[TelnyxVoiceService] Not initialized — call initialize() first');
198
+ }
199
+ }
200
+ }
201
+ exports.TelnyxVoiceService = TelnyxVoiceService;
202
+ //# sourceMappingURL=TelnyxVoiceService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TelnyxVoiceService.js","sourceRoot":"","sources":["../src/TelnyxVoiceService.ts"],"names":[],"mappings":";AAAA,cAAc;AACd;;;;;;;GAOG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA2C;AA2D3C,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E,MAAa,kBAAkB;IAK7B,YAAY,MAA2B;QAJ/B,WAAM,GAAwB,IAAI,CAAC;QACnC,YAAO,GAAG,KAAK,CAAC;QAItB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,kBAAkB;IAElB;;;;OAIG;IACH,KAAK,CAAC,UAAU;QACd,IAAI,IAAI,CAAC,OAAO;YAAE,OAAO;QAEzB,IAAI,CAAC;YACH,iEAAiE;YACjE,MAAM,YAAY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QAEjB,IAAI,CAAC;YACH,MAAM,aAAa,GAAG,GAAG,SAAS,IAAI,IAAI,EAAE,CAAC;YAE7C,+CAA+C;YAC/C,oEAAoE;YACpE,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAC;YAC1E,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YAChD,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC,CAAC;YAE3D,MAAM,QAAQ,GAAG,IAAA,0BAAY,EAAC,SAAS,CAAC,CAAC;YACzC,kEAAkE;YAClE,wDAAwD;YACxD,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;YAC/B,QAAQ,CAAC,GAAG,EAAE,CAAC;YAEf,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC,eAAe,CAAC;gBACvD,GAAG,EAAE,MAAM;gBACX,MAAM,EAAE,KAAK;gBACb,IAAI,EAAE,MAAM;aACb,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;QACtE,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,gBAAgB;IAER,iBAAiB;QACvB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;QACpF,CAAC;IACH,CAAC;CACF;AAlMD,gDAkMC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @fileoverview Telnyx Voice Call Extension for AgentOS.
3
+ *
4
+ * Provides an IVoiceCallProvider backed by Telnyx Call Control v2,
5
+ * plus an ITool descriptor for programmatic voice call management.
6
+ *
7
+ * @module @framers/agentos-ext-voice-telnyx
8
+ */
9
+ import type { ExtensionContext, ExtensionPack } from '@framers/agentos';
10
+ export interface TelnyxVoiceOptions {
11
+ /** Telnyx API v2 key (overrides secrets/env). */
12
+ apiKey?: string;
13
+ /** Telnyx Call Control Application connection ID (overrides secrets/env). */
14
+ connectionId?: string;
15
+ /** Ed25519 public key for webhook signature verification. */
16
+ publicKey?: string;
17
+ /** Default E.164 "from" number for outbound calls. */
18
+ fromNumber?: string;
19
+ /** Webhook base URL (e.g., https://yourdomain.com). */
20
+ webhookBaseUrl?: string;
21
+ /** Priority for extension descriptor ordering. */
22
+ priority?: number;
23
+ }
24
+ export declare function createExtensionPack(context: ExtensionContext): ExtensionPack;
25
+ export { TelnyxVoiceService, type TelnyxServiceConfig } from './TelnyxVoiceService';
26
+ export { TelnyxVoiceProvider } from './TelnyxVoiceProvider';
27
+ export { TelnyxVoiceCallTool, type VoiceCallToolHandler } from './tools/voiceCall';
28
+ export default createExtensionPack;
29
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAwB,MAAM,kBAAkB,CAAC;AAU9F,MAAM,WAAW,kBAAkB;IACjC,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAuDD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,GAAG,aAAa,CAoE5E;AAID,OAAO,EAAE,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACnF,eAAe,mBAAmB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ /**
4
+ * @fileoverview Telnyx Voice Call Extension for AgentOS.
5
+ *
6
+ * Provides an IVoiceCallProvider backed by Telnyx Call Control v2,
7
+ * plus an ITool descriptor for programmatic voice call management.
8
+ *
9
+ * @module @framers/agentos-ext-voice-telnyx
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.TelnyxVoiceCallTool = exports.TelnyxVoiceProvider = exports.TelnyxVoiceService = void 0;
13
+ exports.createExtensionPack = createExtensionPack;
14
+ const agentos_1 = require("@framers/agentos");
15
+ const TelnyxVoiceService_1 = require("./TelnyxVoiceService");
16
+ const TelnyxVoiceProvider_1 = require("./TelnyxVoiceProvider");
17
+ const voiceCall_1 = require("./tools/voiceCall");
18
+ // ============================================================================
19
+ // Secret / Env Resolution
20
+ // ============================================================================
21
+ function resolveApiKey(options, secrets) {
22
+ if (options.apiKey)
23
+ return options.apiKey;
24
+ if (secrets?.['telnyx.apiKey'])
25
+ return secrets['telnyx.apiKey'];
26
+ for (const envName of ['TELNYX_API_KEY', 'TELNYX_API_V2_KEY']) {
27
+ if (process.env[envName])
28
+ return process.env[envName];
29
+ }
30
+ throw new Error('Telnyx API key not found. Provide via options.apiKey, secrets["telnyx.apiKey"], or TELNYX_API_KEY env var.');
31
+ }
32
+ function resolveConnectionId(options, secrets) {
33
+ if (options.connectionId)
34
+ return options.connectionId;
35
+ if (secrets?.['telnyx.connectionId'])
36
+ return secrets['telnyx.connectionId'];
37
+ for (const envName of ['TELNYX_CONNECTION_ID', 'TELNYX_APP_ID']) {
38
+ if (process.env[envName])
39
+ return process.env[envName];
40
+ }
41
+ throw new Error('Telnyx connection ID not found. Provide via options.connectionId, secrets["telnyx.connectionId"], or TELNYX_CONNECTION_ID env var.');
42
+ }
43
+ function resolvePublicKey(options, secrets) {
44
+ if (options.publicKey)
45
+ return options.publicKey;
46
+ if (secrets?.['telnyx.publicKey'])
47
+ return secrets['telnyx.publicKey'];
48
+ return process.env['TELNYX_PUBLIC_KEY'] ?? undefined;
49
+ }
50
+ function resolveFromNumber(options) {
51
+ return options.fromNumber ?? process.env['TELNYX_FROM_NUMBER'] ?? undefined;
52
+ }
53
+ // ============================================================================
54
+ // Factory
55
+ // ============================================================================
56
+ function createExtensionPack(context) {
57
+ const options = (context.options ?? {});
58
+ const apiKey = resolveApiKey(options, options.secrets);
59
+ const connectionId = resolveConnectionId(options, options.secrets);
60
+ const publicKey = resolvePublicKey(options, options.secrets);
61
+ const fromNumber = resolveFromNumber(options);
62
+ const config = {
63
+ apiKey,
64
+ connectionId,
65
+ publicKey,
66
+ fromNumber,
67
+ };
68
+ // Create service and provider
69
+ const service = new TelnyxVoiceService_1.TelnyxVoiceService(config);
70
+ const provider = new TelnyxVoiceProvider_1.TelnyxVoiceProvider(service, config);
71
+ // Create a CallManager to back the tool handler
72
+ const callManager = new agentos_1.CallManager({
73
+ provider: { provider: 'telnyx', config: { apiKey, connectionId, fromNumber: fromNumber ?? '' } },
74
+ webhookBaseUrl: options.webhookBaseUrl,
75
+ defaultMode: 'conversation',
76
+ });
77
+ callManager.registerProvider(provider);
78
+ // Wire tool handler to CallManager
79
+ const toolHandler = {
80
+ async initiateCall(toNumber, message, mode) {
81
+ return callManager.initiateCall({ toNumber, message, mode });
82
+ },
83
+ speakText(callId, text) {
84
+ callManager.speakText(callId, text);
85
+ },
86
+ async hangupCall(callId) {
87
+ await callManager.hangupCall(callId);
88
+ },
89
+ getCallStatus(callId) {
90
+ return callManager.getCall(callId);
91
+ },
92
+ getActiveCalls() {
93
+ return callManager.getActiveCalls();
94
+ },
95
+ };
96
+ const voiceCallTool = new voiceCall_1.TelnyxVoiceCallTool(toolHandler);
97
+ const priority = options.priority ?? 50;
98
+ return {
99
+ name: '@framers/agentos-ext-voice-telnyx',
100
+ version: '0.1.0',
101
+ descriptors: [
102
+ { id: 'telnyxVoiceCall', kind: 'tool', priority, payload: voiceCallTool },
103
+ { id: 'telnyxVoiceProvider', kind: 'voice-provider', priority, payload: provider },
104
+ ],
105
+ onActivate: async () => {
106
+ await service.initialize();
107
+ context.logger?.info('[TelnyxVoice] Extension activated');
108
+ },
109
+ onDeactivate: async () => {
110
+ callManager.dispose();
111
+ await service.shutdown();
112
+ context.logger?.info('[TelnyxVoice] Extension deactivated');
113
+ },
114
+ };
115
+ }
116
+ // ── Re-exports ──
117
+ var TelnyxVoiceService_2 = require("./TelnyxVoiceService");
118
+ Object.defineProperty(exports, "TelnyxVoiceService", { enumerable: true, get: function () { return TelnyxVoiceService_2.TelnyxVoiceService; } });
119
+ var TelnyxVoiceProvider_2 = require("./TelnyxVoiceProvider");
120
+ Object.defineProperty(exports, "TelnyxVoiceProvider", { enumerable: true, get: function () { return TelnyxVoiceProvider_2.TelnyxVoiceProvider; } });
121
+ var voiceCall_2 = require("./tools/voiceCall");
122
+ Object.defineProperty(exports, "TelnyxVoiceCallTool", { enumerable: true, get: function () { return voiceCall_2.TelnyxVoiceCallTool; } });
123
+ exports.default = createExtensionPack;
124
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,cAAc;AACd;;;;;;;GAOG;;;AAgFH,kDAoEC;AAjJD,8CAA+C;AAC/C,6DAAoF;AACpF,+DAA4D;AAC5D,iDAAmF;AAqBnF,+EAA+E;AAC/E,0BAA0B;AAC1B,+EAA+E;AAE/E,SAAS,aAAa,CACpB,OAA2B,EAC3B,OAAgC;IAEhC,IAAI,OAAO,CAAC,MAAM;QAAE,OAAO,OAAO,CAAC,MAAM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AAA;AAC5B,+CAAmF;AAA1E,gHAAA,mBAAmB,OAAA;AAC5B,kBAAe,mBAAmB,CAAC"}
@@ -0,0 +1,116 @@
1
+ /**
2
+ * @fileoverview ITool for initiating and managing voice calls via Telnyx.
3
+ *
4
+ * Follows the same VoiceCallToolHandler pattern used by other telephony
5
+ * providers (Twilio, Plivo) to provide a consistent tool interface for
6
+ * the AgentOS tool orchestrator.
7
+ *
8
+ * @module @framers/agentos-ext-voice-telnyx/tools/voiceCall
9
+ */
10
+ import type { ITool, ToolExecutionContext, ToolExecutionResult } from '@framers/agentos';
11
+ import type { CallMode, CallRecord } from '@framers/agentos';
12
+ /**
13
+ * Abstraction over voice call operations. The extension's index.ts wires
14
+ * a concrete handler backed by CallManager + TelnyxVoiceProvider.
15
+ */
16
+ export interface VoiceCallToolHandler {
17
+ /** Initiate a new outbound call. */
18
+ initiateCall(toNumber: string, message?: string, mode?: CallMode): Promise<CallRecord>;
19
+ /** Speak text into an active call. */
20
+ speakText(callId: string, text: string): void;
21
+ /** Hang up an active call. */
22
+ hangupCall(callId: string): Promise<void>;
23
+ /** Get the current status of a call. */
24
+ getCallStatus(callId: string): CallRecord | undefined;
25
+ /** List all active (non-terminal) calls. */
26
+ getActiveCalls(): CallRecord[];
27
+ }
28
+ export declare class TelnyxVoiceCallTool implements ITool {
29
+ private readonly handler;
30
+ readonly id = "telnyxVoiceCall";
31
+ readonly name = "telnyxVoiceCall";
32
+ readonly displayName = "Telnyx Voice Call";
33
+ readonly description = "Make and manage phone calls via Telnyx. Supports outbound calling, in-call TTS, hangup, and status queries.";
34
+ readonly category = "voice";
35
+ readonly version = "0.1.0";
36
+ readonly hasSideEffects = true;
37
+ readonly inputSchema: {
38
+ type: "object";
39
+ required: readonly ["action"];
40
+ properties: {
41
+ action: {
42
+ type: string;
43
+ enum: string[];
44
+ description: string;
45
+ };
46
+ toNumber: {
47
+ type: string;
48
+ description: string;
49
+ };
50
+ message: {
51
+ type: string;
52
+ description: string;
53
+ };
54
+ mode: {
55
+ type: string;
56
+ enum: string[];
57
+ description: string;
58
+ };
59
+ callId: {
60
+ type: string;
61
+ description: string;
62
+ };
63
+ };
64
+ };
65
+ readonly outputSchema: {
66
+ type: "object";
67
+ properties: {
68
+ callId: {
69
+ type: string;
70
+ description: string;
71
+ };
72
+ state: {
73
+ type: string;
74
+ description: string;
75
+ };
76
+ provider: {
77
+ type: string;
78
+ description: string;
79
+ };
80
+ calls: {
81
+ type: string;
82
+ description: string;
83
+ items: {
84
+ type: string;
85
+ properties: {
86
+ callId: {
87
+ type: string;
88
+ };
89
+ state: {
90
+ type: string;
91
+ };
92
+ toNumber: {
93
+ type: string;
94
+ };
95
+ fromNumber: {
96
+ type: string;
97
+ };
98
+ };
99
+ };
100
+ };
101
+ };
102
+ };
103
+ constructor(handler: VoiceCallToolHandler);
104
+ execute(args: {
105
+ action: 'call' | 'speak' | 'hangup' | 'status' | 'list';
106
+ toNumber?: string;
107
+ message?: string;
108
+ mode?: CallMode;
109
+ callId?: string;
110
+ }, _context: ToolExecutionContext): Promise<ToolExecutionResult>;
111
+ validateArgs(args: Record<string, any>): {
112
+ isValid: boolean;
113
+ errors?: string[];
114
+ };
115
+ }
116
+ //# sourceMappingURL=voiceCall.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voiceCall.d.ts","sourceRoot":"","sources":["../../src/tools/voiceCall.ts"],"names":[],"mappings":"AACA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAM7D;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,oCAAoC;IACpC,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;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@@ -0,0 +1,190 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ /**
4
+ * @fileoverview ITool for initiating and managing voice calls via Telnyx.
5
+ *
6
+ * Follows the same VoiceCallToolHandler pattern used by other telephony
7
+ * providers (Twilio, Plivo) to provide a consistent tool interface for
8
+ * the AgentOS tool orchestrator.
9
+ *
10
+ * @module @framers/agentos-ext-voice-telnyx/tools/voiceCall
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.TelnyxVoiceCallTool = void 0;
14
+ // ============================================================================
15
+ // Tool Implementation
16
+ // ============================================================================
17
+ class TelnyxVoiceCallTool {
18
+ constructor(handler) {
19
+ this.handler = handler;
20
+ this.id = 'telnyxVoiceCall';
21
+ this.name = 'telnyxVoiceCall';
22
+ this.displayName = 'Telnyx Voice Call';
23
+ this.description = 'Make and manage phone calls via Telnyx. Supports outbound calling, in-call TTS, hangup, and status queries.';
24
+ this.category = 'voice';
25
+ this.version = '0.1.0';
26
+ this.hasSideEffects = true;
27
+ this.inputSchema = {
28
+ type: 'object',
29
+ required: ['action'],
30
+ properties: {
31
+ action: {
32
+ type: 'string',
33
+ enum: ['call', 'speak', 'hangup', 'status', 'list'],
34
+ description: 'The voice call action to perform',
35
+ },
36
+ toNumber: {
37
+ type: 'string',
38
+ description: 'E.164 phone number to call (required for "call" action)',
39
+ },
40
+ message: {
41
+ type: 'string',
42
+ description: 'Message to speak (for "call" in notify mode, or "speak" action)',
43
+ },
44
+ mode: {
45
+ type: 'string',
46
+ enum: ['notify', 'conversation'],
47
+ description: 'Call interaction mode (default: "conversation")',
48
+ },
49
+ callId: {
50
+ type: 'string',
51
+ description: 'Call ID (required for "speak", "hangup", and "status" actions)',
52
+ },
53
+ },
54
+ };
55
+ this.outputSchema = {
56
+ type: 'object',
57
+ properties: {
58
+ callId: { type: 'string', description: 'Internal call identifier' },
59
+ state: { type: 'string', description: 'Current call state' },
60
+ provider: { type: 'string', description: 'Telephony provider name' },
61
+ calls: {
62
+ type: 'array',
63
+ description: 'List of active calls (for "list" action)',
64
+ items: {
65
+ type: 'object',
66
+ properties: {
67
+ callId: { type: 'string' },
68
+ state: { type: 'string' },
69
+ toNumber: { type: 'string' },
70
+ fromNumber: { type: 'string' },
71
+ },
72
+ },
73
+ },
74
+ },
75
+ };
76
+ }
77
+ async execute(args, _context) {
78
+ try {
79
+ switch (args.action) {
80
+ case 'call': {
81
+ if (!args.toNumber) {
82
+ return { success: false, error: 'toNumber is required for "call" action' };
83
+ }
84
+ const call = await this.handler.initiateCall(args.toNumber, args.message, args.mode ?? 'conversation');
85
+ return {
86
+ success: true,
87
+ output: {
88
+ callId: call.callId,
89
+ state: call.state,
90
+ provider: call.provider,
91
+ toNumber: call.toNumber,
92
+ fromNumber: call.fromNumber,
93
+ },
94
+ };
95
+ }
96
+ case 'speak': {
97
+ if (!args.callId || !args.message) {
98
+ return { success: false, error: 'callId and message are required for "speak" action' };
99
+ }
100
+ this.handler.speakText(args.callId, args.message);
101
+ return { success: true, output: { callId: args.callId, action: 'speak' } };
102
+ }
103
+ case 'hangup': {
104
+ if (!args.callId) {
105
+ return { success: false, error: 'callId is required for "hangup" action' };
106
+ }
107
+ await this.handler.hangupCall(args.callId);
108
+ return { success: true, output: { callId: args.callId, action: 'hangup' } };
109
+ }
110
+ case 'status': {
111
+ if (!args.callId) {
112
+ return { success: false, error: 'callId is required for "status" action' };
113
+ }
114
+ const call = this.handler.getCallStatus(args.callId);
115
+ if (!call) {
116
+ return { success: false, error: `Call not found: ${args.callId}` };
117
+ }
118
+ return {
119
+ success: true,
120
+ output: {
121
+ callId: call.callId,
122
+ state: call.state,
123
+ provider: call.provider,
124
+ direction: call.direction,
125
+ mode: call.mode,
126
+ toNumber: call.toNumber,
127
+ fromNumber: call.fromNumber,
128
+ transcriptLength: call.transcript.length,
129
+ createdAt: call.createdAt,
130
+ endedAt: call.endedAt,
131
+ },
132
+ };
133
+ }
134
+ case 'list': {
135
+ const calls = this.handler.getActiveCalls();
136
+ return {
137
+ success: true,
138
+ output: {
139
+ calls: calls.map((c) => ({
140
+ callId: c.callId,
141
+ state: c.state,
142
+ toNumber: c.toNumber,
143
+ fromNumber: c.fromNumber,
144
+ direction: c.direction,
145
+ mode: c.mode,
146
+ createdAt: c.createdAt,
147
+ })),
148
+ count: calls.length,
149
+ },
150
+ };
151
+ }
152
+ default:
153
+ return { success: false, error: `Unknown action: ${args.action}` };
154
+ }
155
+ }
156
+ catch (error) {
157
+ return { success: false, error: error.message };
158
+ }
159
+ }
160
+ validateArgs(args) {
161
+ const errors = [];
162
+ if (!args.action) {
163
+ errors.push('action is required');
164
+ }
165
+ else if (!['call', 'speak', 'hangup', 'status', 'list'].includes(args.action)) {
166
+ errors.push('action must be one of: call, speak, hangup, status, list');
167
+ }
168
+ if (args.action === 'call' && !args.toNumber) {
169
+ errors.push('toNumber is required for "call" action');
170
+ }
171
+ if (args.action === 'speak') {
172
+ if (!args.callId)
173
+ errors.push('callId is required for "speak" action');
174
+ if (!args.message)
175
+ errors.push('message is required for "speak" action');
176
+ }
177
+ if (args.action === 'hangup' && !args.callId) {
178
+ errors.push('callId is required for "hangup" action');
179
+ }
180
+ if (args.action === 'status' && !args.callId) {
181
+ errors.push('callId is required for "status" action');
182
+ }
183
+ if (args.mode && !['notify', 'conversation'].includes(args.mode)) {
184
+ errors.push('mode must be "notify" or "conversation"');
185
+ }
186
+ return { isValid: errors.length === 0, errors };
187
+ }
188
+ }
189
+ exports.TelnyxVoiceCallTool = TelnyxVoiceCallTool;
190
+ //# sourceMappingURL=voiceCall.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voiceCall.js","sourceRoot":"","sources":["../../src/tools/voiceCall.ts"],"names":[],"mappings":";AAAA,cAAc;AACd;;;;;;;;GAQG;;;AA0BH,+EAA+E;AAC/E,sBAAsB;AACtB,+EAA+E;AAE/E,MAAa,mBAAmB;IA6D9B,YAA6B,OAA6B;QAA7B,YAAO,GAAP,OAAO,CAAsB;QA5D1C,OAAE,GAAG,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M,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IAClD,CAAC;CACF;AApMD,kDAoMC"}
package/manifest.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://agentos.sh/schemas/extension-manifest-v1.json",
3
3
  "id": "com.framers.voice.telnyx",
4
4
  "name": "Telnyx Voice Call Extension",
5
- "version": "0.1.0",
5
+ "version": "0.1.1",
6
6
  "description": "Telnyx telephony provider for voice calls via Call Control v2 — outbound/inbound calls, TTS speak commands, and bidirectional media streaming.",
7
7
  "categories": ["voice", "telephony"],
8
8
  "platforms": ["telnyx"],
package/package.json CHANGED
@@ -1,31 +1,54 @@
1
1
  {
2
2
  "name": "@framers/agentos-ext-voice-telnyx",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Telnyx voice call provider for AgentOS — outbound/inbound calls via Telnyx Call Control v2",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
- "scripts": {
8
- "build": "tsc",
9
- "dev": "tsc --watch",
10
- "test": "vitest run",
11
- "test:watch": "vitest watch",
12
- "clean": "rm -rf dist"
7
+ "keywords": [
8
+ "agentos",
9
+ "extension",
10
+ "voice",
11
+ "telnyx",
12
+ "telephony"
13
+ ],
14
+ "author": {
15
+ "name": "Framers AI",
16
+ "url": "https://frame.dev"
13
17
  },
14
- "keywords": ["agentos", "extension", "voice", "telnyx", "telephony"],
15
- "author": { "name": "Framers AI", "url": "https://frame.dev" },
16
18
  "license": "MIT",
17
- "files": ["dist", "manifest.json"],
19
+ "files": [
20
+ "dist",
21
+ "manifest.json"
22
+ ],
18
23
  "peerDependencies": {
19
- "@framers/agentos": "^0.1.0"
24
+ "@framers/agentos": "^0.10.28"
20
25
  },
21
26
  "dependencies": {
22
27
  "telnyx": "^2.0.0"
23
28
  },
24
29
  "devDependencies": {
25
- "@framers/agentos": "workspace:*",
26
30
  "@types/node": "^20.0.0",
27
31
  "typescript": "^5.0.0",
28
- "vitest": "^1.0.0"
32
+ "vitest": "^1.0.0",
33
+ "@framers/agentos": "^0.10.28"
34
+ },
35
+ "engines": {
36
+ "node": ">=18.0.0"
37
+ },
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/framerslab/agentos-extensions.git",
41
+ "directory": "registry/curated/voice/telnyx"
29
42
  },
30
- "engines": { "node": ">=18.0.0" }
31
- }
43
+ "homepage": "https://github.com/framerslab/agentos-extensions/tree/master/registry/curated/voice/telnyx#readme",
44
+ "bugs": {
45
+ "url": "https://github.com/framerslab/agentos-extensions/issues"
46
+ },
47
+ "scripts": {
48
+ "build": "tsc",
49
+ "dev": "tsc --watch",
50
+ "test": "vitest run --passWithNoTests",
51
+ "test:watch": "vitest watch",
52
+ "clean": "rm -rf dist"
53
+ }
54
+ }