Updated on 2023-03-23 GMT+08:00

Scenario 6: Initiating a Call

Description

The startCall API can be used to initiate a call after you log in.

Service Process

If you need to initiate a call using the SDK, call the startCall API and then implement the callback.

  1. Call the API.

    1. Call the startCall API to initiate a call.

  2. Implement the callback.

    Implement the callback.

Sample Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
/// Initiate a call.
- (void)startCall {
    /**
     * App ID login scenario: You can use an account, number, or third-party user ID for login. The priority is as follows: number > account > third-party user ID.
     * Non-app ID login scenario: You can use an account or number for login. The priority is as follows: number > account.
     */
    HWMStartCallParam *param = [[HWMStartCallParam alloc] init];
    param.isVideo = YES;
    param.account = @"";
    param.number = @"+991112988657623";
    param.thirdUserId = @"";
    [[HWMSdk getOpenApi] startCall:param callback:^(NSError * _Nullable error, id  _Nullable result) {
        if (error) {
            NSLog(@"Failed to initiate the call %@", error.localizedDescription);
        }else{
            NSLog(@"Call initiated.");
        }
    }];
}