You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: PREFLIGHT.md
+20-20
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
1
Preflight Test
2
2
==============
3
3
4
-
The SDK supports a preflight test API which can help determine Voice calling readiness. The API creates a test call and will provide information to help troubleshoot call related issues. This new API is a static member of the [Device](https://www.twilio.com/docs/voice/client/javascript/device#twilio-device) class and can be used by calling `Device.testPreflight(token, options)`. For example:
4
+
The SDK supports a preflight test API which can help determine Voice calling readiness. The API creates a test call and will provide information to help troubleshoot call related issues. This new API is a static member of the [Device](https://www.twilio.com/docs/voice/sdks/javascript/twiliodevice) class and can be used by calling `Device.runPreflight(token, options)`. For example:
`Device.testPreflight(token, options)` requires a [Twilio Access Token](https://www.twilio.com/docs/iam/access-tokens) to initiate the test call. This access token will be passed directly to the [Device's constructor](https://www.twilio.com/docs/voice/client/javascript/device#setup) and will be used to connect to a TwiML app that you associated with your [Twilio Access Token](https://www.twilio.com/docs/iam/access-tokens). In order to get better results, the TwiML app should be able to record audio from a microphone and play it back to the browser. Please see [Preflight Test TwiML App](#twiml-app---record-and-play) for details.
23
+
`Device.runPreflight(token, options)` requires a [Twilio Access Token](https://www.twilio.com/docs/iam/access-tokens) to initiate the test call. This access token will be passed directly to the [Device's constructor](https://www.twilio.com/docs/voice/sdks/javascript/twiliodevice#instantiate-a-device) and will be used to connect to a TwiML app that you associated with your [Twilio Access Token](https://www.twilio.com/docs/iam/access-tokens). In order to get better results, the TwiML app should be able to record audio from a microphone and play it back to the browser. Please see [Preflight Test TwiML App](#twiml-app---record-and-play) for details.
24
24
25
25
### Options
26
26
The `PreflightTest.Options` parameter is a JavaScript object containing configuration settings. Available settings are listed below:
@@ -29,7 +29,7 @@ The `PreflightTest.Options` parameter is a JavaScript object containing configur
29
29
|:---------|:--------|:------------|
30
30
|`codecPreferences`|`['pcmu', 'opus']`| An ordered list of preferred codecs. |
31
31
|`debug`|`false`| Can be `true` or `false`. Set this property to true to enable debug logging in your browser console. |
32
-
|`edge`|`roaming`| Specifies which Twilio `edge` to use when initiating the test call. Please see documentation on [edges](https://www.twilio.com/docs/voice/client/edges). |
32
+
|`edge`|`roaming`| Specifies which Twilio `edge` to use when initiating the test call. Please see documentation on [edges](https://www.twilio.com/docs/voice/sdks/javascript/edges). |
33
33
|`fakeMicInput`|`false`| If set to `true`, the test call will ignore microphone input and will use a default audio file. If set to `false`, the test call will capture the audio from the microphone. |
34
34
|`iceServers`|`null`| An array of custom ICE servers to use to connect media. If you provide both STUN and TURN server configurations, the test will detect whether a TURN server is required to establish a connection. See [Using Twilio NTS for Generating STUN/TURN Credentials](#using-twilio-nts-for-generating-stunturn-credentials)|
35
35
|`signalingTimeoutMs`|`10000`| Ammount of time to wait for setting up signaling connection. |
@@ -39,7 +39,7 @@ The following example demonstrates how to use [Twilio's Network Traversal Servic
39
39
40
40
```ts
41
41
importClientfrom'twilio';
42
-
import { Device } from'twilio-client';
42
+
import { Device } from'@twilio/voice-sdk';
43
43
44
44
// Generate the STUN and TURN server credentials with a ttl of 120 seconds
The `PreflightTest` object that is returned by `Device.testPreflight(token, options)` is an [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter), and as such its events can be subscribed to via `preflightTest.on(eventName, handler)`. The following is a list of all supported events that might get emitted throughout the duration of the test.
72
+
The `PreflightTest` object that is returned by `Device.runPreflight(token, options)` is an [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter), and as such its events can be subscribed to via `preflightTest.on(eventName, handler)`. The following is a list of all supported events that might get emitted throughout the duration of the test.
73
73
74
74
#### .on('completed', handler(report))
75
75
Raised when `PreflightTest.status` has transitioned to `PreflightTest.Status.Completed`. During this time, the `report` is available and ready to be inspected. This will not trigger if a fatal error is encountered during the test. Example report:
@@ -215,12 +215,12 @@ Raised when `PreflightTest.status` has transitioned to `PreflightTest.Status.Com
@@ -240,10 +240,10 @@ Raised when `PreflightTest.status` has transitioned to `PreflightTest.Status.Com
240
240
Raised when `PreflightTest.status` has transitioned to `PreflightTest.Status.Connected`. This means, the connection to Twilio has been established.
241
241
242
242
#### .on('failed', handler(error))
243
-
Raised when `PreflightTest.status` has transitioned to `PreflightTest.Status.Failed`. This happens when establishing a connection to Twilio has failed or when a test call has encountered a fatal error. This is also raised if `PreflightTest.stop` is called while the test is in progress. The error emitted from this event is coming from [Device.on('error)](https://www.twilio.com/docs/voice/client/javascript/device#error) and uses the same error format.
243
+
Raised when `PreflightTest.status` has transitioned to `PreflightTest.Status.Failed`. This happens when establishing a connection to Twilio has failed or when a test call has encountered a fatal error. This is also raised if `PreflightTest.stop` is called while the test is in progress. The error emitted from this event is coming from [Device.on('error)](https://www.twilio.com/docs/voice/sdks/javascript/twiliodevice#error-event) and uses the same error format.
244
244
245
245
#### .on('sample', handler(sample))
246
-
This event is published every second and is raised when the [Connection](https://www.twilio.com/docs/voice/client/javascript/connection) gets a webrtc sample object. The `sample` object is coming from [Connection.on('sample')](https://www.twilio.com/docs/voice/client/javascript/connection#sample) and uses the same `sample` format.
246
+
This event is published every second and is raised when the [Call](https://www.twilio.com/docs/voice/sdks/javascript/twiliocall) gets a webrtc sample object. The `sample` object is coming from [Call.on('sample')](https://www.twilio.com/docs/voice/sdks/javascript/twiliocall#sample-event) and uses the same `sample` format.
247
247
248
248
#### .on('warning', handler(warning))
249
249
Raised whenever the test encounters a warning. Example warning data:
@@ -252,7 +252,7 @@ Raised whenever the test encounters a warning. Example warning data:
252
252
{
253
253
/**
254
254
* Name of the warning.
255
-
* See https://www.twilio.com/docs/voice/insights/call-quality-events-twilio-client-sdk
255
+
* See https://www.twilio.com/docs/voice/voice-insights/api/call/details-sdk-call-quality-events
256
256
*/
257
257
name: 'insights-connection-error',
258
258
@@ -262,8 +262,8 @@ Raised whenever the test encounters a warning. Example warning data:
262
262
description: 'Received an error when attempting to connect to Insights gateway',
263
263
264
264
/**
265
-
* Optional RTCWarning data coming from Connection.on('warning')
266
-
* See https://www.twilio.com/docs/voice/client/javascript/connection#onwarning-handlerwarningname
265
+
* Optional RTCWarning data coming from Call.on('warning')
266
+
* See https://www.twilio.com/docs/voice/sdks/javascript/twiliocall#warning-event
267
267
*/
268
268
rtcWarning: {...}
269
269
}
@@ -275,9 +275,9 @@ You can access the following properties on the `PreflightTest` object:
275
275
276
276
*`callSid` - The callsid generated for the test call. This is set when the client has finished connecting to Twilio.
277
277
*`endTime` - A timestamp in milliseconds of when the test ended. This is set when the test has completed and raised the `completed` event.
278
-
*`latestSample` - The latest WebRTC sample collected. This is set whenever the connection emits a `sample`. Please see [Connection.on('sample')](https://www.twilio.com/docs/voice/client/javascript/connection#sample) API for more details.
278
+
*`latestSample` - The latest WebRTC sample collected. This is set whenever the connection emits a `sample`. Please see [Call.on('sample')](https://www.twilio.com/docs/voice/sdks/javascript/twiliocall#sample-event) API for more details.
279
279
*`report` - The report for this test. This is set when the test has completed and raised the `completed` event.
280
-
*`startTime` - A timestamp in milliseconds of when the test started. This is set right after calling `Device.testPreflight(token, options)`.
280
+
*`startTime` - A timestamp in milliseconds of when the test started. This is set right after calling `Device.runPreflight(token, options)`.
281
281
*`status` - The status of the test. Below are the possible values for this property.
282
282
283
283
| Value | Description |
@@ -297,7 +297,7 @@ Calling this method from the `PreflightTest` object will stop the existing test
297
297
TwiML App - Record and Play
298
298
===========================
299
299
300
-
If `PreflightTest.Options.fakeMicInput` is set to `false`, `Device.testPreflight(token, options)` API requires a [token](https://www.twilio.com/docs/iam/access-tokens) with a TwiML app that can record an audio from a microphone and the ability to play the recorded audio back to the browser. In order to achieve this, we need two TwiML endpoints: one to capture and record the audio, and another one to play the recorded audio.
300
+
If `PreflightTest.Options.fakeMicInput` is set to `false`, `Device.runPreflight(token, options)` API requires a [token](https://www.twilio.com/docs/iam/access-tokens) with a TwiML app that can record an audio from a microphone and the ability to play the recorded audio back to the browser. In order to achieve this, we need two TwiML endpoints: one to capture and record the audio, and another one to play the recorded audio.
301
301
302
302
TwiML Bins
303
303
----------
@@ -341,13 +341,13 @@ Creating the TwiML App
341
341
342
342
Now that we have created our TwiML Bins, let's create our TwiML app by going to the [TwiML Apps](https://www.twilio.com/console/voice/twiml/apps) page. Click the plus button on that screen and enter a friendly name that you prefer. Under Voice request url, enter the **TwiML Bin's Record** url that you created in the previous section, and then click the **Create** button.
343
343
344
-
On that same page, open the TwiML app that you just created by clicking on it and make note of the `SID`. You can now use this TwiML app to generate your [token](https://www.twilio.com/docs/iam/access-tokens) when calling `Device.testPreflight(token, options)` API.
344
+
On that same page, open the TwiML app that you just created by clicking on it and make note of the `SID`. You can now use this TwiML app to generate your [token](https://www.twilio.com/docs/iam/access-tokens) when calling `Device.runPreflight(token, options)` API.
345
345
346
346
347
347
TwiML App - Echo
348
348
================
349
349
350
-
If `PreflightTest.Options.fakeMicInput` is set to `true`, `Device.testPreflight(token, options)` API requires a [token](https://www.twilio.com/docs/iam/access-tokens) with a single TwiML app that can capture and play an audio. Following the [previous steps](#twiml-bins), create a TwiML Bin using the following template, and name it `Echo`.
350
+
If `PreflightTest.Options.fakeMicInput` is set to `true`, `Device.runPreflight(token, options)` API requires a [token](https://www.twilio.com/docs/iam/access-tokens) with a single TwiML app that can capture and play an audio. Following the [previous steps](#twiml-bins), create a TwiML Bin using the following template, and name it `Echo`.
0 commit comments