@tmsoft/webphone 2.0.13 → 2.0.14
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 +23 -140
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,22 +18,10 @@ npm install @tmsoft/webphone
|
|
|
18
18
|
```vue
|
|
19
19
|
<script setup lang="ts">
|
|
20
20
|
import { WebPhone } from '@tmsoft/webphone'
|
|
21
|
-
import type { WebPhoneContact } from '@tmsoft/webphone'
|
|
22
|
-
|
|
23
|
-
const contacts: WebPhoneContact[] = [
|
|
24
|
-
{ name: 'Support', number: '1000', type: 'extension' },
|
|
25
|
-
{ name: 'Sales', number: '2000', type: 'extension' },
|
|
26
|
-
]
|
|
27
21
|
</script>
|
|
28
22
|
|
|
29
23
|
<template>
|
|
30
|
-
<WebPhone
|
|
31
|
-
host="pbx.example.com"
|
|
32
|
-
extension="1001"
|
|
33
|
-
password="your-password"
|
|
34
|
-
:contacts="contacts"
|
|
35
|
-
@back="handleBack"
|
|
36
|
-
/>
|
|
24
|
+
<WebPhone host="pbx.example.com" extension="1001" password="your-password" />
|
|
37
25
|
</template>
|
|
38
26
|
```
|
|
39
27
|
|
|
@@ -42,33 +30,31 @@ const contacts: WebPhoneContact[] = [
|
|
|
42
30
|
```html
|
|
43
31
|
<script src="https://unpkg.com/@tmsoft/webphone/dist/webphone.component.js"></script>
|
|
44
32
|
|
|
45
|
-
<web-phone
|
|
46
|
-
host="pbx.example.com"
|
|
47
|
-
extension="1001"
|
|
48
|
-
password="your-password"
|
|
49
|
-
contacts='[{"name":"Support","number":"1000","type":"extension"}]'
|
|
50
|
-
></web-phone>
|
|
33
|
+
<web-phone host="pbx.example.com" extension="1001" password="your-password"></web-phone>
|
|
51
34
|
```
|
|
52
35
|
|
|
53
36
|
## Props
|
|
54
37
|
|
|
55
|
-
| Prop | Type | Required | Default | Description
|
|
56
|
-
| ----------- | -------------------------------- | -------- | -------- |
|
|
57
|
-
| `host` | `string` |
|
|
58
|
-
| `
|
|
59
|
-
| `
|
|
60
|
-
| `
|
|
61
|
-
| `
|
|
62
|
-
| `
|
|
63
|
-
| `
|
|
38
|
+
| Prop | Type | Required | Default | Description |
|
|
39
|
+
| ----------- | -------------------------------- | -------- | -------- | ------------------------------------------------------------------- |
|
|
40
|
+
| `host` | `string` | No\* | — | SIP server hostname. WebSocket URL: `wss://<host>:8089/asterisk/ws` |
|
|
41
|
+
| `wsUrl` | `string` | No\* | — | Custom WebSocket URL. Takes precedence over `host` |
|
|
42
|
+
| `extension` | `string` | Yes | — | SIP extension |
|
|
43
|
+
| `password` | `string` | Yes | — | SIP password |
|
|
44
|
+
| `mode` | `'webcall' \| 'call' \| 'video'` | No | `'call'` | Operating mode |
|
|
45
|
+
| `logo` | `string` | No | — | Logo URL for `webcall` mode |
|
|
46
|
+
| `to` | `string` | No | — | Auto-dial number for `webcall` mode |
|
|
47
|
+
| `contacts` | `WebPhoneContact[]` | No | `[]` | Contact list |
|
|
48
|
+
|
|
49
|
+
> \* Either `host` or `wsUrl` must be provided.
|
|
64
50
|
|
|
65
51
|
## Modes
|
|
66
52
|
|
|
67
|
-
| Mode | Description
|
|
68
|
-
| --------- |
|
|
69
|
-
| `call` | Standard softphone with keypad
|
|
70
|
-
| `video` |
|
|
71
|
-
| `webcall` |
|
|
53
|
+
| Mode | Description |
|
|
54
|
+
| --------- | ----------------------------------------------- |
|
|
55
|
+
| `call` | Standard softphone with keypad and call history |
|
|
56
|
+
| `video` | Softphone with video support |
|
|
57
|
+
| `webcall` | Click-to-call widget. Requires `to` and `logo` |
|
|
72
58
|
|
|
73
59
|
## Types
|
|
74
60
|
|
|
@@ -80,114 +66,11 @@ interface WebPhoneContact {
|
|
|
80
66
|
}
|
|
81
67
|
```
|
|
82
68
|
|
|
83
|
-
##
|
|
84
|
-
|
|
85
|
-
| Emit | Description |
|
|
86
|
-
| ------ | ----------------------------------- |
|
|
87
|
-
| `back` | Emitted when back button is pressed |
|
|
88
|
-
|
|
89
|
-
## Examples
|
|
90
|
-
|
|
91
|
-
### Call Mode (Default)
|
|
92
|
-
|
|
93
|
-
Standard softphone with full interface.
|
|
94
|
-
|
|
95
|
-
```vue
|
|
96
|
-
<WebPhone
|
|
97
|
-
host="pbx.example.com"
|
|
98
|
-
extension="1001"
|
|
99
|
-
password="secret"
|
|
100
|
-
mode="call"
|
|
101
|
-
:contacts="contacts"
|
|
102
|
-
/>
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
### Video Mode
|
|
106
|
-
|
|
107
|
-
Softphone with video support.
|
|
108
|
-
|
|
109
|
-
```vue
|
|
110
|
-
<WebPhone
|
|
111
|
-
host="pbx.example.com"
|
|
112
|
-
extension="1001"
|
|
113
|
-
password="secret"
|
|
114
|
-
mode="video"
|
|
115
|
-
:contacts="contacts"
|
|
116
|
-
/>
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
### WebCall Mode
|
|
120
|
-
|
|
121
|
-
Click-to-call widget for websites.
|
|
122
|
-
|
|
123
|
-
```vue
|
|
124
|
-
<WebPhone
|
|
125
|
-
host="pbx.example.com"
|
|
126
|
-
extension="1001"
|
|
127
|
-
password="secret"
|
|
128
|
-
mode="webcall"
|
|
129
|
-
to="5551234567"
|
|
130
|
-
logo="https://your-site.com/logo.png"
|
|
131
|
-
/>
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
```html
|
|
135
|
-
<!-- Web Component -->
|
|
136
|
-
<web-phone
|
|
137
|
-
host="pbx.example.com"
|
|
138
|
-
extension="1001"
|
|
139
|
-
password="secret"
|
|
140
|
-
mode="webcall"
|
|
141
|
-
to="5551234567"
|
|
142
|
-
logo="https://your-site.com/logo.png"
|
|
143
|
-
></web-phone>
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
## Development
|
|
147
|
-
|
|
148
|
-
### Prerequisites
|
|
69
|
+
## Events
|
|
149
70
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
### Setup
|
|
154
|
-
|
|
155
|
-
```bash
|
|
156
|
-
# Install dependencies
|
|
157
|
-
yarn install
|
|
158
|
-
|
|
159
|
-
# Start development server
|
|
160
|
-
yarn dev
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
### Scripts
|
|
164
|
-
|
|
165
|
-
| Command | Description |
|
|
166
|
-
| -------------------- | ------------------------------ |
|
|
167
|
-
| `yarn dev` | Start development server |
|
|
168
|
-
| `yarn build` | Build for production |
|
|
169
|
-
| `yarn build:lib` | Build library for distribution |
|
|
170
|
-
| `yarn test:unit` | Run unit tests in watch mode |
|
|
171
|
-
| `yarn test:coverage` | Run tests with coverage report |
|
|
172
|
-
| `yarn lint` | Run ESLint |
|
|
173
|
-
| `yarn type-check` | Run TypeScript type checking |
|
|
174
|
-
|
|
175
|
-
### Testing
|
|
176
|
-
|
|
177
|
-
The project uses Vitest for unit testing with the following coverage thresholds:
|
|
178
|
-
|
|
179
|
-
- Statements: 80%
|
|
180
|
-
- Branches: 70%
|
|
181
|
-
- Functions: 70%
|
|
182
|
-
- Lines: 80%
|
|
183
|
-
|
|
184
|
-
```bash
|
|
185
|
-
# Run tests
|
|
186
|
-
yarn test:unit
|
|
187
|
-
|
|
188
|
-
# Run tests with coverage
|
|
189
|
-
yarn test:coverage
|
|
190
|
-
```
|
|
71
|
+
| Event | Description |
|
|
72
|
+
| ------ | ------------------- |
|
|
73
|
+
| `back` | Back button pressed |
|
|
191
74
|
|
|
192
75
|
## License
|
|
193
76
|
|