Options
Menu

Module Voice

Index

Classes

Interfaces

Variables

Functions

Variables

Const BITRATE_MAX

BITRATE_MAX: 510000 = 510000

Const BITRATE_MIN

BITRATE_MIN: 6000 = 6000

Const COWBELL_AUDIO_URL

COWBELL_AUDIO_URL: string = `${SOUNDS_BASE_URL}/cowbell.mp3?cache=${RELEASE_VERSION}`

Const DEFAULT_TEST_SOUND_URL

DEFAULT_TEST_SOUND_URL: string = `${SOUNDS_BASE_URL}/outgoing.mp3`

Const DTMF_INTER_TONE_GAP

DTMF_INTER_TONE_GAP: number = 70

Const DTMF_PAUSE_DURATION

DTMF_PAUSE_DURATION: number = 500

Const DTMF_TONE_DURATION

DTMF_TONE_DURATION: number = 160

Const ECHO_TEST_DURATION

ECHO_TEST_DURATION: 20000 = 20000

Const ERROR_PEER_CONNECTION_NULL

ERROR_PEER_CONNECTION_NULL: "PeerConnection is null" = "PeerConnection is null"

Const ERROR_WEB_RTC_UNSUPPORTED

ERROR_WEB_RTC_UNSUPPORTED: "WebRTC statistics are unsupported" = "WebRTC statistics are unsupported"

Const Exception

Exception: TwilioException = TwilioException

Const ICE_GATHERING_FAIL_NONE

ICE_GATHERING_FAIL_NONE: "none" = "none"

Const ICE_GATHERING_FAIL_TIMEOUT

ICE_GATHERING_FAIL_TIMEOUT: "timeout" = "timeout"

Const ICE_GATHERING_TIMEOUT

ICE_GATHERING_TIMEOUT: 15000 = 15000

Const INITIAL_ICE_CONNECTION_STATE

INITIAL_ICE_CONNECTION_STATE: "new" = "new"

Const INVALID_TOKEN_MESSAGE

INVALID_TOKEN_MESSAGE: "Parameter "token" must be of type "string"." = "Parameter "token" must be of type "string"."

Const Logger

Logger: Logger = Log.getLogLevelInstance()

Const MAX_RECONNECT_TIMEOUT_ALLOWED

MAX_RECONNECT_TIMEOUT_ALLOWED: 30 = 30

Const METRICS_BATCH_SIZE

METRICS_BATCH_SIZE: number = 10

Const METRICS_DELAY

METRICS_DELAY: number = 5000

Const NativeRTCStatsReport

NativeRTCStatsReport: undefined | object = typeof window !== 'undefined'? window.RTCStatsReport : undefined

Const OLD_MAX_VOLUME

OLD_MAX_VOLUME: 32767 = 32767

This file was imported from another project. If making changes to this file, please don't make them here. Make them on the linked repo below, then copy back: https://code.hq.twilio.com/client/MockRTCStatsReport

Const PACKAGE_NAME

PACKAGE_NAME: "@twilio/voice-sdk" = "@twilio/voice-sdk"

Const PSTREAM_VERSION

PSTREAM_VERSION: "1.6" = "1.6"

Const PUBLISHER_PRODUCT_NAME

PUBLISHER_PRODUCT_NAME: "twilio-js-sdk" = "twilio-js-sdk"

Const REGISTRATION_INTERVAL

REGISTRATION_INTERVAL: 30000 = 30000

Const RELEASE_VERSION

RELEASE_VERSION: "2.12.3" = "2.12.3"

Const RINGTONE_PLAY_TIMEOUT

RINGTONE_PLAY_TIMEOUT: 2000 = 2000

Const RTCPeerConnectionShim

RTCPeerConnectionShim: any = require('rtcpeerconnection-shim')

Const RTCRtpTransceiver

RTCRtpTransceiver: any

Const Request

Request: request = request

Use XMLHttpRequest to get a network resource.

param

HTTP Method

param

Request parameters

param

URL of the resource

param

An array of headers to pass [{ headerName : headerBody }]

param

A JSON body to send to the resource

returns

Const SAMPLE_COUNT_CLEAR

SAMPLE_COUNT_CLEAR: 0 = 0

