@sinch/functions-runtime 0.4.7 → 0.4.9
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/dist/bin/sinch-runtime.js +1 -0
- package/dist/bin/sinch-runtime.js.map +1 -1
- package/dist/index.d.ts +19 -2
- package/dist/index.js +9 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -137,7 +137,20 @@ export interface RunMenuAction extends BaseAction {
|
|
|
137
137
|
enableDice?: boolean;
|
|
138
138
|
custom?: string;
|
|
139
139
|
}
|
|
140
|
-
/** Connect to
|
|
140
|
+
/** Connect to a WebSocket media stream (Sinch agents SDK) */
|
|
141
|
+
export interface ConnectStreamAction extends BaseAction {
|
|
142
|
+
name: "connectStream";
|
|
143
|
+
destination: {
|
|
144
|
+
type: "websocket";
|
|
145
|
+
endpoint: string;
|
|
146
|
+
};
|
|
147
|
+
streamingOptions?: {
|
|
148
|
+
sampleRate?: 8000 | 16000;
|
|
149
|
+
maxFrameSizeMs?: 20 | 40;
|
|
150
|
+
};
|
|
151
|
+
custom?: string;
|
|
152
|
+
}
|
|
153
|
+
/** Connect to an AI agent via SIP (e.g. ElevenLabs) */
|
|
141
154
|
export interface ConnectAgentAction extends BaseAction {
|
|
142
155
|
name: "connectSip";
|
|
143
156
|
destination: {
|
|
@@ -146,9 +159,10 @@ export interface ConnectAgentAction extends BaseAction {
|
|
|
146
159
|
cli?: string;
|
|
147
160
|
maxDuration?: number;
|
|
148
161
|
suppressCallbacks?: boolean;
|
|
162
|
+
custom?: string;
|
|
149
163
|
}
|
|
150
164
|
/** Union type for all SVAML actions */
|
|
151
|
-
export type SvamletAction = HangupAction | ContinueAction | ConnectPstnAction | ConnectSipAction | ConnectMxpAction | ConnectConfAction | ParkAction | RunMenuAction | ConnectAgentAction;
|
|
165
|
+
export type SvamletAction = HangupAction | ContinueAction | ConnectPstnAction | ConnectSipAction | ConnectMxpAction | ConnectConfAction | ParkAction | RunMenuAction | ConnectStreamAction | ConnectAgentAction;
|
|
152
166
|
/** Menu option definition */
|
|
153
167
|
export interface MenuOption {
|
|
154
168
|
dtmf: string;
|
|
@@ -387,6 +401,9 @@ export declare const MenuTemplates: {
|
|
|
387
401
|
* Supported AI agent providers
|
|
388
402
|
*/
|
|
389
403
|
export declare enum AgentProvider {
|
|
404
|
+
/** Sinch agents SDK — WebSocket media stream (default) */
|
|
405
|
+
Sinch = "sinch",
|
|
406
|
+
/** ElevenLabs — SIP-based agent */
|
|
390
407
|
ElevenLabs = "elevenlabs"
|
|
391
408
|
}
|
|
392
409
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// ../runtime-shared/dist/ai/connect-agent.js
|
|
2
2
|
var AgentProvider;
|
|
3
3
|
(function(AgentProvider2) {
|
|
4
|
+
AgentProvider2["Sinch"] = "sinch";
|
|
4
5
|
AgentProvider2["ElevenLabs"] = "elevenlabs";
|
|
5
6
|
})(AgentProvider || (AgentProvider = {}));
|
|
6
7
|
var AgentSipHelper = class {
|
|
@@ -28,23 +29,17 @@ var AgentSipHelper = class {
|
|
|
28
29
|
}
|
|
29
30
|
};
|
|
30
31
|
function createConnectAgentAction(provider, agentId, options) {
|
|
32
|
+
if (provider === AgentProvider.Sinch) {
|
|
33
|
+
throw new Error("AgentProvider.Sinch uses connectStream, not connectSip. Use connectAgent() from @sinch/agents instead.");
|
|
34
|
+
}
|
|
31
35
|
const sipUri = AgentSipHelper.buildSipUri(provider, agentId, options);
|
|
32
|
-
|
|
36
|
+
return {
|
|
33
37
|
name: "connectSip",
|
|
34
|
-
destination: {
|
|
35
|
-
|
|
36
|
-
}
|
|
38
|
+
destination: { endpoint: sipUri },
|
|
39
|
+
...options?.cli && { cli: options.cli },
|
|
40
|
+
...options?.maxDuration !== void 0 && { maxDuration: options.maxDuration },
|
|
41
|
+
...options?.suppressCallbacks !== void 0 && { suppressCallbacks: options.suppressCallbacks }
|
|
37
42
|
};
|
|
38
|
-
if (options?.cli) {
|
|
39
|
-
action.cli = options.cli;
|
|
40
|
-
}
|
|
41
|
-
if (options?.maxDuration !== void 0) {
|
|
42
|
-
action.maxDuration = options.maxDuration;
|
|
43
|
-
}
|
|
44
|
-
if (options?.suppressCallbacks !== void 0) {
|
|
45
|
-
action.suppressCallbacks = options.suppressCallbacks;
|
|
46
|
-
}
|
|
47
|
-
return action;
|
|
48
43
|
}
|
|
49
44
|
|
|
50
45
|
// ../runtime-shared/dist/builders/svaml.js
|