@cognigy/click-to-call-sdk 0.1.1 → 0.2.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/README.md +2 -0
- package/dist/ConfigManager.d.ts +1 -0
- package/dist/SessionManager.d.ts +2 -1
- package/dist/WebRTCClient.d.ts +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/types/index.d.ts +7 -0
- package/dist/utils/events.d.ts +1 -0
- package/dist/webRTCSDK.cjs.js +1 -1
- package/dist/webRTCSDK.cjs.js.br +0 -0
- package/dist/webRTCSDK.cjs.js.gz +0 -0
- package/dist/webRTCSDK.es.js +1 -1
- package/dist/webRTCSDK.es.js.br +0 -0
- package/dist/webRTCSDK.es.js.gz +0 -0
- package/dist/webRTCSDK.js +1 -1
- package/dist/webRTCSDK.js.br +0 -0
- package/dist/webRTCSDK.js.gz +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -73,6 +73,7 @@ interface WebRTCClientConfig {
|
|
|
73
73
|
| `endCall()` | End the current call |
|
|
74
74
|
| `mute()` / `unmute()` | Toggle microphone |
|
|
75
75
|
| `sendInfo(text, data?)` | Send info message during a call |
|
|
76
|
+
| `sendDTMF(tones, options?)` | Send DTMF tones (`0-9 A-D # * ,`) during a call |
|
|
76
77
|
| `isConnected()` | Check connection state |
|
|
77
78
|
| `getCurrentSession()` | Get active `CallSession` or `null` |
|
|
78
79
|
| `on(event, callback)` | Add event listener (returns `this`) |
|
|
@@ -97,6 +98,7 @@ interface WebRTCClientConfig {
|
|
|
97
98
|
| `captureAudio` | Remote audio stream available (requires opt-in) `(stream: MediaStream)` |
|
|
98
99
|
| `audioEnded` | `()` |
|
|
99
100
|
| `infoSent` | `(text: string, data: Record<string, any>)` |
|
|
101
|
+
| `dtmfSent` | `(tones: string)` |
|
|
100
102
|
| `infoReceived` | `(data: { originator: string; info: { body: string } })` |
|
|
101
103
|
| `transcription` | `(transcription: { originator: string; messages: { text: string }[] })` |
|
|
102
104
|
| `error` | `(error: Error)` |
|
package/dist/ConfigManager.d.ts
CHANGED
package/dist/SessionManager.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SDKEventEmitter } from './utils/events.js';
|
|
2
2
|
import { ExtendedRTCSession } from './types/internal.js';
|
|
3
|
-
import { CallSession } from './types/index.js';
|
|
3
|
+
import { CallSession, SendDTMFOptions } from './types/index.js';
|
|
4
4
|
export declare class SessionManager extends SDKEventEmitter {
|
|
5
5
|
private sessions;
|
|
6
6
|
private activeSessionId;
|
|
@@ -21,6 +21,7 @@ export declare class SessionManager extends SDKEventEmitter {
|
|
|
21
21
|
getAllSessions(): CallSession[];
|
|
22
22
|
mute(): void;
|
|
23
23
|
unmute(): void;
|
|
24
|
+
sendDTMF(tones: string | number, options?: SendDTMFOptions): void;
|
|
24
25
|
sendInfo(text: string, data?: Record<string, any>): void;
|
|
25
26
|
terminate(sipCode?: number, sipReason?: string): void;
|
|
26
27
|
private getActiveSessionState;
|
package/dist/WebRTCClient.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SDKEventEmitter } from './utils/events.js';
|
|
2
|
-
import { WebRTCClient as IWebRTCClient, WebRTCClientConfig, CallSession, EventName, EventCallback } from './types/index.js';
|
|
2
|
+
import { WebRTCClient as IWebRTCClient, WebRTCClientConfig, CallSession, EventName, EventCallback, SendDTMFOptions } from './types/index.js';
|
|
3
3
|
export declare class WebRTCClient extends SDKEventEmitter implements IWebRTCClient {
|
|
4
4
|
private configManager;
|
|
5
5
|
private sipManager;
|
|
@@ -16,6 +16,7 @@ export declare class WebRTCClient extends SDKEventEmitter implements IWebRTCClie
|
|
|
16
16
|
mute(): Promise<void>;
|
|
17
17
|
unmute(): Promise<void>;
|
|
18
18
|
connectAndCall(): Promise<void>;
|
|
19
|
+
sendDTMF(tones: string | number, options?: SendDTMFOptions): Promise<void>;
|
|
19
20
|
sendInfo(text: string, data?: Record<string, any>): Promise<void>;
|
|
20
21
|
on<T extends EventName>(event: T, callback: EventCallback<T>): this;
|
|
21
22
|
off<T extends EventName>(event: T, callback: EventCallback<T>): this;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WebRTCClient } from './WebRTCClient.js';
|
|
2
2
|
import { isWebRTCSupported } from './utils/helpers.js';
|
|
3
3
|
import { WebRTCClientConfig } from './types/index.js';
|
|
4
|
-
export type { WebRTCClient as IWebRTCClient, WebRTCClientConfig, CreateWebRTCClientOptions, CreateWebRTCClient, EndpointConfig, SipConnectivityInfo, CallSession, CallEndInfo, SessionStatus, EventName, EventCallback, WebRTCClientEvents, } from './types/index.js';
|
|
4
|
+
export type { WebRTCClient as IWebRTCClient, WebRTCClientConfig, CreateWebRTCClientOptions, CreateWebRTCClient, EndpointConfig, SipConnectivityInfo, CallSession, CallEndInfo, SessionStatus, EventName, EventCallback, WebRTCClientEvents, SendDTMFOptions, } from './types/index.js';
|
|
5
5
|
export { WebRTCClient };
|
|
6
6
|
export { isWebRTCSupported };
|
|
7
7
|
export declare function createWebRTCClient(config: WebRTCClientConfig): Promise<WebRTCClient>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -60,6 +60,11 @@ export interface CallEndInfo {
|
|
|
60
60
|
cause: string | null;
|
|
61
61
|
description?: string | null;
|
|
62
62
|
}
|
|
63
|
+
export interface SendDTMFOptions {
|
|
64
|
+
duration?: number;
|
|
65
|
+
interToneGap?: number;
|
|
66
|
+
transportType?: 'INFO' | 'RFC2833';
|
|
67
|
+
}
|
|
63
68
|
export interface WebRTCClientEvents {
|
|
64
69
|
'connecting': () => void;
|
|
65
70
|
'connected': () => void;
|
|
@@ -74,6 +79,7 @@ export interface WebRTCClientEvents {
|
|
|
74
79
|
'unmuted': (session: CallSession) => void;
|
|
75
80
|
'audioEnded': () => void;
|
|
76
81
|
'infoSent': (text: string, data: Record<string, any>) => void;
|
|
82
|
+
'dtmfSent': (tones: string) => void;
|
|
77
83
|
'infoReceived': (data: {
|
|
78
84
|
originator: string;
|
|
79
85
|
info: any;
|
|
@@ -89,6 +95,7 @@ export interface WebRTCClient {
|
|
|
89
95
|
endCall(): Promise<void>;
|
|
90
96
|
mute(): Promise<void>;
|
|
91
97
|
unmute(): Promise<void>;
|
|
98
|
+
sendDTMF(tones: string | number, options?: SendDTMFOptions): Promise<void>;
|
|
92
99
|
sendInfo(text: string, data?: Record<string, any>): Promise<void>;
|
|
93
100
|
on<T extends EventName>(event: T, callback: EventCallback<T>): this;
|
|
94
101
|
off<T extends EventName>(event: T, callback: EventCallback<T>): this;
|
package/dist/utils/events.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export declare const COGNIGY_WEBRTC_EVENTS: {
|
|
|
24
24
|
readonly UNMUTED: "unmuted";
|
|
25
25
|
readonly AUDIO_ENDED: "audioEnded";
|
|
26
26
|
readonly INFO_SENT: "infoSent";
|
|
27
|
+
readonly DTMF_SENT: "dtmfSent";
|
|
27
28
|
readonly ERROR: "error";
|
|
28
29
|
readonly SESSION_CREATED: "sessionCreated";
|
|
29
30
|
readonly SESSION_UPDATED: "sessionUpdated";
|