Start a one-to-one call
Start a one-to-one audio or video call with the OpenIM iOS SDK.
Initiate a direct audio or video call by dispatching a call invitation. The SDK coordinates signaling exchange and room credential allocation. The application layer consumes the returned room credentials to connect to your WebRTC or RTC media engine.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
inviteeUserIDList | NSArray<NSString *> * | Yes | List of target user IDs. For one-to-one calls, provide exactly one target user ID. |
roomID | NSString * | Yes | Unique room identifier, generated as a UUID by the client or provided by your backend. |
timeout | NSInteger | Yes | Invitation timeout duration in seconds. |
mediaType | NSString * | Yes | Media stream type: @"video" or @"audio". |
groupID | NSString * | No | Target group identifier. Pass an empty string @"" for one-to-one calls. |
Code example
OIMInvitationInfo *invitation = [OIMInvitationInfo new];
invitation.inviteeUserIDList = @[@"user_b"];
invitation.roomID = NSUUID.UUID.UUIDString.lowercaseString;
invitation.timeout = 30;
invitation.mediaType = @"video";
invitation.groupID = @"";
OIMSignalingInfo *signalingInfo =
[[OIMManager manager] signalingInvite:invitation
offlinePushInfo:push
onSuccess:^(OIMInvitationResultInfo * _Nullable credentials) {
if (credentials != nil) {
[self joinMediaRoom:credentials];
}
}
onFailure:^(NSInteger code, NSString * _Nullable message) {
[self showCallError:code message:message ?: @"Failed to initiate call"];
}];Retain the OIMSignalingInfo object returned synchronously by signalingInvite:...; it stores the active signaling snapshot required to cancel, hang up, or correlate subsequent signaling events.
Return value
The onSuccess callback returns an OIMInvitationResultInfo instance containing the allocated roomID, room access token, streaming liveURL, and busy user list (busyLineUserIDList). Success indicates only that OpenIMServer processed the signaling invitation; it does not indicate that the callee has answered.
State changes after the call
- Local state merge: Track active call session state using
roomIDas the primary key and track participant states combiningroomIDanduserID. - Remote event notification: The callee receives an incoming invitation notification via
onReceiveNewInvitation:inOIMSignalingListener(see Handle call events). - Answer detection: The caller tracks whether the callee accepts or rejects the call via the
onInviteeAccepted:andonInviteeRejected:delegate callbacks.
Was this page helpful?