@solo3li/backend-node 1.0.1 → 1.0.3

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/index.d.ts CHANGED
@@ -16,4 +16,11 @@ export declare class CPaaSClient {
16
16
  private client;
17
17
  constructor(config: CPaaSConfig);
18
18
  createConnectionToken(request: CreateTokenRequest): Promise<CreateTokenResponse>;
19
+ createTransferToken(roomId: string, agentName: string): Promise<{
20
+ token: string;
21
+ livekitUrl: string;
22
+ }>;
23
+ initiateSipTransfer(roomId: string, sipUri: string): Promise<{
24
+ success: boolean;
25
+ }>;
19
26
  }
package/dist/index.js CHANGED
@@ -32,5 +32,35 @@ class CPaaSClient {
32
32
  throw error;
33
33
  }
34
34
  }
35
+ async createTransferToken(roomId, agentName) {
36
+ try {
37
+ const response = await this.client.post('/api/Connection/transfer-token', {
38
+ roomId,
39
+ participantName: agentName
40
+ });
41
+ return response.data;
42
+ }
43
+ catch (error) {
44
+ if (error.response) {
45
+ throw new Error(`CPaaS API Error: ${error.response.status} - ${JSON.stringify(error.response.data)}`);
46
+ }
47
+ throw error;
48
+ }
49
+ }
50
+ async initiateSipTransfer(roomId, sipUri) {
51
+ try {
52
+ const response = await this.client.post('/api/Connection/sip-transfer', {
53
+ roomId,
54
+ sipUri
55
+ });
56
+ return response.data;
57
+ }
58
+ catch (error) {
59
+ if (error.response) {
60
+ throw new Error(`CPaaS API Error: ${error.response.status} - ${JSON.stringify(error.response.data)}`);
61
+ }
62
+ throw error;
63
+ }
64
+ }
35
65
  }
36
66
  exports.CPaaSClient = CPaaSClient;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solo3li/backend-node",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Node.js SDK for Voice AI CPaaS",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",