Browse SDKs · WASM
SDKsWASMEnterprise

Start a one-to-one call

Start a one-to-one audio or video call with the WASM SDK.

Copy

signalingInvite() starts a one-to-one call. The WASM SDK handles call signaling; your application still needs to connect to a real-time audio and video engine with the returned room credentials.

Parameters

ParameterTypeRequiredDescription
invitationRtcInviteYesInvitation for this call.
invitation.inviterUserIDstringYesID of the currently signed-in user.
invitation.inviteeUserIDListstring[]YesInvitee IDs. For a one-to-one call, include only the other user.
invitation.groupIDstringYesPass an empty string for a one-to-one call.
invitation.roomIDstringYesUnique room identifier for this call and the merge key for subsequent state.
invitation.timeoutnumberYesInvitation timeout in seconds.
invitation.mediaTypestringYesApplication-defined media type, usually audio or video.
invitation.sessionTypeSessionTypeYesUse SessionType.Single for a one-to-one call.
invitation.platformIDPlatformYesCurrent client platform. Use Platform.Web in a web application.
invitation.customDatastringNoBusiness extension string carried with the invitation.
invitation.initiateTimenumberNoInvitation start time. The signaling flow normally maintains it, so it does not need to be set manually.
invitation.busyLineUserIDListstring[]NoBusy-user list. Normally omit it when starting a new invitation.
offlinePushInfoOfflinePushNoPush content used when the invitee is offline.
offlinePushInfo.titlestringConditionalPush title, required when offlinePushInfo is provided.
offlinePushInfo.descstringConditionalPush body, required when offlinePushInfo is provided.
offlinePushInfo.exstringConditionalExtension string, required when offlinePushInfo is provided. Pass an empty string if unused.
offlinePushInfo.iOSPushSoundstringConditionaliOS push sound, required when offlinePushInfo is provided.
offlinePushInfo.iOSBadgeCountbooleanConditionalWhether to update the iOS badge, required when offlinePushInfo is provided.
import { Platform, SessionType } from '@openim/wasm-client-sdk';

const { data: roomCredentials } = await openimsdk.signalingInvite({
  invitation: {
    inviterUserID: currentUserID,
    inviteeUserIDList: [peerUserID],
    customData: JSON.stringify({ source: 'contact-card' }),
    groupID: '',
    roomID: crypto.randomUUID(),
    timeout: 30,
    mediaType: 'video',
    sessionType: SessionType.Single,
    platformID: Platform.Web,
  },
  offlinePushInfo: {
    title: 'Video call',
    desc: 'You have received a video call invitation',
    ex: '',
    iOSPushSound: 'default',
    iOSBadgeCount: true,
  },
});

Return result

When the Promise resolves, data is RtcInviteResults:

FieldTypeDescription
roomIDstringMedia room ID for this call. It should match the room in the signaling invitation.
tokenstringShort-lived credential for joining the media room. Keep it in memory only.
liveURLstringRoom connection URL returned by the media service. Whether it is used depends on the integrated media engine.
busyLineUserIDListstring[] (optional)IDs of users who could not enter the invitation flow because they were busy.

Connect to the media room only after obtaining a valid token and roomID. Promise completion means the signaling request completed and room credentials were returned; it does not mean the other user has answered. For subsequent state, see Call events.