1 Star 0 Fork 370

minleilei / telephony_call_manager_0908

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 10.93 KB
一键复制 编辑 原始数据 按行查看 历史
张海丰 提交于 2021-09-05 20:23 . zhanghaifeng11@huawei.com

Call Manager

Introduction

The Call Manager module mainly manages three types of calls: circuit switched (CS), IP multimedia subsystem (IMS), and over the top (OTT) calls. It is responsible for applying for the audio and video resources required for a call and resolving conflicts in a multi-channel call. The module consists of six parts: UI interaction (CallServiceAbility), service management (CallManagerService), call management (Call Manager), audio management (Audio Manager), video management (Video Manager), and Bluetooth management (Bluetooth Manager).

  1. CallServiceAbility: Implements interaction with the call UI, for example, launching the keypad UI for dialup and reporting the incoming call status to the UI.
  2. CallManagerService: starts and initializes the Call Manager.
  3. Call Manager: processes downlink call operations (such as dialup, answer, and onhook) and uplink call status (such as incoming call status and call waiting status), and resolves conflicts that occur in a call.
  4. Audio Manager: applies for audio resources for a call and releases the resources after the call ends. This part depends on the multimedia subsystem and needs to call its APIs to perform audio-related operations.
  5. Video Manager: applies for video resources for a call and releases the resources after the call ends. This part depends on the multimedia subsystem and needs to call its APIs to perform video-related operations.
  6. Bluetooth Manager: applies for Bluetooth resources for a call and releases the resources after the call ends. Besides, this part processes call operations initiated by Bluetooth devices, such as answering and ending calls.

The following figure shows the architecture of the Call Manager module.

Figure 1 Architecture of the Call Manager module

Directory Structure

/base/telephony/call_manager
├─ interfaces                              # External APIs
│  └─ kits                                 # JS APIs and NAPIs
├─ sa_profile                              # SA profile
├─ services                                # Service code
│  ├─ audio                                # Audio Manager code
│  ├─ bluetooth                            # Bluetooth Manager code
│  ├─ call                                 # Call Manager code
│  ├─ call_manager_service                 # CallManagerService code
│  ├─ call_setting                         # CallSetting code
│  ├─ telephony_interaction                # Telephony core service code
│  └─ call_ui_interaction                  # CallServiceAbility code
├─ test                                    # Unit test code
└─ utils                                   # Utilities

Constraints

  • Programming language: JavaScript
  • In terms of software, this module needs to work with the Security subsystem, Multimedia subsystem, and Intelligent Soft Bus subsystem (Bluetooth module), as well as the telephony core service (core_service) and cellular call module (cellular_call).
  • In terms of hardware, the accommodating device must be equipped with a speaker or earphone, and a headset.

Available APIs

Table 1 External API provided by the Call Manager module

Description

Description

Required Permission

function dial(phoneNumber: string, options: DialOptions, callback: AsyncCallback<boolean>): void;

Performs dialup operations.

ohos.permission.PLACE_CALL

Table 2 Parameters of the Dial API

Parameter

Description

phoneNumber: string

Phone number

options: DialOptions

Dialup options (For details, see the following table.)

callback: AsyncCallback<boolean>

Asynchronous execution result. Value true indicates that the dialup is successful, and value false indicates that the dialup has failed.

Table 3 Parameter description of options: DialOptions

Parameter

Type

Description

Mandatory

Default Value

extras

boolean

false: audio; true: video

No

false

Usage Guidelines

Calling the dial API to Place a Call

  1. Construct the phoneNumber and options parameters.

  2. Call the Dial API in callback or Promise mode.

  3. Obtain the dialup result. The Dial API works in asynchronous mode. The dialup result is returned through the callback.

    import call from "@ohos.telephony.call";
    
    let phoneNumber = "12312312312";
    
    // Call the API in callback mode.
    call.dial(phoneNumber, {extras: false}, (err, value) => {
      if (err) {
        // If the API call failed, err is not empty.
        console.error(`failed to dial because ${err.message}`);
        return;
      }
      // If the API call succeeded, err is empty.
      console.log(`success to dial: ${value}`);
    });
    
    // Call the API in Promise mode.
    let promise = call.dial(phoneNumber, {extras: false});
    promise.then((value) => {
      // The API call succeeded.
      console.log(`success to dial: ${value}`);
    }).catch((err) => {
      // The API call failed.
      console.error(`failed to dial because ${err.message}`);
    });

Repositories Involved

Telephony

telephony_call_manager

telephony_core_service

telephony_cellular_call

telephony_state_registry

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/minleilei/telephony_call_manager.git
git@gitee.com:minleilei/telephony_call_manager.git
minleilei
telephony_call_manager
telephony_call_manager_0908
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891