Const SAMPLE_COUNT_METRICS

SAMPLE_COUNT_METRICS: 5 = 5

Const SAMPLE_COUNT_RAISE

SAMPLE_COUNT_RAISE: 3 = 3

Const SAMPLE_INTERVAL

SAMPLE_INTERVAL: 1000 = 1000

Const SOUNDS_BASE_URL

SOUNDS_BASE_URL: "https://sdk.twilio.com/js/client/sounds/releases/1.0.0" = "https://sdk.twilio.com/js/client/sounds/releases/1.0.0"

Const VOLUME_INTERVAL_MS

VOLUME_INTERVAL_MS: 50 = 50

Const WARNING_TIMEOUT

WARNING_TIMEOUT: number = 5 * 1000

Const defaultEdge

defaultEdge: Edge = Edge.Roaming

The default edge to connect to and create a chunder uri from, if the edge parameter is not specified during setup in Device.

constant

Const defaultOpusId

defaultOpusId: 111 = 111

Const md5

md5: any = typeof md5Lib === 'function' ? md5Lib : md5Lib.default

Const r0

r0: 94.768 = 94.768

Const webkitAudioContext

webkitAudioContext: typeof AudioContext

Functions

EventTarget

  • EventTarget(): void

MockRTCStatsReport

  • MockRTCStatsReport(statsMap: any): any
  • Create a MockRTCStatsReport wrapper around a Map of RTCStats objects. If RTCStatsReport is available natively, it will be inherited so that instanceof checks pass.

    Parameters

    • statsMap: any

      A Map of RTCStats objects to wrap with a MockRTCStatsReport object.

    Returns any

PeerConnection

  • PeerConnection(audioHelper: any, pstream: any, options: any): any

RTCPC

  • RTCPC(options: any): void

RTCSample

  • RTCSample(): void
  • property

    {Number} [timestamp]

    property

    {String} [codecName] - MimeType name of the codec being used by the outbound audio stream

    property

    {Number} [rtt] - Round trip time

    property

    {Number} [jitter]

    property

    {Number} [packetsSent]

    property

    {Number} [packetsLost]

    property

    {Number} [packetsReceived]

    property

    {Number} [bytesReceived]

    property

    {Number} [bytesSent]

    property

    {Number} [localAddress]

    property

    {Number} [remoteAddress]

    Returns void

Sound

  • Sound(name: any, url: any, options: any): any
  • property

    {number} [maxDuration=0] - The maximum length of time to play the sound before stopping it.

    property

    {Boolean} [shouldLoop=false] - Whether the sound should be looped.

    Parameters

    • name: any
    • url: any
    • options: any

    Returns any

TwilioException

  • TwilioException(message: any): any
  • Exception class.

    name

    Exception

    exports

    Exception as Twilio.Exception

    memberof

    Twilio

    Parameters

    • message: any

      The exception message

    Returns any

addStream

  • addStream(pc: any, stream: any): void

average

  • average(values: any): number

calculate

  • calculate(rtt: any, jitter: any, fractionLost: any): number | null
  • Calculate the mos score of a stats object

    Parameters

    • rtt: any
    • jitter: any
    • fractionLost: any

      The fraction of packets that have been lost. Calculated by packetsLost / totalPackets

    Returns number | null

    mos - Calculated MOS, 1.0 through roughly 4.5. Returns null when any of the input parameters are not a non-negative number.

cloneStream

  • cloneStream(oldStream: any): any

convertMsToSeconds

  • convertMsToSeconds(inMs: any): undefined | number

createChunderEdgeURI

  • createChunderEdgeURI(edge: string): string
  • String template for an edge chunder URI

    Parameters

    • edge: string

      The edge.

    Returns string

createCodecMapForMediaSection

  • createCodecMapForMediaSection(section: any): unknown
  • Create a Codec Map for the given m= section.

    Parameters

    • section: any

      The given m= section

    Returns unknown

createEventGatewayURI

  • createEventGatewayURI(region: string): string
  • String template for a region insights URI

    Parameters

    • region: string

      The region.

    Returns string

