Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
figures/ | 12-May-2024 | - | ||||
frameworks/ | 12-May-2024 | - | 15,996 | 13,892 | ||
interfaces/ | 12-May-2024 | - | 9,669 | 1,757 | ||
resource/audio/ | 12-May-2024 | - | 22 | 20 | ||
sa_profile/ | 12-May-2024 | - | 49 | 45 | ||
services/ | 12-May-2024 | - | 25,097 | 19,499 | ||
test/ | 12-May-2024 | - | 17,185 | 13,239 | ||
utils/ | 12-May-2024 | - | 324 | 244 | ||
BUILD.gn | D | 12-May-2024 | 7.7 KiB | 197 | 183 | |
LICENSE | D | 12-May-2024 | 9.9 KiB | 177 | 150 | |
README.md | D | 12-May-2024 | 11.2 KiB | 182 | 148 | |
README_zh.md | D | 12-May-2024 | 11 KiB | 190 | 156 | |
bundle.json | D | 12-May-2024 | 2.7 KiB | 91 | 90 |
README.md
1# Call Manager<a name="EN-US_TOPIC_0000001105058232"></a> 2 3 4## Introduction<a name="section117mcpsimp"></a> 5 6The 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\). 7 81. CallServiceAbility: Implements interaction with the call UI, for example, launching the keypad UI for dialup and reporting the incoming call status to the UI. 92. CallManagerService: starts and initializes the Call Manager. 103. 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. 114. 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. 125. 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. 136. 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. 14 15The following figure shows the architecture of the Call Manager module. 16 17**Figure 1** Architecture of the Call Manager module<a name="fig11440121615591"></a> 18 19 20 21 22## Directory Structure<a name="section128mcpsimp"></a> 23 24``` 25/base/telephony/call_manager 26├─ figures # Figures of readme files 27├─ frameworks # Frameworks 28│ ├─ js # JS code 29│ └─ native # Native code 30├─ interfaces # APIs 31│ ├─ innerkits # Internal APIs 32│ └─ kits # External APIs (such as JS APIs) 33├─ sa_profile # SA profile 34├─ services # Service code 35│ ├─ audio # Audio management 36│ ├─ bluetooth # Bluetooth call management 37│ ├─ call # Call service 38│ ├─ call_manager_service # Call Manager service 39│ ├─ call_report # Call status reporting 40│ ├─ call_setting # Call setting 41│ ├─ telephony_interaction # Telephony core service interaction 42│ └─ video # Video Manager code 43├─ test # Test code 44│ ├─ fuzztest # Fuzzy test 45│ ├─ mock # Simulation test 46│ └─ unittest # Unit test 47└─ utils # Utilities 48``` 49 50## Constraints<a name="section131mcpsimp"></a> 51 52- Programming language: JavaScript 53- 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\). 54- In terms of hardware, the accommodating device must be equipped with a speaker or earphone, and a headset. 55 56## Available APIs<a name="section136mcpsimp"></a> 57 58**Table 1** External API provided by the Call Manager module 59 60<a name="table137mcpsimp"></a> 61<table><thead align="left"><tr id="row143mcpsimp"><th class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.2.4.1.1"><p id="entry144mcpsimpp0"><a name="entry144mcpsimpp0"></a><a name="entry144mcpsimpp0"></a>Description</p> 62</th> 63<th class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.2.4.1.2"><p id="entry145mcpsimpp0"><a name="entry145mcpsimpp0"></a><a name="entry145mcpsimpp0"></a>Description</p> 64</th> 65<th class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.2.4.1.3"><p id="entry146mcpsimpp0"><a name="entry146mcpsimpp0"></a><a name="entry146mcpsimpp0"></a>Required Permission</p> 66</th> 67</tr> 68</thead> 69<tbody><tr id="row147mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.1 "><p id="p143312519577"><a name="p143312519577"></a><a name="p143312519577"></a>function dial(phoneNumber: string, options: DialOptions, callback: AsyncCallback<boolean>): void;</p> 70</td> 71<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.2 "><p id="entry149mcpsimpp0"><a name="entry149mcpsimpp0"></a><a name="entry149mcpsimpp0"></a>Performs dialup operations.</p> 72</td> 73<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.3 "><p id="entry150mcpsimpp0"><a name="entry150mcpsimpp0"></a><a name="entry150mcpsimpp0"></a>ohos.permission.PLACE_CALL</p> 74</td> 75</tr> 76</tbody> 77</table> 78 79**Table 2** Parameters of the Dial API 80 81<a name="table18488202215170"></a> 82<table><thead align="left"><tr id="row748952217179"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p1948942271710"><a name="p1948942271710"></a><a name="p1948942271710"></a>Parameter</p> 83</th> 84<th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.2"><p id="p1648972215173"><a name="p1648972215173"></a><a name="p1648972215173"></a>Description</p> 85</th> 86</tr> 87</thead> 88<tbody><tr id="row749092213171"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p14901222191720"><a name="p14901222191720"></a><a name="p14901222191720"></a>phoneNumber: string</p> 89</td> 90<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p34906228170"><a name="p34906228170"></a><a name="p34906228170"></a>Phone number</p> 91</td> 92</tr> 93<tr id="row549011221176"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p44902223175"><a name="p44902223175"></a><a name="p44902223175"></a>options: DialOptions</p> 94</td> 95<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p11490162241718"><a name="p11490162241718"></a><a name="p11490162241718"></a>Dialup options (For details, see the following table.)</p> 96</td> 97</tr> 98<tr id="row149072216176"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p5490152211715"><a name="p5490152211715"></a><a name="p5490152211715"></a>callback: AsyncCallback<boolean></p> 99</td> 100<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p649002291718"><a name="p649002291718"></a><a name="p649002291718"></a>Asynchronous execution result. Value <strong id="b1400386820"><a name="b1400386820"></a><a name="b1400386820"></a>true</strong> indicates that the dialup is successful, and value <strong id="b022154719814"><a name="b022154719814"></a><a name="b022154719814"></a>false</strong> indicates that the dialup has failed.</p> 101</td> 102</tr> 103</tbody> 104</table> 105 106**Table 3** Parameter description of options: DialOptions 107 108<a name="table1322739190"></a> 109<table><thead align="left"><tr id="row193221031194"><th class="cellrowborder" valign="top" width="20%" id="mcps1.2.6.1.1"><p id="p203224311917"><a name="p203224311917"></a><a name="p203224311917"></a>Parameter</p> 110</th> 111<th class="cellrowborder" valign="top" width="20%" id="mcps1.2.6.1.2"><p id="p1639614810198"><a name="p1639614810198"></a><a name="p1639614810198"></a>Type</p> 112</th> 113<th class="cellrowborder" valign="top" width="20%" id="mcps1.2.6.1.3"><p id="p113221730191"><a name="p113221730191"></a><a name="p113221730191"></a>Description</p> 114</th> 115<th class="cellrowborder" valign="top" width="20%" id="mcps1.2.6.1.4"><p id="p153221330197"><a name="p153221330197"></a><a name="p153221330197"></a>Mandatory</p> 116</th> 117<th class="cellrowborder" valign="top" width="20%" id="mcps1.2.6.1.5"><p id="p632220310199"><a name="p632220310199"></a><a name="p632220310199"></a>Default Value</p> 118</th> 119</tr> 120</thead> 121<tbody><tr id="row123238311920"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.1 "><p id="p932310311197"><a name="p932310311197"></a><a name="p932310311197"></a>extras</p> 122</td> 123<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.2 "><p id="p73966801911"><a name="p73966801911"></a><a name="p73966801911"></a>boolean</p> 124</td> 125<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.3 "><p id="p19821612162118"><a name="p19821612162118"></a><a name="p19821612162118"></a><strong id="b345117841310"><a name="b345117841310"></a><a name="b345117841310"></a>false</strong>: audio; <strong id="b1701410181319"><a name="b1701410181319"></a><a name="b1701410181319"></a>true</strong>: video</p> 126</td> 127<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.4 "><p id="p33231931191"><a name="p33231931191"></a><a name="p33231931191"></a>No</p> 128</td> 129<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.5 "><p id="p12323232197"><a name="p12323232197"></a><a name="p12323232197"></a>false</p> 130</td> 131</tr> 132</tbody> 133</table> 134 135## Usage Guidelines<a name="section163mcpsimp"></a> 136 137### Calling the dial API to Place a Call<a name="section113291522113518"></a> 138 1391. Construct the **phoneNumber** and **options** parameters. 1402. Call the **Dial** API in callback or Promise mode. 1413. Obtain the dialup result. The **Dial** API works in asynchronous mode. The dialup result is returned through the callback. 142 143 ``` 144 import call from "@ohos.telephony.call"; 145 146 let phoneNumber = "12312312312"; 147 148 // Call the API in callback mode. 149 call.dial(phoneNumber, {extras: false}, (err, value) => { 150 if (err) { 151 // If the API call failed, err is not empty. 152 console.error(`failed to dial because ${err.message}`); 153 return; 154 } 155 // If the API call succeeded, err is empty. 156 console.log(`success to dial: ${value}`); 157 }); 158 159 // Call the API in Promise mode. 160 let promise = call.dial(phoneNumber, {extras: false}); 161 promise.then((value) => { 162 // The API call succeeded. 163 console.log(`success to dial: ${value}`); 164 }).catch((err) => { 165 // The API call failed. 166 console.error(`failed to dial because ${err.message}`); 167 }); 168 ``` 169 170 171## Repositories Involved<a name="section227mcpsimp"></a> 172 173[Telephony](https://gitee.com/openharmony/docs/blob/master/en/readme/telephony.md) 174 175**telephony_call_manager** 176 177[telephony_core_service](https://gitee.com/openharmony/telephony_core_service/blob/master/README.md) 178 179[telephony_cellular_call](https://gitee.com/openharmony/telephony_cellular_call/blob/master/README.md) 180 181[telephony_state_registry](https://gitee.com/openharmony/telephony_state_registry/blob/master/README.md) 182
README_zh.md
1# 通话管理<a name="ZH-CN_TOPIC_0000001105058232"></a> 2 3- [简介](#section117mcpsimp) 4- [目录](#section128mcpsimp) 5- [约束](#section131mcpsimp) 6- [接口说明](#section136mcpsimp) 7- [使用说明](#section163mcpsimp) 8 - [拨打电话接口调用流程及示例代码](#section113291522113518) 9 10- [相关仓](#section227mcpsimp) 11 12## 简介<a name="section117mcpsimp"></a> 13 14通话管理模块主要管理CS(Circuit Switch,电路交换)、IMS(IP Multimedia Subsystem,IP多媒体子系统)和OTT(over the top,OTT解决方案)三种类型的通话,负责申请通话所需要的音视频资源,并处理多路通话时产生的各种冲突。通话管理主要分为UI交互、服务管理、系统通话管理、通话音频管理、通话视频管理和蓝牙通话管理六大模块,各模块简介如下: 15 161. UI交互模块:负责和通话UI交互,如UI调用接口拨号,上报来电等状态给UI。 172. 服务管理模块:负责启动和初始化系统通话管理服务。 183. 系统通话管理模块:负责处理通话下行操作(如拨号、接听、挂断等)和上行状态(来电状态、呼叫等待状态等)的处理,并解决通话过程中产生的冲突。 194. 通话音频管理模块:负责通话时需要的音频资源的申请和释放,依赖多媒体子系统,需要调用多媒体子系统接口进行音频相关的操作。 205. 通话视频管理模块:负责通话时需要的视频资源的申请和释放,依赖多媒体子系统,需要调用多媒体子系统接口进行视频相关的操作。 216. 蓝牙通话管理模块:负责通话时需要的蓝牙资源的申请和释放,并处理蓝牙设备发起的通话操作,如接听和挂断等。 22 23其主要的结构及流程如下图所示: 24 25**图 1** 通话管理模块架构图<a name="fig11440121615591"></a> 26 27 28 29 30## 目录<a name="section128mcpsimp"></a> 31 32``` 33/base/telephony/call_manager 34├─ figures # Readme资源文件 35├─ frameworks # 框架层目录 36│ ├─ js # js相关代码 37│ └─ native # native相关代码 38├─ interfaces # 接口目录 39│ ├─ innerkits # 部件间的内部接口 40│ └─ kits # 对应用提供的接口(例如JS接口) 41├─ sa_profile # 启动配置文件 42├─ services # 服务内部代码 43│ ├─ audio # 音频管理相关代码 44│ ├─ bluetooth # 蓝牙通话相关代码 45│ ├─ call # 通话业务相关代码 46│ ├─ call_manager_service # 进程服务管理相关代码 47│ ├─ call_report # 通话状态等信息上报相关代码 48│ ├─ call_setting # 通话设置相关代码 49│ ├─ telephony_interaction # 电话核心服务交互相关代码 50│ └─ video # 视频管理相关代码 51├─ test # 测试相关代码 52│ ├─ fuzztest # 模糊测试相关代码 53│ ├─ mock # 模拟测试相关代码 54│ └─ unittest # 单元测试相关代码 55└─ utils # 通用工具代码目录 56``` 57 58## 约束<a name="section131mcpsimp"></a> 59 60- 开发语言:JavaScript。 61- 软件上,需要与以下子系统和服务配合使用:安全子系统,多媒体子系统,软总线基础通信子系统\(蓝牙模块\),Telephony核心服务(core\_service),蜂窝通话服务(cellular\_call)。 62- 硬件上,需要搭载的设备支持以下硬件:扬声器或听筒、麦克风。 63 64## 接口说明<a name="section136mcpsimp"></a> 65 66**表 1** 通话管理对外提供的接口 67 68<a name="table137mcpsimp"></a> 69<table><thead align="left"><tr id="row143mcpsimp"><th class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.2.4.1.1"><p id="entry144mcpsimpp0"><a name="entry144mcpsimpp0"></a><a name="entry144mcpsimpp0"></a>接口内容</p> 70</th> 71<th class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.2.4.1.2"><p id="entry145mcpsimpp0"><a name="entry145mcpsimpp0"></a><a name="entry145mcpsimpp0"></a>接口描述</p> 72</th> 73<th class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.2.4.1.3"><p id="entry146mcpsimpp0"><a name="entry146mcpsimpp0"></a><a name="entry146mcpsimpp0"></a>所需权限</p> 74</th> 75</tr> 76</thead> 77<tbody><tr id="row147mcpsimp"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.1 "><p id="p143312519577"><a name="p143312519577"></a><a name="p143312519577"></a>function dial(phoneNumber: string, options: DialOptions, callback: AsyncCallback<boolean>): void;</p> 78</td> 79<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.2 "><p id="entry149mcpsimpp0"><a name="entry149mcpsimpp0"></a><a name="entry149mcpsimpp0"></a>拨号接口,调用此接口可以进行拨号操作</p> 80</td> 81<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.2.4.1.3 "><p id="entry150mcpsimpp0"><a name="entry150mcpsimpp0"></a><a name="entry150mcpsimpp0"></a>ohos.permission.PLACE_CALL</p> 82</td> 83</tr> 84</tbody> 85</table> 86 87**表 2** 拨号接口参数说明 88 89<a name="table18488202215170"></a> 90<table><thead align="left"><tr id="row748952217179"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p1948942271710"><a name="p1948942271710"></a><a name="p1948942271710"></a>参数</p> 91</th> 92<th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.2"><p id="p1648972215173"><a name="p1648972215173"></a><a name="p1648972215173"></a>描述</p> 93</th> 94</tr> 95</thead> 96<tbody><tr id="row749092213171"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p14901222191720"><a name="p14901222191720"></a><a name="p14901222191720"></a>phoneNumber: string</p> 97</td> 98<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p34906228170"><a name="p34906228170"></a><a name="p34906228170"></a>电话号码</p> 99</td> 100</tr> 101<tr id="row549011221176"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p44902223175"><a name="p44902223175"></a><a name="p44902223175"></a>options: DialOptions</p> 102</td> 103<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p11490162241718"><a name="p11490162241718"></a><a name="p11490162241718"></a>扩展参数(详见下表)</p> 104</td> 105</tr> 106<tr id="row149072216176"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p5490152211715"><a name="p5490152211715"></a><a name="p5490152211715"></a>callback: AsyncCallback<boolean></p> 107</td> 108<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p649002291718"><a name="p649002291718"></a><a name="p649002291718"></a>异步执行结果,true表示执行成功,false表示执行失败</p> 109</td> 110</tr> 111</tbody> 112</table> 113 114**表 3** options: DialOptions参数说明 115 116<a name="table1322739190"></a> 117<table><thead align="left"><tr id="row193221031194"><th class="cellrowborder" valign="top" width="20%" id="mcps1.2.6.1.1"><p id="p203224311917"><a name="p203224311917"></a><a name="p203224311917"></a>参数</p> 118</th> 119<th class="cellrowborder" valign="top" width="20%" id="mcps1.2.6.1.2"><p id="p1639614810198"><a name="p1639614810198"></a><a name="p1639614810198"></a>类型</p> 120</th> 121<th class="cellrowborder" valign="top" width="20%" id="mcps1.2.6.1.3"><p id="p113221730191"><a name="p113221730191"></a><a name="p113221730191"></a>描述</p> 122</th> 123<th class="cellrowborder" valign="top" width="20%" id="mcps1.2.6.1.4"><p id="p153221330197"><a name="p153221330197"></a><a name="p153221330197"></a>是否必填</p> 124</th> 125<th class="cellrowborder" valign="top" width="20%" id="mcps1.2.6.1.5"><p id="p632220310199"><a name="p632220310199"></a><a name="p632220310199"></a>默认值</p> 126</th> 127</tr> 128</thead> 129<tbody><tr id="row123238311920"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.1 "><p id="p932310311197"><a name="p932310311197"></a><a name="p932310311197"></a>extras</p> 130</td> 131<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.2 "><p id="p73966801911"><a name="p73966801911"></a><a name="p73966801911"></a>boolean</p> 132</td> 133<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.3 "><p id="p19821612162118"><a name="p19821612162118"></a><a name="p19821612162118"></a>false:音频 true:视频</p> 134</td> 135<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.4 "><p id="p33231931191"><a name="p33231931191"></a><a name="p33231931191"></a>否</p> 136</td> 137<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.5 "><p id="p12323232197"><a name="p12323232197"></a><a name="p12323232197"></a>false</p> 138</td> 139</tr> 140</tbody> 141</table> 142 143完整的JS API说明以及实例代码请参考:[拨打电话](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-call.md)。 144## 使用说明<a name="section163mcpsimp"></a> 145 146### 拨打电话接口调用流程及示例代码<a name="section113291522113518"></a> 147 1481. 构造phoneNumber和options参数; 1492. 可以通过callback或者Promise的方式调用dial接口。 1503. 该接口为异步接口,相关执行结果会从callback中返回。 151 152 ``` 153 import call from "@ohos.telephony.call"; 154 155 let phoneNumber = "12312312312"; 156 157 // 调用接口【callback方式】 158 call.dial(phoneNumber, {extras: false}, (err, value) => { 159 if (err) { 160 // 接口调用失败,err非空 161 console.error(`failed to dial because ${err.message}`); 162 return; 163 } 164 // 接口调用成功,err为空 165 console.log(`success to dial: ${value}`); 166 }); 167 168 // 调用接口【Promise方式】 169 let promise = call.dial(phoneNumber, {extras: false}); 170 promise.then((value) => { 171 // 接口调用成功,此处可以实现成功场景分支代码。 172 console.log(`success to dial: ${value}`); 173 }).catch((err) => { 174 // 接口调用失败,此处可以实现失败场景分支代码。 175 console.error(`failed to dial because ${err.message}`); 176 }); 177 ``` 178 179 180## 相关仓<a name="section227mcpsimp"></a> 181 182[电话服务子系统](https://gitee.com/openharmony/docs/blob/master/zh-cn/readme/电话服务子系统.md) 183 184**telephony_call_manager** 185 186[telephony_core_service](https://gitee.com/openharmony/telephony_core_service/blob/master/README_zh.md) 187 188[telephony_cellular_call](https://gitee.com/openharmony/telephony_cellular_call/blob/master/README_zh.md) 189 190[telephony_state_registry](https://gitee.com/openharmony/telephony_state_registry/blob/master/README_zh.md)