Skip to main content

Class: Call

Defined in: models/call.ts:14 Represents a call with reactive state streams. This class wraps the underlying Telnyx Call object and provides reactive streams for all call state changes, making it easy to integrate with any state management solution.

Constructors

Constructor

new Call(_telnyxCall, _callId, _destination, _isIncoming, isReattached, _originalCallerName?, _originalCallerNumber?): Call
Defined in: models/call.ts:23

Parameters

_telnyxCall

TelnyxCall

_callId

string

_destination

string

_isIncoming

boolean

isReattached

boolean = false

_originalCallerName?

string

_originalCallerNumber?

string

Returns

Call

Accessors

callId

Get Signature

get callId(): string
Defined in: models/call.ts:44 Unique identifier for this call

Returns

string

destination

Get Signature

get destination(): string
Defined in: models/call.ts:51 The destination number or SIP URI

Returns

string

isIncoming

Get Signature

get isIncoming(): boolean
Defined in: models/call.ts:58 Whether this is an incoming call

Returns

boolean

isOutgoing

Get Signature

get isOutgoing(): boolean
Defined in: models/call.ts:65 Whether this is an outgoing call

Returns

boolean

currentState

Get Signature

get currentState(): TelnyxCallState
Defined in: models/call.ts:72 Current call state (synchronous access)

Returns

TelnyxCallState

currentIsMuted

Get Signature

get currentIsMuted(): boolean
Defined in: models/call.ts:79 Current mute state (synchronous access)

Returns

boolean

currentIsHeld

Get Signature

get currentIsHeld(): boolean
Defined in: models/call.ts:86 Current hold state (synchronous access)

Returns

boolean

currentDuration

Get Signature

get currentDuration(): number
Defined in: models/call.ts:93 Current call duration in seconds (synchronous access)

Returns

number

inviteCustomHeaders

Get Signature

get inviteCustomHeaders(): object[]
Defined in: models/call.ts:102 Custom headers received from the WebRTC INVITE message. These headers are passed during call initiation and can contain application-specific information. Format should be [{"name": "X-Header-Name", "value": "Value"}] where header names must start with “X-”.

Returns

object[]

answerCustomHeaders

Get Signature

get answerCustomHeaders(): object[]
Defined in: models/call.ts:111 Custom headers received from the WebRTC ANSWER message. These headers are passed during call acceptance and can contain application-specific information. Format should be [{"name": "X-Header-Name", "value": "Value"}] where header names must start with “X-”.

Returns

object[]

telnyxCall

Get Signature

get telnyxCall(): TelnyxCall
Defined in: models/call.ts:119 Internal Get the underlying Telnyx Call object (for internal use)

Returns

TelnyxCall

callState$

Get Signature

get callState$(): Observable<TelnyxCallState>
Defined in: models/call.ts:126 Observable stream of call state changes

Returns

Observable<TelnyxCallState>

isMuted$

Get Signature

get isMuted$(): Observable<boolean>
Defined in: models/call.ts:133 Observable stream of mute state changes

Returns

Observable<boolean>

isHeld$

Get Signature

get isHeld$(): Observable<boolean>
Defined in: models/call.ts:140 Observable stream of hold state changes

Returns

Observable<boolean>

duration$

Get Signature

get duration$(): Observable<number>
Defined in: models/call.ts:147 Observable stream of call duration changes (in seconds)

Returns

Observable<number>

canAnswer$

Get Signature

get canAnswer$(): Observable<boolean>
Defined in: models/call.ts:154 Observable that emits true when the call can be answered

Returns

Observable<boolean>

canHangup$

Get Signature

get canHangup$(): Observable<boolean>
Defined in: models/call.ts:164 Observable that emits true when the call can be hung up

Returns

Observable<boolean>

canHold$

Get Signature

get canHold$(): Observable<boolean>
Defined in: models/call.ts:174 Observable that emits true when the call can be put on hold

Returns

Observable<boolean>

canResume$

Get Signature

get canResume$(): Observable<boolean>
Defined in: models/call.ts:184 Observable that emits true when the call can be resumed from hold

Returns

Observable<boolean>

Methods

answer()

answer(customHeaders?): Promise<void>
Defined in: models/call.ts:195 Answer the incoming call

Parameters

customHeaders?

object[] Optional custom headers to include with the answer

Returns

Promise<void>

hangup()

hangup(customHeaders?): Promise<void>
Defined in: models/call.ts:227 Hang up the call

Parameters

customHeaders?

object[] Optional custom headers to include with the hangup request

Returns

Promise<void>

hold()

hold(): Promise<void>
Defined in: models/call.ts:266 Put the call on hold

Returns

Promise<void>

resume()

resume(): Promise<void>
Defined in: models/call.ts:282 Resume the call from hold

Returns

Promise<void>

mute()

mute(): Promise<void>
Defined in: models/call.ts:298 Mute the call

Returns

Promise<void>

unmute()

unmute(): Promise<void>
Defined in: models/call.ts:315 Unmute the call

Returns

Promise<void>

toggleMute()

toggleMute(): Promise<void>
Defined in: models/call.ts:332 Toggle mute state

Returns

Promise<void>

setConnecting()

setConnecting(): void
Defined in: models/call.ts:344 Internal Set the call to connecting state (used for push notification calls when answered via CallKit)

Returns

void

dispose()

dispose(): void
Defined in: models/call.ts:352 Clean up resources when the call is disposed

Returns

void