4 * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Ja-young Gu <jygu@samsung.com>
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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.
28 #include <tapi_common.h>
30 #include <ITapiCall.h>
31 #include <TapiUtility.h>
36 static char data_call_id[MENU_DATA_SIZE + 1] = "1";
37 static char data_call_id2[MENU_DATA_SIZE + 1] = "2";
38 static char data_call_type[MENU_DATA_SIZE + 1] = "0";
39 static char data_dtmf_digit[MENU_DATA_SIZE + 1] = "1";
40 static char data_dtmf_string[MENU_DATA_SIZE + 1] = "12345";
41 static char data_dtmf_pulse_width[MENU_DATA_SIZE + 1] = "1";
42 static char data_dtmf_inter_digit_interval[MENU_DATA_SIZE + 1] = "1";
43 static char data_call_number[MENU_DATA_SIZE + 1] = "+821099777347";
44 static char data_answer_type[MENU_DATA_SIZE + 1] = "1";
45 static char data_end_type[MENU_DATA_SIZE + 1] = "1";
46 static char data_mute_path[MENU_DATA_SIZE + 1] = "0";
47 static char data_mute_status[MENU_DATA_SIZE + 1] = "0";
48 static char data_vol_device[MENU_DATA_SIZE + 1] = "0";
49 static char data_vol_type[MENU_DATA_SIZE + 1] = "1";
50 static char data_vol_level[MENU_DATA_SIZE + 1] = "1";
51 static char data_sound_path[MENU_DATA_SIZE + 1] = "1";
52 static char data_extra_volume_status[MENU_DATA_SIZE + 1] = "0";
53 static char data_preferred_voice_subscription[MENU_DATA_SIZE + 1] = "0";
55 static void on_noti_call_status_idle(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
57 TelCallStatusIdleNoti_t *noti_data = (TelCallStatusIdleNoti_t*)data;
60 msgb("event(%s) receive !!", TAPI_NOTI_VOICE_CALL_STATUS_IDLE);
65 msg(" - id = %d", noti_data->id);
66 msg(" - cause = 0x%x", noti_data->cause);
69 static void on_noti_call_status_active(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
71 TelCallStatusActiveNoti_t *noti_data = (TelCallStatusActiveNoti_t*)data;
74 msgb("event(%s) receive !!", TAPI_NOTI_VOICE_CALL_STATUS_ACTIVE);
79 msg(" - id = %d", noti_data->id);
82 static void on_noti_call_status_held(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
84 TelCallStatusHeldNoti_t *noti_data = (TelCallStatusHeldNoti_t*)data;
87 msgb("event(%s) receive !!", TAPI_NOTI_VOICE_CALL_STATUS_HELD);
92 msg(" - id = %d", noti_data->id);
95 static void on_noti_call_status_dialing(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
97 TelCallStatusDialingNoti_t *noti_data = (TelCallStatusDialingNoti_t*)data;
100 msgb("event(%s) receive !!", TAPI_NOTI_VOICE_CALL_STATUS_DIALING);
105 msg(" - id = %d", noti_data->id);
108 static void on_noti_call_status_alert(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
110 TelCallStatusAlertNoti_t *noti_data = (TelCallStatusAlertNoti_t*)data;
113 msgb("event(%s) receive !!", TAPI_NOTI_VOICE_CALL_STATUS_ALERT);
118 msg(" - id = %d", noti_data->id);
121 static void on_noti_call_status_incoming(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
123 TelCallStatusIncomingNoti_t *noti_data = (TelCallStatusIncomingNoti_t*)data;
126 msgb("event(%s) receive !!", TAPI_NOTI_VOICE_CALL_STATUS_INCOMING);
131 msg(" - id = %d", noti_data->id);
134 static void on_noti_call_sound_ringback_tone(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
136 TelCallSoundRingbackToneNoti_t *noti_data = (TelCallSoundRingbackToneNoti_t*)data;
139 msgb("event(%s) receive !!", TAPI_NOTI_CALL_SOUND_RINGBACK_TONE);
144 msg(" - Ringback tone status = 0x%x", *noti_data);
147 static void on_noti_call_sound_wbamr(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
149 gboolean *noti_data = (gboolean*)data;
152 msgb("event(%s) receive !!", TAPI_NOTI_CALL_SOUND_WBAMR);
157 msg(" - status = 0x%x", *noti_data);
160 static void on_noti_call_preferred_voice_subscription(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
162 TelCallPreferredVoiceSubsNoti_t *noti_data = (TelCallPreferredVoiceSubsNoti_t *)data;
165 msgb("event(%s) receive !!", TAPI_NOTI_CALL_PREFERRED_VOICE_SUBSCRIPTION);
170 msg(" - preferred_subscription = 0x%x", noti_data->preferred_subs);
173 static void on_noti_call_sound_path(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
175 TelSoundPath_t *noti_data = (TelSoundPath_t *)data;
178 msgb("event(%s) receive !!", TAPI_NOTI_CALL_SOUND_PATH);
183 msg(" - Sound path = 0x%x", *noti_data);
186 static void on_noti_call_on_hold(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
188 unsigned int *noti_data = (unsigned int*)data;
191 msgb("event(%s) receive !!", TAPI_NOTI_CALL_INFO_HELD);
196 msg(" - ID = %d", *noti_data);
199 static void on_noti_call_active(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
201 unsigned int *noti_data = (unsigned int*)data;
204 msgb("event(%s) receive !!", TAPI_NOTI_CALL_INFO_ACTIVE);
209 msg(" - ID = %d", *noti_data);
212 static void on_noti_call_joined(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
214 unsigned int *noti_data = (unsigned int*)data;
217 msgb("event(%s) receive !!", TAPI_NOTI_CALL_INFO_JOINED);
222 msg(" - ID = %d", *noti_data);
226 static void on_dial_call(TapiHandle *handle, int result, void *data, void *user_data)
228 msg("on_dial_call() - result : 0x%x", result);
231 static void on_answer_call(TapiHandle *handle, int result, void *data, void *user_data)
233 TelCallAnswerCnf_t *cnf_data = (TelCallAnswerCnf_t*)data;
235 msg("on_answer_call() - cnf_data->id : %d", cnf_data->id);
238 static void on_end_call(TapiHandle *handle, int result, void *data, void *user_data)
240 TelCallEndCnf_t *cnf_data = (TelCallEndCnf_t*)data;
242 msg("on_end_call() - cnf_data->id : %d result : 0x%x", cnf_data->id, result);
245 static void on_hold_call(TapiHandle *handle, int result, void *data, void *user_data)
247 TelCallHoldCnf_t *cnf_data = (TelCallHoldCnf_t*)data;
249 msg("on_hold_call() - cnf_data->id : %d result : 0x%x", cnf_data->id, result);
252 static void on_active_call(TapiHandle *handle, int result, void *data, void *user_data)
254 TelCallActiveCnf_t *cnf_data = (TelCallActiveCnf_t*)data;
256 msg("on_active_call() - cnf_data->id : %d result : 0x%x", cnf_data->id, result);
259 static void on_swap_call(TapiHandle *handle, int result, void *data, void *user_data)
261 TelCallSwapCnf_t *cnf_data = (TelCallSwapCnf_t*)data;
263 msg("on_swap_call() - cnf_data->id : %d result : 0x%x", cnf_data->id, result);
266 static void on_join_call(TapiHandle *handle, int result, void *data, void *user_data)
268 TelCallJoinCnf_t *cnf_data = (TelCallJoinCnf_t*)data;
270 msg("on_join_call() - cnf_data->id : %d result : 0x%x", cnf_data->id, result);
273 static void on_split_call(TapiHandle *handle, int result, void *data, void *user_data)
275 TelCallSplitCnf_t *cnf_data = (TelCallSplitCnf_t*)data;
277 msg("on_split_call() - cnf_data->id : %d result : 0x%x", cnf_data->id, result);
280 static void on_transfer_call(TapiHandle *handle, int result, void *data, void *user_data)
282 TelCallTransferCnf_t *cnf_data = (TelCallTransferCnf_t*)data;
284 msg("on_transfer_call() - cnf_data->id : %d result : 0x%x", cnf_data->id, result);
287 static void on_start_cont_dtmf_call(TapiHandle *handle, int result, void *data, void *user_data)
289 msg("on_start_cont_dtmf_call() result : 0x%x", result);
292 static void on_stop_cont_dtmf_call(TapiHandle *handle, int result, void *data, void *user_data)
294 msg("on_stop_cont_dtmf_call() result : 0x%x", result);
297 static void on_send_burst_dtmf_call(TapiHandle *handle, int result, void *data, void *user_data)
299 msg("on_send_burst_dtmf_call() result : 0x%x", result);
302 static void on_call_set_mute_status(TapiHandle *handle, int result, void *data, void *user_data)
304 msg("on_call_set_mute_status() - result : 0x%x", result);
307 static void on_call_get_mute_status(TapiHandle *handle, int result, void *data, void *user_data)
309 TelCallGetMuteStatusResp_t *resp = (TelCallGetMuteStatusResp_t *)data;
311 msg("on_call_get_mute_status() - result : 0x%x", result);
312 msg("on_call_get_mute_status() - path : 0x%x", resp->path);
313 msg("on_call_get_mute_status() - status : 0x%x", resp->status);
316 static void on_call_set_volume_info(TapiHandle *handle, int result, void *data, void *user_data)
318 msg("on_call_set_volume_info() - result : 0x%x", result);
321 static void on_call_get_volume_info(TapiHandle *handle, int result, void *data, void *user_data)
324 TelCallGetVolumeInfoResp_t *resp = (TelCallGetVolumeInfoResp_t *)data;
326 msg("on_call_get_volume_info() - result : 0x%x", result);
327 msg("on_call_get_volume_info() - record_num : 0x%x", resp->record_num);
329 for ( i=0; i<resp->record_num; i++ ) {
330 msg("on_call_get_volume_info() - record[%d].device : 0x%x", (i+1), resp->record[i].device);
331 msg("on_call_get_volume_info() - record[%d].type : 0x%x", (i+1), resp->record[i].device);
332 msg("on_call_get_volume_info() - record[%d].volume : 0x%x", (i+1), resp->record[i].volume);
337 static void on_call_set_sound_path(TapiHandle *handle, int result, void *data, void *user_data)
339 msg("on_call_set_sound_path() - result : 0x%x", result);
342 static void on_call_set_preferred_voice_subscription(TapiHandle *handle, int result, void *data, void *user_data)
344 msg("on_call_set_preferred_voice_subscription() - result : 0x%x", result);
347 static int run_call_dial(MManager *mm, struct menu_data *menu)
349 TapiHandle *handle = menu_manager_ref_user_data(mm);
354 memset(&data, 0, sizeof(TelCallDial_t));
356 data.CallType = atoi(data_call_type);
357 len = strlen(data_call_number);
358 if (len > TAPI_CALL_DIALDIGIT_LEN_MAX) {
359 msg("number too long");
363 memcpy(data.szNumber, data_call_number, len);
365 msg("call tel_dail_call()");
367 result = tel_dial_call(handle, &data, on_dial_call, NULL);
368 if (result != TAPI_API_SUCCESS) {
369 msg("failed. (result = %d)", result);
375 static int run_call_answer(MManager *mm, struct menu_data *menu)
377 TapiHandle *handle = menu_manager_ref_user_data(mm);
379 unsigned int call_id;
380 TelCallAnswerType_t answer_type;
383 msg("call tel_answer_call()");
385 call_id = atoi(data_call_id);
386 answer_type = atoi(data_answer_type);
388 result = tel_answer_call(handle, call_id, answer_type, on_answer_call, NULL);
389 if (result != TAPI_API_SUCCESS) {
390 msg("failed. (result = %d)", result);
396 static int run_call_end(MManager *mm, struct menu_data *menu)
398 TapiHandle *handle = menu_manager_ref_user_data(mm);
400 unsigned int call_id;
401 TelCallEndType_t end_type;
403 msg("call tel_end_call()");
405 call_id = atoi(data_call_id);
406 end_type = atoi(data_end_type);
408 result = tel_end_call(handle, call_id, end_type, on_end_call, NULL);
409 if (result != TAPI_API_SUCCESS) {
410 msg("failed. (result = %d)", result);
416 static int run_call_hold(MManager *mm, struct menu_data *menu)
418 TapiHandle *handle = menu_manager_ref_user_data(mm);
420 unsigned int call_id;
422 msg("call tel_hold_call()");
424 call_id = atoi(data_call_id);
425 result = tel_hold_call(handle, call_id, on_hold_call, NULL);
427 if (result != TAPI_API_SUCCESS) {
428 msg("failed. (result = %d)", result);
434 static int run_call_join(MManager *mm, struct menu_data *menu)
436 TapiHandle *handle = menu_manager_ref_user_data(mm);
438 unsigned int call_id;
440 msg("call tel_join_call()");
442 call_id = atoi(data_call_id);
444 result = tel_join_call(handle, call_id, 0, on_join_call, NULL);
445 if (result != TAPI_API_SUCCESS) {
446 msg("failed. (result = %d)", result);
452 static int run_call_active(MManager *mm, struct menu_data *menu)
454 TapiHandle *handle = menu_manager_ref_user_data(mm);
456 unsigned int call_id;
458 msg("call tel_active_call()");
460 call_id = atoi(data_call_id);
461 result = tel_active_call(handle, call_id, on_active_call, NULL);
462 if (result != TAPI_API_SUCCESS) {
463 msg("failed. (result = %d)", result);
470 static int run_call_split(MManager *mm, struct menu_data *menu)
472 TapiHandle *handle = menu_manager_ref_user_data(mm);
474 unsigned int call_id;
476 msg("call tel_split_call()");
478 call_id = atoi(data_call_id);
480 result = tel_split_call(handle, call_id, on_split_call, NULL);
481 if (result != TAPI_API_SUCCESS) {
482 msg("failed. (result = %d)", result);
488 static int run_call_swap(MManager *mm, struct menu_data *menu)
490 TapiHandle *handle = menu_manager_ref_user_data(mm);
492 unsigned int call_id;
493 unsigned int call_id2;
495 msg("call tel_swap_call()");
497 call_id = atoi(data_call_id);
498 call_id2 = atoi(data_call_id2);
499 result = tel_swap_call(handle, call_id, call_id2, on_swap_call, NULL);
501 if (result != TAPI_API_SUCCESS) {
502 msg("failed. (result = %d)", result);
509 static int run_call_transfer(MManager *mm, struct menu_data *menu)
511 TapiHandle *handle = menu_manager_ref_user_data(mm);
513 unsigned int call_id;
516 msg("call tel_transfer_call()");
518 call_id = atoi(data_call_id);
520 result = tel_transfer_call(handle, call_id, on_transfer_call, NULL);
521 if (result != TAPI_API_SUCCESS) {
522 msg("failed. (result = %d)", result);
528 static int run_call_start_cont_dtmf(MManager *mm, struct menu_data *menu)
530 TapiHandle *handle = menu_manager_ref_user_data(mm);
533 msg("call tel_start_call_cont_dtmf()");
535 result = tel_start_call_cont_dtmf(handle, data_dtmf_digit[0], on_start_cont_dtmf_call, NULL);
536 if (result != TAPI_API_SUCCESS) {
537 msg("failed. (result = %d)", result);
543 static int run_call_stop_cont_dtmf(MManager *mm, struct menu_data *menu)
545 TapiHandle *handle = menu_manager_ref_user_data(mm);
548 msg("call tel_stop_call_cont_dtmf()");
550 result = tel_stop_call_cont_dtmf(handle, on_stop_cont_dtmf_call, NULL);
551 if (result != TAPI_API_SUCCESS) {
552 msg("failed. (result = %d)", result);
558 static int run_call_send_burst_dtmf(MManager *mm, struct menu_data *menu)
560 TapiHandle *handle = menu_manager_ref_user_data(mm);
562 TelCallBurstDtmf_t info;
563 memset(&info, 0x0, sizeof(info));
564 g_strlcpy(info.dtmf_string, data_dtmf_string, TAPI_CALL_BURST_DTMF_STRING_MAX + 1);
565 info.pulse_width = data_dtmf_pulse_width[0];
566 info.inter_digit_interval = data_dtmf_inter_digit_interval[0];
568 msg("call tel_send_call_burst_dtmf()");
570 result = tel_send_call_burst_dtmf(handle, &info,on_send_burst_dtmf_call, NULL);
571 if (result != TAPI_API_SUCCESS) {
572 msg("failed. (result = %d)", result);
579 static void call_status_callback( TelCallStatus_t *status, void *user_data )
582 msg(" - id = %d", status->CallHandle);
583 msg(" - direction = %d", status->bMoCall);
584 msg(" - number = %s", status->pNumber);
585 msg(" - type = %d", status->CallType);
586 msg(" - state = %d", status->CallState);
587 msg(" - multiparty = %d", status->bConferenceState);
591 static int run_call_get_status(MManager *mm, struct menu_data *menu)
593 TapiHandle *handle = menu_manager_ref_user_data(mm);
595 unsigned int call_id = 0;
596 TelCallStatus_t info;
598 msg("call tel_get_call_status()");
600 call_id = atoi(data_call_id);
602 result = tel_get_call_status(handle, call_id, &info);
603 if (result != TAPI_API_SUCCESS) {
604 msg("failed. (result = %d)", result);
608 msg(" - id = %d", info.CallHandle);
609 msg(" - direction = %d", info.bMoCall);
610 msg(" - number = %s", info.pNumber);
611 msg(" - type = %d", info.CallType);
612 msg(" - state = %d", info.CallState);
613 msg(" - multiparty = %d", info.bConferenceState);
618 static int run_call_get_status_all(MManager *mm, struct menu_data *menu)
620 TapiHandle *handle = menu_manager_ref_user_data(mm);
623 msg("call tel_get_call_status_all()");
625 result = tel_get_call_status_all(handle, call_status_callback, NULL);
626 if (result != TAPI_API_SUCCESS) {
627 msg("failed. (result = %d)", result);
633 static int run_call_set_mute_status(MManager *mm, struct menu_data *menu)
635 TapiHandle *handle = menu_manager_ref_user_data(mm);
637 TelSoundMutePath_t path = 0;
638 TelSoundMuteStatus_t status = 0;
640 msg("call tel_set_call_mute_status()");
642 path = (TelSoundMutePath_t)atoi(data_mute_path);
643 status = (TelSoundMuteStatus_t)atoi(data_mute_status);
645 msg("path : (%d)", path);
646 msg("status : (%d)", status);
648 result = tel_set_call_mute_status(handle, status, path, on_call_set_mute_status, NULL);
649 if (result != TAPI_API_SUCCESS) {
650 msg("failed. (result = %d)", result);
656 static int run_call_get_mute_status(MManager *mm, struct menu_data *menu)
658 TapiHandle *handle = menu_manager_ref_user_data(mm);
661 msg("call tel_get_call_mute_status()");
663 result = tel_get_call_mute_status(handle, on_call_get_mute_status, NULL);
664 if (result != TAPI_API_SUCCESS) {
665 msg("failed. (result = %d)", result);
671 static int run_call_set_volume_info(MManager *mm, struct menu_data *menu)
673 TapiHandle *handle = menu_manager_ref_user_data(mm);
675 TelCallVolumeInfo_t data;
677 msg("call tel_set_call_volume_info()");
679 data.device = (TelSoundDevice_t)atoi(data_vol_device);
680 data.type = (TelSoundType_t)atoi(data_vol_type);
681 data.volume = (TelSoundVolume_t)atoi(data_vol_level);
683 msg("device : (%d)", data.device);
684 msg("type : (%d)", data.type);
685 msg("volume : (%d)", data.volume);
687 result = tel_set_call_volume_info(handle, &data, on_call_set_volume_info, NULL);
688 if (result != TAPI_API_SUCCESS) {
689 msg("failed. (result = %d)", result);
695 static int run_call_get_volume_info(MManager *mm, struct menu_data *menu)
697 TapiHandle *handle = menu_manager_ref_user_data(mm);
699 TelSoundDevice_t device;
702 msg("call tel_get_call_volume_info()");
704 device = (TelSoundDevice_t)atoi(data_vol_device);
705 type = (TelSoundType_t)atoi(data_vol_type);
707 msg("device : (%d)", device);
708 msg("type : (%d)", type);
710 result = tel_get_call_volume_info(handle, device, type, on_call_get_volume_info, NULL);
711 if (result != TAPI_API_SUCCESS) {
712 msg("failed. (result = %d)", result);
718 static int run_call_set_sound_path(MManager *mm, struct menu_data *menu)
720 TapiHandle *handle = menu_manager_ref_user_data(mm);
722 TelCallSoundPathInfo_t sound_path ;
724 msg("call tel_set_sound_path()");
726 sound_path.path = (TelSoundPath_t)atoi(data_sound_path);
727 sound_path.ex_volume = atoi(data_extra_volume_status);
729 msg("sound_path.path : (0x%x)", sound_path.path);
730 msg("sound_path.ex_volume : (0x%x)", sound_path.ex_volume);
732 result = tel_set_call_sound_path(handle, &sound_path, on_call_set_sound_path, NULL);
733 if (result != TAPI_API_SUCCESS) {
734 msg("failed. (result = %d)", result);
740 static int run_call_set_preferred_voice_subscription(MManager *mm, struct menu_data *menu)
742 TapiHandle *handle = menu_manager_ref_user_data(mm);
744 TelCallPreferredVoiceSubs_t preferred_subscription;
746 msg("call run_call_set_preferred_voice_subscription()");
748 preferred_subscription = (TelCallPreferredVoiceSubs_t)atoi(data_preferred_voice_subscription);
750 msg("preferred_subscription : (%d)", preferred_subscription);
752 result = tel_set_call_preferred_voice_subscription(handle, preferred_subscription, on_call_set_preferred_voice_subscription, NULL);
753 if (result != TAPI_API_SUCCESS) {
754 msg("failed. (result = %d)", result);
760 static int run_call_get_preferred_voice_subscription(MManager *mm, struct menu_data *menu)
762 TapiHandle *handle = menu_manager_ref_user_data(mm);
764 TelCallPreferredVoiceSubs_t preferred_subscription = TAPI_CALL_PREFERRED_VOICE_SUBS_UNKNOWN;
766 msg("call tel_get_call_preferred_voice_subscription()");
768 result = tel_get_call_preferred_voice_subscription(handle, &preferred_subscription);
769 if (result != TAPI_API_SUCCESS) {
770 msg("failed. (result = %d)", result);
773 msg("'preferred' Voice call subscription = (%d)", preferred_subscription);
779 static struct menu_data menu_call_dial[] = {
780 { "1", "type (0=VOICE, 1=VIDEO, 2=Emergency)", 0, 0, data_call_type},
781 { "2", "number", 0, 0, data_call_number},
782 { "3", "run", 0, run_call_dial, 0},
786 static struct menu_data menu_call_answer[] = {
787 { "1", "id", 0, 0, data_call_id},
788 { "2", "type (0=ACCEPT, 1=REJECT, 2=REPLACE, 3=HOLD&ACCEPT)", 0, 0, data_answer_type},
789 { "3", "run", 0, run_call_answer, 0},
793 static struct menu_data menu_call_end[] = {
794 { "1", "id", 0, 0, data_call_id},
795 { "2", "type (0=END, 1=END ALL, 2=END ACTIVE ALL, 3=END HOLD ALL)", 0, 0, data_end_type},
796 { "3", "run", 0, run_call_end, 0},
800 static struct menu_data menu_call_hold[] = {
801 { "1", "id", 0, 0, data_call_id},
802 { "2", "run", 0, run_call_hold, 0},
806 static struct menu_data menu_call_active[] = {
807 { "1", "id", 0, 0, data_call_id},
808 { "2", "run", 0, run_call_active, 0},
812 static struct menu_data menu_call_swap[] = {
813 { "1", "id", 0, 0, data_call_id},
814 { "2", "id2", 0, 0, data_call_id2},
815 { "3", "run", 0, run_call_swap, 0},
818 static struct menu_data menu_call_join[] = {
819 { "1", "id", 0, 0, data_call_id},
820 { "2", "run", 0, run_call_join, 0},
824 static struct menu_data menu_call_split[] = {
825 { "1", "id", 0, 0, data_call_id},
826 { "2", "run", 0, run_call_split, 0},
830 static struct menu_data menu_call_transfer[] = {
831 { "1", "id", 0, 0, data_call_id},
832 { "2", "run", 0, run_call_transfer, 0},
836 static struct menu_data menu_call_start_cont_dtmf[] = {
837 { "1", "Dtmf Charater(0-9, A-D, ' * ' and ' # ') one character at a time ", NULL, NULL, data_dtmf_digit},
838 { "2", "run", NULL, run_call_start_cont_dtmf, NULL},
842 static struct menu_data menu_call_stop_cont_dtmf[] = {
843 { "1", "run", NULL, run_call_stop_cont_dtmf, NULL},
847 static struct menu_data menu_call_send_burst_dtmf[] = {
848 { "1", "Dtmf String(0-9, A-D, ' * ' and ' # ') one character or a string of characters ", NULL, NULL, data_dtmf_string},
849 { "2", "DTMF pulse width (ONLENGTH_95MS=0x0, ONLENGTH_150MS=0x1, ONLENGTH_200MS=0x2, ONLENGTH_250MS=0x3, ONLENGTH_300MS=0x4, ONLENGTH_350MS=0x5, ONLENGTH_SMS=0x6)", NULL, NULL, data_dtmf_pulse_width},
850 { "3", "DTMF inter digit interval (OFFLENGTH_60MS=0x0, OFFLENGTH_100MS=0x1, OFFLENGTH_150MS=0x2, OFFLENGTH_200MS=0x3)", NULL, NULL, data_dtmf_inter_digit_interval},
851 { "4", "run", NULL, run_call_send_burst_dtmf, NULL},
856 static struct menu_data menu_call_get_status[] = {
857 { "1", "id", 0, 0, data_call_id},
858 { "2", "run", 0, run_call_get_status, 0},
862 static struct menu_data menu_call_get_status_all[] = {
863 { "1", "id", 0, 0, data_call_id},
864 { "2", "run", 0, run_call_get_status_all, 0},
868 static struct menu_data menu_call_set_mute_status[] = {
869 { "1", "status", 0, 0, data_mute_status},
870 { "2", "path", 0, 0, data_mute_path},
871 { "3", "run", 0, run_call_set_mute_status, 0},
875 static struct menu_data menu_call_get_mute_status[] = {
876 { "1", "run", 0, run_call_get_mute_status, 0},
880 static struct menu_data menu_call_set_volume_info[] = {
881 { "1", "device", 0, 0, data_vol_device},
882 { "2", "type", 0, 0, data_vol_type},
883 { "3", "volume", 0, 0, data_vol_level},
884 { "4", "run", 0, run_call_set_volume_info, 0},
888 static struct menu_data menu_call_get_volume_info[] = {
889 { "1", "device", 0, 0, data_vol_device},
890 { "2", "type", 0, 0, data_vol_type},
891 { "3", "run", 0, run_call_get_volume_info, 0},
895 static struct menu_data menu_call_set_sound_path[] = {
896 { "1", "Sound path(1= HANDSET, 2= HEADSET, 3= HANDSFREE, 4=BUETOOTH, 5=STEREO_BLUETOOTH, 6=SPK_PHONE, 7=HEADSET_5_PI, 8=BT_NSCE_OFF, 9=MIC1, 10=MIC2, 11=HEADSET_HAC)", 0, 0, data_sound_path},
897 { "2", "Extra Volume Status( 0=OFF, 1=ON)", 0, 0, data_extra_volume_status},
898 { "3", "run", 0, run_call_set_sound_path, 0},
902 static struct menu_data menu_call_set_preferred_voice_subscription[] = {
903 { "1", "Preferred Voice call Subcription (0=Current network, 1=ASK Always, 2=SIM 1, 3=SIM 2)", 0, 0, data_preferred_voice_subscription},
904 { "2", "run", 0, run_call_set_preferred_voice_subscription, 0},
908 static struct menu_data menu_call_get_preferred_voice_subscription[] = {
909 { "1", "run", 0, run_call_get_preferred_voice_subscription, 0},
913 struct menu_data menu_call[] = {
914 { "1", "tel_dial_call", menu_call_dial, 0, 0},
915 { "2", "tel_answer_call", menu_call_answer, 0, 0},
916 { "3", "tel_end_call", menu_call_end, 0, 0},
917 { "4", "tel_hold_call", menu_call_hold, 0, 0},
918 { "5", "tel_active_call", menu_call_active, 0, 0},
919 { "6", "tel_swap_call", menu_call_swap, 0, 0},
920 { "7", "tel_join_call", menu_call_join, 0, 0},
921 { "8", "tel_split_call", menu_call_split, 0, 0},
922 { "9", "tel_transfer_call", menu_call_transfer, 0, 0},
923 { "10", "tel_start_call_cont_dtmf_call", menu_call_start_cont_dtmf, NULL, NULL},
924 { "11", "tel_stop_call_cont_dtmf_call", menu_call_stop_cont_dtmf, NULL, NULL},
925 { "12", "tel_send_call_burst_dtmf", menu_call_send_burst_dtmf, NULL, NULL},
926 { "13", "tel_get_call_status", menu_call_get_status, NULL, NULL},
927 { "14", "tel_get_call_status_all", menu_call_get_status_all, NULL, NULL},
928 { "15", "tel_set_call_mute_status", menu_call_set_mute_status, NULL, NULL},
929 { "16", "tel_get_call_mute_status", menu_call_get_mute_status, NULL, NULL},
930 { "17", "tel_set_call_volume_info", menu_call_set_volume_info, NULL, NULL},
931 { "18", "tel_get_call_volume_info", menu_call_get_volume_info, NULL, NULL},
932 { "19", "tel_set_call_sound_path", menu_call_set_sound_path, NULL, NULL},
933 { "20", "tel_set_call_preferred_voice_subscription", menu_call_set_preferred_voice_subscription, 0, 0},
934 { "21", "tel_get_call_preferred_voice_subscription", menu_call_get_preferred_voice_subscription, 0, 0},
938 void register_call_event(TapiHandle *handle)
942 ret = tel_register_noti_event(handle, TAPI_NOTI_VOICE_CALL_STATUS_IDLE, on_noti_call_status_idle, 0);
943 if (ret != TAPI_API_SUCCESS) {
944 msg("event register failed(%d)", ret);
947 ret = tel_register_noti_event(handle, TAPI_NOTI_VOICE_CALL_STATUS_ACTIVE, on_noti_call_status_active, 0);
948 if (ret != TAPI_API_SUCCESS) {
949 msg("event register failed(%d)", ret);
952 ret = tel_register_noti_event(handle, TAPI_NOTI_VOICE_CALL_STATUS_HELD, on_noti_call_status_held, 0);
953 if (ret != TAPI_API_SUCCESS) {
954 msg("event register failed(%d)", ret);
957 ret = tel_register_noti_event(handle, TAPI_NOTI_VOICE_CALL_STATUS_DIALING, on_noti_call_status_dialing, 0);
958 if (ret != TAPI_API_SUCCESS) {
959 msg("event register failed(%d)", ret);
962 ret = tel_register_noti_event(handle, TAPI_NOTI_VOICE_CALL_STATUS_ALERT, on_noti_call_status_alert, 0);
963 if (ret != TAPI_API_SUCCESS) {
964 msg("event register failed(%d)", ret);
967 ret = tel_register_noti_event(handle, TAPI_NOTI_VOICE_CALL_STATUS_INCOMING, on_noti_call_status_incoming, 0);
968 if (ret != TAPI_API_SUCCESS) {
969 msg("event register failed(%d)", ret);
972 ret = tel_register_noti_event(handle, TAPI_NOTI_CALL_INFO_HELD, on_noti_call_on_hold, 0);
973 if (ret != TAPI_API_SUCCESS) {
974 msg("event register failed(%d)", ret);
977 ret = tel_register_noti_event(handle, TAPI_NOTI_CALL_INFO_ACTIVE, on_noti_call_active, 0);
978 if (ret != TAPI_API_SUCCESS) {
979 msg("event register failed(%d)", ret);
982 ret = tel_register_noti_event(handle, TAPI_NOTI_CALL_INFO_JOINED, on_noti_call_joined, 0);
983 if (ret != TAPI_API_SUCCESS) {
984 msg("event register failed(%d)", ret);
987 ret = tel_register_noti_event(handle, TAPI_NOTI_CALL_SOUND_RINGBACK_TONE, on_noti_call_sound_ringback_tone, 0);
988 if (ret != TAPI_API_SUCCESS) {
989 msg("event register failed(%d)", ret);
992 ret = tel_register_noti_event(handle, TAPI_NOTI_CALL_SOUND_WBAMR, on_noti_call_sound_wbamr, 0);
993 if (ret != TAPI_API_SUCCESS) {
994 msg("event register failed(%d)", ret);
997 ret = tel_register_noti_event(handle, TAPI_NOTI_CALL_SOUND_PATH, on_noti_call_sound_path, 0);
998 if (ret != TAPI_API_SUCCESS) {
999 msg("event register failed(%d)", ret);
1002 ret = tel_register_noti_event(handle, TAPI_NOTI_CALL_PREFERRED_VOICE_SUBSCRIPTION, on_noti_call_preferred_voice_subscription, 0);
1003 if (ret != TAPI_API_SUCCESS) {
1004 msg("event register failed(%d)", ret);