createPtToCodecName

  • createPtToCodecName(mediaSection: any): any
  • Create a Map from PTs to codec names for the given m= section.

    Parameters

    • mediaSection: any

      The given m= section.

    Returns any

    ptToCodecName

createRTCCertificateStats

  • createRTCCertificateStats(report: any): object
  • Parameters

    • report: any

    Returns object

    • base64Certificate: any
    • fingerprint: any
    • fingerprintAlgorithm: any
    • id: any
    • issuerCertificateId: any
    • timestamp: number
    • type: string

createRTCCodecStats

  • createRTCCodecStats(report: any): object
  • Parameters

    • report: any

    Returns object

    • channels: undefined
    • clockRate: undefined
    • id: any
    • implementation: undefined
    • mimeType: string
    • payloadType: undefined
    • sdpFmtpLine: undefined
    • timestamp: number
    • type: string

createRTCDataChannelStats

  • createRTCDataChannelStats(report: any): object
  • Parameters

    • report: any

    Returns object

    • bytesReceived: undefined
    • bytesSent: undefined
    • datachannelid: any
    • id: any
    • label: any
    • messagesReceived: undefined
    • messagesSent: undefined
    • protocol: any
    • state: any
    • timestamp: number
    • transportId: any
    • type: string

createRTCIceCandidatePairStats

  • createRTCIceCandidatePairStats(report: any): object
  • Parameters

    • report: any

    Returns object

    • availableIncomingBitrate: undefined
    • availableOutgoingBitrate: undefined
    • bytesReceived: undefined | number
    • bytesSent: undefined | number
    • consentRequestsSent: undefined | number
    • currentRoundTripTime: undefined | number
    • id: any
    • lastPacketReceivedTimestamp: undefined
    • lastPacketSentTimestamp: undefined
    • localCandidateId: any
    • nominated: undefined
    • priority: undefined
    • readable: undefined
    • remoteCandidateId: any
    • requestsReceived: undefined | number
    • requestsSent: undefined | number
    • responsesReceived: undefined | number
    • responsesSent: undefined | number
    • retransmissionsReceived: undefined
    • retransmissionsSent: undefined
    • state: undefined
    • timestamp: number
    • totalRoundTripTime: undefined
    • transportId: any
    • type: string
    • writable: undefined | false | true

createRTCIceCandidateStats

  • createRTCIceCandidateStats(report: any, isRemote: any): object
  • Parameters

    • report: any
    • isRemote: any

      Whether to create for a remote candidate, or local candidate.

    Returns object

    • candidateType: any
    • deleted: undefined
    • id: any
    • ip: any
    • isRemote: any
    • port: undefined | number
    • priority: undefined | number
    • protocol: any
    • relayProtocol: undefined
    • timestamp: number
    • transportId: undefined
    • type: string
    • url: undefined

createRTCInboundRTPStreamStats

  • createRTCInboundRTPStreamStats(report: any): object
  • Parameters

    • report: any

    Returns object

    • associateStatsId: undefined
    • codecId: string
    • firCount: undefined | number
    • id: any
    • isRemote: undefined
    • mediaType: any
    • nackCount: undefined | number
    • pliCount: undefined | number
    • qpSum: undefined | number
    • sliCount: undefined
    • ssrc: any
    • timestamp: number
    • trackId: string
    • transportId: any

createRTCMediaStreamTrackStats

  • createRTCMediaStreamTrackStats(report: any): object
  • Parameters

    • report: any

    Returns object

    • audioLevel: number
    • detached: undefined
    • echoReturnLoss: undefined | number
    • echoReturnLossEnhancement: undefined | number
    • ended: undefined
    • frameHeight: undefined | number
    • frameWidth: undefined | number
    • framesCorrupted: undefined
    • framesDecoded: undefined | number
    • framesDropped: undefined
    • framesPerSecond: undefined
    • framesReceived: undefined
    • framesSent: undefined | number
    • fullFramesLost: undefined
    • id: any
    • kind: any
    • partialFramesLost: undefined
    • remoteSource: undefined
    • ssrcIds: undefined
    • timestamp: number
    • trackIdentifier: any
    • type: string

