2 * Telephony test application
4 * Copyright (c) 2012 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_string[MENU_DATA_SIZE + 1] = "1";
40 static char data_call_number[MENU_DATA_SIZE + 1] = "+821099777347";
41 static char data_answer_type[MENU_DATA_SIZE + 1] = "1";
42 static char data_end_type[MENU_DATA_SIZE + 1] = "1";
43 static char data_clock_status[MENU_DATA_SIZE + 1] = "1";
44 static char data_mute_path[MENU_DATA_SIZE + 1] = "0";
45 static char data_mute_status[MENU_DATA_SIZE + 1] = "0";
46 static char data_vol_device[MENU_DATA_SIZE + 1] = "0";
47 static char data_vol_type[MENU_DATA_SIZE + 1] = "1";
48 static char data_vol_level[MENU_DATA_SIZE + 1] = "1";
49 static char data_sound_path[MENU_DATA_SIZE + 1] = "1";
50 static char data_extra_volume_status[MENU_DATA_SIZE + 1] = "0";
51 static char data_sound_recording[MENU_DATA_SIZE + 1] = "0";
52 static char data_sound_equalization_mode[MENU_DATA_SIZE + 1] = "0";
53 static char data_sound_direction[MENU_DATA_SIZE + 1] = "0";
54 static char data_sound_noise_reduction[MENU_DATA_SIZE + 1] = "0";
56 static void on_noti_call_status_idle(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
58 TelCallStatusIdleNoti_t *noti_data = (TelCallStatusIdleNoti_t*)data;
61 msgb("event(%s) receive !!", TAPI_NOTI_VOICE_CALL_STATUS_IDLE);
66 msg(" - id = %d", noti_data->id);
67 msg(" - cause = 0x%x", noti_data->cause);
70 static void on_noti_call_status_active(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
72 TelCallStatusActiveNoti_t *noti_data = (TelCallStatusActiveNoti_t*)data;
75 msgb("event(%s) receive !!", TAPI_NOTI_VOICE_CALL_STATUS_ACTIVE);
80 msg(" - id = %d", noti_data->id);
83 static void on_noti_call_status_held(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
85 TelCallStatusHeldNoti_t *noti_data = (TelCallStatusHeldNoti_t*)data;
88 msgb("event(%s) receive !!", TAPI_NOTI_VOICE_CALL_STATUS_HELD);
93 msg(" - id = %d", noti_data->id);
96 static void on_noti_call_status_dialing(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
98 TelCallStatusDialingNoti_t *noti_data = (TelCallStatusDialingNoti_t*)data;
101 msgb("event(%s) receive !!", TAPI_NOTI_VOICE_CALL_STATUS_DIALING);
106 msg(" - id = %d", noti_data->id);
109 static void on_noti_call_status_alert(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
111 TelCallStatusAlertNoti_t *noti_data = (TelCallStatusAlertNoti_t*)data;
114 msgb("event(%s) receive !!", TAPI_NOTI_VOICE_CALL_STATUS_ALERT);
119 msg(" - id = %d", noti_data->id);
122 static void on_noti_call_status_incoming(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
124 TelCallStatusIncomingNoti_t *noti_data = (TelCallStatusIncomingNoti_t*)data;
127 msgb("event(%s) receive !!", TAPI_NOTI_VOICE_CALL_STATUS_INCOMING);
132 msg(" - id = %d", noti_data->id);
135 static void on_noti_call_sound_clock_status(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
137 gboolean *noti_data = (gboolean*)data;
140 msgb("event(%s) receive !!", TAPI_NOTI_CALL_SOUND_CLOCK_STATUS);
145 msg(" - status = 0x%x", *noti_data);
148 static void on_noti_call_sound_ringback_tone(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
150 TelCallSoundRingbackToneNoti_t *noti_data = (TelCallSoundRingbackToneNoti_t*)data;
153 msgb("event(%s) receive !!", TAPI_NOTI_CALL_SOUND_RINGBACK_TONE);
158 msg(" - Ringback tone status = 0x%x", *noti_data);
161 static void on_noti_call_sound_wbamr(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
163 gboolean *noti_data = (gboolean*)data;
166 msgb("event(%s) receive !!", TAPI_NOTI_CALL_SOUND_WBAMR);
171 msg(" - status = 0x%x", *noti_data);
174 static void on_noti_call_sound_noise_reduction(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
176 gboolean *noti_data = (gboolean*)data;
179 msgb("event(%s) receive !!", TAPI_NOTI_CALL_SOUND_NOISE_REDUCTION);
184 msg(" - status = 0x%x", *noti_data);
187 static void on_noti_call_sound_equalization(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
189 TelCallSoundEqualizationNoti_t *noti_data = (TelCallSoundEqualizationNoti_t *)data;
192 msgb("event(%s) receive !!", TAPI_NOTI_CALL_SOUND_EQUALIZATION);
197 msg(" - Mode = 0x%x Direction = 0x%x", noti_data->mode, noti_data->direction);
200 static void on_noti_call_sound_path(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
202 TelSoundPath_t *noti_data = (TelSoundPath_t *)data;
205 msgb("event(%s) receive !!", TAPI_NOTI_CALL_SOUND_PATH);
210 msg(" - Sound path = 0x%x", *noti_data);
213 static void on_noti_call_on_hold(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
215 unsigned int *noti_data = (unsigned int*)data;
218 msgb("event(%s) receive !!", TAPI_NOTI_CALL_INFO_HELD);
223 msg(" - ID = %d", *noti_data);
226 static void on_noti_call_active(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
228 unsigned int *noti_data = (unsigned int*)data;
231 msgb("event(%s) receive !!", TAPI_NOTI_CALL_INFO_ACTIVE);
236 msg(" - ID = %d", *noti_data);
239 static void on_noti_call_joined(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
241 unsigned int *noti_data = (unsigned int*)data;
244 msgb("event(%s) receive !!", TAPI_NOTI_CALL_INFO_JOINED);
249 msg(" - ID = %d", *noti_data);
253 static void on_dial_call(TapiHandle *handle, int result, void *data, void *user_data)
255 msg("on_dial_call() - result : 0x%x", result);
258 static void on_answer_call(TapiHandle *handle, int result, void *data, void *user_data)
260 TelCallAnswerCnf_t *cnf_data = (TelCallAnswerCnf_t*)data;
262 msg("on_answer_call() - cnf_data->id : %d", cnf_data->id);
265 static void on_end_call(TapiHandle *handle, int result, void *data, void *user_data)
267 TelCallEndCnf_t *cnf_data = (TelCallEndCnf_t*)data;
269 msg("on_end_call() - cnf_data->id : %d result : 0x%x", cnf_data->id, result);
272 static void on_hold_call(TapiHandle *handle, int result, void *data, void *user_data)
274 TelCallHoldCnf_t *cnf_data = (TelCallHoldCnf_t*)data;
276 msg("on_hold_call() - cnf_data->id : %d result : 0x%x", cnf_data->id, result);
279 static void on_active_call(TapiHandle *handle, int result, void *data, void *user_data)
281 TelCallActiveCnf_t *cnf_data = (TelCallActiveCnf_t*)data;
283 msg("on_active_call() - cnf_data->id : %d result : 0x%x", cnf_data->id, result);
286 static void on_swap_call(TapiHandle *handle, int result, void *data, void *user_data)
288 TelCallSwapCnf_t *cnf_data = (TelCallSwapCnf_t*)data;
290 msg("on_swap_call() - cnf_data->id : %d result : 0x%x", cnf_data->id, result);
293 static void on_join_call(TapiHandle *handle, int result, void *data, void *user_data)
295 TelCallJoinCnf_t *cnf_data = (TelCallJoinCnf_t*)data;
297 msg("on_join_call() - cnf_data->id : %d result : 0x%x", cnf_data->id, result);
300 static void on_split_call(TapiHandle *handle, int result, void *data, void *user_data)
302 TelCallSplitCnf_t *cnf_data = (TelCallSplitCnf_t*)data;
304 msg("on_split_call() - cnf_data->id : %d result : 0x%x", cnf_data->id, result);
307 static void on_transfer_call(TapiHandle *handle, int result, void *data, void *user_data)
309 TelCallTransferCnf_t *cnf_data = (TelCallTransferCnf_t*)data;
311 msg("on_transfer_call() - cnf_data->id : %d result : 0x%x", cnf_data->id, result);
314 static void on_dtmf_call(TapiHandle *handle, int result, void *data, void *user_data)
316 msg("on_dtmf_call() result : 0x%x", result);
320 static void on_call_sound_clock_status(TapiHandle *handle, int result, void *data, void *user_data)
322 msg("on_call_sound_clock_status() - result : 0x%x", result);
325 static void on_call_set_mute_status(TapiHandle *handle, int result, void *data, void *user_data)
327 msg("on_call_set_mute_status() - result : 0x%x", result);
330 static void on_call_get_mute_status(TapiHandle *handle, int result, void *data, void *user_data)
332 TelCallGetMuteStatusResp_t *resp = (TelCallGetMuteStatusResp_t *)data;
334 msg("on_call_get_mute_status() - result : 0x%x", result);
335 msg("on_call_get_mute_status() - path : 0x%x", resp->path);
336 msg("on_call_get_mute_status() - status : 0x%x", resp->status);
339 static void on_call_set_volume_info(TapiHandle *handle, int result, void *data, void *user_data)
341 msg("on_call_set_volume_info() - result : 0x%x", result);
344 static void on_call_get_volume_info(TapiHandle *handle, int result, void *data, void *user_data)
347 TelCallGetVolumeInfoResp_t *resp = (TelCallGetVolumeInfoResp_t *)data;
349 msg("on_call_get_volume_info() - result : 0x%x", result);
350 msg("on_call_get_volume_info() - record_num : 0x%x", resp->record_num);
352 for ( i=0; i<resp->record_num; i++ ) {
353 msg("on_call_get_volume_info() - record[%d].device : 0x%x", (i+1), resp->record[i].device);
354 msg("on_call_get_volume_info() - record[%d].type : 0x%x", (i+1), resp->record[i].device);
355 msg("on_call_get_volume_info() - record[%d].volume : 0x%x", (i+1), resp->record[i].volume);
360 static void on_call_set_sound_path(TapiHandle *handle, int result, void *data, void *user_data)
362 msg("on_call_set_sound_path() - result : 0x%x", result);
365 static void on_call_set_sound_recording(TapiHandle *handle, int result, void *data, void *user_data)
367 msg("on_call_set_sound_recording() - result : 0x%x", result);
370 static void on_call_set_sound_equalization(TapiHandle *handle, int result, void *data, void *user_data)
372 msg("on_call_set_sound_equalization() - result : 0x%x", result);
375 static void on_call_set_sound_noise_reduction(TapiHandle *handle, int result, void *data, void *user_data)
377 msg("on_call_set_sound_noise_reduction() - result : 0x%x", result);
380 static int run_call_dial(MManager *mm, struct menu_data *menu)
382 TapiHandle *handle = menu_manager_ref_user_data(mm);
387 memset(&data, 0, sizeof(TelCallDial_t));
389 data.CallType = atoi(data_call_type);
390 len = strlen(data_call_number);
391 if (len > TAPI_CALL_DIALDIGIT_LEN_MAX) {
392 msg("number too long");
396 memcpy(data.szNumber, data_call_number, len);
398 msg("call tel_dail_call()");
400 result = tel_dial_call(handle, &data, on_dial_call, NULL);
401 if (result != TAPI_API_SUCCESS) {
402 msg("failed. (result = %d)", result);
408 static int run_call_answer(MManager *mm, struct menu_data *menu)
410 TapiHandle *handle = menu_manager_ref_user_data(mm);
412 unsigned int call_id;
413 TelCallAnswerType_t answer_type;
416 msg("call tel_answer_call()");
418 call_id = atoi(data_call_id);
419 answer_type = atoi(data_answer_type);
421 result = tel_answer_call(handle, call_id, answer_type, on_answer_call, NULL);
422 if (result != TAPI_API_SUCCESS) {
423 msg("failed. (result = %d)", result);
429 static int run_call_end(MManager *mm, struct menu_data *menu)
431 TapiHandle *handle = menu_manager_ref_user_data(mm);
433 unsigned int call_id;
434 TelCallEndType_t end_type;
436 msg("call tel_end_call()");
438 call_id = atoi(data_call_id);
439 end_type = atoi(data_end_type);
441 result = tel_end_call(handle, call_id, end_type, on_end_call, NULL);
442 if (result != TAPI_API_SUCCESS) {
443 msg("failed. (result = %d)", result);
449 static int run_call_hold(MManager *mm, struct menu_data *menu)
451 TapiHandle *handle = menu_manager_ref_user_data(mm);
453 unsigned int call_id;
455 msg("call tel_hold_call()");
457 call_id = atoi(data_call_id);
458 result = tel_hold_call(handle, call_id, on_hold_call, NULL);
460 if (result != TAPI_API_SUCCESS) {
461 msg("failed. (result = %d)", result);
467 static int run_call_join(MManager *mm, struct menu_data *menu)
469 TapiHandle *handle = menu_manager_ref_user_data(mm);
471 unsigned int call_id;
473 msg("call tel_join_call()");
475 call_id = atoi(data_call_id);
477 result = tel_join_call(handle, call_id, 0, on_join_call, NULL);
478 if (result != TAPI_API_SUCCESS) {
479 msg("failed. (result = %d)", result);
485 static int run_call_active(MManager *mm, struct menu_data *menu)
487 TapiHandle *handle = menu_manager_ref_user_data(mm);
489 unsigned int call_id;
491 msg("call tel_active_call()");
493 call_id = atoi(data_call_id);
494 result = tel_active_call(handle, call_id, on_active_call, NULL);
495 if (result != TAPI_API_SUCCESS) {
496 msg("failed. (result = %d)", result);
503 static int run_call_split(MManager *mm, struct menu_data *menu)
505 TapiHandle *handle = menu_manager_ref_user_data(mm);
507 unsigned int call_id;
509 msg("call tel_split_call()");
511 call_id = atoi(data_call_id);
513 result = tel_split_call(handle, call_id, on_split_call, NULL);
514 if (result != TAPI_API_SUCCESS) {
515 msg("failed. (result = %d)", result);
521 static int run_call_swap(MManager *mm, struct menu_data *menu)
523 TapiHandle *handle = menu_manager_ref_user_data(mm);
525 unsigned int call_id;
526 unsigned int call_id2;
528 msg("call tel_swap_call()");
530 call_id = atoi(data_call_id);
531 call_id2 = atoi(data_call_id2);
532 result = tel_swap_call(handle, call_id, call_id2, on_swap_call, NULL);
534 if (result != TAPI_API_SUCCESS) {
535 msg("failed. (result = %d)", result);
542 static int run_call_transfer(MManager *mm, struct menu_data *menu)
544 TapiHandle *handle = menu_manager_ref_user_data(mm);
546 unsigned int call_id;
549 msg("call tel_transfer_call()");
551 call_id = atoi(data_call_id);
553 result = tel_transfer_call(handle, call_id, on_transfer_call, NULL);
554 if (result != TAPI_API_SUCCESS) {
555 msg("failed. (result = %d)", result);
561 static int run_call_dtmf(MManager *mm, struct menu_data *menu)
563 TapiHandle *handle = menu_manager_ref_user_data(mm);
566 msg("call tel_dtmf_call()");
568 result = tel_call_dtmf(handle, data_dtmf_string, on_dtmf_call, NULL);
569 if (result != TAPI_API_SUCCESS) {
570 msg("failed. (result = %d)", result);
576 static void call_status_callback( TelCallStatus_t *status, void *user_data )
579 msg(" - id = %d", status->CallHandle);
580 msg(" - direction = %d", status->bMoCall);
581 msg(" - number = %s", status->pNumber);
582 msg(" - type = %d", status->CallType);
583 msg(" - state = %d", status->CallState);
584 msg(" - multiparty = %d", status->bConferenceState);
588 static int run_call_get_status(MManager *mm, struct menu_data *menu)
590 TapiHandle *handle = menu_manager_ref_user_data(mm);
592 unsigned int call_id = 0;
593 TelCallStatus_t info;
595 msg("call tel_get_call_status()");
597 call_id = atoi(data_call_id);
599 result = tel_get_call_status(handle, call_id, &info);
600 if (result != TAPI_API_SUCCESS) {
601 msg("failed. (result = %d)", result);
605 msg(" - id = %d", info.CallHandle);
606 msg(" - direction = %d", info.bMoCall);
607 msg(" - number = %s", info.pNumber);
608 msg(" - type = %d", info.CallType);
609 msg(" - state = %d", info.CallState);
610 msg(" - multiparty = %d", info.bConferenceState);
615 static int run_call_get_status_all(MManager *mm, struct menu_data *menu)
617 TapiHandle *handle = menu_manager_ref_user_data(mm);
620 msg("call tel_get_call_status_all()");
622 result = tel_get_call_status_all(handle, call_status_callback, NULL);
623 if (result != TAPI_API_SUCCESS) {
624 msg("failed. (result = %d)", result);
630 static int run_call_set_sound_clock_status(MManager *mm, struct menu_data *menu)
632 TapiHandle *handle = menu_manager_ref_user_data(mm);
636 msg("call tel_set_call_sound_clock_status()");
638 status = atoi(data_clock_status);
640 msg("status : (%d)", status);
642 result = tel_set_call_sound_clock_status(handle, (gboolean)status, on_call_sound_clock_status, NULL);
643 if (result != TAPI_API_SUCCESS) {
644 msg("failed. (result = %d)", result);
650 static int run_call_set_mute_status(MManager *mm, struct menu_data *menu)
652 TapiHandle *handle = menu_manager_ref_user_data(mm);
654 TelSoundMutePath_t path = 0;
655 TelSoundMuteStatus_t status = 0;
657 msg("call tel_set_call_mute_status()");
659 path = (TelSoundMutePath_t)atoi(data_mute_path);
660 status = (TelSoundMuteStatus_t)atoi(data_mute_status);
662 msg("path : (%d)", path);
663 msg("status : (%d)", status);
665 result = tel_set_call_mute_status(handle, status, path, on_call_set_mute_status, NULL);
666 if (result != TAPI_API_SUCCESS) {
667 msg("failed. (result = %d)", result);
673 static int run_call_get_mute_status(MManager *mm, struct menu_data *menu)
675 TapiHandle *handle = menu_manager_ref_user_data(mm);
678 msg("call tel_get_call_mute_status()");
680 result = tel_get_call_mute_status(handle, on_call_get_mute_status, NULL);
681 if (result != TAPI_API_SUCCESS) {
682 msg("failed. (result = %d)", result);
688 static int run_call_set_volume_info(MManager *mm, struct menu_data *menu)
690 TapiHandle *handle = menu_manager_ref_user_data(mm);
692 TelCallVolumeInfo_t data;
694 msg("call tel_set_call_volume_info()");
696 data.device = (TelSoundDevice_t)atoi(data_vol_device);
697 data.type = (TelSoundType_t)atoi(data_vol_type);
698 data.volume = (TelSoundVolume_t)atoi(data_vol_level);
700 msg("device : (%d)", data.device);
701 msg("type : (%d)", data.type);
702 msg("volume : (%d)", data.volume);
704 result = tel_set_call_volume_info(handle, &data, on_call_set_volume_info, NULL);
705 if (result != TAPI_API_SUCCESS) {
706 msg("failed. (result = %d)", result);
712 static int run_call_get_volume_info(MManager *mm, struct menu_data *menu)
714 TapiHandle *handle = menu_manager_ref_user_data(mm);
716 TelSoundDevice_t device;
719 msg("call tel_get_call_volume_info()");
721 device = (TelSoundDevice_t)atoi(data_vol_device);
722 type = (TelSoundType_t)atoi(data_vol_type);
724 msg("device : (%d)", device);
725 msg("type : (%d)", type);
727 result = tel_get_call_volume_info(handle, device, type, on_call_get_volume_info, NULL);
728 if (result != TAPI_API_SUCCESS) {
729 msg("failed. (result = %d)", result);
735 static int run_call_set_sound_path(MManager *mm, struct menu_data *menu)
737 TapiHandle *handle = menu_manager_ref_user_data(mm);
739 TelCallSoundPathInfo_t sound_path ;
741 msg("call tel_set_sound_path()");
743 sound_path.path = (TelSoundPath_t)atoi(data_sound_path);
744 sound_path.ex_volume = atoi(data_extra_volume_status);
746 msg("sound_path.path : (0x%x)", sound_path.path);
747 msg("sound_path.ex_volume : (0x%x)", sound_path.ex_volume);
749 result = tel_set_call_sound_path(handle, &sound_path, on_call_set_sound_path, NULL);
750 if (result != TAPI_API_SUCCESS) {
751 msg("failed. (result = %d)", result);
757 static int run_call_set_sound_recording(MManager *mm, struct menu_data *menu)
759 TapiHandle *handle = menu_manager_ref_user_data(mm);
761 TelSoundRecording_t sound_recording ;
763 msg("call tel_set_sound_recording()");
765 sound_recording = (TelSoundRecording_t)atoi(data_sound_recording);
767 msg("sound_recording : (0x%x)", sound_recording);
769 result = tel_set_call_sound_recording(handle, &sound_recording, on_call_set_sound_recording, NULL);
770 if (result != TAPI_API_SUCCESS) {
771 msg("failed. (result = %d)", result);
777 static int run_call_set_sound_equalization(MManager *mm, struct menu_data *menu)
779 TapiHandle *handle = menu_manager_ref_user_data(mm);
781 TelCallSoundEqualization_t sound_equalization ;
783 msg("call tel_set_sound_equalization()");
784 memset(&sound_equalization,0,sizeof(sound_equalization));
786 sound_equalization.mode = (TelSoundEqualizationMode_t)atoi(data_sound_equalization_mode);
787 sound_equalization.direction = (TelSoundDirection_t)atoi(data_sound_direction);
789 msg("sound_equalization.mode: (0x%x)", sound_equalization.mode);
790 msg("sound_equalization.direction: (0x%x)", sound_equalization.direction);
792 result = tel_set_call_sound_equalization(handle, &sound_equalization, on_call_set_sound_equalization, NULL);
793 if (result != TAPI_API_SUCCESS) {
794 msg("failed. (result = %d)", result);
800 static int run_call_set_sound_noise_reduction(MManager *mm, struct menu_data *menu)
802 TapiHandle *handle = menu_manager_ref_user_data(mm);
804 TelSoundNoiseReduction_t sound_noise_reduction ;
806 msg("call tel_set_sound_noise_reduction()");
808 sound_noise_reduction = (TelSoundNoiseReduction_t)atoi(data_sound_noise_reduction);
810 msg("sound_noise_reduction : (0x%x)", sound_noise_reduction);
812 result = tel_set_call_sound_noise_reduction(handle, sound_noise_reduction, on_call_set_sound_noise_reduction, NULL);
813 if (result != TAPI_API_SUCCESS) {
814 msg("failed. (result = %d)", result);
823 static struct menu_data menu_call_dial[] = {
824 { "1", "type (0=VOICE, 1=VIDEO, 2=Emergency)", 0, 0, data_call_type},
825 { "2", "number", 0, 0, data_call_number},
826 { "3", "run", 0, run_call_dial, 0},
830 static struct menu_data menu_call_answer[] = {
831 { "1", "id", 0, 0, data_call_id},
832 { "2", "type (0=ACCEPT, 1=REJECT, 2=REPLACE, 3=HOLD&ACCEPT)", 0, 0, data_answer_type},
833 { "3", "run", 0, run_call_answer, 0},
837 static struct menu_data menu_call_end[] = {
838 { "1", "id", 0, 0, data_call_id},
839 { "2", "type (0=END, 1=END ALL, 2=END ACTIVE ALL, 3=END HOLD ALL)", 0, 0, data_end_type},
840 { "3", "run", 0, run_call_end, 0},
844 static struct menu_data menu_call_hold[] = {
845 { "1", "id", 0, 0, data_call_id},
846 { "2", "run", 0, run_call_hold, 0},
850 static struct menu_data menu_call_active[] = {
851 { "1", "id", 0, 0, data_call_id},
852 { "2", "run", 0, run_call_active, 0},
856 static struct menu_data menu_call_swap[] = {
857 { "1", "id", 0, 0, data_call_id},
858 { "2", "id2", 0, 0, data_call_id2},
859 { "3", "run", 0, run_call_swap, 0},
862 static struct menu_data menu_call_join[] = {
863 { "1", "id", 0, 0, data_call_id},
864 { "2", "run", 0, run_call_join, 0},
868 static struct menu_data menu_call_split[] = {
869 { "1", "id", 0, 0, data_call_id},
870 { "2", "run", 0, run_call_split, 0},
874 static struct menu_data menu_call_transfer[] = {
875 { "1", "id", 0, 0, data_call_id},
876 { "2", "run", 0, run_call_transfer, 0},
880 static struct menu_data menu_call_dtmf[] = {
881 { "1", "Dtmf Charater(0-9, A-D, ' * ' and ' # ') one character at a time ", 0, 0, data_dtmf_string},
882 { "2", "run", 0, run_call_dtmf, 0},
886 static struct menu_data menu_call_get_status[] = {
887 { "1", "id", 0, 0, data_call_id},
888 { "2", "run", 0, run_call_get_status, 0},
892 static struct menu_data menu_call_get_status_all[] = {
893 { "1", "id", 0, 0, data_call_id},
894 { "2", "run", 0, run_call_get_status_all, 0},
898 static struct menu_data menu_call_set_sound_clock_status[] = {
899 { "1", "status", 0, 0, data_clock_status},
900 { "2", "run", 0, run_call_set_sound_clock_status, 0},
904 static struct menu_data menu_call_set_mute_status[] = {
905 { "1", "status", 0, 0, data_mute_status},
906 { "2", "path", 0, 0, data_mute_path},
907 { "3", "run", 0, run_call_set_mute_status, 0},
911 static struct menu_data menu_call_get_mute_status[] = {
912 { "1", "run", 0, run_call_get_mute_status, 0},
916 static struct menu_data menu_call_set_volume_info[] = {
917 { "1", "device", 0, 0, data_vol_device},
918 { "2", "type", 0, 0, data_vol_type},
919 { "3", "volume", 0, 0, data_vol_level},
920 { "4", "run", 0, run_call_set_volume_info, 0},
924 static struct menu_data menu_call_get_volume_info[] = {
925 { "1", "device", 0, 0, data_vol_device},
926 { "2", "type", 0, 0, data_vol_type},
927 { "3", "run", 0, run_call_get_volume_info, 0},
931 static struct menu_data menu_call_set_sound_path[] = {
932 { "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},
933 { "2", "Extra Volume Status( 0=OFF, 1=ON)", 0, 0, data_extra_volume_status},
934 { "3", "run", 0, run_call_set_sound_path, 0},
938 static struct menu_data menu_call_set_sound_recording[] = {
939 { "1", "Sound Recording(0=OFF, 1=ON) ", 0, 0, data_sound_recording},
940 { "2", "run", 0, run_call_set_sound_recording, 0},
944 static struct menu_data menu_call_set_sound_equalization[] = {
945 { "1", "Sound Equalization Mode (0=OFF, 1=ON, 2=FLAG_OFF, 3=FLAG_ON, 4=SOFT1, 5=SOFT2)", 0, 0, data_sound_equalization_mode},
946 { "2", "Sound direction (0=LEFT, 1=RIGHT)", 0, 0, data_sound_direction},
947 { "3", "run", 0, run_call_set_sound_equalization, 0},
951 static struct menu_data menu_call_set_sound_noise_reduction[] = {
952 { "1", "Sound Noise reduction (0=OFF, 1=ON)", 0, 0, data_sound_noise_reduction},
953 { "2", "run", 0, run_call_set_sound_noise_reduction, 0},
958 struct menu_data menu_call[] = {
959 { "1", "tel_dial_call", menu_call_dial, 0, 0},
960 { "2", "tel_answer_call", menu_call_answer, 0, 0},
961 { "3", "tel_end_call", menu_call_end, 0, 0},
962 { "4", "tel_hold_call", menu_call_hold, 0, 0},
963 { "5", "tel_active_call", menu_call_active, 0, 0},
964 { "6", "tel_swap_call", menu_call_swap, 0, 0},
965 { "7", "tel_join_call", menu_call_join, 0, 0},
966 { "8", "tel_split_call", menu_call_split, 0, 0},
967 { "9", "tel_transfer_call", menu_call_transfer, 0, 0},
968 { "10", "tel_dtmf_call", menu_call_dtmf, 0, 0},
969 { "11", "tel_get_call_status", menu_call_get_status, 0, 0},
970 { "12", "tel_get_call_status_all", menu_call_get_status_all, 0, 0},
971 { "13", "tel_set_call_sound_clock_status", menu_call_set_sound_clock_status, 0, 0},
972 { "14", "tel_set_call_mute_status", menu_call_set_mute_status, 0, 0},
973 { "15", "tel_get_call_mute_status", menu_call_get_mute_status, 0, 0},
974 { "16", "tel_set_call_volume_info", menu_call_set_volume_info, 0, 0},
975 { "17", "tel_get_call_volume_info", menu_call_get_volume_info, 0, 0},
976 { "18", "tel_set_call_sound_path", menu_call_set_sound_path, 0, 0},
977 { "19", "tel_set_call_sound_recording", menu_call_set_sound_recording, 0, 0},
978 { "20", "tel_set_call_sound_equalization", menu_call_set_sound_equalization, 0, 0},
979 { "21", "tel_set_call_sound_noise_reduction", menu_call_set_sound_noise_reduction, 0, 0},
983 void register_call_event(TapiHandle *handle)
987 ret = tel_register_noti_event(handle, TAPI_NOTI_VOICE_CALL_STATUS_IDLE, on_noti_call_status_idle, 0);
988 if (ret != TAPI_API_SUCCESS) {
989 msg("event register failed(%d)", ret);
992 ret = tel_register_noti_event(handle, TAPI_NOTI_VOICE_CALL_STATUS_ACTIVE, on_noti_call_status_active, 0);
993 if (ret != TAPI_API_SUCCESS) {
994 msg("event register failed(%d)", ret);
997 ret = tel_register_noti_event(handle, TAPI_NOTI_VOICE_CALL_STATUS_HELD, on_noti_call_status_held, 0);
998 if (ret != TAPI_API_SUCCESS) {
999 msg("event register failed(%d)", ret);
1002 ret = tel_register_noti_event(handle, TAPI_NOTI_VOICE_CALL_STATUS_DIALING, on_noti_call_status_dialing, 0);
1003 if (ret != TAPI_API_SUCCESS) {
1004 msg("event register failed(%d)", ret);
1007 ret = tel_register_noti_event(handle, TAPI_NOTI_VOICE_CALL_STATUS_ALERT, on_noti_call_status_alert, 0);
1008 if (ret != TAPI_API_SUCCESS) {
1009 msg("event register failed(%d)", ret);
1012 ret = tel_register_noti_event(handle, TAPI_NOTI_VOICE_CALL_STATUS_INCOMING, on_noti_call_status_incoming, 0);
1013 if (ret != TAPI_API_SUCCESS) {
1014 msg("event register failed(%d)", ret);
1017 ret = tel_register_noti_event(handle, TAPI_NOTI_CALL_SOUND_CLOCK_STATUS, on_noti_call_sound_clock_status, 0);
1018 if (ret != TAPI_API_SUCCESS) {
1019 msg("event register failed(%d)", ret);
1022 ret = tel_register_noti_event(handle, TAPI_NOTI_CALL_INFO_HELD, on_noti_call_on_hold, 0);
1023 if (ret != TAPI_API_SUCCESS) {
1024 msg("event register failed(%d)", ret);
1027 ret = tel_register_noti_event(handle, TAPI_NOTI_CALL_INFO_ACTIVE, on_noti_call_active, 0);
1028 if (ret != TAPI_API_SUCCESS) {
1029 msg("event register failed(%d)", ret);
1032 ret = tel_register_noti_event(handle, TAPI_NOTI_CALL_INFO_JOINED, on_noti_call_joined, 0);
1033 if (ret != TAPI_API_SUCCESS) {
1034 msg("event register failed(%d)", ret);
1037 ret = tel_register_noti_event(handle, TAPI_NOTI_CALL_SOUND_RINGBACK_TONE, on_noti_call_sound_ringback_tone, 0);
1038 if (ret != TAPI_API_SUCCESS) {
1039 msg("event register failed(%d)", ret);
1042 ret = tel_register_noti_event(handle, TAPI_NOTI_CALL_SOUND_WBAMR, on_noti_call_sound_wbamr, 0);
1043 if (ret != TAPI_API_SUCCESS) {
1044 msg("event register failed(%d)", ret);
1047 ret = tel_register_noti_event(handle, TAPI_NOTI_CALL_SOUND_EQUALIZATION, on_noti_call_sound_equalization, 0);
1048 if (ret != TAPI_API_SUCCESS) {
1049 msg("event register failed(%d)", ret);
1052 ret = tel_register_noti_event(handle, TAPI_NOTI_CALL_SOUND_PATH, on_noti_call_sound_path, 0);
1053 if (ret != TAPI_API_SUCCESS) {
1054 msg("event register failed(%d)", ret);
1057 ret = tel_register_noti_event(handle, TAPI_NOTI_CALL_SOUND_NOISE_REDUCTION, on_noti_call_sound_noise_reduction, 0);
1058 if (ret != TAPI_API_SUCCESS) {
1059 msg("event register failed(%d)", ret);