retell-sdk 2.2.7 → 2.2.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/package.json +1 -1
- package/sdk/audioWsClient.d.ts.map +1 -1
- package/sdk/audioWsClient.js +15 -5
- package/sdk/audioWsClient.js.map +1 -1
- package/src/sdk/audioWsClient.ts +13 -5
- package/example.d.ts +0 -2
- package/example.d.ts.map +0 -1
- package/example.js +0 -143
- package/example.js.map +0 -1
- package/src/example.ts +0 -158
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audioWsClient.d.ts","sourceRoot":"","sources":["../src/sdk/audioWsClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAK7C,qBAAa,aAAc,SAAQ,YAAY;IAC7C,OAAO,CAAC,EAAE,CAAY;gBAEV,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"audioWsClient.d.ts","sourceRoot":"","sources":["../src/sdk/audioWsClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAK7C,qBAAa,aAAc,SAAQ,YAAY;IAC7C,OAAO,CAAC,EAAE,CAAY;gBAEV,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM;IAiCnD,IAAI,CAAC,KAAK,EAAE,UAAU;IAMtB,KAAK;CAGN;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG,YAAY,CAWrE;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,CAUrE"}
|
package/sdk/audioWsClient.js
CHANGED
|
@@ -16,13 +16,23 @@ class AudioWsClient extends eventemitter3_1.EventEmitter {
|
|
|
16
16
|
this.ws = new isomorphic_ws_1.default(endpoint);
|
|
17
17
|
this.ws.binaryType = "arraybuffer";
|
|
18
18
|
this.ws.onmessage = (event) => {
|
|
19
|
-
|
|
20
|
-
if (
|
|
21
|
-
|
|
19
|
+
// Check if the data is a string (text data)
|
|
20
|
+
if (typeof event.data === "string") {
|
|
21
|
+
if (event.data === "clear") {
|
|
22
|
+
this.emit("clear");
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
// Handle other text data if necessary
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
else if (event.data instanceof ArrayBuffer) {
|
|
29
|
+
// Handle binary data (ArrayBuffer)
|
|
30
|
+
const audio = new Uint8Array(event.data);
|
|
31
|
+
this.emit("audio", audio);
|
|
22
32
|
}
|
|
23
33
|
else {
|
|
24
|
-
|
|
25
|
-
this.
|
|
34
|
+
this.emit("error", "Got unknown message from server.");
|
|
35
|
+
this.ws.close(1002, "Got unknown message from server.");
|
|
26
36
|
}
|
|
27
37
|
};
|
|
28
38
|
this.ws.onclose = (event) => {
|
package/sdk/audioWsClient.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audioWsClient.js","sourceRoot":"","sources":["../src/sdk/audioWsClient.ts"],"names":[],"mappings":";;;;;;AAAA,iDAA6C;AAC7C,kEAAsC;AAEtC,IAAI,YAAY,GAAG,uCAAuC,CAAC;AAE3D,MAAa,aAAc,SAAQ,4BAAY;IAG7C,YAAY,MAAc,EAAE,cAAuB;QACjD,KAAK,EAAE,CAAC;QAER,IAAI,cAAc;YAAE,YAAY,GAAG,cAAc,CAAC;QAClD,MAAM,QAAQ,GAAG,YAAY,GAAG,MAAM,CAAC;QACvC,IAAI,CAAC,EAAE,GAAG,IAAI,uBAAS,CAAC,QAAQ,CAAC,CAAC;QAClC,IAAI,CAAC,EAAE,CAAC,UAAU,GAAG,aAAa,CAAC;QAEnC,IAAI,CAAC,EAAE,CAAC,SAAS,GAAG,CAAC,KAAK,EAAE,EAAE;YAC5B,
|
|
1
|
+
{"version":3,"file":"audioWsClient.js","sourceRoot":"","sources":["../src/sdk/aud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AM,CAAC,CAAC;IAElC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,KAAK,GAAI,KAAK,CAAC,CAAC,CAAY,GAAG,KAAK,CAAC;QAC3C,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,yBAAyB;IAC9D,CAAC;IAED,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC;AAVD,sDAUC"}
|
package/src/sdk/audioWsClient.ts
CHANGED
|
@@ -15,12 +15,20 @@ export class AudioWsClient extends EventEmitter {
|
|
|
15
15
|
this.ws.binaryType = "arraybuffer";
|
|
16
16
|
|
|
17
17
|
this.ws.onmessage = (event) => {
|
|
18
|
-
|
|
19
|
-
if (
|
|
20
|
-
|
|
18
|
+
// Check if the data is a string (text data)
|
|
19
|
+
if (typeof event.data === "string") {
|
|
20
|
+
if (event.data === "clear") {
|
|
21
|
+
this.emit("clear");
|
|
22
|
+
} else {
|
|
23
|
+
// Handle other text data if necessary
|
|
24
|
+
}
|
|
25
|
+
} else if (event.data instanceof ArrayBuffer) {
|
|
26
|
+
// Handle binary data (ArrayBuffer)
|
|
27
|
+
const audio = new Uint8Array(event.data);
|
|
28
|
+
this.emit("audio", audio);
|
|
21
29
|
} else {
|
|
22
|
-
|
|
23
|
-
this.
|
|
30
|
+
this.emit("error", "Got unknown message from server.");
|
|
31
|
+
this.ws.close(1002, "Got unknown message from server.");
|
|
24
32
|
}
|
|
25
33
|
};
|
|
26
34
|
this.ws.onclose = (event) => {
|
package/example.d.ts
DELETED
package/example.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example.d.ts","sourceRoot":"","sources":["src/example.ts"],"names":[],"mappings":""}
|
package/example.js
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const sdk_1 = require("./sdk");
|
|
4
|
-
// import { AudioEncoding, AudioWebsocketProtocol } from "./models/components";
|
|
5
|
-
// import { CallType, SortOrder } from "./models/operations";
|
|
6
|
-
const retell = new sdk_1.RetellClient({
|
|
7
|
-
// Find the key in dashboard
|
|
8
|
-
apiKey: "557e09e6-f8e6-4c24-bf8c-e7a1754e44e2",
|
|
9
|
-
serverURL: "http://localhost:3002",
|
|
10
|
-
});
|
|
11
|
-
async function main() {
|
|
12
|
-
// const res = await retell.createAgent({
|
|
13
|
-
// agentName: "testfunction",
|
|
14
|
-
// llmSetting: {
|
|
15
|
-
// provider: "retell",
|
|
16
|
-
// prompt: "test prompt",
|
|
17
|
-
// },
|
|
18
|
-
// voiceId: "11labs-Ryan",
|
|
19
|
-
// interactionSetting: {
|
|
20
|
-
// enableBeginMessage: true,
|
|
21
|
-
// beginMessage: "Hello there, how can I help you?",
|
|
22
|
-
// enableEndCall: true,
|
|
23
|
-
// enableEndMessage: false,
|
|
24
|
-
// endMessage: "Hope you have a good day, goodbye.",
|
|
25
|
-
// },
|
|
26
|
-
// functions: [{
|
|
27
|
-
// url: "http://localhost:3002/get-weather",
|
|
28
|
-
// description: "Get the current weather in a given location.",
|
|
29
|
-
// name: "get_current_weather",
|
|
30
|
-
// parameters: {
|
|
31
|
-
// type: "object",
|
|
32
|
-
// properties: {
|
|
33
|
-
// location: {
|
|
34
|
-
// type: "string",
|
|
35
|
-
// description: "The city and state, e.g. San Francisco, CA"
|
|
36
|
-
// },
|
|
37
|
-
// unit: {
|
|
38
|
-
// type: "string",
|
|
39
|
-
// enum: ["celsius", "fahrenheit"]
|
|
40
|
-
// }
|
|
41
|
-
// },
|
|
42
|
-
// required: ["location"]
|
|
43
|
-
// }
|
|
44
|
-
// }]
|
|
45
|
-
// });
|
|
46
|
-
// console.log(res.agent);
|
|
47
|
-
// const res = await retell.getAgent("147d9b8e9b698e275d0aaa353bce8864");
|
|
48
|
-
// console.log(res.agent);
|
|
49
|
-
// const res = await retell.updateAgent(
|
|
50
|
-
// {
|
|
51
|
-
// agentName: "new name",
|
|
52
|
-
// interactionSetting: {
|
|
53
|
-
// enableEndCall: true,
|
|
54
|
-
// endMessage: "bye",
|
|
55
|
-
// },
|
|
56
|
-
// functions: [
|
|
57
|
-
// {
|
|
58
|
-
// name: "Test",
|
|
59
|
-
// description: "Test",
|
|
60
|
-
// parameters: {
|
|
61
|
-
// type: "object",
|
|
62
|
-
// required: ["location"],
|
|
63
|
-
// properties: {
|
|
64
|
-
// location: {
|
|
65
|
-
// type: "string",
|
|
66
|
-
// description: "The city and state, e.g. San Francisco, CA",
|
|
67
|
-
// },
|
|
68
|
-
// unit: {
|
|
69
|
-
// type: "string",
|
|
70
|
-
// enum: ["celsius", "fahrenheit"],
|
|
71
|
-
// },
|
|
72
|
-
// },
|
|
73
|
-
// },
|
|
74
|
-
// url: "http://localhost:3002/test",
|
|
75
|
-
// },
|
|
76
|
-
// ],
|
|
77
|
-
// },
|
|
78
|
-
// "ebff89152bc1defa7fa5251451310817",
|
|
79
|
-
// );
|
|
80
|
-
// console.log(res.agent);
|
|
81
|
-
// const res = await retell.getAgent("d9f66007232809aca1c3a6cdb84c3f47");
|
|
82
|
-
// console.log(res.agent);
|
|
83
|
-
// const res = await retell.listAgents();
|
|
84
|
-
// console.log(res.agents);
|
|
85
|
-
const res = await retell.updateAgent({
|
|
86
|
-
llmWebsocketUrl: "wss://123456",
|
|
87
|
-
}, "d9f66007232809aca1c3a6cdb84c3f47");
|
|
88
|
-
console.log(res.agent);
|
|
89
|
-
// const res = await retell.registerCall({
|
|
90
|
-
// agentId: "fd8b5df78d1cdab31194b2b6c349946d",
|
|
91
|
-
// audioEncoding: AudioEncoding.S16le,
|
|
92
|
-
// sampleRate: 24000,
|
|
93
|
-
// audioWebsocketProtocol: AudioWebsocketProtocol.Web,
|
|
94
|
-
// });
|
|
95
|
-
// console.log(res.callDetail);
|
|
96
|
-
// const res2 = await retell.getCall("b9c1fb64bc0f82be50ee83bd236cd437");
|
|
97
|
-
// console.log(res2.callDetail);
|
|
98
|
-
// const agent = await retell.updateAgent({
|
|
99
|
-
// agentName: "new name",
|
|
100
|
-
// interactionSetting: {
|
|
101
|
-
// enableEndCall: true,
|
|
102
|
-
// endMessage: "bye"
|
|
103
|
-
// },
|
|
104
|
-
// }, '5790c196cd6b7728de819c3de444d3b5');
|
|
105
|
-
// console.log(agent.agent);
|
|
106
|
-
// const res = await retell.deleteAgent('5790c196cd6b7728de819c3de444d3b5');
|
|
107
|
-
// console.log(res.statusCode)
|
|
108
|
-
// const res = await retell.createPhoneNumber({
|
|
109
|
-
// agentId: "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD",
|
|
110
|
-
// areaCode: 415,
|
|
111
|
-
// });
|
|
112
|
-
// res.phoneNumber
|
|
113
|
-
// const res = await retell.deletePhoneNumber("+14159095857");
|
|
114
|
-
// console.log(res.statusCode)
|
|
115
|
-
// const res = await retell.getCall("e208e53fe334b42a21bdf065f5b121e1");
|
|
116
|
-
// console.log(res.callDetail);
|
|
117
|
-
// const newPhoneNumber = await retell.createPhoneNumber({
|
|
118
|
-
// agentId: "5790c196cd6b7728de819c3de444d3b5", // Required
|
|
119
|
-
// // areaCode: 415, // Optional, default is 213
|
|
120
|
-
// });
|
|
121
|
-
// console.log("phone number: ", newPhoneNumber);
|
|
122
|
-
// const ongoingCall = await retell.createPhoneCall({
|
|
123
|
-
// phoneNumber: {
|
|
124
|
-
// from: "+12138954697", // Phone number you created
|
|
125
|
-
// to: "+12137134981",
|
|
126
|
-
// },
|
|
127
|
-
// });
|
|
128
|
-
// console.log("phone call: ", ongoingCall);
|
|
129
|
-
// const filterCriteria = {
|
|
130
|
-
// // afterEndTimestamp: 1703302428800,
|
|
131
|
-
// // afterStartTimestamp: 1703302407300,
|
|
132
|
-
// // agentId: ["oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD"],
|
|
133
|
-
// // beforeEndTimestamp: 1703302428899,
|
|
134
|
-
// // beforeStartTimestamp: 1703302407399,
|
|
135
|
-
// callType: [CallType.InboundPhoneCall, CallType.OutboundPhoneCall],
|
|
136
|
-
// };
|
|
137
|
-
// const limit = 1;
|
|
138
|
-
// const sortOrder = SortOrder.Descending;
|
|
139
|
-
// const res = await retell.listCalls(filterCriteria, limit, sortOrder);
|
|
140
|
-
// console.log(res)
|
|
141
|
-
}
|
|
142
|
-
main();
|
|
143
|
-
//# sourceMappingURL=example.js.map
|
package/example.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example.js","sourceRoot":"","sources":["src/example.ts"],"names":[],"mappings":";;AAAA,+BAAqC;AACrC,+EAA+E;AAC/E,6DAA6D;AAE7D,MAAM,MAAM,GAAG,IAAI,kBAAY,CAAC;IAC9B,4BAA4B;IAC5B,MAAM,EAAE,sCAAsC;IAC9C,SAAS,EAAE,uBAAuB;CACnC,CAAC,CAAC;AAEH,KAAK,UAAU,IAAI;IACjB,yCAAyC;IACzC,iCAAiC;IACjC,oBAAoB;IACpB,8BAA8B;IAC9B,iCAAiC;IACjC,SAAS;IACT,8BAA8B;IAC9B,4BAA4B;IAC5B,oCAAoC;IACpC,4DAA4D;IAC5D,+BAA+B;IAC/B,mCAAmC;IACnC,4DAA4D;IAC5D,SAAS;IACT,oBAAoB;IACpB,kDAAkD;IAClD,qEAAqE;IACrE,qCAAqC;IACrC,sBAAsB;IACtB,0BAA0B;IAC1B,wBAAwB;IACxB,wBAAwB;IACxB,8BAA8B;IAC9B,wEAAwE;IACxE,eAAe;IACf,oBAAoB;IACpB,8BAA8B;IAC9B,8CAA8C;IAC9C,cAAc;IACd,aAAa;IACb,iCAAiC;IACjC,UAAU;IACV,SAAS;IACT,MAAM;IACN,0BAA0B;IAE1B,yEAAyE;IACzE,0BAA0B;IAE1B,wCAAwC;IACxC,MAAM;IACN,6BAA6B;IAC7B,4BAA4B;IAC5B,6BAA6B;I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C7C,wDAAwD;IACxD,4CAA4C;IAC5C,8CAA8C;IAC9C,yEAAyE;IACzE,KAAK;IACL,mBAAmB;IACnB,0CAA0C;IAE1C,wEAAwE;IACxE,mBAAmB;AACrB,CAAC;AAED,IAAI,EAAE,CAAC"}
|
package/src/example.ts
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { RetellClient } from "./sdk";
|
|
2
|
-
// import { AudioEncoding, AudioWebsocketProtocol } from "./models/components";
|
|
3
|
-
// import { CallType, SortOrder } from "./models/operations";
|
|
4
|
-
|
|
5
|
-
const retell = new RetellClient({
|
|
6
|
-
// Find the key in dashboard
|
|
7
|
-
apiKey: "557e09e6-f8e6-4c24-bf8c-e7a1754e44e2",
|
|
8
|
-
serverURL: "http://localhost:3002",
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
async function main() {
|
|
12
|
-
// const res = await retell.createAgent({
|
|
13
|
-
// agentName: "testfunction",
|
|
14
|
-
// llmSetting: {
|
|
15
|
-
// provider: "retell",
|
|
16
|
-
// prompt: "test prompt",
|
|
17
|
-
// },
|
|
18
|
-
// voiceId: "11labs-Ryan",
|
|
19
|
-
// interactionSetting: {
|
|
20
|
-
// enableBeginMessage: true,
|
|
21
|
-
// beginMessage: "Hello there, how can I help you?",
|
|
22
|
-
// enableEndCall: true,
|
|
23
|
-
// enableEndMessage: false,
|
|
24
|
-
// endMessage: "Hope you have a good day, goodbye.",
|
|
25
|
-
// },
|
|
26
|
-
// functions: [{
|
|
27
|
-
// url: "http://localhost:3002/get-weather",
|
|
28
|
-
// description: "Get the current weather in a given location.",
|
|
29
|
-
// name: "get_current_weather",
|
|
30
|
-
// parameters: {
|
|
31
|
-
// type: "object",
|
|
32
|
-
// properties: {
|
|
33
|
-
// location: {
|
|
34
|
-
// type: "string",
|
|
35
|
-
// description: "The city and state, e.g. San Francisco, CA"
|
|
36
|
-
// },
|
|
37
|
-
// unit: {
|
|
38
|
-
// type: "string",
|
|
39
|
-
// enum: ["celsius", "fahrenheit"]
|
|
40
|
-
// }
|
|
41
|
-
// },
|
|
42
|
-
// required: ["location"]
|
|
43
|
-
// }
|
|
44
|
-
// }]
|
|
45
|
-
// });
|
|
46
|
-
// console.log(res.agent);
|
|
47
|
-
|
|
48
|
-
// const res = await retell.getAgent("147d9b8e9b698e275d0aaa353bce8864");
|
|
49
|
-
// console.log(res.agent);
|
|
50
|
-
|
|
51
|
-
// const res = await retell.updateAgent(
|
|
52
|
-
// {
|
|
53
|
-
// agentName: "new name",
|
|
54
|
-
// interactionSetting: {
|
|
55
|
-
// enableEndCall: true,
|
|
56
|
-
// endMessage: "bye",
|
|
57
|
-
// },
|
|
58
|
-
// functions: [
|
|
59
|
-
// {
|
|
60
|
-
// name: "Test",
|
|
61
|
-
// description: "Test",
|
|
62
|
-
// parameters: {
|
|
63
|
-
// type: "object",
|
|
64
|
-
// required: ["location"],
|
|
65
|
-
// properties: {
|
|
66
|
-
// location: {
|
|
67
|
-
// type: "string",
|
|
68
|
-
// description: "The city and state, e.g. San Francisco, CA",
|
|
69
|
-
// },
|
|
70
|
-
// unit: {
|
|
71
|
-
// type: "string",
|
|
72
|
-
// enum: ["celsius", "fahrenheit"],
|
|
73
|
-
// },
|
|
74
|
-
// },
|
|
75
|
-
// },
|
|
76
|
-
// url: "http://localhost:3002/test",
|
|
77
|
-
// },
|
|
78
|
-
// ],
|
|
79
|
-
// },
|
|
80
|
-
// "ebff89152bc1defa7fa5251451310817",
|
|
81
|
-
// );
|
|
82
|
-
// console.log(res.agent);
|
|
83
|
-
|
|
84
|
-
// const res = await retell.getAgent("d9f66007232809aca1c3a6cdb84c3f47");
|
|
85
|
-
// console.log(res.agent);
|
|
86
|
-
// const res = await retell.listAgents();
|
|
87
|
-
// console.log(res.agents);
|
|
88
|
-
|
|
89
|
-
const res = await retell.updateAgent(
|
|
90
|
-
{
|
|
91
|
-
llmWebsocketUrl: "wss://123456",
|
|
92
|
-
},
|
|
93
|
-
"d9f66007232809aca1c3a6cdb84c3f47",
|
|
94
|
-
);
|
|
95
|
-
console.log(res.agent);
|
|
96
|
-
|
|
97
|
-
// const res = await retell.registerCall({
|
|
98
|
-
// agentId: "fd8b5df78d1cdab31194b2b6c349946d",
|
|
99
|
-
// audioEncoding: AudioEncoding.S16le,
|
|
100
|
-
// sampleRate: 24000,
|
|
101
|
-
// audioWebsocketProtocol: AudioWebsocketProtocol.Web,
|
|
102
|
-
// });
|
|
103
|
-
// console.log(res.callDetail);
|
|
104
|
-
|
|
105
|
-
// const res2 = await retell.getCall("b9c1fb64bc0f82be50ee83bd236cd437");
|
|
106
|
-
// console.log(res2.callDetail);
|
|
107
|
-
|
|
108
|
-
// const agent = await retell.updateAgent({
|
|
109
|
-
// agentName: "new name",
|
|
110
|
-
// interactionSetting: {
|
|
111
|
-
// enableEndCall: true,
|
|
112
|
-
// endMessage: "bye"
|
|
113
|
-
// },
|
|
114
|
-
// }, '5790c196cd6b7728de819c3de444d3b5');
|
|
115
|
-
// console.log(agent.agent);
|
|
116
|
-
// const res = await retell.deleteAgent('5790c196cd6b7728de819c3de444d3b5');
|
|
117
|
-
// console.log(res.statusCode)
|
|
118
|
-
// const res = await retell.createPhoneNumber({
|
|
119
|
-
// agentId: "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD",
|
|
120
|
-
// areaCode: 415,
|
|
121
|
-
// });
|
|
122
|
-
// res.phoneNumber
|
|
123
|
-
// const res = await retell.deletePhoneNumber("+14159095857");
|
|
124
|
-
// console.log(res.statusCode)
|
|
125
|
-
|
|
126
|
-
// const res = await retell.getCall("e208e53fe334b42a21bdf065f5b121e1");
|
|
127
|
-
|
|
128
|
-
// console.log(res.callDetail);
|
|
129
|
-
|
|
130
|
-
// const newPhoneNumber = await retell.createPhoneNumber({
|
|
131
|
-
// agentId: "5790c196cd6b7728de819c3de444d3b5", // Required
|
|
132
|
-
// // areaCode: 415, // Optional, default is 213
|
|
133
|
-
// });
|
|
134
|
-
// console.log("phone number: ", newPhoneNumber);
|
|
135
|
-
|
|
136
|
-
// const ongoingCall = await retell.createPhoneCall({
|
|
137
|
-
// phoneNumber: {
|
|
138
|
-
// from: "+12138954697", // Phone number you created
|
|
139
|
-
// to: "+12137134981",
|
|
140
|
-
// },
|
|
141
|
-
// });
|
|
142
|
-
// console.log("phone call: ", ongoingCall);
|
|
143
|
-
// const filterCriteria = {
|
|
144
|
-
// // afterEndTimestamp: 1703302428800,
|
|
145
|
-
// // afterStartTimestamp: 1703302407300,
|
|
146
|
-
// // agentId: ["oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD"],
|
|
147
|
-
// // beforeEndTimestamp: 1703302428899,
|
|
148
|
-
// // beforeStartTimestamp: 1703302407399,
|
|
149
|
-
// callType: [CallType.InboundPhoneCall, CallType.OutboundPhoneCall],
|
|
150
|
-
// };
|
|
151
|
-
// const limit = 1;
|
|
152
|
-
// const sortOrder = SortOrder.Descending;
|
|
153
|
-
|
|
154
|
-
// const res = await retell.listCalls(filterCriteria, limit, sortOrder);
|
|
155
|
-
// console.log(res)
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
main();
|