createRTCOutboundRTPStreamStats

  • createRTCOutboundRTPStreamStats(report: any): object
  • Parameters

    • report: any

    Returns object

    • associateStatsId: undefined
    • codecId: string
    • firCount: undefined | number
    • id: any
    • isRemote: undefined
    • mediaType: any
    • nackCount: undefined | number
    • pliCount: undefined | number
    • qpSum: undefined | number
    • sliCount: undefined
    • ssrc: any
    • timestamp: number
    • trackId: string
    • transportId: any

createRTCRTPStreamStats

  • createRTCRTPStreamStats(report: any, isInbound: any): object
  • Parameters

    • report: any
    • isInbound: any

      Whether to create an inbound stats object, or outbound.

    Returns object

    • associateStatsId: undefined
    • codecId: string
    • firCount: undefined | number
    • id: any
    • isRemote: undefined
    • mediaType: any
    • nackCount: undefined | number
    • pliCount: undefined | number
    • qpSum: undefined | number
    • sliCount: undefined
    • ssrc: any
    • timestamp: number
    • trackId: string
    • transportId: any

createRTCTransportStats

  • createRTCTransportStats(report: any): object
  • Parameters

    • report: any

    Returns object

    • bytesReceived: undefined
    • bytesSent: undefined
    • dtlsState: undefined
    • id: any
    • localCertificateId: any
    • remoteCertificateId: any
    • rtcpTransportStatsId: undefined
    • selectedCandidatePairId: any
    • timestamp: number
    • type: string

createSignalingEndpointURL

  • createSignalingEndpointURL(uri: string): string
  • Create a signaling endpoint URL to connect a websocket to from a chunder URI.

    Parameters

    • uri: string

      the chunder URI to create a signaling endpoint URL for

    Returns string

destroyAudioElement

  • destroyAudioElement(audioElement: any): void

difference

  • difference(lefts: any, rights: any, getKey?: any): any

enabled

  • enabled(): boolean

flatMap

  • flatMap(list: any, mapFn: any): any
  • Map a list to an array of arrays, and return the flattened result.

    Parameters

    • list: any
    • mapFn: any

    Returns any

    Array<*>

flattenSamples

  • flattenSamples(sampleSets: number[][]): number[]
  • Flatten a set of numerical sample sets into a single array of samples.

    Parameters

    • sampleSets: number[][]

    Returns number[]

formatMetric

  • formatMetric(sample: any): object
  • Parameters

    • sample: any

    Returns object

    • audio_codec: any
    • audio_level_in: any
    • audio_level_out: any
    • bytes_received: any
    • bytes_sent: any
    • call_volume_input: any
    • call_volume_output: any
    • jitter: any
    • mos: number
    • packets_lost: any
    • packets_lost_fraction: number
    • packets_received: any
    • rtt: any
    • timestamp: string
    • total_bytes_received: any
    • total_bytes_sent: any
    • total_packets_lost: any
    • total_packets_received: any
    • total_packets_sent: any

generateTempCallSid

  • generateTempCallSid(): string

generateUuid

  • generateUuid(): string

generateVoiceEventSid

  • generateVoiceEventSid(): string

getBoolean

  • getBoolean(report: any, statName: any): undefined | false | true

getBrowserInfo

  • getBrowserInfo(): object
  • Returns object

    • p: string
    • plugin: string
    • v: string
    • browser: object
      • platform: any
      • userAgent: any

getFloat

  • getFloat(report: any, statName: any): undefined | number

getInt

  • getInt(report: any, statName: any): undefined | number

getMediaEngine

  • getMediaEngine(): "ORTC" | "WebRTC"

getMediaSections

  • getMediaSections(sdp: any, kind: any, direction: any): any
  • Get the m= sections of a particular kind and direction from an sdp.

    Parameters

    • sdp: any

      SDP string

    • kind: any
    • direction: any

    Returns any

    mediaSections

getPayloadTypesInMediaSection

  • getPayloadTypesInMediaSection(section: any): any
  • Get the Codec Payload Types present in the first line of the given m= section

    Parameters

    • section: any

      The m= section

    Returns any

    Payload Types

getPreferredCodecInfo

  • getPreferredCodecInfo(sdp: any): object
  • Parameters

    • sdp: any

    Returns object

    • codecName: null | string
    • codecParams: null | string

