@tmsoft/webphone 3.0.5 → 3.0.7

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 CHANGED
@@ -79,6 +79,12 @@ If `onAnswer`, `onHangup` or `onReject` are provided, the component will call th
79
79
  | Event | Description |
80
80
  | --- | --- |
81
81
  | `back` | Back button pressed |
82
+ | `call-context` | Emits `channelId`, SIP `Call-ID`, direction and remote number when a SIP session is created |
83
+ | `call-state` | Emits `dialing`, `ringing`, `connected`, `ended` or `failed` with the call context |
84
+ | `media-ready` | Emits separate `localStream` and `remoteStream` objects when both audio tracks are ready |
85
+
86
+ `sipCallId` is the SIP dialog identifier. It is not the Asterisk `Uniqueid` or `Linkedid`.
87
+ Consumers may read the emitted streams but must not stop or mutate their tracks; the WebPhone owns their lifecycle.
82
88
 
83
89
  ## License
84
90
 
@@ -3,6 +3,22 @@ export interface WebPhoneContact {
3
3
  number: string;
4
4
  type?: 'tool' | 'extension' | 'contact' | 'voicemail';
5
5
  }
6
+ export type WebPhoneCallDirection = 'incoming' | 'outgoing';
7
+ export type WebPhoneCallState = 'dialing' | 'ringing' | 'connected' | 'ended' | 'failed';
8
+ export interface WebPhoneCallContext {
9
+ channelId: number;
10
+ sipCallId: string;
11
+ direction: WebPhoneCallDirection;
12
+ remoteNumber: string;
13
+ }
14
+ export interface WebPhoneCallStateEvent extends WebPhoneCallContext {
15
+ state: WebPhoneCallState;
16
+ timestamp: number;
17
+ }
18
+ export interface WebPhoneMediaEvent extends WebPhoneCallContext {
19
+ localStream: MediaStream;
20
+ remoteStream: MediaStream;
21
+ }
6
22
  export interface WebPhoneProps {
7
23
  host?: string;
8
24
  wsUrl?: string;
@@ -19,4 +35,7 @@ export interface WebPhoneProps {
19
35
  }
20
36
  export interface WebPhoneEmits {
21
37
  back: () => void;
38
+ 'call-context': (context: WebPhoneCallContext) => void;
39
+ 'call-state': (event: WebPhoneCallStateEvent) => void;
40
+ 'media-ready': (event: WebPhoneMediaEvent) => void;
22
41
  }
@@ -1,3 +1,4 @@
1
+ import { WebPhoneCallContext, WebPhoneCallStateEvent, WebPhoneMediaEvent } from '../../lib/types';
1
2
  type WebPhonePosition = {
2
3
  x?: number;
3
4
  y?: number;
@@ -21,7 +22,19 @@ type __VLS_Props = {
21
22
  onHangup?: () => void | Promise<void>;
22
23
  onReject?: () => void | Promise<void>;
23
24
  };
24
- declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
25
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {
26
+ stop: () => Promise<void>;
27
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
28
+ back: () => any;
29
+ "call-context": (context: WebPhoneCallContext) => any;
30
+ "call-state": (event: WebPhoneCallStateEvent) => any;
31
+ "media-ready": (event: WebPhoneMediaEvent) => any;
32
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
33
+ onBack?: (() => any) | undefined;
34
+ "onCall-context"?: ((context: WebPhoneCallContext) => any) | undefined;
35
+ "onCall-state"?: ((event: WebPhoneCallStateEvent) => any) | undefined;
36
+ "onMedia-ready"?: ((event: WebPhoneMediaEvent) => any) | undefined;
37
+ }>, {
25
38
  contacts: {
26
39
  name: string;
27
40
  number: string;