sinch-rtc
    Preparing search index...

    Interface CallClient

    interface CallClient {
        addListener(listener: CallClientListener): void;
        callConference(
            conferenceId: string,
            headers?: Record<string, string>,
        ): Promise<Call>;
        callPhoneNumber(
            phoneNumber: string,
            headers?: Record<string, string>,
        ): Promise<Call>;
        callSip(
            sipIdentity: string,
            headers?: Record<string, string>,
        ): Promise<Call>;
        callUser(toUserId: string, headers?: Record<string, string>): Promise<Call>;
        callUserVideo(
            toUserId: string,
            headers?: Record<string, string>,
        ): Promise<Call>;
        dialPhoneNumber(
            phoneNumber: string,
            options?: DialPhoneNumberOptions,
        ): Promise<Call>;
        dialSip(sipIdentity: string, options?: DialSipOptions): Promise<Call>;
        dialStream(streamUrl: string, options?: DialStreamOptions): Promise<Call>;
        dialVoiceRelay(
            voiceRelayUrl: string,
            options: DialVoiceRelayOptions,
        ): Promise<Call>;
        getCall(callId: string): undefined | Call;
        removeListener(listener: CallClientListener): void;
        setAudioTrackConstraints(constraints: null | MediaTrackConstraints): void;
        setVideoTrackConstraints(constraints: null | MediaTrackConstraints): void;
    }
    Index

    Methods

    • Calls the conference with the given id and the given headers.

      Parameters

      • conferenceId: string

        Conference ID to dial in to.

      • Optionalheaders: Record<string, string>

        Headers to pass with the call.

      Returns Promise<Call>

      A Call instance.

      InvalidOperationError if SinchClient is not started

      ArgumentError if the size of all header strings exceeds 1024 bytes when encoded as UTF-8.

    • Calls a phone number and terminates the call to the PSTN-network (Publicly Switched Telephone Network).

      Parameters

      • phoneNumber: string

        The phone number to call. The phone number should be given according to E.164 number formatting (http://en.wikipedia.org/wiki/E.164) and should be prefixed with a '+'. E.g. to call the US phone number 415 555 0101, it should be specified as "+14155550101", where the '+' is the required prefix and the US country code '1' added before the local subscriber number.

      • Optionalheaders: Record<string, string>

        Headers to pass with the call.

      Returns Promise<Call>

      A Call instance.

      InvalidOperationError if SinchClient is not started

      ArgumentError if conferenceId exceeds 64 characters

      ArgumentError if the size of all header strings exceeds 1024 bytes when encoded as UTF-8.

    • Makes a SIP call to the user with the given identity. The identity should be in the form "sip:user@server".

      Parameters

      • sipIdentity: string

        SIP identity to dial in to.

      • Optionalheaders: Record<string, string>

      Returns Promise<Call>

      A Call instance.

      InvalidOperationError if SinchClient is not started

      ArgumentError if sipIdentity exceeds 64 characters

      ArgumentError if the size of all header strings exceeds 1024 bytes when encoded as UTF-8.

    • Makes a call to the user with the given id.

      Parameters

      • toUserId: string

        The app specific id of the user to call. May not be null or empty.

      • Optionalheaders: Record<string, string>

        Headers to pass with the call.

      Returns Promise<Call>

      A Call instance.

      InvalidOperationError if SinchClient is not started

      ArgumentError if the size of all header strings exceeds 1024 bytes when encoded as UTF-8.

    • Makes a video call to the user with the given id and adding the given headers.

      Parameters

      • toUserId: string

        The app specific id of the user to call. May not be null or empty.

      • Optionalheaders: Record<string, string>

        Headers to pass with the call.

      Returns Promise<Call>

      A Call instance.

      InvalidOperationError if SinchClient is not started

      ArgumentError if the size of all header strings exceeds 1024 bytes when encoded as UTF-8.

    • Beta

      Dials a phone number through the Sinch Voice V2 platform and terminates the call to the PSTN-network (Publicly Switched Telephone Network).

      This API is in beta. It is functional, but its signature or behaviour may change in a future release without going through the usual deprecation cycle.

      Parameters

      • phoneNumber: string

        The phone number to dial. The phone number should be given according to E.164 number formatting (http://en.wikipedia.org/wiki/E.164) and should be prefixed with a '+'. E.g. to dial the US phone number 415 555 0101, it should be specified as "+14155550101", where the '+' is the required prefix and the US country code '1' added before the local subscriber number.

      • Optionaloptions: DialPhoneNumberOptions

        Optional DialPhoneNumberOptions containing a Voice V2 serviceId and caller identifier (cli).

      Returns Promise<Call>

      A Call instance.

      InvalidOperationError if SinchClient is not started

    • Beta

      Dials a SIP identity through the Sinch Voice V2 platform. The identity should be in the form "sip:user@server".

      This API is in beta. It is functional, but its signature or behaviour may change in a future release without going through the usual deprecation cycle.

      Parameters

      • sipIdentity: string

        SIP identity to dial in to.

      • Optionaloptions: DialSipOptions

        Optional DialSipOptions containing a Voice V2 serviceId, SIP transport, and call headers.

      Returns Promise<Call>

      A Call instance.

      InvalidOperationError if SinchClient is not started

      ArgumentError if more than 16 call headers are given, a header key is not a valid SIP header name or is longer than 255 characters, or a header value is longer than 255 characters.

    • Beta

      Dials a stream destination through the Sinch Voice V2 platform.

      This API is in beta. It is functional, but its signature or behaviour may change in a future release without going through the usual deprecation cycle.

      Parameters

      • streamUrl: string

        Stream endpoint URL. For example, wss://example.com.

      • Optionaloptions: DialStreamOptions

        Optional DialStreamOptions containing a Voice V2 serviceId, stream configuration, and call headers.

      Returns Promise<Call>

      A Call instance.

      InvalidOperationError if SinchClient is not started

      ArgumentError if more than 16 call headers are given, a header key is empty or longer than 255 characters, or a header value is longer than 255 characters.

    • Beta

      Dials a voice relay destination through the Sinch Voice V2 platform.

      This API is in beta. It is functional, but its signature or behaviour may change in a future release without going through the usual deprecation cycle.

      Parameters

      Returns Promise<Call>

      A Call instance.

      InvalidOperationError if SinchClient is not started

      ArgumentError if ttsVoice or sttLanguage is missing, if more than 16 call headers are given, a header key is empty or longer than 255 characters, or a header value is longer than 255 characters.

    • Returns the Call object with the identifier callId.

      Parameters

      • callId: string

        The call identifier string.

      Returns undefined | Call

      A Call instance if one matches, otherwise undefined.

    • Sets or removes audio track constraints that are applied to ongoing calls and will also be used for any new Call created.

      Parameters

      • constraints: null | MediaTrackConstraints

        The constraints to apply for the audio track:

        • Provide a MediaTrackConstraints object to apply specific constraints (e.g. { deviceId: { exact: "mic-id" }, echoCancellation: true }).
        • Pass null to remove previously set constraints, falling back to the default device when requesting audio.

      Returns void

      callClient.setAudioTrackConstraints({ echoCancellation: true });
      callClient.setAudioTrackConstraints(null); // remove constraints, use default device
    • Sets or removes video track constraints that are applied to ongoing calls and will also be used for any new Call created.

      Parameters

      • constraints: null | MediaTrackConstraints

        The constraints to apply for the video track:

        • Provide a MediaTrackConstraints object to apply specific constraints (e.g. { width: 1280, height: 720 }).
        • Pass null to remove previously set constraints, falling back to default constraints.

      Returns void

      callClient.setVideoTrackConstraints({ width: 1280, height: 720 });
      callClient.setVideoTrackConstraints(null); // remove constraints, use default/fallback