getRTCIceCandidateStatsReport

  • getRTCIceCandidateStatsReport(peerConnection: any): any
  • Generate WebRTC stats report containing relevant information about ICE candidates for the given PeerConnection

    Parameters

    • peerConnection: any

      Target connection.

    Returns any

    RTCIceCandidateStatsReport object

getRTCStats

  • getRTCStats(peerConnection: any, options: any): any
  • Collects any WebRTC statistics for the given PeerConnection

    Parameters

    • peerConnection: any

      Target connection.

    • options: any

      List of custom options.

    Returns any

    Universally-formatted version of RTC stats.

getRTCStatsReport

  • getRTCStatsReport(peerConnection: any): any

getReorderedPayloadTypes

  • getReorderedPayloadTypes(codecMap: any, preferredCodecs: any): any
  • Create the reordered Codec Payload Types based on the preferred Codec Names.

    Parameters

    • codecMap: any

      Codec Map

    • preferredCodecs: any

      Preferred Codec Names

    Returns any

    Reordered Payload Types

getUserMedia

  • getUserMedia(constraints: any, options: any): Promise<unknown>

isChrome

  • isChrome(window: any, navigator: any): boolean

isElectron

  • isElectron(navigator: any): boolean

isFirefox

  • isFirefox(navigator?: any): boolean

isLegacyEdge

  • isLegacyEdge(navigator?: any): boolean

isNonNegativeNumber

  • isNonNegativeNumber(n: any): boolean
  • Returns true if and only if the parameter passed is a number, is not NaN, is finite, and is greater than or equal to 0.

    Parameters

    • n: any

    Returns boolean

isPresent

  • isPresent(report: any, statName: any): boolean

isSafari

  • isSafari(navigator: any): boolean

isUnifiedPlanDefault

  • isUnifiedPlanDefault(window: any, navigator: any, PeerConnection: any, RtpTransceiver: any): boolean
  • Parameters

    • window: any
    • navigator: any
    • PeerConnection: any
    • RtpTransceiver: any

    Returns boolean

promisify

  • promisify(fn: any, ctx: any, areCallbacksFirst: any, checkRval: any): (Anonymous function)
  • Parameters

    • fn: any
    • ctx: any
    • areCallbacksFirst: any
    • checkRval: any

    Returns (Anonymous function)

promisifyCreate

  • promisifyCreate(fn: any, ctx: any): (Anonymous function)

promisifyEvents

  • promisifyEvents(emitter: any, resolveEventName: any, rejectEventName: any): Promise<unknown>
  • Converts an EventEmitter's events into a promise and automatically cleans up handlers once the promise is resolved or rejected.

    Parameters

    • emitter: any
    • resolveEventName: any
    • rejectEventName: any

    Returns Promise<unknown>

promisifySet

  • promisifySet(fn: any, ctx: any): (Anonymous function)

queryToJson

  • queryToJson(params: any): any

removeStream

  • removeStream(pc: any, stream: any): void

request

  • request(method: any, params: any, callback: any): void

setAudioSource

  • setAudioSource(audio: any, stream: any): boolean
  • Set the source of an HTMLAudioElement to the specified MediaStream

    Parameters

    • audio: any
    • stream: any

    Returns boolean

    Whether the audio source was set successfully

setCodecPreferences

  • setCodecPreferences(sdp: any, preferredCodecs: any): string
  • Return a new SDP string with the re-ordered codec preferences.

    Parameters

    • sdp: any
    • preferredCodecs: any

      If empty, the existing order of audio codecs is preserved

    Returns string

    Updated SDP string

setIceAggressiveNomination

  • setIceAggressiveNomination(sdp: any): any

setMaxAverageBitrate

  • setMaxAverageBitrate(sdp: any, maxAverageBitrate: any): any

setPayloadTypesInMediaSection

  • setPayloadTypesInMediaSection(payloadTypes: any, section: any): string
  • Set the given Codec Payload Types in the first line of the given m= section.

    Parameters

    • payloadTypes: any

      Payload Types

    • section: any

      Given m= section

    Returns string

    • Updated m= section

translateCandidateType

  • translateCandidateType(type: any): any

Generated using TypeDoc