4 * Copyright (c) 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Kyeongchul Kim <kyeongchul.kim@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.
24 #include <pthread.h> /* pthread functions and data structures */
33 #include "ITapiPower.h"
34 #include "ITapiCall.h"
35 #include "TapiCommon.h"
49 #define _CALL_TEST_KOREA_FMT_ 4
50 #define _CALL_TEST_INDIA_FMT_ 10
52 #define TEST_DEBUG(frmt, args...) \
53 {do { fprintf(stderr, "[Call Test][%s:%04d] " frmt "\n", __func__, __LINE__, ##args); } while (FALSE) ;}
55 #define AUTO_LOG(frmt, args...)
58 #define MAX_BURST_DTMF_STRLEN 32
60 extern int EvtDeliveryHandle ;
66 TelTapiCallInfo_t info;
82 static TelCallActiveLine_t _glob_test_curr_line = 0x00;
83 //static TS_UINT endHCall = -1;
84 static long __call_test_auto_mo = 0;
85 static long __call_test_auto_ans = 0;
86 static long _timer_exp_count = 0;
88 call_ctxt_t ctxt[TAPI_CONTEXT_CALL_SIZE_MAX];
89 TelCallStatus_t gcallStatus[TAPI_CONTEXT_CALL_SIZE_MAX];
90 TS_UINT incoming_handle= -1;
91 TS_UINT curr_handle= -1;
96 TelCallSetupParams_t _glob_setup_info;
99 struct itimerval timer;
101 /* Success returns 0 */
102 extern pthread_t __glob_tapi_keypad_thread;
104 //static int _country_spc_num_ = 0;
105 char pre_string[16] = {0, };
106 int _auto_dtmf_send_count = 0;
107 int _auto_dtmf_cnf_count = 0;
109 static unsigned int * CALL_subscription_id;
111 void __PrintCallType(char* str, TelCallType_t eCallType)
115 case TAPI_CALL_TYPE_VOICE:
116 fprintf(stderr, "%s [TAPI_CALL_TYPE_VOICE]", str);
118 case TAPI_CALL_TYPE_DATA:
119 fprintf(stderr, "%s [TAPI_CALL_TYPE_DATA]", str);
121 case TAPI_CALL_TYPE_E911:
122 fprintf(stderr, "%s [TAPI_CALL_TYPE_E911]", str);
125 fprintf(stderr, "%s Undefined Call Type:[0x%x]", str, eCallType);
130 void __PrintActiveCallState(char* str, TelCallActiveState_t eCallActiveState)
132 switch(eCallActiveState)
134 case TAPI_CALL_CONNECT_IDLE:
135 fprintf(stderr, "%s [TAPI_CALL_CONNECT_IDLE]", str);
137 case TAPI_CALL_CONNECT_ACTIVE:
138 fprintf(stderr, "%s [TAPI_CALL_CONNECT_ACTIVE]", str);
140 case TAPI_CALL_CONNECT_HELD:
141 fprintf(stderr, "%s [TAPI_CALL_CONNECT_HELD]", str);
144 fprintf(stderr, "%s Undefined Call Active State", str);
149 void __PrintCallState(char* str, TelCallStates_t eCallState)
153 case TAPI_CALL_STATE_IDLE:
154 fprintf(stderr, "%s [TAPI_CALL_STATE_IDLE]", str);
156 case TAPI_CALL_STATE_ORIG:
157 fprintf(stderr, "%s [TAPI_CALL_STATE_ORIG]", str);
159 case TAPI_CALL_STATE_SETUPIND:
160 fprintf(stderr, "%s [TAPI_CALL_STATE_SETUPIND]", str);
162 case TAPI_CALL_STATE_CONNECTING:
163 fprintf(stderr, "%s [TAPI_CALL_STATE_CONNECTING]", str);
165 case TAPI_CALL_STATE_ALERT:
166 fprintf(stderr, "%s [TAPI_CALL_STATE_ALERT]", str);
168 case TAPI_CALL_STATE_INCOM:
169 fprintf(stderr, "%s [TAPI_CALL_STATE_INCOM]", str);
171 case TAPI_CALL_STATE_ANSWER:
172 fprintf(stderr, "%s [TAPI_CALL_STATE_ANSWER]", str);
174 case TAPI_CALL_STATE_CONV:
175 fprintf(stderr, "%s [TAPI_CALL_STATE_CONV]", str);
177 case TAPI_CALL_STATE_ENDING:
178 fprintf(stderr, "%s [TAPI_CALL_STATE_ENDING]", str);
180 case TAPI_CALL_STATE_INVALID:
181 fprintf(stderr, "%s [TAPI_CALL_STATE_INVALID]", str);
184 fprintf(stderr, "%s Undefined Call State", str);
189 void __PrintCallFwType(char* str, TelCallForwardType_t eCallFwType)
193 case TAPI_CALL_OUTGOING_FWDED:
194 fprintf(stderr, "%s [TAPI_CALL_OUTGOING_FWDED]", str);
196 case TAPI_CALL_INCOMMING_FWDED:
197 fprintf(stderr, "%s [TAPI_CALL_INCOMMING_FWDED]", str);
200 fprintf(stderr, "%s Undefined Call ForwardType", str);
206 int call_test_ret_first_free_index(void);
210 void timer_handler (int signum)
212 TEST_DEBUG("Timer Expired [%ld] times", ++_timer_exp_count);
214 /* Free the current call context */
221 /* Configure the timer to expire after 250 msec... */
222 timer.it_value.tv_sec = 60;
223 timer.it_value.tv_usec = 0;
224 /* ... and every 250 msec after that. */
225 timer.it_interval.tv_sec = 0;
226 timer.it_interval.tv_usec = 0;
232 /* Start a virtual timer. It counts down whenever this process is
234 setitimer (ITIMER_REAL, &timer, NULL);
239 void call_test_auto_hold(void)
241 TapiResult_t api_err;
243 TEST_DEBUG("Request to Auto Hold call with Handle [%d]", curr_handle);
245 api_err = tel_hold_call(curr_handle, &requestID);
247 TEST_DEBUG("Tapi API Err Code [%x], Auto MO Count [%ld]", api_err, __call_test_auto_mo);
248 AUTO_LOG("API: tel_hold_call:-IN Handle [%d], Return [%d]", curr_handle, api_err);
253 void call_test_auto_act(void)
255 TapiResult_t api_err;
257 TEST_DEBUG("Request to Auto Activate Call with Handle [%d]", curr_handle);
259 api_err = tel_retrieve_call(curr_handle, &requestID);
261 TEST_DEBUG("Tapi API Err Code [%x], Auto Count [%ld]", api_err, __call_test_auto_ans);
262 AUTO_LOG("API: tel_retrieve_call:-IN Handle [%d], Return [%d]", curr_handle, api_err);
266 void call_test_auto_ans(void)
268 TapiResult_t api_err;
270 TEST_DEBUG("Request to Auto Ans call with Handle [%d]", incoming_handle);
272 __call_test_auto_ans++;
274 api_err = tel_answer_call(incoming_handle, TAPI_CALL_ANSWER_ACCEPT, &requestID);
276 TEST_DEBUG("Tapi API Err Code [%x], Auto Count [%ld]", api_err, __call_test_auto_ans);
278 AUTO_LOG("API: tel_answer_call:- IN Hanlde [%d] Return [%d]", incoming_handle, api_err);
285 void call_test_auto_mo(void)
288 TapiResult_t api_err;
291 TEST_DEBUG("Request to Auto Setup call with Number ...%s", _glob_setup_info.szNumber);
293 __call_test_auto_mo++;
295 api_err = tel_exe_call_mo(&_glob_setup_info, &curr_handle, &RequestId);
297 TEST_DEBUG("After calling tel_exe_call_mo : Handle [%d]", curr_handle);
299 TEST_DEBUG("Tapi API Err Code [%x], Auto Count [%ld]", api_err, __call_test_auto_mo);
301 if(api_err == TAPI_API_SUCCESS)
303 free_id = call_test_ret_first_free_index();
307 TEST_DEBUG("No Free Context ...");
312 memcpy(&ctxt[free_id].info.callNumber, _glob_setup_info.szNumber, sizeof( _glob_setup_info.szNumber));
313 ctxt[free_id].info.callState = TAPI_CALL_STATE_ORIG;
314 ctxt[free_id].info.activeState = TAPI_CALL_CONNECT_IDLE;
315 ctxt[free_id].info.isMobileOriginated = true;
316 ctxt[free_id].handle = curr_handle;
319 AUTO_LOG("API: tel_exe_call_mo:- Return [%d], Handle [%d]", api_err, curr_handle);
328 void call_test_count_mo()
330 if (__call_test_auto_mo)
333 TEST_DEBUG("Non Automated testing...");
337 void call_test_count_ans()
339 if (__call_test_auto_ans)
340 call_test_auto_ans();
342 TEST_DEBUG("Non Automated testing...");
345 void call_test_auto_dtmf()
350 api_err = tel_send_call_dtmf("9\0", &RequestID);
351 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
352 _auto_dtmf_send_count++;
353 AUTO_LOG("API: tel_send_call_dtmf: Send Count [%d]", _auto_dtmf_send_count);
357 TS_UINT call_test_ret_handle_by_active_state(void)
360 int max = TAPI_CONTEXT_CALL_SIZE_MAX;
362 for (start = 0; start < max; start++)
364 if (ctxt[start].info.activeState == TAPI_CALL_CONNECT_ACTIVE)
366 TEST_DEBUG("Current Active Call Handle is [%d]", ctxt[start].handle);
367 return ctxt[start].handle;
377 TEST_DEBUG("Could not find Call with Active State")
387 int call_test_ret_index_by_handle(TS_UINT handle)
390 int max = TAPI_CONTEXT_CALL_SIZE_MAX;
392 for (start = 0; start < max; start++)
394 if (ctxt[start].handle == handle)
406 TEST_DEBUG("Could not find CTXT")
415 int call_test_ret_first_free_index(void)
418 int max = TAPI_CONTEXT_CALL_SIZE_MAX;
420 for (start = 0; start < max; start++)
422 /* by default they are free */
423 if (ctxt[start].used == false)
425 //TEST_DEBUG("Creating a Context with Index [%d]", start);
427 ctxt[start].used = true;
428 ctxt[start].index = start;
440 TEST_DEBUG("Could not find FREE CTXT")
448 /* Create a context and populate the data */
449 void call_test_process_incom_ind(void *data)
452 TelCallIncomingCallInfo_t IncomingInfo = {0, };
455 free_id = call_test_ret_first_free_index();
463 memcpy(&IncomingInfo, data, sizeof(TelCallIncomingCallInfo_t));
465 ctxt[free_id].handle = IncomingInfo.CallHandle;
467 len = strlen(IncomingInfo.szCallingPartyNumber);
469 memcpy(&ctxt[free_id].info.callNumber, IncomingInfo.szCallingPartyNumber, len);
471 ctxt[free_id].info.callState = TAPI_CALL_STATE_INCOM;
472 ctxt[free_id].info.callType = IncomingInfo.CallType;
473 //ctxt[free_id].info.CliCause = IncomingInfo.CliCause;
475 TEST_DEBUG("Incoming Call Information: call handle:[%d], Number [%s], Type [0x%x]",
476 ctxt[free_id].handle, ctxt[free_id].info.callNumber, ctxt[free_id].info.callType);
478 TEST_DEBUG("No CLI Cause [0x%x]", IncomingInfo.CliCause);
480 incoming_handle = ctxt[free_id].handle;
482 AUTO_LOG("EVENT: INCOMING IND:- Hanlde [%d], Number [%s]",
483 incoming_handle, ctxt[free_id].info.callNumber);
485 /* if the test is automated, then call ans api */
486 call_test_count_ans();
492 //static void call_test_process_events (TelTapiEventClass_t eventClass, int eventType, void * param2)
493 static void call_async_event_callback(TelTapiEvent_t *event, void *data)
495 TS_UINT temp_handle = -1;
498 TEST_DEBUG("EVENT TYPE:[0x%x], STATUS:[0x%x]", event->EventType, event->Status);
501 userdata = (int *)data;
503 switch(event->EventClass)
505 case TAPI_EVENT_CLASS_CALL_VOICE:
506 switch(event->EventType)
508 case TAPI_EVENT_CALL_SWAP_CNF:
510 TEST_DEBUG("TAPI_EVENT_CALL_SWAP_CNF");
514 case TAPI_EVENT_CALL_ANSWER_CNF:
516 TEST_DEBUG("TAPI_EVENT_CALL_ANSWER_CNF");
520 case TAPI_EVENT_CALL_RELEASE_CNF:
522 TEST_DEBUG("TAPI_EVENT_CALL_RELEASE_CNF");
526 case TAPI_EVENT_CALL_RELEASE_ALL_CNF:
528 TEST_DEBUG("TAPI_EVENT_CALL_RELEASE_ALL_CNF");
532 case TAPI_EVENT_CALL_RELEASE_ALL_ACTIVE_CNF:
534 TEST_DEBUG("TAPI_EVENT_CALL_RELEASE_ALL_ACTIVE_CNF");
538 case TAPI_EVENT_CALL_RELEASE_ALL_HELD_CNF:
540 TEST_DEBUG("TAPI_EVENT_CALL_RELEASE_ALL_HELD_CNF");
544 case TAPI_EVENT_CALL_GET_PRIVACYMODE_CNF:
546 TEST_DEBUG("TAPI_EVENT_CALL_GET_PRIVACYMODE_CNF");
547 TelCallVoicePrivacyInfo_t vp_info={0,};
548 memcpy(&vp_info, event->pData, sizeof(TelCallVoicePrivacyInfo_t));
549 switch(vp_info.PrivacyType)
551 case TAPI_CALL_PRIVACY_TYPE_MS:
552 TEST_DEBUG("TAPI_CALL_PRIVACY_TYPE_MS");
554 case TAPI_CALL_PRIVACY_TYPE_BS:
555 TEST_DEBUG("TAPI_CALL_PRIVACY_TYPE_BS");
557 case TAPI_CALL_PRIVACY_TYPE_CURRENT:
558 TEST_DEBUG("TAPI_CALL_PRIVACY_TYPE_CURRENT");
564 switch(vp_info.PrivacyMode)
566 case TAPI_CALL_PRIVACY_MODE_STANDARD:
567 TEST_DEBUG("TAPI_CALL_PRIVACY_MODE_STANDARD");
569 case TAPI_CALL_PRIVACY_MODE_ENHANCED:
570 TEST_DEBUG("TAPI_CALL_PRIVACY_MODE_ENHANCED");
579 case TAPI_EVENT_CALL_SET_PRIVACYMODE_CNF:
581 TEST_DEBUG("TAPI_EVENT_CALL_SET_PRIVACYMODE_CNF");
585 case TAPI_EVENT_CALL_PRIVACYMODE_IND:
587 TEST_DEBUG("TAPI_EVENT_CALL_PRIVACYMODE_IND");
588 TelCallVoicePrivacyInfo_t vp_info={0,};
589 memcpy(&vp_info, event->pData, sizeof(TelCallVoicePrivacyInfo_t));
590 switch(vp_info.PrivacyType)
592 case TAPI_CALL_PRIVACY_TYPE_MS:
593 TEST_DEBUG("TAPI_CALL_PRIVACY_TYPE_MS");
595 case TAPI_CALL_PRIVACY_TYPE_BS:
596 TEST_DEBUG("TAPI_CALL_PRIVACY_TYPE_BS");
598 case TAPI_CALL_PRIVACY_TYPE_CURRENT:
599 TEST_DEBUG("TAPI_CALL_PRIVACY_TYPE_CURRENT");
605 switch(vp_info.PrivacyMode)
607 case TAPI_CALL_PRIVACY_MODE_STANDARD:
608 TEST_DEBUG("TAPI_CALL_PRIVACY_MODE_STANDARD");
610 case TAPI_CALL_PRIVACY_MODE_ENHANCED:
611 TEST_DEBUG("TAPI_CALL_PRIVACY_MODE_ENHANCED");
620 case TAPI_EVENT_CALL_FLASHINFO_CNF:
622 TEST_DEBUG("TAPI_EVENT_CALL_FLASHINFO_CNF");
626 case TAPI_EVENT_CALL_EXIT_EMERGENCYMODE_CNF:
628 TEST_DEBUG("TAPI_EVENT_CALL_EXIT_EMERGENCYMODE_CNF");
632 case TAPI_EVENT_CALL_EMERGENCYMODE_IND:
634 TEST_DEBUG("TAPI_EVENT_CALL_EMERGENCYMODE_IND");
635 TelCallEmergecyMode_t mode= 0;
636 memcpy(&mode, event->pData, sizeof(TelCallEmergecyMode_t));
639 case TAPI_CALL_EMERGENCY_MODE_EXIT:
640 TEST_DEBUG("TAPI_CALL_EMERGENCY_MODE_EXIT");
642 case TAPI_CALL_EMERGENCY_MODE_ENTER:
643 TEST_DEBUG("TAPI_CALL_EMERGENCY_MODE_ENTER");
652 case TAPI_EVENT_CALL_TIME_CNF:
654 TEST_DEBUG("TAPI_EVENT_CALL_TIME_CNF");
655 TelCallTimeInfo_t calltime_info={0,};
656 memcpy(&calltime_info, event->pData, sizeof(TelCallTimeInfo_t));
657 TEST_DEBUG("req_type_mask = [0x%x]",calltime_info.req_type_mask);
658 TEST_DEBUG("TotalCallCnt = [%ld]",calltime_info.TotalCallCnt);
659 TEST_DEBUG("OutgoingCallCnt = [%ld]",calltime_info.OutgoingCallCnt);
660 TEST_DEBUG("IncomingCallCnt = [%ld]",calltime_info.IncomingCallCnt);
661 TEST_DEBUG("TotalCallTime = [%ld]",calltime_info.TotalCallTime);
662 TEST_DEBUG("OutgoingCallTime = [%ld]",calltime_info.OutgoingCallTime);
663 TEST_DEBUG("IncomingCallTime = [%ld]",calltime_info.IncomingCallTime);
664 TEST_DEBUG("LastCallTime = [%ld]",calltime_info.LastCallTime);
668 case TAPI_EVENT_CALL_TIME_IND:
670 TEST_DEBUG("TAPI_EVENT_CALL_TIME_IND");
671 TelCallTimeInfo_t calltime_info={0,};
672 memcpy(&calltime_info, event->pData, sizeof(TelCallTimeInfo_t));
673 TEST_DEBUG("req_type_mask = [%d]",calltime_info.req_type_mask);
674 TEST_DEBUG("TotalCallCnt = [%ld]",calltime_info.TotalCallCnt);
675 TEST_DEBUG("OutgoingCallCnt = [%ld]",calltime_info.OutgoingCallCnt);
676 TEST_DEBUG("IncomingCallCnt = [%ld]",calltime_info.IncomingCallCnt);
677 TEST_DEBUG("TotalCallTime = [%ld]",calltime_info.TotalCallTime);
678 TEST_DEBUG("OutgoingCallTime = [%ld]",calltime_info.OutgoingCallTime);
679 TEST_DEBUG("IncomingCallTime = [%ld]",calltime_info.IncomingCallTime);
680 TEST_DEBUG("LastCallTime = [%ld]",calltime_info.LastCallTime);
684 case TAPI_EVENT_CALL_OTA_PROGRESS_IND:
686 TEST_DEBUG("TAPI_EVENT_CALL_OTA_PROGRESS_IND");
687 TelCallOtaProgressInfo_t ota_info={0,};
688 memcpy(&ota_info, event->pData, sizeof(TelCallOtaProgressInfo_t));
689 switch(ota_info.OtaType)
691 case TAPI_CALL_OTATYPE_OTASP:
693 TEST_DEBUG("TAPI_CALL_OTATYPE_OTASP");
695 switch(ota_info.OtaspStatus)
697 case TAPI_CALL_OTASP_OK_SPL_UNLOCKED:
698 TEST_DEBUG("TAPI_CALL_OTASP_OK_SPL_UNLOCKED");
700 case TAPI_CALL_OTASP_OK_AKEY_EXCESS:
701 TEST_DEBUG("TAPI_CALL_OTASP_OK_AKEY_EXCESS");
703 case TAPI_CALL_OTASP_OK_SSD_UPDATE:
704 TEST_DEBUG("TAPI_CALL_OTASP_OK_SSD_UPDATE");
706 case TAPI_CALL_OTASP_OK_NAM_DWNLD:
707 TEST_DEBUG("TAPI_CALL_OTASP_OK_NAM_DWNLD");
709 case TAPI_CALL_OTASP_OK_MDN_DWNLD:
710 TEST_DEBUG("TAPI_CALL_OTASP_OK_MDN_DWNLD");
712 case TAPI_CALL_OTASP_OK_IMSI_DWNLD:
713 TEST_DEBUG("TAPI_CALL_OTASP_OK_IMSI_DWNLD");
715 case TAPI_CALL_OTASP_OK_PRL_DWNLD:
716 TEST_DEBUG("TAPI_CALL_OTASP_OK_PRL_DWNLD");
718 case TAPI_CALL_OTASP_OK_COMMIT:
719 TEST_DEBUG("TAPI_CALL_OTASP_OK_COMMIT");
721 case TAPI_CALL_OTASP_OK_PROGRAMMING:
722 TEST_DEBUG("TAPI_CALL_OTASP_OK_PROGRAMMING");
724 case TAPI_CALL_OTASP_SUCCESS:
725 TEST_DEBUG("TAPI_CALL_OTASP_SUCCESS");
727 case TAPI_CALL_OTASP_UNSUCCESS:
728 TEST_DEBUG("TAPI_CALL_OTASP_UNSUCCESS");
730 case TAPI_CALL_OTASP_OK_OTAPA_VERIFY:
731 TEST_DEBUG("TAPI_CALL_OTASP_OK_OTAPA_VERIFY");
733 case TAPI_CALL_OTASP_PROGRESS:
734 TEST_DEBUG("TAPI_CALL_OTASP_PROGRESS");
736 case TAPI_CALL_OTASP_FAILURES_EXCESS_SPC:
737 TEST_DEBUG("TAPI_CALL_OTASP_FAILURES_EXCESS_SPC");
739 case TAPI_CALL_OTASP_LOCK_CODE_PW_SET:
740 TEST_DEBUG("TAPI_CALL_OTASP_LOCK_CODE_PW_SET");
749 case TAPI_CALL_OTATYPE_OTAPA:
751 TEST_DEBUG("TAPI_CALL_OTATYPE_OTAPA");
753 switch(ota_info.OtapaStatus)
755 case TAPI_CALL_OTAPA_STOP:
756 TEST_DEBUG("TAPI_CALL_OTAPA_STOP");
758 case TAPI_CALL_OTAPA_START:
759 TEST_DEBUG("TAPI_CALL_OTAPA_START");
775 case TAPI_EVENT_CALL_SETUP_CNF:
777 TEST_DEBUG("TAPI_EVENT_CALL_SETUP_CNF");
780 if(event->Status == 0)
782 memcpy(&temp_handle, event->pData, sizeof(TS_UINT));
783 TEST_DEBUG("Received Call Setup for call Handle [%d]", temp_handle);
785 free_id = call_test_ret_first_free_index();
789 TEST_DEBUG("No Free Context id ...");
794 memcpy(&ctxt[free_id].info.callNumber, _glob_setup_info.szNumber, sizeof( _glob_setup_info.szNumber));
795 ctxt[free_id].info.callState = TAPI_CALL_STATE_SETUPIND;
796 ctxt[free_id].info.activeState = TAPI_CALL_CONNECT_IDLE;
797 ctxt[free_id].info.isMobileOriginated = true;
798 ctxt[free_id].handle = temp_handle;
803 TEST_DEBUG("event->Status is not zero..");
807 case TAPI_EVENT_CALL_ALERT_IND:
811 TEST_DEBUG("TAPI_EVENT_CALL_ALERT_IND");
812 memcpy(&temp_handle, event->pData, sizeof(TS_UINT));
813 TEST_DEBUG("Received Alert for call Handle [%d]", temp_handle);
815 index = call_test_ret_index_by_handle(temp_handle);
817 ctxt[index].info.callState = TAPI_CALL_STATE_ALERT;
819 AUTO_LOG("EVENT: ALERT_IND:- Handle [%d]", temp_handle);
823 case TAPI_EVENT_CALL_INCOM_IND:
825 TEST_DEBUG("\n$$$$$$$$$$$$$$ TAPI_EVENT_CALL_INCOM_IND $$$$$$$$$$$$$$\n");
826 call_test_process_incom_ind(event->pData);
830 case TAPI_EVENT_CALL_WAITING_IND:
831 TEST_DEBUG("TAPI_EVENT_CALL_WAITING_IND");
834 case TAPI_EVENT_CALL_END_IND:
837 TelCallEndInfo_t EndInfo = {0, };
839 TEST_DEBUG("TAPI_EVENT_CALL_END_IND");
841 memcpy(&EndInfo, event->pData, sizeof(TelCallEndInfo_t));
843 TEST_DEBUG("Call Handle [%d], End Reason [%x]",
844 EndInfo.pCallHandle, EndInfo.CallEndCause);
846 index = call_test_ret_index_by_handle(EndInfo.pCallHandle);
848 /* Free this context.. */
849 ctxt[index].used = false;
851 memset(&ctxt[index].info, 0, sizeof(TelTapiCallInfo_t));
853 AUTO_LOG("EVENT: END_IND:- Handle [%d] CauseX [%x]",
854 EndInfo.pCallHandle, EndInfo.CallEndCause);
856 /* Continue Auto MO Call */
857 call_test_count_mo();
862 case TAPI_EVENT_CALL_CONNECTED_IND:
865 //TapiResult_t api_err = TAPI_API_SUCCESS;
867 TEST_DEBUG("TAPI_EVENT_CALL_CONNECTED_IND");
869 /* Stop the Timer.. */
872 memcpy(&temp_handle, event->pData, sizeof(TS_UINT));
874 TEST_DEBUG("Received Connected Event for call Handle [%d]", temp_handle);
876 curr_handle = temp_handle;
878 index = call_test_ret_index_by_handle(temp_handle);
880 ctxt[index].info.callState = TAPI_CALL_STATE_CONV;
881 ctxt[index].info.activeState = TAPI_CALL_CONNECT_ACTIVE;
883 AUTO_LOG("EVENT: CONNECTED_IND:- Handle [%d]", temp_handle);
885 /* Hold the Call after 10 sec */
886 if(__call_test_auto_mo)
890 call_test_auto_hold();
897 case TAPI_EVENT_CALL_RETRIEVE_CNF:
900 TapiResult_t api_err = TAPI_API_SUCCESS;
902 TEST_DEBUG("TAPI_EVENT_CALL_RETRIEVE_CNF");
904 memcpy(&temp_handle, event->pData, sizeof(TS_UINT));
906 TEST_DEBUG("Received Activate Cnf Event for call Handle [%d]", temp_handle);
908 index = call_test_ret_index_by_handle(temp_handle);
910 ctxt[index].info.activeState = TAPI_CALL_CONNECT_ACTIVE;
912 AUTO_LOG("EVENT: RETRIEVE_CNF:- Handle [%d]", temp_handle);
914 if(__call_test_auto_mo)
918 TEST_DEBUG("### Drop the Call with handle [%d]", incoming_handle);
920 api_err = tel_release_call(temp_handle, &RequestId);
922 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
923 AUTO_LOG("API: tel_release_call:- Handle [%d], Return [%d]", temp_handle, api_err);
930 case TAPI_EVENT_CALL_HOLD_CNF:
934 TEST_DEBUG("TAPI_EVENT_CALL_HOLD_CNF");
936 memcpy(&temp_handle, event->pData, sizeof(TS_UINT));
938 TEST_DEBUG("Received Hold Cnf Event for call Handle [%d]", temp_handle);
940 index = call_test_ret_index_by_handle(temp_handle);
942 ctxt[index].info.activeState = TAPI_CALL_CONNECT_HELD;
944 AUTO_LOG("EVENT: HOLD_CNF:- Handle [%d]", temp_handle);
946 if(__call_test_auto_mo)
950 call_test_auto_act();
958 case TAPI_EVENT_CALL_SETUPCONFERENCE_CNF:
962 TEST_DEBUG("TAPI_EVENT_CALL_SETUPCONFERENCE_CNF");
964 memcpy(&temp_handle, event->pData, sizeof(TS_UINT));
966 TEST_DEBUG("Received Conf Setup Cnf Event for call Handle [%d]", temp_handle);
968 index = call_test_ret_index_by_handle(temp_handle);
970 ctxt[index].info.conferenceState = TAPI_CALL_CONFERENCE_ACTIVE;
971 ctxt[index].info.activeState = TAPI_CALL_CONNECT_HELD;
973 AUTO_LOG("EVENT: SETUPCONFERENCE_CNF:- Handle [%d]", temp_handle);
979 case TAPI_EVENT_CALL_SPLITCONFERENCE_CNF:
983 TEST_DEBUG("TAPI_EVENT_CALL_SPLITCONFERENCE_CNF");
985 memcpy(&temp_handle, event->pData, sizeof(TS_UINT));
988 TEST_DEBUG("Received Conf Split Cnf Event for call Handle [%d]", temp_handle);
990 index = call_test_ret_index_by_handle(temp_handle);
992 ctxt[index].info.conferenceState = TAPI_CALL_CONFERENCE_IDLE;
993 AUTO_LOG("EVENT: SPLITCONFERENCE_CNF:- Handle [%d]", temp_handle);
999 case TAPI_EVENT_CALL_TRANSFER_CNF:
1003 TEST_DEBUG("TAPI_EVENT_CALL_TRANSFER_CNF");
1005 memcpy(&temp_handle, event->pData, sizeof(TS_UINT));
1007 TEST_DEBUG("Received Tansfer Cnf Event for call Handle [%d]", temp_handle);
1009 index = call_test_ret_index_by_handle(temp_handle);
1011 ctxt[index].info.callState = TAPI_CALL_STATE_ENDING;
1012 AUTO_LOG("EVENT: TRANSFER_CNF:- Handle [%d]", temp_handle);
1017 case TAPI_EVENT_CALL_FORWARD_IND:
1020 TelCallForwardType_t type;
1022 TEST_DEBUG("TAPI_EVENT_CALL_FORWARD_IND");
1024 memcpy(&temp_handle, event->pData, sizeof(TS_UINT));
1026 memcpy(&type, event->pData+sizeof(TS_UINT), sizeof(TelCallForwardType_t ));
1028 TEST_DEBUG("Received Fw Ind Event for call Handle [%d]", temp_handle);
1029 __PrintCallFwType("CallFwType: ", type);
1031 index = call_test_ret_index_by_handle(temp_handle);
1032 AUTO_LOG("EVENT: FORWARD_IND::- Handle [%d]", temp_handle);
1037 case TAPI_EVENT_CALL_RETRIEVE_IND:
1041 TEST_DEBUG("TAPI_EVENT_CALL_RETRIEVE_IND");
1043 memcpy(&temp_handle, event->pData, sizeof(TS_UINT));
1045 TEST_DEBUG("Received Act Ind Event for call Handle [%d]", temp_handle);
1047 index = call_test_ret_index_by_handle(temp_handle);
1049 ctxt[index].info.activeState = TAPI_CALL_CONNECT_ACTIVE;
1050 AUTO_LOG("EVENT: RETRIEVE_IND:- Handle [%d]", temp_handle);
1054 case TAPI_EVENT_CALL_HOLD_IND:
1058 TEST_DEBUG("TAPI_EVENT_CALL_HOLD_IND");
1060 memcpy(&temp_handle, event->pData, sizeof(TS_UINT));
1063 TEST_DEBUG("Received Held Ind Event for call Handle [%d]", temp_handle);
1065 index = call_test_ret_index_by_handle(temp_handle);
1067 ctxt[index].info.activeState = TAPI_CALL_CONNECT_HELD;
1068 AUTO_LOG("EVENT: HOLD_IND:- Handle [%d]", temp_handle);
1072 case TAPI_EVENT_CALL_TRANSFER_IND:
1076 TEST_DEBUG("TAPI_EVENT_CALL_TRANSFER_IND");
1078 memcpy(&temp_handle, event->pData, sizeof(TS_UINT));
1080 TEST_DEBUG("Received Tansfer Ind Event for call Handle [%d]", temp_handle);
1082 index = call_test_ret_index_by_handle(temp_handle);
1083 AUTO_LOG("EVENT: TRANSFER_IND:- Handle [%d]", temp_handle);
1087 case TAPI_EVENT_CALL_SETUPCONFERENCE_IND:
1091 TEST_DEBUG("TAPI_EVENT_CALL_SETUPCONFERENCE_IND");
1093 memcpy(&temp_handle, event->pData, sizeof(TS_UINT));
1095 TEST_DEBUG("Received Conf Setup Ind Event for call Handle [%d]", temp_handle);
1097 index = call_test_ret_index_by_handle(temp_handle);
1098 AUTO_LOG("EVENT: SETUPCONFERENCE_IND:- Handle [%d]", temp_handle);
1103 case TAPI_EVENT_CALL_BARRING_IND:
1107 TEST_DEBUG("TAPI_EVENT_CALL_BARRING_IND");
1109 memcpy(&temp_handle, event->pData, sizeof(TS_UINT));
1111 TEST_DEBUG("Received Barr Ind Event for call Handle [%d]", temp_handle);
1113 index = call_test_ret_index_by_handle(temp_handle);
1114 AUTO_LOG("EVENT: BARRING_IND:- Handle [%d]", temp_handle);
1120 case TAPI_EVENT_CALL_SEND_DTMF_CNF:
1122 TEST_DEBUG("Received TAPI_EVENT_CALL_SEND_DTMF_CNF");
1123 AUTO_LOG("EVENT: DTMF_CNF: Cnf Count [%d]", _auto_dtmf_cnf_count++);
1124 if((_auto_dtmf_send_count > 0) && (_auto_dtmf_send_count < 100))
1125 call_test_auto_dtmf();
1129 case TAPI_EVENT_CALL_SET_LINEID_CNF:
1131 TEST_DEBUG("Received TAPI_EVENT_CALL_SET_LINEID_CNF");
1132 AUTO_LOG("EVENT: SET_LINEID_CNF:");
1136 case TAPI_EVENT_CALL_GET_LINEID_CNF:
1138 TEST_DEBUG("Received TAPI_EVENT_CALL_GET_LINEID_CNF");
1139 AUTO_LOG("EVENT: GET_LINEID_CNF:");
1144 case TAPI_EVENT_CALL_AOCINFO_IND:
1146 TelCallAocInfo_t info = {0, };
1148 TEST_DEBUG("TAPI_EVENT_CALL_AOCINFO_IND");
1149 memcpy(&temp_handle, event->pData, sizeof(TS_UINT));
1151 memcpy(&info, event->pData+sizeof(TS_UINT), sizeof(TelCallAocInfo_t));
1153 TEST_DEBUG("Received AOC Info Ind Event for call Handle [%d], acm [%u], max acm [%u]",
1154 temp_handle, info.ACM, info.MaxAcm);
1155 AUTO_LOG("EVENT: AOCINFO_IND:- Handle [%d]", temp_handle);
1159 case TAPI_EVENT_CALL_CONNECTEDNUMBERINFO_IND:
1161 TelCallConnectedNumberInfo_t info = {0, };
1163 TEST_DEBUG("TAPI_EVENT_CALL_CONNECTEDNUMBERINFO_IND");
1165 memcpy(&temp_handle, event->pData, sizeof(TS_UINT));
1167 memcpy(&info, event->pData+sizeof(TS_UINT), sizeof(TelCallConnectedNumberInfo_t));
1169 TEST_DEBUG("Received SS Info Ind Event for call Handle [%d], cli cause [%d], name mode [%d]",
1170 temp_handle, info.no_cli_cause, info.name_mode);
1171 AUTO_LOG("EVENT: CONNECTEDNUMBERINFO_IND:- Handle [%d]", temp_handle);
1177 TEST_DEBUG("Undefined Event Type [%d] Received", event->EventType);
1178 AUTO_LOG("EVENT: UNDEFINED EVENT:-TYPE [%d]", event->EventType);
1186 TEST_DEBUG("*** Other TAPI EVENT received : class=%x type=%x ****",event->EventClass, event->EventType);
1190 TEST_DEBUG("****************** End event *****************************");
1194 int call_test_subscribe_tapi_events (void)
1198 int iNumOfCALLEvt = 0;
1199 TapiResult_t api_err = TAPI_API_SUCCESS;
1204 TAPI_EVENT_CALL_SETUP_CNF, /**<0x0000, This event indicates the Call Setup request triggered */
1205 TAPI_EVENT_CALL_ALERT_IND, /**< This event indicates the Call is in Alerting stage*/
1206 TAPI_EVENT_CALL_CONNECTING_IND, /**< This event indicates the Call is in Connecting stage*/
1207 TAPI_EVENT_CALL_CONNECTED_IND, /**< This event indicates the Call is Connected */
1208 TAPI_EVENT_CALL_INCOM_IND , /**< This event indicates Incoming Call indication to Application*/
1209 TAPI_EVENT_CALL_ANSWER_CNF, /**< Incoming call was answered*/
1210 TAPI_EVENT_CALL_RETRIEVE_CNF, /**< This event indicates Call is retrieved from held state*/
1211 TAPI_EVENT_CALL_RETRIEVE_IND, /**< This event indicates that other party has retrieved the call from hold*/
1212 TAPI_EVENT_CALL_HOLD_IND, /**< This event indicates that other party is has put the call on hold*/
1213 TAPI_EVENT_CALL_HOLD_CNF , /**< This event indicates is call is put on hold*/
1214 TAPI_EVENT_CALL_TRANSFER_CNF, /**< This event indicates is call is explicitly transferred*/
1215 TAPI_EVENT_CALL_TRANSFER_IND, /**< Call Transfer Indication*/
1216 TAPI_EVENT_CALL_SETUPCONFERENCE_CNF, /**< This event indicates that Call is joined in a conference*/
1217 TAPI_EVENT_CALL_SETUPCONFERENCE_IND, /**< Conference setup indication*/
1218 TAPI_EVENT_CALL_SPLITCONFERENCE_CNF, /**< This event indicates Call is split from conference*/
1219 TAPI_EVENT_CALL_SEND_DTMF_CNF, /**< This event indicates the confirmation for sending DTMF Digits to the network*/
1220 TAPI_EVENT_CALL_WAITING_IND, /**< Call waiting indication*/
1221 TAPI_EVENT_CALL_FORWARD_IND, /**< This event indication for Call is forwarded */
1222 TAPI_EVENT_CALL_RELEASE_CNF, /**< This event is indicated when a specific call is released requested by the application*/
1223 TAPI_EVENT_CALL_RELEASE_ALL_CNF, /**< This event is indicated when all the calls released requested by the application*/
1224 TAPI_EVENT_CALL_RELEASE_ALL_ACTIVE_CNF, /**< This event is indicated when all the active calls released requested by the application*/
1225 TAPI_EVENT_CALL_RELEASE_ALL_HELD_CNF, /**< This event is indicated when all the held calls released requested by the application*/
1226 TAPI_EVENT_CALL_END_IND, /**< This event indicates the Call is Ended. This event can be solicited/unsolicited.*/
1227 TAPI_EVENT_CALL_GET_LINEID_CNF, /**< Error in Get Line ID */
1228 TAPI_EVENT_CALL_SET_LINEID_CNF, /**< Error in Set Line Id */
1229 TAPI_EVENT_CALL_SWAP_CNF, /**< Call Swap Confirmation */
1230 TAPI_EVENT_CALL_GET_PRIVACYMODE_CNF, /**< Get Privacy mode */
1231 TAPI_EVENT_CALL_SET_PRIVACYMODE_CNF, /**< Set Privacy mode */
1232 TAPI_EVENT_CALL_PRIVACYMODE_IND, /**< Privacy mode Indication */
1233 TAPI_EVENT_CALL_FLASHINFO_CNF, /**< Flash info */
1234 TAPI_EVENT_CALL_EXIT_EMERGENCYMODE_CNF, /**< Exit Emergency mode cnf */
1235 TAPI_EVENT_CALL_EMERGENCYMODE_IND, /**< Emergency mode ind */
1236 TAPI_EVENT_CALL_TIME_CNF, /**< call time cnf */
1237 TAPI_EVENT_CALL_TIME_IND, /**< call time ind */
1238 TAPI_EVENT_CALL_OTA_PROGRESS_IND, /**< ota progress ind */
1239 TAPI_EVENT_CALL_DISPLAY_INFO_IND, /**< display info ind */
1240 TAPI_EVENT_CALL_BARRING_IND, /**< This event indicates the Call is Barred*/
1241 TAPI_EVENT_CALL_FORWARDED_INFO_IND, /**< This event indicates the MT call is Forwarded*/
1242 TAPI_EVENT_CALL_AOCINFO_IND, /**< This event indicates the AOC Information*/
1243 TAPI_EVENT_CALL_CALLINGNAMEINFO_IND, /**< This event indicates the Calling Name Information*/
1244 TAPI_EVENT_CALL_CONNECTEDNUMBERINFO_IND, /**< This event indicates the Connected Number Information*/
1245 TAPI_EVENT_CALL_CLISUPRESSIONREJ_IND, /**< This event indicates the CLI Suppression Indication*/
1246 TAPI_EVENT_CALL_DEFLECTED_IND, /**< This event indicates the Call is Deflected*/
1247 TAPI_EVENT_CALL_UNCOND_FORWARDING_IND, /**< This event indicates the Call is unconditionally forwarded*/
1248 TAPI_EVENT_CALL_COND_FORWARDING_IND, /**< This event indicates the Call is conditionally forwarded*/
1249 TAPI_EVENT_CALL_CONNECTED_ECT_REMOTE_IND, /**< This event indicates the ECT remote connection */
1250 TAPI_EVENT_CALL_ON_HOLD_RELEASED_IND, /**< This event indicates the Call on hold is released*/
1251 TAPI_EVENT_CALL_ALERT_ECT_REMOTE_IND, /**< This event indicates the ECT remote alert*/
1252 TAPI_EVENT_CALL_SS_FORWARDED_MSG_RXED_IND, /**< This event indicates that the forwarded msg has been received*/
1255 iNumOfCALLEvt = sizeof(CALLEvtList)/sizeof(int);
1256 CALL_subscription_id = (unsigned int *) calloc (iNumOfCALLEvt, sizeof (unsigned int));
1260 for( i=0 ; i< iNumOfCALLEvt; i++ )
1262 api_err = tel_register_event(CALLEvtList[i], &CALL_subscription_id[i],(TelAppCallback)&call_async_event_callback,NULL );
1263 if(api_err != TAPI_API_SUCCESS)
1265 TEST_DEBUG("isn't subscribed. event id is %d, api_err is %d\n", CALLEvtList[i],api_err);
1276 char *videocallEvents[] = {
1277 "Telephony.Call.Video.SetupCnf",
1278 "Telephony.Call.Video.AlertInd",
1279 "Telephony.Call.Video.ConnectedInd",
1280 "Telephony.Call.Video.IncomingInd",
1281 "Telephony.Call.Video.AnswerCnf",
1282 "Telephony.Call.Video.ForwardInd",
1283 "Telephony.Call.Video.ReleaseCnf",
1284 "Telephony.Call.Video.EndInd",
1285 "Telephony.Call.Video.BarringInd",
1286 "Telephony.Call.Video.ForwardedInfoInd",
1287 "Telephony.Call.Video.AocInfoInd",
1288 "Telephony.Call.Video.ConnectedNumberInfoInd",
1289 "Telephony.Call.Video.UncondforwardingActiveInd",
1290 "Telephony.Call.Video.CondforwardingActiveInd",
1291 "Telephony.Call.Video.ConnectedEctRemoteInd",
1294 for(count =0;count < (sizeof(videocallEvents)/sizeof(*videocallEvents)) ; count++)
1296 error_code = EvtSysEventSubscribe (
1298 videocallEvents[count], /* notification ID */
1299 NULL, /* filter expression */
1300 (EvtSysEventCb)call_test_noti_cb, /* notification handler */
1301 (void *)&sdata, /* local data */
1302 &subscription_id2 /* subscription ID */
1306 TEST_DEBUG( " EvtSysEventSubscribe(): error [%#X] for event [%s]", error_code , videocallEvents[count]);
1316 int call_test_exit(void)
1324 int call_test_get_request(void)
1329 //unsigned short len;
1331 char dtmfStr[16] = "1000103001";
1332 //char normal[16] = "+91";
1333 //unsigned short error;
1334 TapiResult_t api_err = TAPI_API_SUCCESS;
1337 _auto_dtmf_send_count = 0;
1338 _auto_dtmf_cnf_count = 0;
1340 for(index=0; index<TAPI_CONTEXT_CALL_SIZE_MAX; index++)
1342 if(ctxt[index].used == true)
1344 api_err = tel_get_call_status( ctxt[index].handle, &gcallStatus[index]);
1346 if(api_err != TAPI_API_SUCCESS)
1348 TEST_DEBUG("Get Call Status Failed: returnStatus value is [%x] for handle[%d] ", api_err, ctxt[index].handle);
1354 printf("\n -----------------------------------------------------------------------------");
1355 printf("\n ############ For gsm/wcdma/cdma ############ ");
1356 printf("\n tel_exe_call_mo : mo <Number>");
1357 printf("\n tel_exe_call_mo (SOS) : sos <Number>");
1358 printf("\n tel_answer_call (Accept) : ans");
1359 printf("\n tel_answer_call (Reject) : rej");
1360 printf("\n tel_send_call_dtmf : dtmf <String>");
1361 printf("\n tel_release_call : drop <Call handle>");
1362 printf("\n tel_release_call_all : rall");
1363 printf("\n tel_get_call_status (SyncAPI) : status <Call handle>");
1364 printf("\n tel_get_call_duration (SyncAPI) : duration <Call handle>");
1365 printf("\n Get call state from NPS (SyncAPI) : state");
1367 printf("\n ############ For only gsm/wcdma ############ ");
1368 printf("\n tel_answer_call(Hold&Accept) : hna");
1369 printf("\n tel_answer_call(Replace) : rep");
1370 printf("\n tel_hold_call : hld <Call handle>");
1371 printf("\n tel_retrieve_call : act <Call handle>");
1372 printf("\n tel_swap_call : swap <Active Call handle> <Held Call handle>");
1373 printf("\n tel_exe_call_explicit_transfer : tran <Active Call handle>");
1374 printf("\n tel_join_call : join <Active Call handle> <Held Call handle>");
1375 printf("\n tel_split_call : split <Call handle>");
1376 printf("\n tel_release_call_all_active : ract");
1377 printf("\n tel_release_call_all_held : rhld");
1378 printf("\n tel_activate_call_ccbs (not supported) : ccbs <Call handle>");
1379 printf("\n tel_deflect_call (not supported) : defl <Number>");
1380 printf("\n tel_get_call_act_line : lineg");
1381 printf("\n tel_set_call_act_line : lines");
1382 printf("\n tel_get_call_conf_list(SyncAPI) : conflist <Call handle>");
1384 printf("\n ############ For only cdma ############ ");
1385 printf("\n tel_exe_call_flash_info : flash1 ");
1386 printf("\n tel_exe_call_flash_info (with Number) : flash2 <Number>");
1387 printf("\n tel_get_call_privacy_mode : pmodeg <vp_type(1/2/3)>");
1388 printf("\n tel_set_call_privacy_mode : pmodes <vp_type(1/2/3)> <vp_mode(0/1)>");
1389 printf("\n tel_exit_call_emergency_mode : xemer ");
1390 printf("\n tel_get_call_time : time <mask(count 1, total time 2 last time 4)>");
1392 printf("\n\n quit : quit ");
1393 printf("\n -----------------------------------------------------------------------------");
1396 printf("\n########################################################\n\n");
1398 for(index=0; index<TAPI_CONTEXT_CALL_SIZE_MAX; index++)
1400 if(ctxt[index].used == true)
1402 fprintf(stderr, " Index:[%d], handle: [%d], [%s], [%s],[%s],",
1403 index, ctxt[index].handle, gcallStatus[index].pNumber, (gcallStatus[index].bMoCall)?"MO":"MT", (gcallStatus[index].bConferenceState)?"Conference":"Single");
1404 __PrintCallType(" ", gcallStatus[index].CallType);
1405 __PrintCallState("\n Call State:", gcallStatus[index].CallState);
1406 __PrintActiveCallState(" Active Call State:", gcallStatus[index].CallActiveState);
1407 fprintf(stderr, "\n");
1410 printf("\n########################################################\n");
1412 ret = read(0, buf, sizeof(buf));
1418 } else if (ret == 0) return ret;
1422 TEST_DEBUG("Enter the API code: ");
1425 /******************************************************************************
1429 *******************************************************************************/
1431 if(strncmp(buf, "flash1", 6) == 0)
1433 TEST_DEBUG("###flash1 .... ");
1435 api_err = tel_exe_call_flash_info(NULL,&RequestID);
1437 TEST_DEBUG(" \n tel_exe_call_flash_info Tapi return returnStatus value is [%x] RequestID : %d \n ", api_err, RequestID);
1441 if(strncmp(buf, "flash2", 6) == 0)
1443 char tempNum[TAPI_CALL_DIALDIGIT_LEN_MAX+1];
1444 char DialNum[TAPI_CALL_DIALDIGIT_LEN_MAX+1];
1446 strncpy(tempNum, &buf[7], TAPI_CALL_DIALDIGIT_LEN_MAX);
1447 length = strlen(tempNum);
1448 strncpy(DialNum,tempNum, length-1); // removing '/n' form the end of the string
1449 TEST_DEBUG("### dial number :[%s]", DialNum);
1451 api_err = tel_exe_call_flash_info(DialNum, &RequestID);
1453 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
1456 if(strncmp(buf, "pmodeg", 6) == 0)
1462 memcpy(&temp, &buf[7], 1);
1463 vp_type = atoi(temp);
1465 TEST_DEBUG("### tel_get_call_privacy_mode: vp_type [%d]", vp_type);
1467 api_err = tel_get_call_privacy_mode(vp_type,&RequestID);
1469 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
1472 if(strncmp(buf, "pmodes", 6) == 0)
1474 TEST_DEBUG("### tel_set_call_privacy_mode");
1477 TelCallVoicePrivacyInfo_t vp_info = { 0, };
1480 memcpy(&temp, &buf[7], 1);
1481 vp_info.PrivacyType = atoi(temp);
1484 memcpy(&temp, &buf[9], 1);
1485 vp_info.PrivacyMode = atoi(temp);
1487 TEST_DEBUG("### tel_set_call_privacy_mode: vp_type [%d] vp_mode [%d]", vp_info.PrivacyType, vp_info.PrivacyMode);
1489 api_err = tel_set_call_privacy_mode(vp_info,&RequestID);
1491 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
1494 if(strncmp(buf, "xemer", 5) == 0)
1496 TEST_DEBUG("###tel_exit_call_emergency_mode");
1498 api_err = tel_exit_call_emergency_mode(&RequestID);
1500 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
1503 if(strncmp(buf, "time", 4) == 0)
1505 TEST_DEBUG("###tel_get_call_time");
1507 unsigned short mask= -1;
1510 memcpy(&temp, &buf[5], 1);
1513 TEST_DEBUG("###tel_get_call_time.. req mask type:[0x%x]",mask );
1515 api_err = tel_get_call_time(mask, &RequestID);
1517 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
1520 //######################################################################
1521 if(strncmp(buf, "sos", 3) == 0)
1524 char tempNum[TAPI_CALL_DIALDIGIT_LEN_MAX+1];
1527 strncpy(tempNum, &buf[4], TAPI_CALL_DIALDIGIT_LEN_MAX);
1528 length = strlen(tempNum);
1530 memset(&_glob_setup_info, 0, sizeof(_glob_setup_info));
1532 strncpy(_glob_setup_info.szNumber,tempNum, length-1); // removing '/n' form the end of the string
1534 _glob_setup_info.CallType=TAPI_CALL_TYPE_E911;
1536 TEST_DEBUG("Request to Setup call with Number [%s], type %d", _glob_setup_info.szNumber, _glob_setup_info.CallType);
1538 api_err = tel_exe_call_mo(&_glob_setup_info, &curr_handle, &RequestID);
1540 TEST_DEBUG(" after calling tel_exe_call_mo : Handle [%d]", curr_handle);
1542 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
1544 #if 0 // move to call setup cnf event
1545 if(api_err == TAPI_API_SUCCESS)
1547 free_id = call_test_ret_first_free_index();
1551 TEST_DEBUG("No Free Context ...");
1556 memcpy(&ctxt[free_id].info.callNumber, _glob_setup_info.szNumber, sizeof( _glob_setup_info.szNumber));
1557 ctxt[free_id].info.callState = TAPI_CALL_STATE_ORIG;
1558 ctxt[free_id].info.activeState = TAPI_CALL_CONNECT_IDLE;
1559 ctxt[free_id].info.isMobileOriginated = true;
1560 ctxt[free_id].handle = curr_handle;
1570 if(strncmp(buf, "automo", 6) == 0)
1572 char temp[16] = {0, };
1574 memcpy(temp, &buf[7], _country_spc_num_);
1577 memset(&_glob_setup_info, 0, sizeof(_glob_setup_info));
1579 _glob_setup_info.CallType=TAPI_CALL_TYPE_VOICE;
1580 strncpy(_glob_setup_info.szNumber, pre_string, sizeof(pre_string));
1582 strncat(_glob_setup_info.szNumber, temp, _country_spc_num_);
1584 _glob_setup_info.IdentityMode = TAPI_CALL_IDENTITY_SHOW;
1586 call_test_auto_mo();
1590 if(strncmp(buf, "autoans", 7) == 0)
1592 call_test_auto_ans();
1596 if(strncmp(buf, "vmo", 2) == 0)
1599 char tempNum[TAPI_CALL_DIALDIGIT_LEN_MAX+1];
1602 strncpy(tempNum, &buf[4], TAPI_CALL_DIALDIGIT_LEN_MAX);
1603 length = strlen(tempNum);
1605 memset(&_glob_setup_info, 0, sizeof(_glob_setup_info));
1607 strncpy(_glob_setup_info.szNumber,tempNum, length-1); // removing '/n' form the end of the string
1609 _glob_setup_info.CallType=TAPI_CALL_TYPE_DATA;
1611 TEST_DEBUG("Request to Setup call with Number [%s], type %d", _glob_setup_info.szNumber, _glob_setup_info.CallType);
1613 api_err = tel_exe_call_mo(&_glob_setup_info, &curr_handle, &RequestID);
1615 TEST_DEBUG(" after calling tel_exe_call_mo : Handle [%d]", curr_handle);
1617 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
1618 #if 0 // move to call setup cnf event
1619 if(api_err == TAPI_API_SUCCESS)
1621 free_id = call_test_ret_first_free_index();
1625 TEST_DEBUG("No Free Context ...");
1630 memcpy(&ctxt[free_id].info.callNumber, _glob_setup_info.szNumber, sizeof( _glob_setup_info.szNumber));
1631 ctxt[free_id].info.callState = TAPI_CALL_STATE_ORIG;
1632 ctxt[free_id].info.activeState = TAPI_CALL_CONNECT_IDLE;
1633 ctxt[free_id].info.isMobileOriginated = true;
1634 ctxt[free_id].handle = curr_handle;
1642 if(strncmp(buf, "mo", 2) == 0)
1645 char tempNum[TAPI_CALL_DIALDIGIT_LEN_MAX+1];
1648 strncpy(tempNum, &buf[3], TAPI_CALL_DIALDIGIT_LEN_MAX);
1649 length = strlen(tempNum);
1651 memset(&_glob_setup_info, 0, sizeof(_glob_setup_info));
1653 strncpy(_glob_setup_info.szNumber,tempNum, length-1); // removing '/n' form the end of the string
1655 _glob_setup_info.CallType=TAPI_CALL_TYPE_VOICE;
1656 //_glob_setup_info.Ecc=TAPI_CALL_ECC_DEFAULT;
1658 TEST_DEBUG("Request to Setup call with Number [%s], type %d", _glob_setup_info.szNumber, _glob_setup_info.CallType);
1660 api_err = tel_exe_call_mo(&_glob_setup_info, &curr_handle, &RequestID);
1662 TEST_DEBUG(" after calling tel_exe_call_mo : Handle [%d]", curr_handle);
1664 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
1666 #if 0 // move to call setup cnf event
1667 if(api_err == TAPI_API_SUCCESS)
1669 free_id = call_test_ret_first_free_index();
1673 TEST_DEBUG("No Free Context ...");
1678 memcpy(&ctxt[free_id].info.callNumber, _glob_setup_info.szNumber, sizeof( _glob_setup_info.szNumber));
1679 ctxt[free_id].info.callState = TAPI_CALL_STATE_ORIG;
1680 ctxt[free_id].info.activeState = TAPI_CALL_CONNECT_IDLE;
1681 ctxt[free_id].info.isMobileOriginated = true;
1682 ctxt[free_id].handle = curr_handle;
1691 if( strncmp(buf, "ans", 3) == 0 )
1693 TEST_DEBUG("###answer incoming call");
1695 api_err = tel_answer_call(incoming_handle, TAPI_CALL_ANSWER_ACCEPT, &RequestID);
1697 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
1700 if( strncmp(buf, "hna", 3) == 0 )
1702 // TS_UINT active_handle = -1;
1704 // active_handle = call_test_ret_handle_by_active_state();
1706 // TEST_DEBUG("### hold active call [%d] and accept waiting call", active_handle);
1708 TEST_DEBUG("### hold active call and accept waiting call");
1710 api_err = tel_answer_call(incoming_handle, TAPI_CALL_ANSWER_HOLD_AND_ACCEPT, &RequestID);
1712 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
1715 if( strncmp(buf, "rep", 3) == 0 )
1717 // TS_UINT active_handle = -1;
1719 // active_handle = call_test_ret_handle_by_active_state();
1721 // TEST_DEBUG("### release active call [%d] and accept waiting call", active_handle);
1723 TEST_DEBUG("### release active call and accept waiting call");
1725 api_err = tel_answer_call(incoming_handle, TAPI_CALL_ANSWER_REPLACE, &RequestID);
1727 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
1731 if( strncmp(buf, "rej", 3) == 0 )
1733 TEST_DEBUG("### reject waiting call ");
1735 api_err = tel_answer_call(incoming_handle, TAPI_CALL_ANSWER_REJECT, &RequestID);
1737 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
1740 //+++++++++++ Release
1741 if( strncmp(buf, "rall", 4) == 0 )
1743 TEST_DEBUG("### release all calls. ");
1745 api_err = tel_release_call_all(&RequestID);
1747 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
1750 if( strncmp(buf, "rall.e", 6) == 0 )
1752 TEST_DEBUG("### release all calls.with err option ");
1754 api_err = tel_release_call(curr_handle, &RequestID);
1756 TEST_DEBUG(" Tapi returned api_err value is [%x] ", api_err);
1759 if( strncmp(buf, "ract", 4) == 0 )
1761 TEST_DEBUG("### release all active calls. ");
1763 api_err = tel_release_call_all_active( &RequestID);
1765 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
1768 if( strncmp(buf, "rhld", 4) == 0 )
1770 TEST_DEBUG("### release all held calls. ");
1772 api_err = tel_release_call_all_held( &RequestID);
1774 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
1777 if( strncmp(buf, "drop", 4) == 0 )
1783 memcpy(&temp, &buf[5], 1);
1784 handle = atoi(temp);
1786 TEST_DEBUG("### Drop the Call with handle [%d]", handle);
1788 api_err = tel_release_call(handle, &RequestID);
1790 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
1796 if( strncmp(buf, "hld", 3) == 0 )
1802 memcpy(&temp, &buf[4], 1);
1803 handle = atoi(temp);
1805 TEST_DEBUG("### Hold the call No. %d !!", handle);
1807 api_err = tel_hold_call(handle, &RequestID);
1809 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
1814 if( strncmp(buf, "act", 3) == 0 )
1820 memcpy(&temp, &buf[4], 1);
1821 handle = atoi(temp);
1823 TEST_DEBUG("### Activate the call No. %d !!", handle);
1825 api_err = tel_retrieve_call(handle, &RequestID);
1827 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
1830 if( strncmp(buf, "swap", 4) == 0 )
1833 TS_UINT held_handle, active_handle = -1;
1836 memcpy(&temp, &buf[5], 1);
1837 active_handle = atoi(temp);
1840 memcpy(&temp, &buf[7], 1);
1841 held_handle = atoi(temp);
1843 TEST_DEBUG("### Swap! Active call No, [%d], Hold the call No. [%d]",
1844 active_handle, held_handle);
1846 api_err = tel_swap_call(active_handle, held_handle, &RequestID);
1848 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
1852 if( strncmp(buf, "join", 4) == 0 )
1855 TS_UINT held_handle, active_handle = -1;
1858 memcpy(&temp, &buf[5], 1);
1859 active_handle = atoi(temp);
1862 memcpy(&temp, &buf[7], 1);
1863 held_handle = atoi(temp);
1865 TEST_DEBUG("Setup a Conference Call with Active & Held Handles [%d] [%d]",
1866 active_handle, held_handle);
1868 api_err = tel_join_call(active_handle, held_handle, &RequestID);
1870 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
1875 if( strncmp(buf, "split", 5) == 0 )
1878 TS_UINT handle = -1;
1881 memcpy(temp, &buf[6], 1);
1882 handle = atoi(temp);
1884 TEST_DEBUG("Split Call Handle [%d] from Conference call", handle);
1886 api_err = tel_split_call(handle, &RequestID);
1888 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
1891 if(strncmp(buf, "conflist", 8) == 0)
1893 unsigned int callList[10];
1897 TS_UINT handle = -1;
1900 memcpy(temp, &buf[9], 1);
1901 handle = atoi(temp);
1903 TEST_DEBUG("Get Conference List for call handle [%d]", handle);
1905 api_err = tel_get_call_conf_list(handle, callList, &noOfCalls);
1907 if(api_err == TAPI_API_SUCCESS)
1909 TEST_DEBUG(" Get Conference List () - call handle : %d No.of Calls %d",handle, noOfCalls );
1911 for(i=0;i<noOfCalls;i++)
1913 TEST_DEBUG("Voice Test: Call Handle %d : %d\n", i+1, callList[i]);
1918 TEST_DEBUG("Voice Test: Get Conference List Failed: returnStatus value is [%d]", api_err);
1924 if(strncmp(buf, "status", 6) == 0)
1926 TelCallStatus_t callStatus;
1928 TS_UINT handle = -1;
1931 memcpy(temp, &buf[7], 1);
1932 handle = atoi(temp);
1934 TEST_DEBUG(" Get Call Status informaiton for call handle %d", handle);
1936 api_err = tel_get_call_status(handle, &callStatus);
1938 if(api_err == TAPI_API_SUCCESS)
1940 fprintf(stderr, "\n\t CallNumber : %s",callStatus.pNumber);
1941 fprintf(stderr, "\n\t Is Mobile Originated : %d(1:true, 0:false)", callStatus.bMoCall);
1942 __PrintCallType("\n\t CallType :", callStatus.CallType);
1943 __PrintActiveCallState("\n\t CallActiveState :", callStatus.CallActiveState);
1944 __PrintCallState("\n\t CallState :", callStatus.CallState);
1945 fprintf(stderr, "\n\t isConferenceState : %d(1:true, 0:false)\n",callStatus.bConferenceState);
1949 TEST_DEBUG("Get Call Status Failed: returnStatus value is [%x] ", api_err);
1954 if( strncmp(buf, "duration", 8) == 0 )
1957 unsigned int duration;
1958 TS_UINT handle = -1;
1961 memcpy(temp, &buf[9], 1);
1962 handle = atoi(temp);
1965 TEST_DEBUG("### Get Duration for the call handle. %d !!", handle);
1967 api_err = tel_get_call_duration(handle, &duration);
1968 TEST_DEBUG("Call Duration for the Call handle [%d] is: [%d] sec \n", handle, duration);
1972 if(strncmp(buf, "tran", 4) == 0)
1975 TS_UINT active_handle = -1;
1978 memcpy(&temp, &buf[5], 1);
1979 active_handle = atoi(temp);
1982 TEST_DEBUG("Transfer calls with handles [%d]", active_handle);
1984 api_err = tel_exe_call_explicit_transfer(active_handle, &RequestID);
1986 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
1990 if(strncmp(buf, "dtmf", 4) == 0)
1992 char tempStr[MAX_BURST_DTMF_STRLEN] ={0,};
1993 char str[MAX_BURST_DTMF_STRLEN] = {0,};
1995 strncpy(tempStr, &buf[5], MAX_BURST_DTMF_STRLEN);
1996 length = strlen(tempStr);
1997 strncpy(str,tempStr, length-1); // removing '/n' form the end of the string
1998 TEST_DEBUG("### Send DTMF - [%s]", str);
2000 api_err = tel_send_call_dtmf(str, &RequestID);
2002 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
2004 if(strncmp(buf, "clir", 4) == 0)
2007 char tempNum[TAPI_CALL_DIALDIGIT_LEN_MAX+1];
2010 strncpy(tempNum, &buf[5], TAPI_CALL_DIALDIGIT_LEN_MAX);
2011 length = strlen(tempNum);
2013 memset(&_glob_setup_info, 0, sizeof(_glob_setup_info));
2015 strncpy(_glob_setup_info.szNumber,tempNum, length-1); // removing '/n' form the end of the string
2017 _glob_setup_info.CallType=TAPI_CALL_TYPE_VOICE;
2019 TEST_DEBUG("Request to Setup CLIR call with Number [%s], type %d", _glob_setup_info.szNumber, _glob_setup_info.CallType);
2021 api_err = tel_exe_call_mo(&_glob_setup_info, &curr_handle, &RequestID);
2023 TEST_DEBUG(" after calling tel_exe_call_mo : Handle [%d]", curr_handle);
2025 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
2029 if(strncmp(buf, "adtmf", 5) == 0)
2031 char DtmfString[10] = {0, };
2032 unsigned char length;
2034 strcpy(DtmfString, "1234\0");
2035 length = strlen(DtmfString);
2037 TEST_DEBUG("Send DTMF digits [%s], length %d", DtmfString, length);
2039 api_err = tel_send_call_dtmf(DtmfString, &RequestID);
2040 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
2041 _auto_dtmf_send_count++;
2044 if(strncmp(buf, "ds", 2) == 0)
2046 strncat(dtmfStr, &buf[3], 16);
2047 strncpy(_glob_setup_info.szNumber, dtmfStr, TAPI_CALL_DIALDIGIT_LEN_MAX);
2048 TEST_DEBUG("### make a call for DTMF test....%s", _glob_setup_info.szNumber);
2050 api_err=tel_exe_call_mo( &_glob_setup_info, &curr_handle,&RequestID);
2052 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
2056 if(strncmp(buf, "lineg", 5) == 0)
2058 TEST_DEBUG("### Get Current Active Line.");
2060 api_err = tel_get_call_act_line(&RequestID);
2062 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
2064 TEST_DEBUG("### Current Active Line : %d", _glob_test_curr_line);
2067 if(strncmp(buf, "lines", 5) == 0)
2069 TEST_DEBUG("### Set Current Active Line.");
2071 if(_glob_test_curr_line == TAPI_CALL_ACTIVE_LINE1)
2072 _glob_test_curr_line = TAPI_CALL_ACTIVE_LINE2;
2075 _glob_test_curr_line = TAPI_CALL_ACTIVE_LINE1;
2077 api_err = tel_set_call_act_line(_glob_test_curr_line,&RequestID);
2079 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
2082 if(strncmp(buf, "ccbs", 4) == 0)
2084 TEST_DEBUG("### Activate ccbs call handle[%d]", curr_handle);
2086 api_err = tel_activate_call_ccbs(curr_handle,&RequestID);
2088 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
2091 if(strncmp(buf, "defl", 4) == 0)
2094 char str[TAPI_CALL_DIALDIGIT_LEN_MAX] = {0, };
2095 TelCallDeflectDstInfo_t dst;
2097 memset(&dst, 0, sizeof(dst));
2099 strncpy(str, &buf[5], TAPI_CALL_DIALDIGIT_LEN_MAX);
2103 strncpy((char*)dst.number, &str[0], (len1-1));
2105 TEST_DEBUG("Deflect Call Handle [%d] to [%s]", incoming_handle, dst.number);
2107 api_err = tel_deflect_call(incoming_handle,&dst, &RequestID);
2109 TEST_DEBUG(" Tapi return api_err value is [%x] ", api_err);
2113 if(strncmp(buf, "quit", 4) == 0)
2115 TEST_DEBUG("quit..... ");
2120 /******************************************************************************
2124 *******************************************************************************/
2126 if(strncmp(buf, "tapi", 4) == 0)
2128 TS_BOOL status = FALSE;
2130 api_err = tel_check_service_ready(&status);
2132 TEST_DEBUG(" Current status of TAPI is:%d, api_err value is [%x]", status, api_err);
2136 if(strncmp(buf, "state", 5) == 0)
2138 unsigned char call_state = 0;
2139 api_err = vconf_get_int(VCONFKEY_TELEPHONY_CALL_STATE, (int*)&call_state);
2140 TEST_DEBUG(" Current call state is:%s, api_err value is [%x]", call_state? "CONV" : "IDLE", api_err);
2143 if(strncmp(buf, "menu", 4) == 0)
2145 TEST_DEBUG("Finished Testing this module, Going back to Main Menu\n");
2151 memset(buf, '\0', 256);
2158 void call_test_loop(void)
2166 FD_SET(0, &readfds);
2168 ret = select(0 + 1, &readfds, NULL, NULL, NULL);
2172 if (FD_ISSET(0, &readfds))
2174 if(call_test_get_request()<0)
2182 void call_test_init(void)
2186 TEST_DEBUG("Please press enter...\n");
2188 for( count = 0; count < TAPI_CONTEXT_CALL_SIZE_MAX; count++)
2190 ctxt[count].handle = -1;
2191 ctxt[count].used = false;
2194 memset(&_glob_setup_info, 0, sizeof(_glob_setup_info));
2196 _glob_setup_info.CallType=TAPI_CALL_TYPE_VOICE;
2197 strncpy(_glob_setup_info.szNumber, pre_string, sizeof(pre_string));