upload tizen1.0 source
[framework/telephony/libslp-tapi.git] / src / tapi_proxy_call.c
1 /*
2  * libslp-tapi
3  *
4  * Copyright (c) 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Ja-young Gu <jygu@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20
21 #include <stdio.h>
22 #include <string.h>
23
24 #include "TelDefines.h"
25 #include "TelSs.h"
26 #include "TelCall.h"
27 #include "tel_cs_conn.h"
28 #include "tapi_proxy.h"
29 #include "TapiUtility.h"
30 #include "TelUtility.h"
31
32 extern tapi_dbus_connection_name conn_name;
33
34 /******************************************************************************
35  *******************************************************************************
36  *
37  *                                                      G L O B A L   V A R I A B L E S
38  *
39  ******************************************************************************
40  ******************************************************************************/
41 //      None.
42
43
44 /******************************************************************************
45  *******************************************************************************
46  *
47  *                                              P R O X Y   C A L  L   A P I's
48  *
49  *
50  ******************************************************************************
51  ******************************************************************************/
52
53 /**
54  *
55  * Initiate a new call. Call could be either voice or video.
56  *
57  * The client specifies the telephone number and the desired call parameters via the
58  *
59  * tapi_call_setup_info_t argument. After successful completion of the dial request a call identifier is
60  *
61  * returned back to the client via the ptr_call_handle argument. The call identifier is needed to hold,
62  *
63  * resume, swap, and terminate the call. It is also needed to monitor the status of the call.
64  *
65  * This is an asynchronous API. After successful completion of the request in Phone Alert Event is
66  *
67  * published. otherwise Error event is published.
68  *
69  * @param[in]           * TelCallSetupParams_t          telephone number and desired call parameters.
70  * @param[out]          * pCallHandle , *pRequestID.   Handle of the call. specifies the request identifier.
71  * @Interface           Synchronous.
72  * @return                      int                             API Result Code.
73  * @exception           In case of exceptions return value contains appropriate error code.
74  * @remarks                     ptr_call_setup_info, and ptr_call_handle can not be NULL.
75  * @see                         See below API's also.
76  *                                      - tel_answer_call(),
77  *                                      - tel_release_call(),
78  *                                      - tel_hold_call(),
79  *                                      - tel_retrieve_call(),
80  *                                      .
81  */
82 EXPORT_API int tel_exe_call_mo(const TelCallSetupParams_t *pParams, unsigned int *pCallHandle, int *pRequestID)
83 {
84         int num_len = 0;
85         TS_BOOL ret = FALSE;
86         int api_err = TAPI_API_SUCCESS;
87
88         TAPI_LIB_DEBUG(LEVEL_DEBUG, "Func Entrance");
89
90         /* check for invalid ptr etc etc if applicable.... */
91         TAPI_RET_ERR_NUM_IF_FAIL((pParams && pCallHandle && pRequestID ),
92                         TAPI_API_INVALID_PTR);
93
94         num_len = strlen(pParams->szNumber);
95
96         /* check for invalid ptr etc etc if applicable.... */
97         if ((TAPI_CALL_DIALDIGIT_LEN_MAX < num_len) || (0 >= num_len)) {
98                 TAPI_LIB_DEBUG(LEVEL_ERR, "_CALL_ERR_ : Invalid telephone no length [%+d]", num_len);
99                 return TAPI_API_INVALID_INPUT;
100         }
101         else {
102                 // Do Nothing........
103         }
104
105         if (conn_name.length_of_name == 0) {
106                 TAPI_LIB_DEBUG(LEVEL_ERR, "No dbus connection name");
107                 return TAPI_API_OPERATION_FAILED;
108         }
109
110         /* check for the RPC link.... */
111         TAPI_RET_ERR_NUM_IF_FAIL(tapi_check_dbus_status(), TAPI_API_SYSTEM_RPC_LINK_DOWN);
112
113         /* Check input range for possible call types */
114         if ((TAPI_CALL_TYPE_VOICE == pParams->CallType) || (TAPI_CALL_TYPE_DATA == pParams->CallType)
115                         || (TAPI_CALL_TYPE_E911 == pParams->CallType)) {
116                 TAPI_GLIB_INIT_PARAMS();
117
118                 TAPI_GLIB_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4,
119                                 out_param1, out_param2, out_param3, out_param1);
120
121                 g_array_append_vals(in_param1, pParams, sizeof(TelCallSetupParams_t));
122                 g_array_append_vals(in_param4, &conn_name, sizeof(tapi_dbus_connection_name));
123
124                 TAPI_LIB_DEBUG(LEVEL_INFO, "Setup Call: Call Type [%d], Number [%s]",
125                                 pParams->CallType, pParams->szNumber);
126
127                 TAPI_PRINT_TIME("tel_exe_call_mo() is called..");
128
129                 ret = tapi_send_request(TAPI_CS_SERVICE_CALL, TAPI_CS_CALL_SETUP, in_param1, in_param2, in_param3, in_param4,
130                                 &out_param1, &out_param2, &out_param3, &out_param4);
131
132                 if (TRUE == ret) {
133                         /* API return value */
134                         api_err = g_array_index(out_param1, int, 0);
135
136                         /* Request ID */
137                         *pRequestID = g_array_index(out_param2, int, 0);
138
139                         /* Call handle */
140                         *pCallHandle = g_array_index(out_param3, unsigned int, 0);
141                 }
142                 else {
143                         /* RPC API failed, return FALSE to APP */
144                         api_err = TAPI_API_SYSTEM_RPC_LINK_DOWN;
145                         TAPI_LIB_DEBUG(LEVEL_ALERT, "_CALL_ERR_ : RPC link is down");
146                 }
147
148                 TAPI_GLIB_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4,
149                                 out_param1, out_param2, out_param3, out_param4);
150         }
151         else {
152                 /* Invalid input range given by the APP. */
153                 api_err = TAPI_API_INVALID_INPUT;
154                 TAPI_LIB_DEBUG(LEVEL_ERR, "_CALL_ERR_: Invalid Input");
155         }
156
157         TAPI_LIB_DEBUG(LEVEL_INFO, " Returning TapiResult_t [%+d] RequestId [%+d] Hanlde [%+d]", api_err, *pRequestID, *pCallHandle);
158
159         return api_err;
160 }
161
162 /**
163  * Accept or Reject an incoming new call.
164  *
165  * Answering an incoming call is possible only when the call status is incoming or waiting.
166  *
167  * Client can choose to answer an incoming call, even when an active call exists, by specifying argument
168  *
169  * TelCallAnswerType_t.  The TelCallAnswerType_t can be accept a single call, or hold a current call and
170  *
171  * accept the incoming call, or replace the current active call with waiting incoming call, or reject the call.
172  *
173  * @param[in]           CallHandle, a call identifier
174  * @param[in]           TelCallAnswerType_t, accept / reject /hold and accept etc.
175  * @param[out]          pRequestID.   specifies the request identifier.
176  * @Interface           Asynchronous.
177  * @return                      int             API Result code.
178  * @exception           In case of exceptions return value contains appropriate error code.
179  * @remarks                     tapi_call_handle should refer a call state which is in incoming/waiting state.
180  * @see                         See below API's also.
181  *                                      - tel_exe_call_mo(),
182  *                                      - tel_release_call(),
183  *                                      - tel_hold_call(),
184  *                                      - tel_retrieve_call(),
185  *                                      .
186  */
187 EXPORT_API int tel_answer_call(unsigned int CallHandle, TelCallAnswerType_t AnsType, int *pRequestID)
188 {
189         TS_BOOL ret = FALSE;
190         int api_err = TAPI_API_SUCCESS;
191
192         TAPI_LIB_DEBUG(LEVEL_DEBUG,"Func Entrance");
193
194         /* check for invalid ptr etc etc if applicable.... */
195         TAPI_RET_ERR_NUM_IF_FAIL(pRequestID, TAPI_API_INVALID_PTR);
196
197         if (conn_name.length_of_name == 0) {
198                 TAPI_LIB_DEBUG(LEVEL_ERR, "No dbus connection name");
199                 return TAPI_API_OPERATION_FAILED;
200         }
201
202         /* Check the call handle value... */
203         if (CallHandle <= 0) {
204                 api_err = TAPI_API_INVALID_CALL_HANDLE;
205                 TAPI_LIB_DEBUG(LEVEL_ERR, "_CALL_ERR_ : Invalid Call Handle.");
206                 return api_err;
207         }
208
209         /* Check input range for tapi_answer_type_t */
210         if ((TAPI_CALL_ANSWER_ACCEPT <= AnsType) && (TAPI_CALL_ANSWER_HOLD_AND_ACCEPT >= AnsType)) {
211                 /* check for the RPC link.... */
212                 TAPI_RET_ERR_NUM_IF_FAIL(tapi_check_dbus_status(), TAPI_API_SYSTEM_RPC_LINK_DOWN);
213                 TAPI_GLIB_INIT_PARAMS();
214
215                 TAPI_GLIB_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4,
216                                 out_param1, out_param2, out_param3, out_param4);
217
218                 g_array_append_vals(in_param1, &CallHandle, sizeof(unsigned int));
219                 g_array_append_vals(in_param2, &AnsType, sizeof(TelCallAnswerType_t));
220                 g_array_append_vals(in_param4, &conn_name, sizeof(tapi_dbus_connection_name));
221
222                 TAPI_LIB_DEBUG(LEVEL_INFO, " Answer Call: Answer Type [%d], Call Handle [%d]",
223                                 AnsType, CallHandle);
224
225                 TAPI_PRINT_TIME("tel_answer_call() is called..");
226
227                 ret = tapi_send_request(TAPI_CS_SERVICE_CALL, TAPI_CS_CALL_ANSWER, in_param1, in_param2, in_param3, in_param4,
228                                 &out_param1, &out_param2, &out_param3, &out_param4);
229
230                 if (TRUE == ret) {
231                         /* Get the API error value as out param 1, from the server. */
232                         api_err = g_array_index(out_param1, int, 0);
233
234                         /* Get the Request ID as out param 2, from the server. */
235                         *pRequestID = g_array_index(out_param2, int, 0);
236                 }
237                 else {
238                         /* RPC API failed, return FALSE to APP */
239                         api_err = TAPI_API_SYSTEM_RPC_LINK_DOWN;
240                         TAPI_LIB_DEBUG(LEVEL_ALERT, "_CALL_ERR_ : RPC link is down");
241                 }
242
243                 TAPI_GLIB_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4,
244                                 out_param1, out_param2, out_param3, out_param4);
245
246         }
247         else {
248                 /* Invalid Input Range */
249                 api_err = TAPI_API_INVALID_INPUT;
250                 TAPI_LIB_DEBUG(LEVEL_ERR, "_CALL_ERR_: Invalid Answer Type");
251         }
252
253         TAPI_LIB_DEBUG(LEVEL_INFO, "Returning TapiResult_t [%+d], Reuest ID [%+d]", api_err, *pRequestID);
254
255         return api_err;
256 }
257
258 /**
259  * Hangup calls. This is only for calls you dialed or answered with Telephony.
260  *
261  * The client specifies the call handle via the call_handle argument.
262  *
263  * Upon successful completion of Hangup, the information related to this call handle is destroyed.
264  *
265  * client can specify to Hangup a single call, all active calls, or all calls via argument tapi_release_type_t.
266  *
267  * @param[in]           CallHandle              Handle of the call which needs to be Hungup.
268  * @param[out]          pRequestID.   specifies the request identifier.
269  * @Interface           Asynchronous.
270  * @return                      int      API result code.
271  * @exception           In case of exceptions return value contains appropriate error code.
272  * @remarks                     tapi_call_handle should contain a call handle which is in connected or held state.
273  * @see                         See below API's also.
274  *                                      - tel_exe_call_mo(),
275  *                                      - tel_answer_call(),
276  *                                      - tel_hold_call(),
277  *                                      - tel_retrieve_call(),
278  *                                      .
279  */
280
281 EXPORT_API int tel_release_call(unsigned int CallHandle, int *pRequestID)
282 {
283         TS_BOOL ret = FALSE;
284         int api_err = TAPI_API_SUCCESS;
285
286         TAPI_LIB_DEBUG(LEVEL_DEBUG, "Func Entrance");
287
288         /* check for invalid ptr etc etc if applicable.... */
289         TAPI_RET_ERR_NUM_IF_FAIL(pRequestID, TAPI_API_INVALID_PTR);
290
291         if (conn_name.length_of_name == 0) {
292                 TAPI_LIB_DEBUG(LEVEL_ERR, "No dbus connection name");
293                 return TAPI_API_OPERATION_FAILED;
294         }
295
296         if (0 < CallHandle) {
297                 /*       check for the RPC link....     */
298                 TAPI_RET_ERR_NUM_IF_FAIL(tapi_check_dbus_status(), TAPI_API_SYSTEM_RPC_LINK_DOWN);
299                 TAPI_GLIB_INIT_PARAMS();
300
301                 TAPI_GLIB_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4,
302                                 out_param1, out_param2, out_param3, out_param4);
303
304                 g_array_append_vals(in_param1, &CallHandle, sizeof(unsigned int));
305                 g_array_append_vals(in_param4, &conn_name, sizeof(tapi_dbus_connection_name));
306
307                 TAPI_LIB_DEBUG(LEVEL_INFO, "Release Call: Call Handle [%d]", CallHandle);
308
309                 TAPI_PRINT_TIME("tel_release_call() is called..");
310
311                 ret = tapi_send_request(TAPI_CS_SERVICE_CALL, TAPI_CS_CALL_RELEASE, in_param1, in_param2, in_param3, in_param4,
312                                 &out_param1, &out_param2, &out_param3, &out_param4);
313
314                 if (TRUE == ret) {
315                         /* Get the API error value as out param 1, from the server. */
316                         api_err = g_array_index(out_param1, int, 0);
317
318                         /* Get the Request ID as out param 2, from the server. */
319                         *pRequestID = g_array_index(out_param2, int, 0);
320                 }
321                 else {
322                         /* RPC API failed, return FALSE to APP */
323                         api_err = TAPI_API_SYSTEM_RPC_LINK_DOWN;
324                         TAPI_LIB_DEBUG(LEVEL_ALERT, "_CALL_ERR_ : RPC link is down");
325                 }
326
327                 TAPI_GLIB_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4,
328                                 out_param1, out_param2, out_param3, out_param4);
329
330         }
331         else {
332                 /* Invalid Input Range.. */
333                 api_err = TAPI_API_INVALID_CALL_HANDLE;
334                 TAPI_LIB_DEBUG(LEVEL_ERR, "_CALL_ERR_:: Invalid Call Handle.");
335         }
336
337         TAPI_LIB_DEBUG(LEVEL_INFO, "Returning TapiResult_t [%+d], Reuest ID [%+d]", api_err, *pRequestID);
338
339         return api_err;
340 }
341
342 /**
343  * Hangup calls. This is only for calls you dialed or answered with Telephony.
344  *
345  * The client specifies the call handle via the call_handle argument.
346  *
347  * Upon successful completion of Hangup, the information related to this call handle is destroyed.
348  *
349  * client can specify to Hangup a single call, all active calls, or all calls via argument tapi_release_type_t.
350  *
351  * @param[in]           NONE.
352  * @param[out]          pRequestID.   specifies the request identifier.
353  * @Interface           Asynchronous.
354  * @return                      int     API result code.
355  * @exception           In case of exceptions return value contains appropriate error code.
356  * @remarks                     tapi_call_handle should contain a call handle which is in connected or held state.
357  * @see                         See below API's also.
358  *                                      - tel_exe_call_mo(),
359  *                                      - tel_answer_call(),
360  *                                      - tel_hold_call(),
361  *                                      - tel_retrieve_call(),
362  *                                      .
363  */
364
365 EXPORT_API int tel_release_call_all(int *pRequestID)
366 {
367         TS_BOOL ret = FALSE;
368         int api_err = TAPI_API_SUCCESS;
369
370         TAPI_LIB_DEBUG(LEVEL_DEBUG, "Func Entrance");
371
372         /* check for invalid ptr etc etc if applicable.... */
373         TAPI_RET_ERR_NUM_IF_FAIL(pRequestID, TAPI_API_INVALID_PTR);
374
375         /* check for the RPC link.... */
376         TAPI_RET_ERR_NUM_IF_FAIL(tapi_check_dbus_status(),
377                         TAPI_API_SYSTEM_RPC_LINK_DOWN);
378
379         if (conn_name.length_of_name == 0) {
380                 TAPI_LIB_DEBUG(LEVEL_ERR, "No dbus connection name");
381                 return TAPI_API_OPERATION_FAILED;
382         }
383         TAPI_GLIB_INIT_PARAMS();
384
385         TAPI_GLIB_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4,
386                         out_param1, out_param2, out_param3, out_param4);
387
388         TAPI_LIB_DEBUG(LEVEL_DEBUG, "Release all calls:");
389
390         TAPI_PRINT_TIME("tel_release_call_all() is called..");
391
392         g_array_append_vals(in_param4, &conn_name, sizeof(tapi_dbus_connection_name));
393
394         ret = tapi_send_request(TAPI_CS_SERVICE_CALL, TAPI_CS_CALL_RELEASEALL, in_param1, in_param2, in_param3, in_param4,
395                         &out_param1, &out_param2, &out_param3, &out_param4);
396
397         if (TRUE == ret) {
398                 /* Get the API error value as out param 1, from the server. */
399                 api_err = g_array_index(out_param1, int, 0);
400
401                 /* Get the Request ID as out param 2, from the server. */
402                 *pRequestID = g_array_index(out_param2, int, 0);
403         }
404         else {
405                 /* RPC API failed, return FALSE to APP */
406                 api_err = TAPI_API_SYSTEM_RPC_LINK_DOWN;
407                 TAPI_LIB_DEBUG(LEVEL_ALERT, "_CALL_ERR_ : RPC link is down");
408         }
409
410         TAPI_GLIB_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4,
411                         out_param1, out_param2, out_param3, out_param4);
412
413         TAPI_LIB_DEBUG(LEVEL_INFO, "Returning TapiResult_t [%+d], Reuest ID [%+d]", api_err, *pRequestID);
414
415         return api_err;
416 }
417
418 /**
419  * Hangup calls. This is only for calls you dialed or answered with Telephony.
420  *
421  * Upon successful completion of Hangup, the information related to this call handle is destroyed.
422  *
423  *
424  * @param[in]           NONE.
425  * @param[out]          pRequestID.   specifies the request identifier.
426  * @Interface           Asynchronous.
427  * @return                      int             API result code.
428  * @exception           In case of exceptions return value contains appropriate error code.
429  * @remarks                     tapi_call_handle should contain a call handle which is in connected or held state.
430  * @see                         See below API's also.
431  *                                      - tel_exe_call_mo(),
432  *                                      - tel_answer_call(),
433  *                                      - tel_hold_call(),
434  *                                      - tel_retrieve_call(),
435  *                                      .
436  */
437 EXPORT_API int tel_release_call_all_active(int *pRequestID)
438 {
439         TS_BOOL ret = FALSE;
440         int api_err = TAPI_API_SUCCESS;
441
442         TAPI_LIB_DEBUG(LEVEL_DEBUG, "Func Entrance");
443
444         /*       check for invalid ptr etc etc if applicable....        */
445         TAPI_RET_ERR_NUM_IF_FAIL(pRequestID, TAPI_API_INVALID_PTR);
446
447         /*       check for the RPC link....     */
448         TAPI_RET_ERR_NUM_IF_FAIL(tapi_check_dbus_status(),
449                         TAPI_API_SYSTEM_RPC_LINK_DOWN);
450
451         if (conn_name.length_of_name == 0) {
452                 TAPI_LIB_DEBUG(LEVEL_ERR, "No dbus connection name");
453                 return TAPI_API_OPERATION_FAILED;
454         }
455         TAPI_GLIB_INIT_PARAMS();
456
457         TAPI_GLIB_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4,
458                         out_param1, out_param2, out_param3, out_param4);
459
460         TAPI_LIB_DEBUG(LEVEL_DEBUG, "Release all active calls:");
461
462         g_array_append_vals(in_param4, &conn_name, sizeof(tapi_dbus_connection_name));
463
464         ret = tapi_send_request(TAPI_CS_SERVICE_CALL, TAPI_CS_CALL_RELEASEALL_ACTIVE, in_param1, in_param2, in_param3,
465                         in_param4, &out_param1, &out_param2, &out_param3, &out_param4);
466
467         if (TRUE == ret) {
468                 /*      Get the API error value as out param 1, from the server.        */
469                 api_err = g_array_index(out_param1, int, 0);
470
471                 /* Get the Request ID as out param 2, from the server.    */
472                 *pRequestID = g_array_index(out_param2, int, 0);
473         }
474         else {
475                 /*      RPC API failed, return FALSE to APP     */
476                 api_err = TAPI_API_SYSTEM_RPC_LINK_DOWN;
477                 TAPI_LIB_DEBUG(LEVEL_ALERT, "_CALL_ERR_ : RPC link is down");
478         }
479
480         TAPI_GLIB_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4,
481                         out_param1, out_param2, out_param3, out_param4);
482
483         TAPI_LIB_DEBUG(LEVEL_INFO, "Returning TapiResult_t [%+d], Reuest ID [%+d]", api_err, *pRequestID);
484
485         return api_err;
486
487 }
488
489 /**
490  * Hangup all held calls. This is only for calls you dialed or answered with Telephony.
491  *
492  *
493  * Upon successful completion of Hangup, the information related to this call handle is destroyed.
494  *
495  *
496  * @param[in]           NONE.
497  * @param[out]          pRequestID.   specifies the request identifier.
498  * @Interface           Asynchronous.
499  * @return                      int                     API result code.
500  * @exception           In case of exceptions return value contains appropriate error code.
501  * @remarks                     tapi_call_handle should contain a call handle which is in connected or held state.
502  * @see                         See below API's also.
503  *                                      - tel_exe_call_mo(),
504  *                                      - tel_answer_call(),
505  *                                      - tel_hold_call(),
506  *                                      - tel_retrieve_call(),
507  *                                      .
508  */
509 EXPORT_API int tel_release_call_all_held(int *pRequestID)
510 {
511         TS_BOOL ret = FALSE;
512         int api_err = TAPI_API_SUCCESS;
513
514         TAPI_LIB_DEBUG(LEVEL_DEBUG, "Func Entrance");
515
516         /*       check for invalid ptr etc etc if applicable....        */
517         TAPI_RET_ERR_NUM_IF_FAIL(pRequestID, TAPI_API_INVALID_PTR);
518
519         /*       check for the RPC link....     */
520         TAPI_RET_ERR_NUM_IF_FAIL(tapi_check_dbus_status(),
521                         TAPI_API_SYSTEM_RPC_LINK_DOWN);
522         if (conn_name.length_of_name == 0) {
523                 TAPI_LIB_DEBUG(LEVEL_ERR, "No dbus connection name");
524                 return TAPI_API_OPERATION_FAILED;
525         }
526         TAPI_GLIB_INIT_PARAMS();
527
528         TAPI_GLIB_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4,
529                         out_param1, out_param2, out_param3, out_param4);
530
531         TAPI_LIB_DEBUG(LEVEL_DEBUG, "Release all held calls:");
532         g_array_append_vals(in_param4, &conn_name, sizeof(tapi_dbus_connection_name));
533
534         ret = tapi_send_request(TAPI_CS_SERVICE_CALL, TAPI_CS_CALL_RELEASEALL_HELD, in_param1, in_param2, in_param3,
535                         in_param4, &out_param1, &out_param2, &out_param3, &out_param4);
536
537         if (TRUE == ret) {
538                 /*      Get the API error value as out param 1, from the server.        */
539                 api_err = g_array_index(out_param1, int, 0);
540
541                 /* Get the Request ID as out param 2, from the server.    */
542                 *pRequestID = g_array_index(out_param2, int, 0);
543         }
544         else {
545                 /*      RPC API failed, return FALSE to APP     */
546                 api_err = TAPI_API_SYSTEM_RPC_LINK_DOWN;
547                 TAPI_LIB_DEBUG(LEVEL_ALERT, "_CALL_ERR_ : RPC link is down");
548         }
549
550         TAPI_GLIB_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4,
551                         out_param1, out_param2, out_param3, out_param4);
552
553         TAPI_LIB_DEBUG(LEVEL_INFO, "Returning TapiResult_t [%+d], Reuest ID [%+d]", api_err, *pRequestID);
554
555         return api_err;
556
557 }
558
559 /**
560  *
561  * Places a call on hold. This is only for calls you dialed or answered with Telephony.
562  *
563  * The client specifies the call handle via the call_handle argument.
564  *
565  * @param[in]           CallHandle,     Hndle of active call.
566  * @param[out]          pRequestID.   specifies the request identifier.
567  * @return                      int             API result code.
568  * @Interface           Asynchronous.
569  * @exception           In case of exceptions return value contains appropriate error code.
570  * @remarks                     tapi_call_handle should refer a call which is in ACTIVE state
571  * @see                         See below API's also.
572  *                                      - tel_retrieve_call().
573  *                                      .
574  */
575 EXPORT_API int tel_hold_call(unsigned int CallHandle, int *pRequestID)
576 {
577         TS_BOOL ret = FALSE;
578         int api_err = TAPI_API_SUCCESS;
579
580         TAPI_LIB_DEBUG(LEVEL_DEBUG, "Func Entrance");
581
582         /*       check for invalid ptr etc etc if applicable....        */
583         TAPI_RET_ERR_NUM_IF_FAIL(pRequestID, TAPI_API_INVALID_PTR);
584
585         if (conn_name.length_of_name == 0) {
586                 TAPI_LIB_DEBUG(LEVEL_ERR, "No dbus connection name");
587                 return TAPI_API_OPERATION_FAILED;
588         }
589
590         /*      Check the call handle  value... */
591         if (0 < CallHandle) {
592                 /*       check for the RPC link....     */
593                 TAPI_RET_ERR_NUM_IF_FAIL(tapi_check_dbus_status(),
594                                 TAPI_API_SYSTEM_RPC_LINK_DOWN);
595                 TAPI_GLIB_INIT_PARAMS();
596
597                 TAPI_GLIB_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4,
598                                 out_param1, out_param2, out_param3, out_param4);
599
600                 g_array_append_vals(in_param1, &CallHandle, sizeof(unsigned int));
601                 g_array_append_vals(in_param4, &conn_name, sizeof(tapi_dbus_connection_name));
602
603                 TAPI_LIB_DEBUG(LEVEL_INFO, "Hold Call Handle [%d]", CallHandle);
604
605                 ret = tapi_send_request(TAPI_CS_SERVICE_CALL, TAPI_CS_CALL_HOLD, in_param1, in_param2, in_param3, in_param4,
606                                 &out_param1, &out_param2, &out_param3, &out_param4);
607
608                 if (TRUE == ret) {
609                         /*      Get the API error value as out param 1, from the server.        */
610                         api_err = g_array_index(out_param1, int, 0);
611
612                         /*      Get the Request ID as out param 2, from the server.    */
613                         *pRequestID = g_array_index(out_param2, int, 0);
614                 }
615                 else {
616                         /*      RPC API failed, return FALSE to APP     */
617                         api_err = TAPI_API_SYSTEM_RPC_LINK_DOWN;
618                         TAPI_LIB_DEBUG(LEVEL_ALERT, "_CALL_ERR_ : RPC link is down");
619                 }
620
621                 TAPI_GLIB_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4,
622                                 out_param1, out_param2, out_param3, out_param4);
623         }
624
625         else {
626                 api_err = TAPI_API_INVALID_CALL_HANDLE;
627                 TAPI_LIB_DEBUG(LEVEL_ERR, "_CALL_ERR_: Invalid CALL HANDLE");
628         }
629
630         TAPI_LIB_DEBUG(LEVEL_INFO, "Returning TapiResult_t [%+d], Reuest ID [%+d]", api_err, *pRequestID);
631
632         return api_err;
633 }
634
635 /**
636  *
637  * Retrieve held calls. This is only for calls you dialed or answered with Telephony.
638  *
639  * The client specifies the call handle via the call_handle argument.
640  *
641  * @param[in]           CallHandle,     Handle of the held call
642  * @param[out]          pRequestID.   specifies the request identifier.
643  * @Interface           Asynchronous.
644  * @return                      int             API result code.
645  * @exception           In case of exceptions return value contains appropriate error code.
646  * @remarks                     tapi_call_handle should refer a call which is in HELD state..
647  * @see                         None.
648  */
649 EXPORT_API int tel_retrieve_call(unsigned int CallHandle, int *pRequestID)
650 {
651         TS_BOOL ret = FALSE;
652         int api_err = TAPI_API_SUCCESS;
653
654         TAPI_LIB_DEBUG(LEVEL_DEBUG, "Func Entrance");
655
656         /*       check for invalid ptr etc etc if applicable....        */
657         TAPI_RET_ERR_NUM_IF_FAIL(pRequestID, TAPI_API_INVALID_PTR);
658
659         if (conn_name.length_of_name == 0) {
660                 TAPI_LIB_DEBUG(LEVEL_ERR, "No dbus connection name");
661                 return TAPI_API_OPERATION_FAILED;
662         }
663
664         /*      Check the call handle  value... */
665         if (0 < CallHandle) {
666                 /*       check for the RPC link....     */
667                 TAPI_RET_ERR_NUM_IF_FAIL(tapi_check_dbus_status(), TAPI_API_SYSTEM_RPC_LINK_DOWN);
668                 TAPI_GLIB_INIT_PARAMS();
669
670                 TAPI_GLIB_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4,
671                                 out_param1, out_param2, out_param3, out_param4);
672
673                 g_array_append_vals(in_param1, &CallHandle, sizeof(unsigned int));
674                 g_array_append_vals(in_param4, &conn_name, sizeof(tapi_dbus_connection_name));
675
676                 TAPI_LIB_DEBUG(LEVEL_INFO, "Activate Call Handle [%d]", CallHandle);
677
678                 ret = tapi_send_request(TAPI_CS_SERVICE_CALL, TAPI_CS_CALL_ACTIVATE, in_param1, in_param2, in_param3,
679                                 in_param4, &out_param1, &out_param2, &out_param3, &out_param4);
680
681                 if (TRUE == ret) {
682                         /*      Get the API error value as out param 1, from the server.        */
683                         api_err = g_array_index(out_param1, int, 0);
684
685                         /*      Get the Request ID as out param 2, from the server.    */
686                         *pRequestID = g_array_index(out_param2, int, 0);
687                 }
688                 else {
689                         /*      RPC API failed, return FALSE to APP     */
690                         api_err = TAPI_API_SYSTEM_RPC_LINK_DOWN;
691                         TAPI_LIB_DEBUG(LEVEL_ALERT, "_CALL_ERR_ : RPC link is down");
692                 }
693
694                 TAPI_GLIB_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4,
695                                 out_param1, out_param2, out_param3, out_param4);
696
697         }
698         else {
699                 api_err = TAPI_API_INVALID_CALL_HANDLE;
700                 TAPI_LIB_DEBUG(LEVEL_ERR, "_CALL_ERR_: Invalid CALL HANDLE");
701         }
702
703         TAPI_LIB_DEBUG(LEVEL_INFO, "Returning TapiResult_t [%+d], Reuest ID [%+d]", api_err, *pRequestID);
704
705         return api_err;
706 }
707
708 /**
709  *
710  * Swap calls. This is only for calls you dialed or answered with Telephony.
711  *
712  * The client specifies the call handles via the active_call and held_call arguments.
713  *
714  * Swap is only available for the voice calls.
715  *
716  * @param[in]           CallHandle1     Handle of the active call.
717  * @param[in]           CallHandle2     Handle of the held call.
718  * @param[out]          pRequestID.   specifies the request identifier.
719  * @Interface           Asynchronous.
720  * @return                      int             API result code.
721  * @exception           In case of exceptions return value contains appropriate error code.
722  * @remarks                     NONE.
723  * @see                         NONE.
724  */
725 EXPORT_API int tel_swap_call(unsigned int CallHandle1, unsigned int CallHandle2, int *pRequestID)
726 {
727         TS_BOOL ret = FALSE;
728         int api_err = TAPI_API_SUCCESS;
729
730         TAPI_LIB_DEBUG(LEVEL_DEBUG, "Func Entrance");
731
732         if (conn_name.length_of_name == 0) {
733                 TAPI_LIB_DEBUG(LEVEL_ERR, "No dbus connection name");
734                 return TAPI_API_OPERATION_FAILED;
735         }
736
737         /*       check for invalid ptr etc etc if applicable....        */
738         TAPI_RET_ERR_NUM_IF_FAIL(pRequestID, TAPI_API_INVALID_PTR);
739
740         if ((0 < CallHandle1) && (0 < CallHandle2)) {
741                 if (CallHandle1 == CallHandle2) {
742                         return TAPI_API_INVALID_CALL_HANDLE;
743                 }
744
745                 /*       check for the RPC link....     */
746                 TAPI_RET_ERR_NUM_IF_FAIL(tapi_check_dbus_status(), TAPI_API_SYSTEM_RPC_LINK_DOWN);
747                 TAPI_GLIB_INIT_PARAMS();
748
749                 TAPI_GLIB_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4,
750                                 out_param1, out_param2, out_param3, out_param4);
751
752                 g_array_append_vals(in_param1, &CallHandle1, sizeof(unsigned int));
753                 g_array_append_vals(in_param2, &CallHandle2, sizeof(unsigned int));
754                 g_array_append_vals(in_param4, &conn_name, sizeof(tapi_dbus_connection_name));
755
756                 TAPI_LIB_DEBUG(LEVEL_INFO, "Swap calls with handles [%d], and [%d]",
757                                 CallHandle1, CallHandle2);
758
759                 ret = tapi_send_request(TAPI_CS_SERVICE_CALL, TAPI_CS_CALL_SWAP, in_param1, in_param2, in_param3, in_param4,
760                                 &out_param1, &out_param2, &out_param3, &out_param4);
761
762                 if (TRUE == ret) {
763                         /*      Get the API error value as out param 1, from the server.        */
764                         api_err = g_array_index(out_param1, int, 0);
765
766                         /*      Get the Request ID as out param 2, from the server.    */
767                         *pRequestID = g_array_index(out_param2, int, 0);
768                 }
769                 else {
770                         /*      RPC API failed, return FALSE to APP     */
771                         api_err = TAPI_API_SYSTEM_RPC_LINK_DOWN;
772                         TAPI_LIB_DEBUG(LEVEL_ALERT, "_CALL_ERR_ : RPC link is down");
773                 }
774
775                 TAPI_GLIB_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4,
776                                 out_param1, out_param2, out_param3, out_param4);
777
778         }
779         else {
780                 api_err = TAPI_API_INVALID_CALL_HANDLE;
781                 TAPI_LIB_DEBUG(LEVEL_ERR, "_CALL_ERR_: Invalid CALL HANDLE");
782         }
783
784         TAPI_LIB_DEBUG(LEVEL_INFO, "Returning TapiResult_t [%+d], Reuest ID [%+d]", api_err, *pRequestID);
785
786         return api_err;
787 }
788
789 /**
790  *
791  * Setup a conference call.
792  *
793  * The client specifies the call handles via the active_call and held_call arguments.
794  *
795  * Setup a conference call is only available for the voice calls.
796  *
797  * @param[in]           CallHandle1     Handle of the active call.
798  * @param[in]           CallHandle2     Handle of the held call.
799  * @param[out]          pRequestID.   specifies the request identifier.
800  * @Interface           Asynchronous.
801  * @return                      int             API result code.
802  * @exception           In case of exceptions return value contains appropriate error code.
803  * @remarks                     NONE.
804  * @see                         NONE.
805  */
806 EXPORT_API int tel_join_call(unsigned int CallHandle1, unsigned int CallHandle2, int *pRequestID)
807 {
808         TS_BOOL ret = FALSE;
809         int api_err = TAPI_API_SUCCESS;
810
811         TAPI_LIB_DEBUG(LEVEL_DEBUG, "Func Entrance");
812
813         /*       check for invalid ptr etc etc if applicable....        */
814         TAPI_RET_ERR_NUM_IF_FAIL(pRequestID, TAPI_API_INVALID_PTR);
815
816         if (conn_name.length_of_name == 0) {
817                 TAPI_LIB_DEBUG(LEVEL_ERR, "No dbus connection name");
818                 return TAPI_API_OPERATION_FAILED;
819         }
820
821         if ((0 < CallHandle1) && (0 < CallHandle2)) {
822                 if (CallHandle1 == CallHandle2) {
823                         return TAPI_API_INVALID_CALL_HANDLE;
824                 }
825
826                 /*       check for the RPC link....     */
827                 TAPI_RET_ERR_NUM_IF_FAIL(tapi_check_dbus_status(), TAPI_API_SYSTEM_RPC_LINK_DOWN);
828                 TAPI_GLIB_INIT_PARAMS();
829
830                 TAPI_GLIB_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4,
831                                 out_param1, out_param2, out_param3, out_param4);
832
833                 g_array_append_vals(in_param1, &CallHandle1, sizeof(unsigned int));
834                 g_array_append_vals(in_param2, &CallHandle2, sizeof(unsigned int));
835                 g_array_append_vals(in_param4, &conn_name, sizeof(tapi_dbus_connection_name));
836
837                 TAPI_LIB_DEBUG(LEVEL_INFO, "Join Calls with Handles [%d], [%d]",
838                                 CallHandle1, CallHandle2);
839
840                 ret = tapi_send_request(TAPI_CS_SERVICE_CALL, TAPI_CS_CALL_SETUPCONFCALL, in_param1, in_param2, in_param3,
841                                 in_param4, &out_param1, &out_param2, &out_param3, &out_param4);
842
843                 if (TRUE == ret) {
844                         /*      Get the API error value as out param 1, from the server.        */
845                         api_err = g_array_index(out_param1, int, 0);
846
847                         /*      Get the Request ID as out param 2, from the server.    */
848                         *pRequestID = g_array_index(out_param2, int, 0);
849                 }
850                 else {
851                         /*      RPC API failed, return FALSE to APP     */
852                         api_err = TAPI_API_SYSTEM_RPC_LINK_DOWN;
853                         TAPI_LIB_DEBUG(LEVEL_ALERT, "_CALL_ERR_ : RPC link is down");
854                 }
855
856                 TAPI_GLIB_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4,
857                                 out_param1, out_param2, out_param3, out_param4);
858
859         }
860         else {
861                 api_err = TAPI_API_INVALID_CALL_HANDLE;
862                 TAPI_LIB_DEBUG(LEVEL_ERR, "_CALL_ERR_: Invalid CALL HANDLE");
863         }
864
865         TAPI_LIB_DEBUG(LEVEL_INFO, "Returning TapiResult_t [%+d], Reuest ID [%+d]", api_err, *pRequestID);
866
867         return api_err;
868 }
869
870 /**
871  *
872  * Split a call from conference call.
873  *
874  * The client specifies the call handle via the call_handle argument.
875  *
876  * Split a conference call is only available for the voice calls.
877  *
878  * @param[in]           CallHandle      Handle of the call which needs to be seperated.
879  * @param[out]          pRequestID.   specifies the request identifier.
880  * @Interface           Asynchronous.
881  * @return                      int             API result code.
882  * @exception           In case of exceptions return value contains appropriate error code.
883  * @remarks                     NONE.
884  * @see                         NONE.
885  */
886 EXPORT_API int tel_split_call(unsigned int CallHandle, int *pRequestID)
887 {
888         TS_BOOL ret = FALSE;
889         int api_err = TAPI_API_SUCCESS;
890
891         TAPI_LIB_DEBUG(LEVEL_DEBUG,"Func Entrance");
892
893         /*       check for invalid ptr etc etc if applicable....        */
894         TAPI_RET_ERR_NUM_IF_FAIL(pRequestID, TAPI_API_INVALID_PTR);
895
896         if (conn_name.length_of_name == 0) {
897                 TAPI_LIB_DEBUG(LEVEL_ERR, "No dbus connection name");
898                 return TAPI_API_OPERATION_FAILED;
899         }
900
901         if ((0 < CallHandle)) {
902                 /*       check for the RPC link....     */
903                 TAPI_RET_ERR_NUM_IF_FAIL(tapi_check_dbus_status(),
904                                 TAPI_API_SYSTEM_RPC_LINK_DOWN);
905                 TAPI_GLIB_INIT_PARAMS();
906
907                 TAPI_GLIB_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4,
908                                 out_param1, out_param2, out_param3, out_param4);
909
910                 g_array_append_vals(in_param1, &CallHandle, sizeof(unsigned int));
911                 g_array_append_vals(in_param4, &conn_name, sizeof(tapi_dbus_connection_name));
912
913                 TAPI_LIB_DEBUG(LEVEL_INFO, "Split Call Handle [%d]", CallHandle);
914
915                 ret = tapi_send_request(TAPI_CS_SERVICE_CALL, TAPI_CS_CALL_SPLITCONFCALL, in_param1, in_param2, in_param3,
916                                 in_param4, &out_param1, &out_param2, &out_param3, &out_param4);
917
918                 if (TRUE == ret) {
919                         /*      Get the API error value as out param 1, from the server.        */
920                         api_err = g_array_index(out_param1, int, 0);
921
922                         /*      Get the Request ID as out param 2, from the server.    */
923                         *pRequestID = g_array_index(out_param2, int, 0);
924                 }
925                 else {
926                         /*      RPC API failed, return FALSE to APP     */
927                         api_err = TAPI_API_SYSTEM_RPC_LINK_DOWN;
928                         TAPI_LIB_DEBUG(LEVEL_ALERT, "_CALL_ERR_ : RPC link is down");
929                 }
930
931                 TAPI_GLIB_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4,
932                                 out_param1, out_param2, out_param3, out_param4);
933         }
934         else {
935                 api_err = TAPI_API_INVALID_CALL_HANDLE;
936                 TAPI_LIB_DEBUG(LEVEL_ERR, "_CALL_ERR_: Invalid CALL HANDLE");
937         }
938
939         TAPI_LIB_DEBUG(LEVEL_INFO, "Returning TapiResult_t [%+d], Reuest ID [%+d]", api_err, *pRequestID);
940
941         return api_err;
942 }
943
944 /**
945  *
946  * Transfers a call to another call.
947  *
948  * client specifies the handle  of the calls via active_call, held_call arguments.
949  *
950  * Transfer call is only available for the voice calls.
951  *
952  * @param[in]           CallHandle,     Handle of the active call.
953  * @param[out]          pRequestID.   specifies the request identifier.
954  * @Interface           Asynchronous.
955  * @return                      int             API result code.
956  * @exception           In case of exceptions return value contains appropriate error code.
957  * @remarks                     NONE.
958  * @see                         NONE.
959  */
960 EXPORT_API int tel_exe_call_explicit_transfer(unsigned int CallHandle, int *pRequestID)
961 {
962         TS_BOOL ret = FALSE;
963         int api_err = TAPI_API_SUCCESS;
964
965         TAPI_LIB_DEBUG(LEVEL_DEBUG, "Func Entrance");
966
967         /*       check for invalid ptr etc etc if applicable....        */
968         TAPI_RET_ERR_NUM_IF_FAIL(pRequestID, TAPI_API_INVALID_PTR);
969
970         if (conn_name.length_of_name == 0) {
971                 TAPI_LIB_DEBUG(LEVEL_ERR, "No dbus connection name");
972                 return TAPI_API_OPERATION_FAILED;
973         }
974
975         if (0 < CallHandle) {
976                 /*       check for the RPC link....     */
977                 TAPI_RET_ERR_NUM_IF_FAIL(tapi_check_dbus_status(), TAPI_API_SYSTEM_RPC_LINK_DOWN);
978                 TAPI_GLIB_INIT_PARAMS();
979
980                 TAPI_GLIB_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4,
981                                 out_param1, out_param2, out_param3, out_param4);
982
983                 g_array_append_vals(in_param1, &CallHandle, sizeof(unsigned int));
984                 g_array_append_vals(in_param4, &conn_name, sizeof(tapi_dbus_connection_name));
985
986                 TAPI_LIB_DEBUG(LEVEL_INFO, "ECT Call Handle [%d]", CallHandle);
987
988                 ret = tapi_send_request(TAPI_CS_SERVICE_CALL, TAPI_CS_CALL_TRANSFERCALL, in_param1, in_param2, in_param3,
989                                 in_param4, &out_param1, &out_param2, &out_param3, &out_param4);
990
991                 if (TRUE == ret) {
992                         /*      Get the API error value as out param 1, from the server.        */
993                         api_err = g_array_index(out_param1, int, 0);
994
995                         /*      Get the Request ID as out param 2, from the server.    */
996                         *pRequestID = g_array_index(out_param2, int, 0);
997                 }
998                 else {
999                         /*      RPC API failed, return FALSE to APP     */
1000                         api_err = TAPI_API_SYSTEM_RPC_LINK_DOWN;
1001                         TAPI_LIB_DEBUG(LEVEL_ALERT, "_CALL_ERR_ : RPC link is down");
1002                 }
1003
1004                 TAPI_GLIB_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4,
1005                                 out_param1, out_param2, out_param3, out_param4);
1006
1007         }
1008         else {
1009                 api_err = TAPI_API_INVALID_CALL_HANDLE;
1010                 TAPI_LIB_DEBUG(LEVEL_ERR, "_CALL_ERR_: Invalid CALL HANDLE");
1011         }
1012
1013         TAPI_LIB_DEBUG(LEVEL_INFO, "Returning TapiResult_t [%+d], Reuest ID [%+d]", api_err, *pRequestID);
1014
1015         return api_err;
1016 }
1017
1018 /**
1019  *
1020  * Activate Call Completion to a Busy Subscriber.
1021  *
1022  * client specifies the handle  of the call via call_handle argument.
1023  *
1024  * Activate CCBS is only available for the voice calls.
1025  *
1026  * @param[in]           CallHandle,     Handle of the call.
1027  * @param[out]          pRequestID.   specifies the request identifier.
1028  * @Interface           Asynchronous.
1029  * @return                      int             API result code.
1030  * @exception           In case of exceptions return value contains appropriate error code.
1031  * @remarks                     NONE.
1032  * @see                         NONE.
1033  */
1034 EXPORT_API int tel_activate_call_ccbs(unsigned int CallHandle, int *pRequestID)
1035 {
1036         TS_BOOL ret = FALSE;
1037         int api_err = TAPI_API_SUCCESS;
1038
1039         TAPI_LIB_DEBUG(LEVEL_DEBUG, "Func Entrance");
1040
1041         /*       check for invalid ptr etc etc if applicable....        */
1042         TAPI_RET_ERR_NUM_IF_FAIL(pRequestID, TAPI_API_INVALID_PTR);
1043
1044         if (conn_name.length_of_name == 0) {
1045                 TAPI_LIB_DEBUG(LEVEL_ERR, "No dbus connection name");
1046                 return TAPI_API_OPERATION_FAILED;
1047         }
1048
1049         /*      Check the call handle  value... */
1050         if (0 < CallHandle) {
1051                 /*       check for the RPC link....     */
1052                 TAPI_RET_ERR_NUM_IF_FAIL(tapi_check_dbus_status(), TAPI_API_SYSTEM_RPC_LINK_DOWN);
1053                 TAPI_GLIB_INIT_PARAMS();
1054
1055                 TAPI_GLIB_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4,
1056                                 out_param1, out_param2, out_param3, out_param4);
1057
1058                 g_array_append_vals(in_param1, &CallHandle, sizeof(unsigned int));
1059                 g_array_append_vals(in_param4, &conn_name, sizeof(tapi_dbus_connection_name));
1060
1061                 TAPI_LIB_DEBUG(LEVEL_INFO, "CCBS Call Handle [%d]", CallHandle);
1062
1063                 ret = tapi_send_request(TAPI_CS_SERVICE_CALL, TAPI_CS_CALL_ACTIVATECCBS, in_param1, in_param2, in_param3,
1064                                 in_param4, &out_param1, &out_param2, &out_param3, &out_param4);
1065
1066                 if (TRUE == ret) {
1067                         /*      Get the API error value as out param 1, from the server.        */
1068                         api_err = g_array_index(out_param1, int, 0);
1069
1070                         /*      Get the Request ID as out param 2, from the server.    */
1071                         *pRequestID = g_array_index(out_param2, int, 0);
1072                 }
1073                 else {
1074                         /*      RPC API failed, return FALSE to APP     */
1075                         api_err = TAPI_API_SYSTEM_RPC_LINK_DOWN;
1076                         TAPI_LIB_DEBUG(LEVEL_ALERT, "_CALL_ERR_ : RPC link is down");
1077                 }
1078
1079                 TAPI_GLIB_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4,
1080                                 out_param1, out_param2, out_param3, out_param4);
1081         }
1082         else {
1083                 api_err = TAPI_API_INVALID_CALL_HANDLE;
1084                 TAPI_LIB_DEBUG(LEVEL_ERR, "_CALL_ERR_: Invalid CALL HANDLE");
1085         }
1086
1087         TAPI_LIB_DEBUG(LEVEL_INFO, "Returning TapiResult_t [%+d], Reuest ID [%+d]", api_err, *pRequestID);
1088
1089         return api_err;
1090 }
1091
1092 /**
1093  *  Send DTMF digits to the network.
1094  *
1095  * Client specifies the Handle of the active call via call_handle argument.
1096  *
1097  * The handle of the call is voice call only.
1098  *
1099  * @param[in]           tapi_call_dtmf_t        DTMF digits.
1100  * @param[out]          pRequestID.   specifies the request identifier.
1101  * @Interface           Asynchronous.
1102  * @return                      int             API result code.
1103  * @exception           In case of exceptions return value contains appropriate error code.
1104  * @remarks                     tapi_call_dtmf_t can not be NULL.
1105  * @see                         NONE.
1106  */
1107 EXPORT_API int tel_send_call_dtmf(const char *pDtmfString, int *pRequestID)
1108 {
1109         TS_BOOL ret = FALSE;
1110         int length = 0;
1111         int app_err = TAPI_API_SUCCESS;
1112
1113         TAPI_LIB_DEBUG(LEVEL_DEBUG, "Func Entrance");
1114
1115         /*       check for invalid ptr etc etc if applicable....        */
1116         TAPI_RET_ERR_NUM_IF_FAIL( (pRequestID && pDtmfString), TAPI_API_INVALID_PTR);
1117
1118         if (conn_name.length_of_name == 0) {
1119                 TAPI_LIB_DEBUG(LEVEL_ERR, "No dbus connection name");
1120                 return TAPI_API_OPERATION_FAILED;
1121         }
1122
1123         length = strlen(pDtmfString);
1124
1125         /*      Check the input value...        */
1126         if (length != 0) {
1127                 /*       check for the RPC link....     */
1128                 TAPI_RET_ERR_NUM_IF_FAIL(tapi_check_dbus_status(), TAPI_API_SYSTEM_RPC_LINK_DOWN);
1129                 TAPI_GLIB_INIT_PARAMS();
1130
1131                 TAPI_GLIB_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4,
1132                                 out_param1, out_param2, out_param3, out_param4);
1133
1134                 TAPI_LIB_DEBUG(LEVEL_INFO, "Send DTMF digits [%s] and len [%d]",
1135                                 pDtmfString, length);
1136
1137                 /*      to allocate for null termiated string   */
1138                 g_array_append_vals(in_param1, pDtmfString, (length + 1));
1139                 g_array_append_vals(in_param4, &conn_name, sizeof(tapi_dbus_connection_name));
1140
1141                 ret = tapi_send_request(TAPI_CS_SERVICE_CALL, TAPI_CS_CALL_DTMF, in_param1, in_param2, in_param3, in_param4,
1142                                 &out_param1, &out_param2, &out_param3, &out_param4);
1143
1144                 if (TRUE == ret) {
1145                         /*      Get the API error value as out param 1, from the server.        */
1146                         app_err = g_array_index(out_param1, int, 0);
1147
1148                         /*      Get the Request ID as out param 2, from the server.    */
1149                         *pRequestID = g_array_index(out_param2, int, 0);
1150                 }
1151                 else {
1152                         /*      RPC API failed, return FALSE to APP     */
1153                         app_err = TAPI_API_SYSTEM_RPC_LINK_DOWN;
1154                         TAPI_LIB_DEBUG(LEVEL_ALERT, "_CALL_ERR_ : RPC link is down");
1155                 }
1156
1157                 TAPI_GLIB_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4,
1158                                 out_param1, out_param2, out_param3, out_param4);
1159         }
1160         else {
1161                 app_err = TAPI_API_INVALID_INPUT;
1162                 TAPI_LIB_DEBUG(LEVEL_ERR, "_CALL_ERR_: Invalid CALL HANDLE");
1163         }
1164
1165         TAPI_LIB_DEBUG(LEVEL_INFO, "Returning TapiResult_t [%+d], Reuest ID [%+d]", app_err, *pRequestID);
1166
1167         return app_err;
1168 }
1169
1170 /**
1171  *
1172  * Call Deflection.
1173  *
1174  * If informed about an incoming call this call may be redirected to an another destination by
1175  *
1176  * entering the destination Number. The cleint spcifies the dstiantion number to which the current
1177  *
1178  * incoming call needs to be redirected is specifed via info argument.
1179  *
1180  * @param[in]           call_handle,                    Incoming call handle.
1181  * @param[in]           TelCallDeflectDstInfo_t Destination Number.
1182  * @param[out]          pRequestID.   specifies the request identifier.
1183  * @Interface           Asynchronous.
1184  * @return                      int             API result code.
1185  * @exception           In case of exceptions return value contains appropriate error code.
1186  * @remarks                     info can not be NULL.
1187  * @see                         None.
1188  */
1189 EXPORT_API int tel_deflect_call(unsigned int CallHandle, const TelCallDeflectDstInfo_t *pInfo, int *pRequestID)
1190 {
1191         TS_BOOL ret = FALSE;
1192         int api_err = TAPI_API_SUCCESS;
1193
1194         TAPI_LIB_DEBUG(LEVEL_DEBUG, "Func Entrance");
1195
1196         if (conn_name.length_of_name == 0) {
1197                 TAPI_LIB_DEBUG(LEVEL_ERR, "No dbus connection name");
1198                 return TAPI_API_OPERATION_FAILED;
1199         }
1200
1201         /*       check for the input pointer .. */
1202         TAPI_RET_ERR_NUM_IF_FAIL( (pRequestID && pInfo), TAPI_API_INVALID_PTR);
1203
1204         /*      Check the input value...        */
1205         if (0 < CallHandle) {
1206                 /*       check for the RPC link.... */
1207                 TAPI_RET_ERR_NUM_IF_FAIL(tapi_check_dbus_status(), TAPI_API_SYSTEM_RPC_LINK_DOWN);
1208                 TAPI_GLIB_INIT_PARAMS();
1209
1210                 TAPI_GLIB_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4,
1211                                 out_param1, out_param2, out_param3, out_param4);
1212
1213                 g_array_append_vals(in_param1, &CallHandle, sizeof(unsigned int));
1214                 g_array_append_vals(in_param2, pInfo, sizeof(TelCallDeflectDstInfo_t));
1215                 g_array_append_vals(in_param4, &conn_name, sizeof(tapi_dbus_connection_name));
1216
1217                 TAPI_LIB_DEBUG(LEVEL_INFO, "Deflect Call Handle [%d] to [%s]",
1218                                 CallHandle, pInfo->number);
1219
1220                 ret = tapi_send_request(TAPI_CS_SERVICE_CALL, TAPI_CS_CALL_DEFLECT, in_param1, in_param2, in_param3, in_param4,
1221                                 &out_param1, &out_param2, &out_param3, &out_param4);
1222
1223                 if (TRUE == ret) {
1224                         /*      Get the API error value as out param 1, from the server.        */
1225                         api_err = g_array_index(out_param1, int, 0);
1226
1227                         /*      Get the Request ID as out param 2, from the server.    */
1228                         *pRequestID = g_array_index(out_param2, int, 0);
1229
1230                 }
1231                 else {
1232                         /*      RPC API failed, return FALSE to APP */
1233                         api_err = TAPI_API_SYSTEM_RPC_LINK_DOWN;
1234                         TAPI_LIB_DEBUG(LEVEL_ALERT, "_CALL_ERR_ : RPC link is down");
1235                 }
1236
1237                 TAPI_GLIB_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4,
1238                                 out_param1, out_param2, out_param3, out_param4);
1239         }
1240         else {
1241                 api_err = TAPI_API_INVALID_CALL_HANDLE;
1242                 TAPI_LIB_DEBUG(LEVEL_ERR, "_CALL_ERR_: Invalid CALL HANDLE");
1243         }
1244
1245         TAPI_LIB_DEBUG(LEVEL_INFO, " Returning TapiResult_t [%+d], Reuest ID [%+d]", api_err, *pRequestID);
1246
1247         return api_err;
1248 }
1249
1250 /**
1251  *
1252  * Get the current calling line identification number.
1253  *
1254  * The line id is returned via the argument ptr_active_line.
1255  *
1256  * @param[in]           NONE
1257  * @param[out]          TelCallActiveLine_t     current active line id, *pRequestID.   specifies the request identifier.
1258  * @Interface           Asynchronous.
1259  * @return                      int             API result code.
1260  * @exception           In case of exceptions return value contains appropriate error code.
1261  * @remarks                     TelCallActiveLine_t can not be NULL.
1262  * @see                         None.
1263  */
1264 EXPORT_API int tel_get_call_act_line(int *pRequestID)
1265 {
1266         TS_BOOL ret = FALSE;
1267         int api_err = TAPI_API_SUCCESS;
1268
1269         TAPI_LIB_DEBUG(LEVEL_DEBUG, "Func Entrance");
1270
1271         /*       check for invalid ptr etc etc if applicable....        */
1272         TAPI_RET_ERR_NUM_IF_FAIL( pRequestID, TAPI_API_INVALID_PTR);
1273
1274         /*       check for the RPC link....     */
1275         TAPI_RET_ERR_NUM_IF_FAIL(tapi_check_dbus_status(), TAPI_API_SYSTEM_RPC_LINK_DOWN);
1276
1277         if (conn_name.length_of_name == 0) {
1278                 TAPI_LIB_DEBUG(LEVEL_ERR, "No dbus connection name");
1279                 return TAPI_API_OPERATION_FAILED;
1280         }
1281         TAPI_GLIB_INIT_PARAMS();
1282
1283         TAPI_GLIB_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4,
1284                         out_param1, out_param2, out_param3, out_param4);
1285
1286         g_array_append_vals(in_param4, &conn_name, sizeof(tapi_dbus_connection_name));
1287
1288         TAPI_LIB_DEBUG(LEVEL_DEBUG, "Get Active Line");
1289
1290         ret = tapi_send_request(TAPI_CS_SERVICE_CALL, TAPI_CS_CALL_GETACTIVELINE, in_param1, in_param2, in_param3,
1291                         in_param4, &out_param1, &out_param2, &out_param3, &out_param4);
1292
1293         if (TRUE == ret) {
1294                 /*      Get the API error value as out param 1, from the server.        */
1295                 api_err = g_array_index(out_param1, int, 0);
1296
1297                 /*      Get the Request ID as out param 2, from the server.    */
1298                 *pRequestID = g_array_index(out_param2, int, 0);
1299
1300         }
1301         else {
1302                 /*      RPC API failed, return FALSE to APP     */
1303                 api_err = TAPI_API_SYSTEM_RPC_LINK_DOWN;
1304                 TAPI_LIB_DEBUG(LEVEL_ALERT, "_CALL_ERR_ : RPC link is down");
1305         }
1306
1307         TAPI_GLIB_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4,
1308                         out_param1, out_param2, out_param3, out_param4);
1309
1310         TAPI_LIB_DEBUG(LEVEL_INFO, " Returning TapiResult_t [%+d], Reuest ID [%+d]", api_err, *pRequestID);
1311
1312         return api_err;
1313 }
1314
1315 /**
1316  *
1317  * Set the current calling line identification number.
1318  *
1319  * Client specifies the desired line id via the argument active_line.
1320  *
1321  * @param[in]           TelCallActiveLine_t     calling line identification.
1322  * @param[out]          pRequestID.   specifies the request identifier.
1323  * @Interface           Asynchronous.
1324  * @return                      int             API result code.
1325  * @exception           In case of exceptions return value contains appropriate error code.
1326  * @remarks                     NONE.
1327  * @see                         NONE.
1328  */
1329 EXPORT_API int tel_set_call_act_line(TelCallActiveLine_t active_line, int *pRequestID)
1330 {
1331         TS_BOOL ret = FALSE;
1332         int api_err = TAPI_API_SUCCESS;
1333
1334         TAPI_LIB_DEBUG(LEVEL_DEBUG, "Func Entrance");
1335
1336         /*       check for invalid ptr etc etc if applicable....        */
1337         TAPI_RET_ERR_NUM_IF_FAIL(pRequestID, TAPI_API_INVALID_PTR);
1338
1339         if (conn_name.length_of_name == 0) {
1340                 TAPI_LIB_DEBUG(LEVEL_ERR, "No dbus connection name");
1341                 return TAPI_API_OPERATION_FAILED;
1342         }
1343
1344         if ((TAPI_CALL_ACTIVE_LINE1 == active_line) || (TAPI_CALL_ACTIVE_LINE2 == active_line)) {
1345                 /*       check for the RPC link....     */
1346                 TAPI_RET_ERR_NUM_IF_FAIL(tapi_check_dbus_status(), TAPI_API_SYSTEM_RPC_LINK_DOWN);
1347                 TAPI_GLIB_INIT_PARAMS();
1348
1349                 TAPI_GLIB_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4,
1350                                 out_param1, out_param2, out_param3, out_param4);
1351
1352                 g_array_append_vals(in_param1, &active_line, sizeof(TelCallActiveLine_t));
1353                 g_array_append_vals(in_param4, &conn_name, sizeof(tapi_dbus_connection_name));
1354
1355                 TAPI_LIB_DEBUG(LEVEL_INFO, "Set Active Line ID [%d]", active_line);
1356
1357                 ret = tapi_send_request(TAPI_CS_SERVICE_CALL, TAPI_CS_CALL_SETACTIVELINE, in_param1, in_param2, in_param3,
1358                                 in_param4, &out_param1, &out_param2, &out_param3, &out_param4);
1359
1360                 if (TRUE == ret) {
1361                         /*      Get the API error value as out param 1, from the server.        */
1362                         api_err = g_array_index(out_param1, int, 0);
1363
1364                         /*      Get the Request ID as out param 2, from the server.    */
1365                         *pRequestID = g_array_index(out_param2, int, 0);
1366                 }
1367                 else {
1368                         /*      RPC API failed, return FALSE to APP     */
1369                         api_err = TAPI_API_SYSTEM_RPC_LINK_DOWN;
1370                         TAPI_LIB_DEBUG(LEVEL_ALERT, "_CALL_ERR_ : RPC link is down");
1371                 }
1372
1373                 TAPI_GLIB_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4,
1374                                 out_param1,out_param2, out_param3, out_param4);
1375         }
1376         else {
1377                 api_err = TAPI_API_INVALID_INPUT;
1378                 TAPI_LIB_DEBUG(LEVEL_ERR, "_CALL_ERR_: Invalid input");
1379         }
1380
1381         TAPI_LIB_DEBUG(LEVEL_INFO, " Returning TapiResult_t [%+d], Reuest ID [%+d]", api_err, *pRequestID);
1382
1383         return api_err;
1384 }
1385
1386 /**
1387  * @brief This function gets status for the current call identified by Call Handle whenever
1388  *      application wants the call status. Call handle must be valid.
1389  *
1390  *
1391  * @par Sync (or) Async:
1392  * This is a Synchronous API.
1393  *
1394  * @par Important Notes:
1395  *   - None.
1396  *
1397  * @warning
1398  * - None.
1399  *
1400  *
1401  * @param[in] CallHandle
1402  *  - Unique handle for referring the call.
1403  *
1404  * @param [out] pCallStatus
1405  *   - Call status information like destination number, call direction (MO or MT), call type (voice or data etc), whether
1406  *      the call is in conference state or not, present call state etc are returned through this parameter.
1407  *
1408  * @par Async Response Message:
1409  *   - None.
1410  *
1411  * @pre
1412  *  - None.
1413  *
1414  * @post
1415  *  - None.
1416  *
1417  * @return Return Type (int) \n
1418  * - 0 - indicating that the operation has completed successfully. \n
1419  * - Else it will return failure and error code (Refer Doxygen doc or TapiResult_t)
1420  *
1421  * @par Prospective Clients:
1422  * External Apps.
1423  *
1424  *
1425  */
1426 EXPORT_API int tel_get_call_status(unsigned int CallHandle, TelCallStatus_t *pCallStatus)
1427 {
1428         TS_BOOL ret = FALSE;
1429         int api_err = TAPI_API_SUCCESS;
1430
1431         TAPI_LIB_DEBUG(LEVEL_DEBUG, "Func Entrance");
1432         TAPI_LIB_DEBUG(LEVEL_DEBUG, "CallHandle:[%d]\n",CallHandle);
1433
1434         /*       check for invalid ptr etc etc if applicable....        */
1435         TAPI_RET_ERR_NUM_IF_FAIL(pCallStatus, TAPI_API_INVALID_PTR);
1436
1437         if (CallHandle > 0) {
1438                 /*       check for the RPC link....     */
1439                 TAPI_RET_ERR_NUM_IF_FAIL(tapi_check_dbus_status(), TAPI_API_SYSTEM_RPC_LINK_DOWN);
1440                 TAPI_GLIB_INIT_PARAMS();
1441
1442                 TAPI_GLIB_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4,
1443                                 out_param1, out_param2, out_param3, out_param4);
1444
1445                 g_array_append_vals(in_param1, &CallHandle, sizeof(unsigned int));
1446
1447                 TAPI_LIB_DEBUG(LEVEL_DEBUG, "Call Service Request: .(Get Call Status)");
1448
1449                 ret = tapi_send_request(TAPI_CS_SERVICE_CALL, TAPI_CS_CALL_GETSTATUS, in_param1, in_param2, in_param3,
1450                                 in_param4, &out_param1, &out_param2, &out_param3, &out_param4);
1451
1452                 if (TRUE == ret) {
1453                         /*      Get the API error value as out param 1, from the server.        */
1454                         api_err = g_array_index(out_param1, int, 0);
1455
1456                         /*      Get the call status as out param 3, from the server.    */
1457                         *pCallStatus = g_array_index(out_param3, TelCallStatus_t , 0);
1458                 }
1459                 else {
1460                         /*      RPC API failed, return FALSE to APP     */
1461                         pCallStatus = NULL;
1462                         api_err = TAPI_API_SYSTEM_RPC_LINK_DOWN;
1463                 }
1464
1465                 TAPI_GLIB_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4,
1466                                 out_param1, out_param2, out_param3, out_param4);
1467         }
1468         else {
1469                 pCallStatus = NULL;
1470                 api_err = TAPI_API_INVALID_CALL_HANDLE;
1471                 TAPI_LIB_DEBUG(LEVEL_ERR, "#####Invalid Handle");
1472         }
1473
1474         TAPI_LIB_DEBUG(LEVEL_INFO, " Returning TapiResult_t [%+d]", api_err);
1475
1476         return api_err;
1477 }
1478
1479 /*================================================================================================*/
1480
1481 /**
1482  * \addtogroup  tel_get_call_duration
1483  * @{
1484  */
1485
1486 /**
1487  * @brief This function gets duration of the given call. This is a synchronous function. Duration is accounted from the moment
1488  *          the connection is established, i.e. call goes into active state for first time.
1489  *
1490  *
1491  * @par Sync (or) Async:
1492  * This is a Synchronous API.
1493  *
1494  * @par Important Notes:
1495  *   - None.
1496  *
1497  * @warning
1498  * - None.
1499  *
1500  *
1501  * @param[in] CallHandle
1502  *  - Unique handle for referring the call.
1503  *
1504  * @param [out] pDurationInSecs
1505  *   - The total call duration in seconds from the call connecting time to the present time is returned through this parameter.
1506  *
1507  * @par Async Response Message:
1508  *  - None.
1509  *
1510  * @pre
1511  *  - None.
1512  *
1513  * @post
1514  *  - None.
1515  *
1516  * @return Return Type (int) \n
1517  * - 0 - indicating that the operation has completed successfully. \n
1518  * - Else it will return failure and error code (Refer Doxygen doc or TapiResult_t)
1519  *
1520  * @par Prospective Clients:
1521  * External Apps.
1522  *
1523  *
1524  *
1525  */
1526 EXPORT_API int tel_get_call_duration(unsigned int CallHandle, unsigned int *pDurationInSecs)
1527 {
1528         TS_BOOL ret = FALSE;
1529         int api_err = TAPI_API_SUCCESS;
1530
1531         TAPI_LIB_DEBUG(LEVEL_DEBUG,"Func Entrance \n");
1532         TAPI_LIB_DEBUG(LEVEL_DEBUG,"CallHandle:[%d]\n",CallHandle);
1533
1534         /*       check for invalid ptr etc etc if applicable....        */
1535         TAPI_RET_ERR_NUM_IF_FAIL(pDurationInSecs, TAPI_API_INVALID_PTR);
1536
1537         if (CallHandle > 0) {
1538                 /*       check for the RPC link....     */
1539                 TAPI_RET_ERR_NUM_IF_FAIL(tapi_check_dbus_status(), TAPI_API_SYSTEM_RPC_LINK_DOWN);
1540                 TAPI_GLIB_INIT_PARAMS();
1541
1542                 TAPI_GLIB_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4,
1543                                 out_param1, out_param2, out_param3, out_param4);
1544
1545                 g_array_append_vals(in_param1, &CallHandle, sizeof(unsigned int));
1546
1547                 TAPI_LIB_DEBUG(LEVEL_DEBUG, "Call Service Request: .(Get Call Duration)");
1548
1549                 ret = tapi_send_request(TAPI_CS_SERVICE_CALL, TAPI_CS_CALL_GETDURATION, in_param1, in_param2, in_param3,
1550                                 in_param4, &out_param1, &out_param2, &out_param3, &out_param4);
1551
1552                 if (TRUE == ret) {
1553                         /*      Get the API error value as out param 1, from the server.        */
1554                         api_err = g_array_index(out_param1, int, 0);
1555
1556                         /*      Get the call durations as out param 3, from the server. */
1557                         *pDurationInSecs = g_array_index(out_param3, unsigned int , 0);
1558                 }
1559                 else {
1560                         /*      RPC API failed, return FALSE to APP     */
1561                         *pDurationInSecs = 0;
1562                         api_err = TAPI_API_SYSTEM_RPC_LINK_DOWN;
1563                 }
1564
1565                 TAPI_GLIB_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4,
1566                                 out_param1, out_param2, out_param3, out_param4);
1567
1568                 TAPI_LIB_DEBUG(LEVEL_INFO, "Returning TapiResult_t [%+d]", api_err);
1569         }
1570         else {
1571                 *pDurationInSecs = 0;
1572                 api_err = TAPI_API_INVALID_CALL_HANDLE;
1573                 TAPI_LIB_DEBUG(LEVEL_ERR, "#####Invalid Handle.");
1574         }
1575
1576         return api_err;
1577 }
1578
1579 /**
1580  * @brief This is a synchronous function returns all call handles within the given conference call.
1581  *
1582  *
1583  * @par Sync (or) Async:
1584  * This is a Synchronous API.
1585  *
1586  * @par Important Notes:
1587  *  - Call should be a Multi-party conference call in order to return actual no of calls and call handles in the conference calls.
1588  *
1589  * @warning
1590  * - None.
1591  *
1592  *
1593  * @param[in] CallHandle
1594  *  - Handle of call which is associated with the conference.
1595  *
1596  * @param [out] pCallList
1597  *   - list of call joined in the conference call. In case there is no active conference. The list will be zero and
1598  *      number of calls parameter value will also be zero. Maximum number of calls in a conference can be upto 5
1599  *      (Based on 3GPP TS 22.084). Memory allocation for calllist is integer array of size 5.
1600  *
1601  * @param [out] pNoOfCalls
1602  *   - Number of the calls present in conference.
1603  *
1604  * @par Async Response Message:
1605  *  -None.
1606  *
1607  * @pre
1608  *  -None.
1609  *
1610  * @post
1611  *  -None.
1612  *
1613  * @return Return Type (int) \n
1614  * - 0 - indicating that the operation has completed successfully. \n
1615  * - Else it will return failure and error code (Refer Doxygen doc or TapiResult_t)
1616  *
1617  * @par Prospective Clients:
1618  * External Apps.
1619  *
1620  *
1621  */
1622 EXPORT_API int tel_get_call_conf_list(unsigned int CallHandle, unsigned int *pCallList, int *pNoOfCalls)
1623 {
1624         TS_BOOL ret = FALSE;
1625         unsigned int * tempCallList;
1626         int api_err = TAPI_API_SUCCESS;
1627
1628         TAPI_LIB_DEBUG(LEVEL_DEBUG,"<PROXY> Func Entrance \n");
1629         TAPI_LIB_DEBUG(LEVEL_DEBUG,"CallHandle:[%d]\n",CallHandle);
1630
1631         /*       check for the input pointer .. */
1632         TAPI_RET_ERR_NUM_IF_FAIL( (pCallList && pNoOfCalls), TAPI_API_INVALID_PTR);
1633
1634         *pNoOfCalls = 0;
1635         *pCallList = 0;
1636
1637         if (0 < CallHandle) {
1638                 /*       check for the RPC link....     */
1639                 TAPI_RET_ERR_NUM_IF_FAIL(tapi_check_dbus_status(), TAPI_API_SYSTEM_RPC_LINK_DOWN);
1640                 TAPI_GLIB_INIT_PARAMS();
1641
1642                 TAPI_GLIB_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4,
1643                                 out_param1, out_param2, out_param3, out_param4);
1644
1645                 g_array_append_vals(in_param1, &CallHandle, sizeof(unsigned int));
1646
1647                 TAPI_LIB_DEBUG(LEVEL_DEBUG, "Call Service Request: .(Get Conference List)");
1648
1649                 ret = tapi_send_request(TAPI_CS_SERVICE_CALL, TAPI_CS_CALL_GETCONFERENCELIST, in_param1, in_param2, in_param3,
1650                                 in_param4, &out_param1, &out_param2, &out_param3, &out_param4);
1651
1652                 if (TRUE == ret) {
1653                         /*      Get the API error value as out param 1, from the server.        */
1654                         api_err = g_array_index(out_param1, int, 0);
1655
1656                         /*      Get the No. of Calls as out param 4, from the server.    */
1657                         *pNoOfCalls = g_array_index(out_param4, int , 0);
1658
1659                         if (*pNoOfCalls > 0) {
1660                                 /*      Get the Call List as out param 3, from the server.    */
1661                                 tempCallList = &g_array_index(out_param3, unsigned int , 0);
1662                         }
1663                         else {
1664                                 tempCallList = NULL;
1665                         }
1666
1667                         if (tempCallList != NULL)
1668                                 memcpy(pCallList, tempCallList, sizeof(unsigned int) * (*pNoOfCalls));
1669
1670                 }
1671                 else {
1672                         /*      RPC API failed, return FALSE to APP     */
1673                         api_err = TAPI_API_SYSTEM_RPC_LINK_DOWN;
1674                 }
1675
1676                 TAPI_GLIB_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4,
1677                                 out_param1, out_param2, out_param3, out_param4);
1678
1679                 TAPI_LIB_DEBUG(LEVEL_INFO, "Returning TapiResult_t [%+d]", api_err);
1680         }
1681         else {
1682                 api_err = TAPI_API_INVALID_CALL_HANDLE;
1683                 TAPI_LIB_DEBUG(LEVEL_ERR, "#####Invalid Handle.");
1684         }
1685
1686         return api_err;
1687 }
1688
1689 /**
1690  *
1691  * @brief This function gets voice privacy option mode in phone(CDMA only).
1692  *
1693  *
1694  * @par Sync (or) Async:
1695  * This is a Asynchronous API.
1696  *
1697  * @par Important Notes:
1698  *   - None.
1699  *
1700  * @warning
1701  * - None.
1702  *
1703  *
1704  * @param[in]
1705  * - None.
1706  *
1707  * @param [out] pRequestId
1708  *   - Unique identifier for a particular request.
1709  *   - Request Id value can be any value from 0 to 255 if the API is returned successfully
1710  *   - -1 (INVALID_REQUEST_ID) will be sent in case of failure.
1711  *
1712  *
1713  * @par Async Response Message:
1714  * - The event associated with this request is TAPI_EVENT_CALL_GET_PRIVACYMODE_CNF. Asynchronous return status
1715  *    is indicated by #TelCallCause_t. #TelCallPrivacyMode_t is included in this event.
1716  *
1717  *
1718  * @pre
1719  *  - None.
1720  *
1721  * @post
1722  *  - None.
1723  *
1724  * @return Return Type (int) \n
1725  * - 0 - indicating that the operation has completed successfully. \n
1726  * - Else it will return failure and error code (Refer Doxygen doc or TapiResult_t)
1727  *
1728  * @par Prospective Clients:
1729  * External Apps.
1730  *
1731  *
1732  *
1733  */
1734 EXPORT_API int tel_get_call_privacy_mode(TelCallPrivacyType_t PrivacyType, int *pRequestID)
1735 {
1736         TS_BOOL ret = FALSE;
1737         int api_err = TAPI_API_SUCCESS;
1738
1739         TAPI_LIB_DEBUG(LEVEL_DEBUG, "Func Entrance");
1740
1741         /*       check for invalid ptr etc etc if applicable....        */
1742         TAPI_RET_ERR_NUM_IF_FAIL(pRequestID, TAPI_API_INVALID_PTR);
1743
1744         if (conn_name.length_of_name == 0) {
1745                 TAPI_LIB_DEBUG(LEVEL_ERR, "No dbus connection name");
1746                 return TAPI_API_OPERATION_FAILED;
1747         }
1748
1749         if ((TAPI_CALL_PRIVACY_TYPE_MS <= PrivacyType) && (PrivacyType <= TAPI_CALL_PRIVACY_TYPE_CURRENT)) {
1750                 /*       check for the RPC link....     */
1751                 TAPI_RET_ERR_NUM_IF_FAIL(tapi_check_dbus_status(), TAPI_API_SYSTEM_RPC_LINK_DOWN);
1752                 TAPI_GLIB_INIT_PARAMS();
1753
1754                 TAPI_GLIB_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4,
1755                                 out_param1, out_param2, out_param3, out_param4);
1756
1757                 g_array_append_vals(in_param1, &PrivacyType, sizeof(TelCallPrivacyType_t));
1758                 g_array_append_vals(in_param4, &conn_name, sizeof(tapi_dbus_connection_name));
1759
1760                 TAPI_LIB_DEBUG(LEVEL_INFO, "Get Request PrivacyType:[%d]", PrivacyType);
1761
1762                 ret = tapi_send_request(TAPI_CS_SERVICE_CALL, TAPI_CS_CALL_GETPRIVACYMODE, in_param1, in_param2, in_param3,
1763                                 in_param4, &out_param1, &out_param2, &out_param3, &out_param4);
1764
1765                 if (TRUE == ret) {
1766                         /*      Get the API error value as out param 1, from the server.        */
1767                         api_err = g_array_index(out_param1, int, 0);
1768
1769                         /*      Get the Request ID as out param 2, from the server.    */
1770                         *pRequestID = g_array_index(out_param2, int, 0);
1771                 }
1772                 else {
1773                         /*      RPC API failed, return FALSE to APP     */
1774                         api_err = TAPI_API_SYSTEM_RPC_LINK_DOWN;
1775                         TAPI_LIB_DEBUG(LEVEL_ALERT, "_CALL_ERR_ : RPC link is down");
1776                 }
1777
1778                 TAPI_GLIB_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4,
1779                                 out_param1, out_param2, out_param3, out_param4);
1780         }
1781         else {
1782                 api_err = TAPI_API_INVALID_INPUT;
1783                 TAPI_LIB_DEBUG(LEVEL_ERR, "_CALL_ERR_: Invalid input");
1784         }
1785
1786         TAPI_LIB_DEBUG(LEVEL_INFO, " Returning TapiResult_t [%+d], Reuest ID [%+d]",api_err, *pRequestID);
1787
1788         return api_err;
1789 }
1790
1791 /**
1792  *
1793  * @brief This function sets voice privacy option mode in phone. It is available only where call exists(CDMA only).
1794  *
1795  * Access to this API is limited, we recommand you use Voice Call engine API.
1796  *
1797  * @par Sync (or) Async:
1798  * This is a Asynchronous API.
1799  *
1800  * @par Important Notes:
1801  *   - None.
1802  *
1803  * @warning
1804  * - None.
1805  *
1806  *
1807  * @param[in] PrivacyMode
1808  * - voice privacy option mode(ENHANCED or STANDARD)
1809  *
1810  *
1811  * @param [out] pRequestId
1812  *   - Unique identifier for a particular request.
1813  *   - Request Id value can be any value from 0 to 255 if the API is returned successfully
1814  *   - -1 (INVALID_REQUEST_ID) will be sent in case of failure.
1815  *
1816  *
1817  * @par Async Response Message:
1818  * - The event associated with this request is TAPI_EVENT_CALL_SET_PRIVACYMODE_CNF. Asynchronous return status
1819  *    is indicated by #TelCallCause_t.
1820  *
1821  *
1822  * @pre
1823  *  - None.
1824  *
1825  * @post
1826  *  - None.
1827  *
1828  * @return Return Type (int) \n
1829  * - 0 - indicating that the operation has completed successfully. \n
1830  * - Else it will return failure and error code (Refer Doxygen doc or TapiResult_t)
1831  *
1832  * @par Prospective Clients:
1833  * External Apps.
1834  *
1835  *
1836  *
1837  */
1838 EXPORT_API int tel_set_call_privacy_mode(TelCallVoicePrivacyInfo_t PrivacyInfo, int *pRequestID)
1839 {
1840         TS_BOOL ret = FALSE;
1841         int api_err = TAPI_API_SUCCESS;
1842
1843         TAPI_LIB_DEBUG(LEVEL_DEBUG, "Func Entrance");
1844
1845         if (conn_name.length_of_name == 0) {
1846                 TAPI_LIB_DEBUG(LEVEL_ERR, "No dbus connection name");
1847                 return TAPI_API_OPERATION_FAILED;
1848         }
1849
1850         /*       check for invalid ptr etc etc if applicable....        */
1851         TAPI_RET_ERR_NUM_IF_FAIL(pRequestID, TAPI_API_INVALID_PTR);
1852
1853         if (((TAPI_CALL_PRIVACY_TYPE_MS <= PrivacyInfo.PrivacyType) && (TAPI_CALL_PRIVACY_TYPE_CURRENT
1854                         >= PrivacyInfo.PrivacyType)) && ((TAPI_CALL_PRIVACY_MODE_STANDARD == PrivacyInfo.PrivacyMode)
1855                         || (TAPI_CALL_PRIVACY_MODE_ENHANCED == PrivacyInfo.PrivacyMode))) {
1856                 /*       check for the RPC link....     */
1857                 TAPI_RET_ERR_NUM_IF_FAIL(tapi_check_dbus_status(), TAPI_API_SYSTEM_RPC_LINK_DOWN);
1858                 TAPI_GLIB_INIT_PARAMS();
1859
1860                 TAPI_GLIB_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4,
1861                                 out_param1, out_param2, out_param3, out_param4);
1862
1863                 g_array_append_vals(in_param1, &PrivacyInfo, sizeof(TelCallVoicePrivacyInfo_t));
1864                 g_array_append_vals(in_param4, &conn_name, sizeof(tapi_dbus_connection_name));
1865
1866                 TAPI_LIB_DEBUG(LEVEL_INFO, "Set PrivacyType:[%d], PrivacyMode:[%d]", PrivacyInfo.PrivacyType, PrivacyInfo.PrivacyMode);
1867
1868                 ret = tapi_send_request(TAPI_CS_SERVICE_CALL, TAPI_CS_CALL_SETPRIVACYMODE, in_param1, in_param2, in_param3,
1869                                 in_param4, &out_param1, &out_param2, &out_param3, &out_param4);
1870
1871                 if (TRUE == ret) {
1872                         /*      Get the API error value as out param 1, from the server.        */
1873                         api_err = g_array_index(out_param1, int, 0);
1874
1875                         /*      Get the Request ID as out param 2, from the server.    */
1876                         *pRequestID = g_array_index(out_param2, int, 0);
1877                 }
1878                 else {
1879                         /*      RPC API failed, return FALSE to APP     */
1880                         api_err = TAPI_API_SYSTEM_RPC_LINK_DOWN;
1881                         TAPI_LIB_DEBUG(LEVEL_ALERT, "_CALL_ERR_ : RPC link is down");
1882                 }
1883
1884                 TAPI_GLIB_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4,
1885                                 out_param1, out_param2, out_param3, out_param4);
1886         }
1887         else {
1888                 api_err = TAPI_API_INVALID_INPUT;
1889                 TAPI_LIB_DEBUG(LEVEL_ERR, "_CALL_ERR_: Invalid input");
1890         }
1891
1892         TAPI_LIB_DEBUG(LEVEL_INFO, " Returning TapiResult_t [%+d], Reuest ID [%+d]", api_err, *pRequestID);
1893
1894         return api_err;
1895 }
1896
1897 /**
1898  *
1899  * @brief This function requests to send a Flash with Information Message(CDMA only).
1900  *
1901  * Access to this API is limited, we recommand you use Voice Call engine API.
1902  *
1903  * @par Sync (or) Async:
1904  * This is a Asynchronous API.
1905  *
1906  * @par Important Notes:
1907  *   - None.
1908  *
1909  * @warning
1910  * - None.
1911  *
1912  *
1913  * @param[in] pDialNumber
1914  * - this is the calling number for 3 way call. But in the call waiting, this param should be NULL.
1915  *
1916  *
1917  * @param [out] pRequestId
1918  *   - Unique identifier for a particular request.
1919  *   - Request Id value can be any value from 0 to 255 if the API is returned successfully
1920  *   - -1 (INVALID_REQUEST_ID) will be sent in case of failure.
1921  *
1922  *
1923  * @par Async Response Message:
1924  * - The event associated with this request is TAPI_EVENT_CALL_FLASHINFO_CNF. Asynchronous return status
1925  *    is indicated by #TelCallCause_t.
1926  *
1927  *
1928  * @pre
1929  *  - None.
1930  *
1931  * @post
1932  *  - None.
1933  *
1934  * @return Return Type (int) \n
1935  * - 0 - indicating that the operation has completed successfully. \n
1936  * - Else it will return failure and error code (Refer Doxygen doc or TapiResult_t)
1937  *
1938  * @par Prospective Clients:
1939  * External Apps.
1940  *
1941  *
1942  *
1943  */
1944 EXPORT_API int tel_exe_call_flash_info(const char *pDialNumber, int *pRequestID)
1945 {
1946         TS_BOOL ret = FALSE;
1947         int length = 0;
1948         int app_err = TAPI_API_SUCCESS;
1949
1950         TAPI_LIB_DEBUG(LEVEL_DEBUG, "Func Entrance");
1951
1952         /*       check for invalid ptr etc etc if applicable....        */
1953         TAPI_RET_ERR_NUM_IF_FAIL( pRequestID, TAPI_API_INVALID_PTR);
1954
1955         if (pDialNumber) {
1956                 length = strlen(pDialNumber);
1957                 TAPI_LIB_DEBUG(LEVEL_INFO, "DialNumber: [%s] and len:[%d]", pDialNumber, length);
1958         }
1959
1960         /*       check for the RPC link....     */
1961         TAPI_RET_ERR_NUM_IF_FAIL(tapi_check_dbus_status(), TAPI_API_SYSTEM_RPC_LINK_DOWN);
1962
1963         if (conn_name.length_of_name == 0) {
1964                 TAPI_LIB_DEBUG(LEVEL_ERR, "No dbus connection name");
1965                 return TAPI_API_OPERATION_FAILED;
1966         }
1967         TAPI_GLIB_INIT_PARAMS();
1968
1969         TAPI_GLIB_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4,
1970                         out_param1, out_param2, out_param3, out_param4);
1971
1972         /*      to allocate for null termiated string   */
1973
1974         if (length > 0)
1975                 g_array_append_vals(in_param1, pDialNumber, (length + 1));
1976
1977         g_array_append_vals(in_param4, &conn_name, sizeof(tapi_dbus_connection_name));
1978
1979         ret = tapi_send_request(TAPI_CS_SERVICE_CALL, TAPI_CS_CALL_FLASHINFO, in_param1, in_param2, in_param3, in_param4,
1980                         &out_param1, &out_param2, &out_param3, &out_param4);
1981
1982         if (TRUE == ret) {
1983                 /*      Get the API error value as out param 1, from the server.        */
1984                 app_err = g_array_index(out_param1, int, 0);
1985
1986                 /*      Get the Request ID as out param 2, from the server.    */
1987                 *pRequestID = g_array_index(out_param2, int, 0);
1988         }
1989         else {
1990                 /*      RPC API failed, return FALSE to APP     */
1991                 app_err = TAPI_API_SYSTEM_RPC_LINK_DOWN;
1992                 TAPI_LIB_DEBUG(LEVEL_ALERT, "_CALL_ERR_ : RPC link is down");
1993         }
1994
1995         TAPI_GLIB_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4,
1996                         out_param1, out_param2, out_param3, out_param4);
1997
1998         TAPI_LIB_DEBUG(LEVEL_INFO, "Returning TapiResult_t [%+d], Reuest ID [%+d]",app_err, *pRequestID);
1999
2000         return app_err;
2001 }
2002
2003 /**
2004  * tel_exit_call_emergency_mode
2005  *
2006  *
2007  */
2008 EXPORT_API int tel_exit_call_emergency_mode(int *pRequestID)
2009 {
2010         TS_BOOL ret = FALSE;
2011         int api_err = TAPI_API_SUCCESS;
2012
2013         TAPI_LIB_DEBUG(LEVEL_DEBUG, "Func Entrance");
2014
2015         /*       check for invalid ptr etc etc if applicable....        */
2016         TAPI_RET_ERR_NUM_IF_FAIL( pRequestID, TAPI_API_INVALID_PTR);
2017
2018         /*       check for the RPC link....     */
2019         TAPI_RET_ERR_NUM_IF_FAIL(tapi_check_dbus_status(), TAPI_API_SYSTEM_RPC_LINK_DOWN);
2020
2021         if (conn_name.length_of_name == 0) {
2022                 TAPI_LIB_DEBUG(LEVEL_ERR, "No dbus connection name");
2023                 return TAPI_API_OPERATION_FAILED;
2024         }
2025         TAPI_GLIB_INIT_PARAMS();
2026
2027         TAPI_GLIB_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4,
2028                         out_param1, out_param2, out_param3, out_param4);
2029
2030         g_array_append_vals(in_param4, &conn_name, sizeof(tapi_dbus_connection_name));
2031
2032         ret = tapi_send_request(TAPI_CS_SERVICE_CALL, TAPI_CS_CALL_EXITEMERGENCYMODE, in_param1, in_param2, in_param3,
2033                         in_param4, &out_param1, &out_param2, &out_param3, &out_param4);
2034
2035         if (TRUE == ret) {
2036                 /*      Get the API error value as out param 1, from the server.        */
2037                 api_err = g_array_index(out_param1, int, 0);
2038
2039                 /*      Get the Request ID as out param 2, from the server.    */
2040                 *pRequestID = g_array_index(out_param2, int, 0);
2041
2042         }
2043         else {
2044                 api_err = TAPI_API_SYSTEM_RPC_LINK_DOWN;
2045                 TAPI_LIB_DEBUG(LEVEL_ALERT, "_CALL_ERR_ : RPC link is down");
2046         }
2047
2048         TAPI_GLIB_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4,
2049                         out_param1, out_param2, out_param3, out_param4);
2050
2051         TAPI_LIB_DEBUG(LEVEL_INFO, " Returning TapiResult_t [%+d], Reuest ID [%+d]", api_err, *pRequestID);
2052
2053         return api_err;
2054 }
2055
2056 /**
2057  * tel_get_call_time
2058  *
2059  *
2060  */
2061 EXPORT_API int tel_get_call_time(unsigned short req_mask, int *pRequestID)
2062 {
2063         TS_BOOL ret = FALSE;
2064         int api_err = TAPI_API_SUCCESS;
2065
2066         TAPI_LIB_DEBUG(LEVEL_DEBUG, "Func Entrance");
2067
2068         /*       check for invalid ptr etc etc if applicable....        */
2069         TAPI_RET_ERR_NUM_IF_FAIL(pRequestID, TAPI_API_INVALID_PTR);
2070
2071         if (conn_name.length_of_name == 0) {
2072                 TAPI_LIB_DEBUG(LEVEL_ERR, "No dbus connection name");
2073                 return TAPI_API_OPERATION_FAILED;
2074         }
2075
2076         /*       check for the RPC link....     */
2077         TAPI_RET_ERR_NUM_IF_FAIL(tapi_check_dbus_status(), TAPI_API_SYSTEM_RPC_LINK_DOWN);
2078         TAPI_GLIB_INIT_PARAMS();
2079
2080         TAPI_GLIB_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4,
2081                         out_param1, out_param2, out_param3, out_param4);
2082
2083         g_array_append_vals(in_param1, &req_mask, sizeof(unsigned short));
2084         g_array_append_vals(in_param4, &conn_name, sizeof(tapi_dbus_connection_name));
2085
2086         TAPI_LIB_DEBUG(LEVEL_INFO, "Get Call time req type:[%x]", req_mask);
2087
2088         ret = tapi_send_request(TAPI_CS_SERVICE_CALL, TAPI_CS_CALL_GETCALLTIME, in_param1, in_param2, in_param3, in_param4,
2089                         &out_param1, &out_param2, &out_param3, &out_param4);
2090
2091         if (TRUE == ret) {
2092                 /*      Get the API error value as out param 1, from the server.        */
2093                 api_err = g_array_index(out_param1, TapiResult_t, 0);
2094
2095                 /*      Get the Request ID as out param 2, from the server.    */
2096                 *pRequestID = g_array_index(out_param2, int, 0);
2097         }
2098         else {
2099                 /*      RPC API failed, return FALSE to APP     */
2100                 api_err = TAPI_API_SYSTEM_RPC_LINK_DOWN;
2101                 TAPI_LIB_DEBUG(LEVEL_ALERT, "_CALL_ERR_ : RPC link is down");
2102         }
2103
2104         TAPI_GLIB_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4,
2105                         out_param1, out_param2, out_param3, out_param4);
2106
2107         TAPI_LIB_DEBUG(LEVEL_INFO, " Returning TapiResult_t [%+d], Reuest ID [%+d]", api_err, *pRequestID);
2108
2109         return api_err;
2110 }
2111
2112 /*      EOF  */
2113