• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Call Manager<a name="EN-US_TOPIC_0000001105058232"></a>
2
3-   [Introduction](#section117mcpsimp)
4-   [Directory Structure](#section128mcpsimp)
5-   [Constraints](#section131mcpsimp)
6-   [Available APIs](#section136mcpsimp)
7-   [Usage Guidelines](#section163mcpsimp)
8    -   [Calling the dial API to Place a Call](#section113291522113518)
9
10-   [Repositories Involved](#section227mcpsimp)
11
12## Introduction<a name="section117mcpsimp"></a>
13
14The 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\).
15
161.  CallServiceAbility: Implements interaction with the call UI, for example, launching the keypad UI for dialup and reporting the incoming call status to the UI.
172.  CallManagerService: starts and initializes the Call Manager.
183.  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.
194.  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.
205.  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.
216.  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.
22
23The following figure shows the architecture of the Call Manager module.
24
25**Figure  1**  Architecture of the Call Manager module<a name="fig11440121615591"></a>
26
27
28![](figures/en-us_architecture-of-the-call-manager-module.png)
29
30## Directory Structure<a name="section128mcpsimp"></a>
31
32```
33/base/telephony/call_manager
34├─ frameworks                              # JS NAPIs
35├─ interfaces                              # External APIs
36│  ├─ innerkits                            # Internal APIs
37│  └─ kits                                 # JS APIs
38├─ sa_profile                              # SA profile
39├─ services                                # Service code
40│  ├─ audio                                # Audio Manager code
41│  ├─ bluetooth                            # Bluetooth Manager code
42│  ├─ call                                 # Call Manager code
43│  ├─ call_manager_service                 # CallManagerService code
44│  ├─ call_report                          # CallReport code
45│  ├─ call_setting                         # CallSetting code
46│  ├─ telephony_interaction                # Telephony core service code
47│  └─ video                                # Video code
48├─ test                                    # Unit test code
49└─ utils                                   # Utilities
50```
51
52## Constraints<a name="section131mcpsimp"></a>
53
54-   Programming language: JavaScript
55-   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\).
56-   In terms of hardware, the accommodating device must be equipped with a speaker or earphone, and a headset.
57
58## Available APIs<a name="section136mcpsimp"></a>
59
60**Table  1**  External API provided by the Call Manager module
61
62<a name="table137mcpsimp"></a>
63<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>
64</th>
65<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>
66</th>
67<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>
68</th>
69</tr>
70</thead>
71<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&lt;boolean&gt;): void;</p>
72</td>
73<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>
74</td>
75<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>
76</td>
77</tr>
78</tbody>
79</table>
80
81**Table  2**  Parameters of the Dial API
82
83<a name="table18488202215170"></a>
84<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>
85</th>
86<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>
87</th>
88</tr>
89</thead>
90<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>
91</td>
92<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>
93</td>
94</tr>
95<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>
96</td>
97<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>
98</td>
99</tr>
100<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&lt;boolean&gt;</p>
101</td>
102<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>
103</td>
104</tr>
105</tbody>
106</table>
107
108**Table  3**  Parameter description of options: DialOptions
109
110<a name="table1322739190"></a>
111<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>
112</th>
113<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>
114</th>
115<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>
116</th>
117<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>
118</th>
119<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>
120</th>
121</tr>
122</thead>
123<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>
124</td>
125<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>
126</td>
127<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>
128</td>
129<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>
130</td>
131<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>
132</td>
133</tr>
134</tbody>
135</table>
136
137## Usage Guidelines<a name="section163mcpsimp"></a>
138
139### Calling the dial API to Place a Call<a name="section113291522113518"></a>
140
1411.  Construct the  **phoneNumber**  and  **options**  parameters.
1422.  Call the  **Dial**  API in callback or Promise mode.
1433.  Obtain the dialup result. The  **Dial**  API works in asynchronous mode. The dialup result is returned through the callback.
144
145    ```
146    import call from "@ohos.telephony.call";
147
148    let phoneNumber = "12312312312";
149
150    // Call the API in callback mode.
151    call.dial(phoneNumber, {extras: false}, (err, value) => {
152      if (err) {
153        // If the API call failed, err is not empty.
154        console.error(`failed to dial because ${err.message}`);
155        return;
156      }
157      // If the API call succeeded, err is empty.
158      console.log(`success to dial: ${value}`);
159    });
160
161    // Call the API in Promise mode.
162    let promise = call.dial(phoneNumber, {extras: false});
163    promise.then((value) => {
164      // The API call succeeded.
165      console.log(`success to dial: ${value}`);
166    }).catch((err) => {
167      // The API call failed.
168      console.error(`failed to dial because ${err.message}`);
169    });
170    ```
171
172
173## Repositories Involved<a name="section227mcpsimp"></a>
174
175[Telephony](https://gitee.com/openharmony/docs/blob/master/en/readme/telephony.md)
176
177**telephony_call_manager**
178
179[telephony_core_service](https://gitee.com/openharmony/telephony_core_service/blob/master/README.md)
180
181[telephony_cellular_call](https://gitee.com/openharmony/telephony_cellular_call/blob/master/README.md)
182
183[telephony_state_registry](https://gitee.com/openharmony/telephony_state_registry/blob/master/README.md)