OmiCall API
  • Overview
  • OMICALL API
    • Tổng quan
    • Xác thực
    • Doanh nghiệp
    • Nhân viên
    • Khách hàng
      • v1
      • v2
    • Tổng đài
    • Lịch sử cuộc gọi
      • v1
      • v2
    • Gọi tự động
      • Gọi tự động sử dụng callBot
      • Gọi tự động thông thường - API V2
    • Webhooks
    • Click To Call
    • Ticket
      • v2
    • API tiêu chí kịch bản
    • Đa kênh
    • AI API
      • Text To Speech API
      • Speech To Text API
      • Gọi tự động sử dụng callBot
      • Phân tích cuộc gọi
  • WEBHOOKS
    • Tổng quan
    • Webhook
  • SDK Tích Hợp
    • Web Extension
      • Changelog
      • Pancake
      • Sapo
      • Haravan
      • Nhanh.vn
      • TPos.vn
      • KiotViet
      • Bitrix24
    • Web SDK
      • v3 Integration
      • v3 Changelog
      • v2 Integration
      • v2 Changelog
    • MOBILE SDK
      • Tổng Quan
      • Tại sao lại sử dụng OMICALL
      • Định nghĩa đầu số
      • Các SDK Hỗ Trợ
      • Tài khoản đăng nhập
      • IOS SDK
        • Cấu hình Push Notification
        • Cài đặt
        • Khởi tạo SDK
        • Xử lý các sự kiện
      • Android SDK
        • Cấu hình SDK
        • Cấu hình Push Notification
        • Khởi tạo SDK
        • Lắng nghe các sự kiện
      • Flutter SDK
      • React-Native SDK
    • Deep Links App to App
  • PARTNER
    • Tổng quan
    • Kho đầu số
    • Gói dịch vụ
    • Lịch sử thanh toán
    • Quản lý doanh nghiệp
    • Thông tin đối tác
Powered by GitBook
On this page
  • Bước 1: cài đặt môi trường:
  • Bước 2: Cài đặt lớp xử lý Voip Push :
  • Bước 3: Cài đặt xử lý Push notification:
  • Bước 4: Khởi tạo thư viện

Was this helpful?

  1. SDK Tích Hợp
  2. MOBILE SDK
  3. IOS SDK

Khởi tạo SDK

PreviousCài đặtNextXử lý các sự kiện

Last updated 2 years ago

Was this helpful?

Đối với IOS Omicall cung cấp cài đặt cho 2 môi trường kiểm thử ( Sanbox ) và triển khai ( Production )

Chúng ta cần import lớp thư viện để bắt đầu

#import <OmiKit/OmiKit.h>

Bước 1: cài đặt môi trường:


[OmiClient setEnviroment:KEY_OMI_APP_ENVIROMENT_SANDBOX];
có 2 biến môi trường:
- KEY_OMI_APP_ENVIROMENT_SANDBOX
- KEY_OMI_APP_ENVIROMENT_PRODUCTION

Bước 2: Cài đặt lớp xử lý Voip Push :

provider = [[CallKitProviderDelegate alloc] initWithCallManager: [OMISIPLib sharedInstance].callManager ];
voipRegistry = [[PKPushRegistry alloc] initWithQueue:dispatch_get_main_queue()];
pushkitManager = [[PushKitManager alloc] initWithVoipRegistry:voipRegistry];

Bước 3: Cài đặt xử lý Push notification:

- (void)requestPushNotificationPermissions
{
    // iOS 10+
    UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
    [center getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {
        switch (settings.authorizationStatus)
        {
            // User hasn't accepted or rejected permissions yet. This block shows the allow/deny dialog
            case UNAuthorizationStatusNotDetermined:
            {
                center.delegate = self;
                [center requestAuthorizationWithOptions:(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error)
                 {
                     if(granted)
                     {
                         dispatch_async(dispatch_get_main_queue(), ^{
                             [[UIApplication sharedApplication] registerForRemoteNotifications];
                         });
                     }
                     else
                     {
                         // notify user to enable push notification permission in settings
                     }
                 }];
                break;
            }
            case UNAuthorizationStatusAuthorized:
            {
                dispatch_async(dispatch_get_main_queue(), ^{
                    [[UIApplication sharedApplication] registerForRemoteNotifications];
                });
                break;
            }
            default:
                break;
        }
    }];
}

- (void)application:(UIApplication*)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)devToken
{
    // parse token bytes to string
    const char *data = [devToken bytes];
    NSMutableString *token = [NSMutableString string];
    for (NSUInteger i = 0; i < [devToken length]; i++)
    {
        [token appendFormat:@"%02.2hhX", data[i]];
    }
    [OmiClient setUserPushNotificationToken:[token copy]];
}

Bước 4: Khởi tạo thư viện

Có 2 cách khơi tạo:

    [OmiClient initWithUsername:@"xx" password:@"xx" realm:@""];
    [OmiClient startOmiService];

Cách 2: khởi tạo bằng apiKey cấp phát cho doanh nghiệp:

Mỗi tài khoản sẽ được cấp một API key để truy cập dịch vụ

Login SDK bằng lệnh:

[OmiClient initWithUUID:<#(NSString * _Nonnull)#> fullName:<#(NSString * _Nullable)#> apiKey:<#(NSString * _Nonnull)#>]

Trong đó:

  • uuid: là id định dạng của user ( có thể lấy username khách hàng của đối tác tích hợp SDK để làm uuid )

  • fullName: Tên của khách hàng dùng để hiển thị khi có cuộc gọi đến

  • apiKey: key dùng để xác minh khách hàng

Cách 1: khởi tạo bằng thông tin của số nội bộ ( cấp cho nhân viên - )

xem ở đây
Cấu hình các chứng chỉ cho từng môi trường phát triển trên Omicall