Options
Menu

Class Call

A Call represents a media and signaling connection to a TwiML application.

Hierarchy

  • EventEmitter
    • Call

Index

Events

Static acceptEvent

  • acceptEvent(call: Call): void

Static cancelEvent

  • cancelEvent(): void

Static disconnectEvent

  • disconnectEvent(call: Call): void

Static errorEvent

Static muteEvent

  • muteEvent(isMuted: boolean, call: Call): void
  • Emitted when the Call is muted or unmuted.

    example

    call.on('mute', (isMuted, call) => { })

    Parameters

    • isMuted: boolean

      Whether the Call is muted.

    • call: Call

      The Call.

    Returns void

Static rejectEvent

  • rejectEvent(call: Call): void

Static sampleEvent

  • Emitted when the Call gets a webrtc sample object. This event is published every second.

    example

    call.on('sample', sample => { })

    Parameters

    Returns void

Static volumeEvent

  • volumeEvent(inputVolume: number, outputVolume: number): void
  • Emitted every 50ms with the current input and output volumes, as a percentage of maximum volume, between -100dB and -30dB. Represented by a floating point number.

    example

    call.on('volume', (inputVolume, outputVolume) => { })

    Parameters

    • inputVolume: number

      A floating point number between 0.0 and 1.0 inclusive.

    • outputVolume: number

      A floating point number between 0.0 and 1.0 inclusive.

    Returns void

Properties

callerInfo

callerInfo: CallerInfo | null

Returns caller verification information about the caller. If no caller verification information is available this will return null.

customParameters

customParameters: Map<string, string>

The custom parameters sent to (outgoing) or received by (incoming) the TwiML app.

Optional outboundConnectionId

outboundConnectionId: undefined | string

The temporary CallSid for this call, if it's outbound.

parameters

parameters: Record<string, string>

Call parameters received from Twilio for an incoming call.

Static defaultMaxListeners

defaultMaxListeners: number

Accessors

codec

  • get codec(): string

direction

Methods

Private _setInputTracksFromStream

  • _setInputTracksFromStream(stream: MediaStream | null): Promise<void>
  • Set the audio input tracks from a given stream.

    Parameters

    • stream: MediaStream | null

    Returns Promise<void>

Private _setSinkIds

  • _setSinkIds(sinkIds: string[]): Promise<void>
  • Set the audio output sink IDs.

    Parameters

    • sinkIds: string[]

    Returns Promise<void>

accept

addListener

  • addListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

disconnect

  • disconnect(): void

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

eventNames

  • eventNames(): Array<string | symbol>

getLocalStream

  • getLocalStream(): MediaStream | undefined

getMaxListeners

  • getMaxListeners(): number

getRemoteStream

  • getRemoteStream(): MediaStream | undefined

ignore

  • ignore(): void

isMuted

  • isMuted(): boolean

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

mute

  • mute(shouldMute?: boolean): void
  • Mute incoming audio.

    Parameters

    • Default value shouldMute: boolean = true

      Whether the incoming audio should be muted. Defaults to true.

    Returns void

off

  • off(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • on(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

once

  • once(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

postFeedback

  • Post an event to Endpoint Analytics indicating that the end user has given call quality feedback. Called without a score, this will report that the customer declined to give feedback.

    Parameters

    • Optional score: FeedbackScore

      The end-user's rating of the call; an integer 1 through 5. Or undefined if the user declined to give feedback.

    • Optional issue: FeedbackIssue

      The primary issue the end user experienced on the call. Can be: ['one-way-audio', 'choppy-audio', 'dropped-call', 'audio-latency', 'noisy-call', 'echo']

    Returns Promise<void>

prependListener

  • prependListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

reject

  • reject(): void

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

sendDigits

  • sendDigits(digits: string): void

setMaxListeners

  • setMaxListeners(n: number): this

status

Private toString

  • toString(): string

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Static Private toString

  • toString(): string

Generated using TypeDoc