blob: 26f454490da66b336d3e57d23199b8c9190a053e [file] [log] [blame]
mj.qu1524fc92025-06-11 04:34:13 -07001/**************************************************************************
2*
3* Copyright (c) 2013 ZTE Corporation.
4*
5***************************************************************************
6* Ä£ ¿é Ãû : CcApp
7* ÎÄ ¼þ Ãû : at_proc.c
8* Ïà¹ØÎļþ :
9* ʵÏÖ¹¦ÄÜ : ATÃüÁî·¢Ëͺͽá¹û´¦ÀíÄ£¿éº¯Êý¶¨Òå
10* ×÷ Õß : syx
11* °æ ±¾ : V1.0
12* Íê³ÉÈÕÆÚ : 2013-01-05
13* ÆäËü˵Ã÷ :
14**************************************************************************/
15
16/**************************************************************************
17* Ð޸ļǼ :
18***************************************************************************/
19/**************************************************************************
20* Ð޸ıàºÅ : 0001
21* ÐÞ ¸Ä ÈË :
22* ÐÞ¸ÄÈÕÆÚ :
23* ÐÞ¸ÄÄÚÈÝ :
24**************************************************************************/
25
26/**************************************************************************
27* #includeÇø
28**************************************************************************/
29#include "cc_main.h"
30#include "cc_proc.h"
31#include "cc_com.h"
32#include "cc_at.h"
33#include "cc_timer.h"
34#include "string.h"
35#ifdef TEST_CCAPP
36#include "soft_timer.h"
37#endif
38
39#include "slic_inf.h"
40#include <stdint.h>
41#include <linux/volte_drv.h>
42#include "voice_lib.h"
43
44#define LOCAL_TEST_CALL_CODE "*#66*#"
45#define TZ_TEST_TIMING "*#83781234*#"
46typedef enum{
47 LocalTestCallST_None = 0,
48 LocalTestCallST_Start,
49 LocalTestCallST_Ring,
50 LocalTestCallST_End
51}eLocalTestCallST;
52int local_test_call_st = 0;
53typedef enum{
54 LocalTestCallType_None = 0,
55 LocalTestCallType_LOOP
56}eLocalTestCallType;
57int local_test_call_type = 0;
58
59extern SINT32 g_zCc_AtRspId;
60
61int zCc_find_held_cid(void);
62int zCc_find_held_incoming_cid(void);
63int zCc_find_all_callout(int slave[ZCC_SLAVES]);
64int zCc_talking_count(void);
65char *get_local_date_time(void);
66char *get_local_datetime(char *buff);
mj.qu58875012025-06-19 02:45:53 -070067int g_chup_flag = 0;
mj.qu1524fc92025-06-11 04:34:13 -070068
69
70/**************************************************************************
71* ³£Á¿¶¨ÒåÇø
72**************************************************************************/
73
74/* {
75 ZCC_S_IDLE_S = 0,
76 ZCC_S_DT_S ,
77 ZCC_S_DACCM_S ,
78 ZCC_S_DIALING_S ,
79 ZCC_S_RINGBACK_S ,// Ö÷½Ð¹ý³ÌÖеÄÕñÁå̬
80 ZCC_S_BSYT_S ,
81 ZCC_S_TKYT_S ,
82 ZCC_S_SIL_S ,
83 ZCC_S_TALKING_S ,
84 ZCC_S_TRYING_S ,
85 ZCC_S_WAIT_RESOURCE_S ,
86} */
87const pCcSlaveFsmFunc zCcSlaveFsmFunc[] = {zCc_SIdleState,
88 zCc_SDtState,
89 zCc_SDaccmState,
90 zCc_SDialingState,
91 zCc_SRingbackState,
92 zCc_SBsyToneState,
93 zCc_STkytState,
94 zCc_SSilState,
95 zCc_STalkingState,
96 zCc_STryingState,
97 zCc_SWaitResourceState
98 };
99 /*
100 CB
101 *54*KSSSS# REGISTER AT+CLCK="AO",1,"SSSS"
102 #54*KSSSS# DeREGISTER AT+CLCK="AO",0,"SSSS"
103 *#54# QUERY/CHECK AT+CLCK="AO",2,"SSSS" not supported---------------------------
104 K=1 "AO"; K=2 or K=3 "OI"(ÒÆ¶¯ÍøÃ»ÓйúÄÚ³¤Í¾ÏÞÖÆÒµÎñ); SSSS password
105 *56# REGISTER AT+CLCK="AI",1,"SSSS" ÐèÒªÖÕ¶Ë·½°¸»ò¸Ä²Ù×÷·½Ê½---------------------------
106 #56# DeREGISTER AT+CLCK="AI",0,"SSSS" ---------------------------
107 CFU
108 *57*DN# REGISTER AT+CCFC=0,1,"DN"
109 #57# DeREGISTER AT+CCFC=0,0
110 *#57*DN# AT+CCFC=0,2 not supported---------------------------
111 CFNRy
112 *41*DN# REGISTER AT+CCFC=2,1,"DN"
113 #41# DeREGISTER AT+CCFC=2,0
114 *#41*DN# AT+CCFC=2,2 not supported---------------------------
115 CFB
116 *40*DN# REGISTER AT+CCFC=1,1,"DN"
117 #40# DeREGISTER AT+CCFC=1,0
118 *#40*DN# AT+CCFC=1,2 not supported---------------------------
119 CW ( ÖÕ¶Ë·½°¸´ý¼Ó )
120 *58# REGISTER AT+CCWA=0,1 ---------------------------
121 #58# DeREGISTER AT+CCWA=0,0 ---------------------------
122 */
123static const T_zCc_ScTab g_zCc_SCTab[] =
124{
125 {ZCC_BAOC_REG, 10, 10, "*54*1"},
126 {ZCC_BAOC_DEREG, 10, 10, "#54*1"},
127 {ZCC_BOIC_REG, 10, 10, "*54*2"},
128 {ZCC_BOIC_DEREG, 10, 10, "#54*2"},
129 {ZCC_BOIC_REG, 10, 10, "*54*3"},
130 {ZCC_BOIC_DEREG, 10, 10, "#54*3"},
131 {ZCC_CFU_REG, 6, SC_MAXLEN, "*57*"},
132 {ZCC_CFU_DEREG, 4, 4, "#57#"},
133 {ZCC_CFNRY_REG, 6, SC_MAXLEN, "*41*"},
134 {ZCC_CFNRY_DEREG, 4, 4, "#41#"},
135 {ZCC_CFB_REG, 6, SC_MAXLEN, "*40*"},
136 {ZCC_CFB_DEREG, 4, 4, "#40#"},
137};
138
139
140
141T_CC_APP_RecvAtIndItem gCcAppRecvAtIndProc[]=
142{
143 {MSG_CMD_DSCI_IND, zCc_RecvDsciInd},
144 {MSG_CMD_ZCPI,zCc_RecvZcpiInd},
145 {MSG_CMD_ZIMSPLUS_IND,zCc_RecvImsplusInd},
146 {MSG_CMD_ZVOICECHNL,zCc_RecvZvoiceChnl},
147 {MSG_CMD_ATD_DIAL_RSP,zCc_RecvRsp},
148 {MSG_CMD_ATA_RSP,zCc_RecvRsp},
149 {MSG_CMD_CHUP_RSP,zCc_RecvRsp},
150 {MSG_CMD_VTS_RSP,zCc_RecvRsp},
151 {MSG_CMD_ZIMSPLUS_RSP,zCc_RecvRsp},
152 {MSG_CMD_CLCK_RSP,zCc_RecvRsp},
153 {MSG_CMD_CCFC_RSP,zCc_RecvRsp},
154 {MSG_CMD_CHLD_RSP,zCc_RecvRsp}
155};
156 T_CC_APP_AtIndProcItem gCcAppAtIndProc[]=
157{
158 {MSG_CMD_DSCI_IND, zCc_DsciIndProc},
159 {MSG_CMD_ZCPI,zCc_ZcpiIndProc},
160 {MSG_CMD_ZIMSPLUS_IND,zCc_ZimsplusProc},
161 {MSG_CMD_ZVOICECHNL,zCc_ZvoicechnlProc}
162};
163
164
165SINT32 gCcAppRecvAtIndProcCnt = sizeof(gCcAppRecvAtIndProc)/sizeof(gCcAppRecvAtIndProc[0]);
166SINT32 gCcAppRecvAtIndCnt = sizeof(gCcAppAtIndProc)/sizeof(gCcAppAtIndProc[0]);
167char g_zCcApp_AtRecvBuf[ZCC_APP_AT_BUF_MAX_LEN+1] = {0};
168T_zCc_CurAtCmdInfo * g_Cc_AtIndRspMsg;
169
mj.qu58875012025-06-19 02:45:53 -0700170static int check_phone_number_in_file(const char* phoneNumber, const char* filename)
171{
172 FILE* file = fopen(filename, "r");
173 if (file == NULL) {
174 return 0;
175 }
176
177 char buffer[20];
178 while (fgets(buffer, sizeof(buffer), file) != NULL) {
179
180 char* newline = strchr(buffer, '\n');
181 if (newline) {
182 *newline = '\0';
183 }
184
185 if (strcmp(buffer, phoneNumber) == 0) {
186 fclose(file);
187 return 1;
188 }
189 }
190
191 fclose(file);
192 return 0;
193}
194
mj.qu1524fc92025-06-11 04:34:13 -0700195VOID zCc_ShowAllSlave(VOID)
196{
197 UINT8 slave = 0;
198
199 for (slave = 0; slave < ZCC_SLAVES; slave++) // slave[0] ²»¿ÉÄÜ
200 {
201 ccapp_log(" slave=%d number=%s cid=%d state=%d tone=%d msg=%d held=%d isOut=%d dsci6=%d",
202 slave,
203 g_Cc_CallDetail.slaveObj[slave].number,
204 g_Cc_CallDetail.slaveObj[slave].cid,
205 g_Cc_CallDetail.slaveObj[slave].state,
206 g_Cc_CallDetail.slaveObj[slave].tone,
207 g_Cc_CallDetail.slaveObj[slave].sMsg,
208 g_Cc_CallDetail.slaveObj[slave].heldcall,
209 g_Cc_CallDetail.slaveObj[slave].is_callout,
210 g_Cc_CallDetail.slaveObj[slave].waitDSCI6);
211 }
212}
213
214VOID zCc_ShowAllSlaveWithTips(const char *tips)
215{
216
217 UINT8 slave = 0;
218
219 for (slave = 0; slave < ZCC_SLAVES; slave++) // slave[0] ²»¿ÉÄÜ
220 {
221 printf/*ccapp_log*/("%s master_state=%d\n slave=%d number=%s cid=%d state=%d tone=%d msg=%d held=%d isOut=%d dsci6=%d",
222 tips, g_Cc_CallDetail.state,
223 slave,
224 g_Cc_CallDetail.slaveObj[slave].number,
225 g_Cc_CallDetail.slaveObj[slave].cid,
226 g_Cc_CallDetail.slaveObj[slave].state,
227 g_Cc_CallDetail.slaveObj[slave].tone,
228 g_Cc_CallDetail.slaveObj[slave].sMsg,
229 g_Cc_CallDetail.slaveObj[slave].heldcall,
230 g_Cc_CallDetail.slaveObj[slave].is_callout,
231 g_Cc_CallDetail.slaveObj[slave].waitDSCI6);
232 }
233}
234
235
236VOID zCc_CheckSlaveState(const char *tips)
237{
238 UINT8 slave = 0;
239
240 if(g_Cc_CallDetail.old_state != g_Cc_CallDetail.state)
241 {
242 ccapp_log("=========== %s =============\n master state %d --> %d",
243 tips,
244 g_Cc_CallDetail.old_state,
245 g_Cc_CallDetail.state);
246 g_Cc_CallDetail.old_state = g_Cc_CallDetail.state;
247 }
248
249 for (slave = 0; slave < ZCC_SLAVES; slave++) // slave[0] ²»¿ÉÄÜ
250 {
251 if(g_Cc_CallDetail.slaveObj[slave].old_state != g_Cc_CallDetail.slaveObj[slave].state)
252 {
253 ccapp_log("=========== %s =============\n slave=%d state %d --> %d",
254 tips,
255 slave,
256 g_Cc_CallDetail.slaveObj[slave].old_state,
257 g_Cc_CallDetail.slaveObj[slave].state);
258
259 g_Cc_CallDetail.slaveObj[slave].old_state = g_Cc_CallDetail.slaveObj[slave].state;
260 }
261 }
262}
263
264
265VOID zCc_ClearDigits(VOID)
266{
267 g_Cc_CallDetail.dCount = 0;
268 memset(g_Cc_CallDetail.digits, 0, sizeof(g_Cc_CallDetail.digits));
269 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ClearDigits: digits cleared\n",__FUNCTION__);
270}
271
272VOID zCc_InitSlaveObj(UINT8 slave)
273{
274 memset(&g_Cc_CallDetail.slaveObj[slave], 0, sizeof(T_zCc_SlaveObj));
275 if (slave == g_Cc_CallDetail.ringCid)
276 {
277 g_Cc_CallDetail.ringCid = 0;
278 }
279}
280
281UINT8 zCc_TalkingCall(UINT8 heldcall)
282{
283 UINT8 slave = 0, cnt = 0;
284
285 for (slave = 1; slave < ZCC_SLAVES; slave++) // slave[0] ²»¿ÉÄÜ
286 {
287 if (g_Cc_CallDetail.slaveObj[slave].state == ZCC_S_TALKING_S
288 && g_Cc_CallDetail.slaveObj[slave].heldcall == heldcall
289 && g_Cc_CallDetail.slaveObj[slave].waitDSCI6 == 0)
290 {
291 cnt++;
292 }
293 }
294
295 return cnt;
296}
297
298UINT8 zCc_GetWaitDisc6Slave(VOID)
299{
300 UINT8 slave = 0, cnt = 0;
301
302 for (slave = 1; slave < ZCC_SLAVES; slave++) // slave[0] ²»¿ÉÄÜ
303 {
304 if (g_Cc_CallDetail.slaveObj[slave].waitDSCI6 == 1)
305 {
306 cnt++;
307 }
308 }
309 return cnt;
310}
311
312UINT8 zCc_BusyToneAllowed(VOID)
313{
314 UINT8 slave = 0, cnt = 0;
315
316 for (slave = 0; slave < ZCC_SLAVES; slave++)
317 {
318 if (g_Cc_CallDetail.slaveObj[slave].state != ZCC_S_IDLE_S )
319 {
320 cnt++;
321 }
322 }
323 if ((1 == cnt)//µ±Ç°Ã»ÓÐÆäËûºô½Ð
324 ||(cnt == 2 && g_Cc_CallDetail.ringCid !=0
325 && g_Cc_CallDetail.slaveObj[g_Cc_CallDetail.ringCid].state == ZCC_S_TRYING_S
326 && g_Cc_CallDetail.slaveObj[g_Cc_CallDetail.ringCid].tone != ZCC_TONE_CIDCW_A)//Õª»ú̬»¹ÓÐÀ´µçÇÒδ·ÅÒô
327 ||(cnt == zCc_GetWaitDisc6Slave()+1))//ÆäËûºô½Ð¶¼ÊÇÔÚµÈdsci6µÄ
328 {
329 return 1;
330 }
331 else
332 {
333 return 0;
334 }
335
336}
337
338UINT8 zCc_ActiveCall(VOID)
339{
340 return zCc_TalkingCall(0);
341}
342
343UINT8 zCc_HeldCall(VOID)
344{
345 return zCc_TalkingCall(1);
346}
347
348UINT8 zCc_GetSpecSlave(UINT8 state)
349{
350 UINT8 slave = 0;
351
352 for (slave = 1; slave < ZCC_SLAVES; slave++) // slave[0] ²»¿ÉÄÜ
353 {
354 if (g_Cc_CallDetail.slaveObj[slave].state == state && g_Cc_CallDetail.slaveObj[slave].waitDSCI6 == 0)
355 {
356 return slave;
357 }
358 }
359 return 0;
360}
361
362UINT8 zCc_GetSpecSlaveIgnoreWaitDSCI6(UINT8 state)
363{
364 UINT8 slave = 0;
365
366 for (slave = 1; slave < ZCC_SLAVES; slave++) // slave[0] ²»¿ÉÄÜ
367 {
368 if (g_Cc_CallDetail.slaveObj[slave].state == state)
369 {
370 return slave;
371 }
372 }
373 return 0;
374}
375
376UINT8 zCc_Find_waitDSCI6_cid(void)
377{
378 UINT8 slave = 0;
379
380 for (slave = 1; slave < ZCC_SLAVES; slave++) // slave[0] ²»¿ÉÄÜ
381 {
382 if (g_Cc_CallDetail.slaveObj[slave].state!=ZCC_S_IDLE_S &&
383 g_Cc_CallDetail.slaveObj[slave].waitDSCI6!=0)
384 {
385 return slave;
386 }
387 }
388 return 0;
389}
390
391
392
393
394UINT8 zCc_GetDialingSlave(UINT8 waitDSCI6)
395{
396 UINT8 slave = 0;
397
398 for (slave = 1; slave < ZCC_SLAVES; slave++) // slave[0] ²»¿ÉÄÜ
399 {
400 if (g_Cc_CallDetail.slaveObj[slave].state == ZCC_S_DIALING_S )
401 {
402 if (waitDSCI6)
403 {
404 if (g_Cc_CallDetail.slaveObj[slave].waitDSCI6 == 0)
405 {
406 return slave;
407 }
408 }
409 else
410 {
411 return slave;
412 }
413 }
414 }
415 return 0;
416}
417
418UINT8 zCc_GetDiscSlave(UINT8 state)
419{
420 UINT8 slave = 0;
421 UINT8 cnt = 0;
422
423 for (slave = 1; slave < ZCC_SLAVES; slave++) // slave[0] ²»¿ÉÄÜ
424 {
425 if (g_Cc_CallDetail.slaveObj[slave].sMsg== ZCC_SDISCN_M && g_Cc_CallDetail.slaveObj[slave].waitDSCI6 == 0)
426 {
427 cnt++;
428 }
429 }
430 return cnt;
431}
432
433
434int tz_lock_cellid_is_limit_callin()
435{
436 char cellid_is_lock[4] = {0};
437
438 cfg_get_item("cellid_is_lock",cellid_is_lock,sizeof(cellid_is_lock));
439 if(strcmp(cellid_is_lock, "1") == 0)
440 return 1;
441
442 return 0;
443}
444
445int tz_lock_cellid_check_sos_num()
446{
447 int ret = 0;
448 char tz_Mexico_sos_lock_cellid[128] = {0};
449
450 ret = strlen(g_Cc_CallDetail.digits);
451 cfg_get_item("tz_Mexico_sos_lock_cellid",tz_Mexico_sos_lock_cellid,sizeof(tz_Mexico_sos_lock_cellid));
452 if(ret > 0 && ((g_Cc_CallDetail.digits[ret-1] == '#') || (g_Cc_CallDetail.digits[ret-1] == 'T')))
453 {
454 return TRUE;
455 }
456 else if(strstr(tz_Mexico_sos_lock_cellid, g_Cc_CallDetail.digits) != NULL)
457 {
458 return TRUE;
459 }
460 else
461 {
462 return FALSE;
463 }
464
465}
466
467extern int digit_map_call(char *num);
468/* µ±Ç°Ò»Â· ·Ç ±£³ÖµÄ ºô½Ð£¬FLASH£¬µ±Ç°ºô½Ð±»±£³Ö»òÊÍ·Å£¬digitsÖ»¼Ç¼Óû§²¦´òµÄºÅÂ룻
469 µ±Ç°Ò»Â· ·Ç ±£³ÖµÄ ºô½Ð£¬FLASH£¬µ±Ç°ºô½Ð±»»Ö¸´£»
470 ÆäËü³¡¾°ÐèÒªdigits ¼Ç¼ZCC_FLASH_SIGNºÍÓû§ ²¦´òµÄһλºÅÂë */
471UINT8 zCc_DigitsMatch(VOID)
472{
473 UINT16 i = 0;
474 UINT8 scSum = sizeof(g_zCc_SCTab)/sizeof(T_zCc_ScTab);
475
476 ccapp_log("zCc_DigitsMatch: digits=%s dCount=%d\n",g_Cc_CallDetail.digits,g_Cc_CallDetail.dCount);
477 if(tz_lock_cellid_is_limit_callin())
478 {
479 if(tz_lock_cellid_check_sos_num() == FALSE)
480 return ZCC_MATCHERR;
481 }
482
483 if (g_Cc_CallDetail.dCount == 0)
484 {
485 //ccapp_log("1");
486 return ZCC_NO_RESULT;
487 }
488
489 if(g_Cc_CallDetail.dCount >= 2 && g_Cc_CallDetail.dCount<ZDIAL_NUM_MAX)
490 {
491 if(g_Cc_CallDetail.digits[0]!=ZCC_FLASH_SIGN &&
492 g_Cc_CallDetail.digits[g_Cc_CallDetail.dCount-1]!=ZCC_TIMEOUT_SIGN)
493 {
494 printf("g_Cc_CallDetail.digits = %s\n",g_Cc_CallDetail.digits);
495 if(strcmp(LOCAL_TEST_CALL_CODE, g_Cc_CallDetail.digits)==0)
496 {
497 //ccapp_log("2");
498 local_test_call_type = LocalTestCallType_None;
499 return ZCC_LOCAL_TEST_CALL;
500 }
501 else if(strcmp(TZ_TEST_TIMING, g_Cc_CallDetail.digits)==0)
502 {
503 local_test_call_type = LocalTestCallType_LOOP;
504 return ZCC_LOCAL_TEST_CALL;
505 }
506 }
507
508 if(g_Cc_CallDetail.digits[0]=='*' && g_Cc_CallDetail.digits[1]=='#')
509 {
510 //ccapp_log("3");
511 return ZCC_NO_RESULT;
512 }
513 }
514
515 if(g_Cc_CallDetail.dCount>=ZDIAL_NUM_MAX)
516 {
517 //ccapp_log("4");
518 return ZCC_MATCHERR;
519 }
520
521 if(digit_map_call(g_Cc_CallDetail.digits)!=0)
522 {
523 ccapp_log("digit_map_call match %s", g_Cc_CallDetail.digits);
524 return ZCC_CALL;
525 }
526
527 if (g_Cc_CallDetail.digits[0] >= '0' && g_Cc_CallDetail.digits[0] <= '9')
528 {
529 //ccapp_log("5");
530 return (g_Cc_CallDetail.digits[g_Cc_CallDetail.dCount-1] == '#'
531 || g_Cc_CallDetail.digits[g_Cc_CallDetail.dCount-1] == ZCC_TIMEOUT_SIGN
532 || g_Cc_CallDetail.dCount == ZDIAL_NUM_MAX) ? ZCC_CALL : ZCC_NO_RESULT;
533 }
534
535 //ccapp_log("6");
536 if (g_Cc_CallDetail.digits[0] == ZCC_FLASH_SIGN) //ÖÁÉÙÓÐ2·ºô½ÐÁË
537 {
538 switch (g_Cc_CallDetail.digits[1])
539 {
540 case '0':
541 return ZCC_FLASH_0;
542 case '1':
543 return ZCC_FLASH_1;
544 case '2':
545 case ZCC_TIMEOUT_SIGN:
546 return ZCC_FLASH_2;
547 case '3':
548 return ZCC_FLASH_3;
549 case '4':
550 return ZCC_FLASH_4;
551 default:
552 return ZCC_MATCHERR;
553 }
554 }
555
556 /*for (i = 0; i<scSum; i++)
557 {
558 if (strncmp((CHAR *)g_zCc_SCTab[i].sc, (CHAR *)g_Cc_CallDetail.digits,
559 (UINT32)(strlen(g_zCc_SCTab[i].sc)<g_Cc_CallDetail.dCount)?strlen(g_zCc_SCTab[i].sc):g_Cc_CallDetail.dCount) == 0)
560 {
561 if (g_Cc_CallDetail.digits[g_Cc_CallDetail.dCount-1] == '#')
562 {
563 return g_zCc_SCTab[i].scName;
564 }
565 if (g_Cc_CallDetail.dCount < g_zCc_SCTab[i].scMaxLen)
566 {
567 return ZCC_NO_RESULT;
568 }
569 if (g_Cc_CallDetail.dCount == g_zCc_SCTab[i].scMaxLen)
570 {
571 return ZCC_MATCHERR;
572 }
573 }
574 }*/
575
576 if(g_Cc_CallDetail.dCount>=2 &&
577 g_Cc_CallDetail.dCount<ZDIAL_NUM_MAX &&
578 g_Cc_CallDetail.digits[0]=='*')
579 {
580 if(g_Cc_CallDetail.digits[g_Cc_CallDetail.dCount-1] == '#'
581 || g_Cc_CallDetail.digits[g_Cc_CallDetail.dCount-1] == ZCC_TIMEOUT_SIGN)
582 {
583 ccapp_log("match special code: %s", g_Cc_CallDetail.digits);
584 return ZCC_CALL;
585 }
586 else
587 {
588 //ccapp_log("8");
589 return ZCC_NO_RESULT;
590 }
591 }
592
593 //ccapp_log("9");
594 return ZCC_MATCHERR;
595}
596
597VOID zCc_DigitsMatchRltProc(UINT8 ret)
598{
599 UINT8 callCnt = 0, slave = 0;
600 SINT32 chldret = -1;
mj.qu8ddc7642025-06-11 04:37:19 -0700601 char voice_dial_time[4] = {0};
602 unsigned int dtmf_interval;
mj.qu1524fc92025-06-11 04:34:13 -0700603
mj.qu8ddc7642025-06-11 04:37:19 -0700604 cfg_get_item("voice_dial_time", voice_dial_time, sizeof(voice_dial_time));
605 dtmf_interval = atoi(voice_dial_time) * 1000;
mj.qu1524fc92025-06-11 04:34:13 -0700606 ccapp_log("ret=%d", ret);
607
608 slave = zCc_GetSpecSlave(ZCC_S_DACCM_S);
609 switch (ret)
610 {
611 case ZCC_NO_RESULT:
612 CreateSoftTimer(ZCCAPP_TIMER_DTMF_DETECT,
613 0,
mj.qu8ddc7642025-06-11 04:37:19 -0700614 dtmf_interval,
mj.qu1524fc92025-06-11 04:34:13 -0700615 zCcApp_DtmfTimer,
616 NULL);
617 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_DigitsMatchRltProc CreateSoftTimer zCcApp_DtmfTimer\n",__FUNCTION__);
618 return;
619
620 case ZCC_CALL:
621 g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SINV_M;
622 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_DIALING_S;
623 if(g_Cc_CallDetail.digits[0]!='*' && (digit_map_call(g_Cc_CallDetail.digits)==0))
624 {
625 g_Cc_CallDetail.digits[g_Cc_CallDetail.dCount-1] = 0;
626 g_Cc_CallDetail.dCount--;
627 }
628 strcpy(g_Cc_CallDetail.slaveObj[slave].number, g_Cc_CallDetail.digits);
629 g_Cc_CallDetail.slaveObj[slave].is_callout = TRUE;
630 return;
631
632 case ZCC_FLASH_1:
633 callCnt = zCc_CallCount();
634 if ((1 < callCnt) && (zCc_ActiveCall() == callCnt) ) // ¼Ç¼±¾´Î²Ù×÷ΪÕë¶Ôconf µÄ
635 {
636 chldret = zCc_SendAtChldReq(21);
637 }
638 else //if (1 < callCnt)
639 {
640 slave = zCc_GetSpecSlave(ZCC_S_DIALING_S);
641 if(slave)
642 {
643 ccapp_log("zCc_SendAtChldReq(%d) dialing", 10+slave);
644 chldret = zCc_SendAtChldReq(10+slave);
645 SLIC_Stop_Signal(0,TONE_SIGNAL);
646 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_OFF_A;
647 g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
648 break;
649 }
650
651 slave = zCc_GetSpecSlave(ZCC_S_RINGBACK_S);
652 if(slave)
653 {
654 ccapp_log("zCc_SendAtChldReq(%d) ringback", 10+slave);
655 chldret = zCc_SendAtChldReq(10+slave);
656 SLIC_Stop_Signal(0,TONE_SIGNAL);
657 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_OFF_A;
658 g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
659 break;
660 }
661
662 ccapp_log("zCc_SendAtChldReq(1)-");
663 chldret = zCc_SendAtChldReq(1);
664 }
665 break;
666
667 case ZCC_FLASH_2:
668 chldret = zCc_SendAtChldReq(2);
669 break;
670
671 case ZCC_FLASH_3:
672 if(zCc_talking_count()==1 && zCc_GetSpecSlave(ZCC_S_TRYING_S))
673 {
674 // talking + incoming, skip hookflash+3, do nothing
675 }
676 else
677 chldret = zCc_SendAtChldReq(3);
678 break;
679
680 case ZCC_FLASH_4:
681 if( zCc_CallCount()> 1)
682 {
683 //system("at_cmd AT+ZTOR=2");
684 //zCcApp_send_message(MSG_CMD_ACTIVE_CALL_TRANSFER, 0, NULL);
685 //ccapp_log("send MSG_CMD_ACTIVE_CALL_TRANSFER");
686 chldret = zCc_SendAtChldReq(4); //AT+CHLD=4
687 }
688 else
689 ccapp_log("skip at_cmd AT+ZTOR=2");
690 break;
691
692 case ZCC_FLASH_0://¾Ü½ÓÀ´µç£¬Í£Ö¹·ÅÒô£¬»Ö¸´ÓïÒô
693 SLIC_Stop_Signal(0,0);
694 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_DigitsMatchRltProc: SLIC_Stop_Signal <---\n",__FUNCTION__);
695 zCc_InitSlaveObj(0);
696 g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
697 SLIC_Start_PCM();
698 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_DigitsMatchRltProc: SLIC_Start_PCM <---\n",__FUNCTION__);
699 chldret = zCc_SendAtChldReq(0);
700 break;
701
702 case ZCC_MATCHERR:
703 if (g_Cc_CallDetail.digits[0] != ZCC_FLASH_SIGN)
704 {
705 zCc_ClearDigits();
706 if (1 == zCc_BusyToneAllowed() && g_Cc_CallDetail.state == ZCC_M_SEIZE_S)//ÓÐÆäËûºô½Ðʱ²»·ÅæÒô
707 {
708 CreateSoftTimer(ZCCAPP_TIMER_BUSYTONE_DETECT,
709 0,
710 ZCCAPP_TIMER_BUSYTONE_INTERVAL,
711 zCcApp_BusyToneTimer,
712 NULL);
713 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_DigitsMatchRltProc CreateSoftTimer zCcApp_BusyToneTimer\n",__FUNCTION__);
714 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_BSY_A;
715 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_BSYT_S;
716 g_Cc_CallDetail.slaveObj[slave].confcall = 0;
717 g_Cc_CallDetail.slaveObj[slave].heldcall = 0;
718 }
719 else
720 {
721 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
722 zCc_InitSlaveObj(slave);
723 }
724 return;
725 }
726 break;
727
728 default:
729 if (ret >= ZCC_BAOC_REG && ret <= ZCC_CFB_DEREG)// SS slave=1
730 {
731 g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SINV_M;
732 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_IDLE_S;//±ÜÃâºóÃæ¹Ò»ú»á·¢Æðchup
733 }
734 return;
735 }
736
737 zCc_ClearDigits();
738 //zCc_InitSlaveObj(slave);
739}
740#if 0
741VOID zCc_PreProcRes(CHAR *pParaLine)
742{
743 SINT32 flg = 0;
744 UINT32 i = 0;
745 UINT32 length = 0;
746 CHAR *pSource = pParaLine;
747 CHAR *pDest = NULL;
748
749 CHAR *pStrDestMalloc = (CHAR *)malloc(AT_CMD_MAX);
750 if (NULL == pStrDestMalloc)
751 {
752 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_PreProcRes: Malloc failed !!!\n",__FUNCTION__);
753 return;
754 }
755 memset(pStrDestMalloc, 0, AT_CMD_MAX);
756
757 assert(pParaLine != NULL);
758 pDest = pStrDestMalloc;
759 length = strlen(pParaLine);
760 if (length == 0 || length >= ZAT_MAX_LEN)
761 {
762 free(pStrDestMalloc);
763 return;
764 }
765 for (i = 0; (i < length )&& (pDest - pStrDestMalloc < AT_CMD_MAX); i++)
766 {
767 if ('"' == *pSource)
768 {
769 flg = (0 == flg)?1:0; /* Ë«ÒýºÅ ɾ³ý */
770 if ('"' == *(pSource + 1)) /* ÐǺźóÃæ½ô¸úÐǺţ¬²åÈë¿Õ´®Õ¼Î»·û */
771 {
772 *pDest++ = (CHAR)ZAT_NULL_FILL;
773 }
774 }
775 else if ((',' == *pSource) && (0 == flg))
776 {
777 *pDest++ = ' '; /* Ë«ÒýºÅÍâÃæµÄ¶ººÅ£¬Ìæ»»³É¿Õ¸ñ */
778 if (',' == *(pSource + 1)) /* ¶ººÅºóÃæ½ô¸ú¶ººÅ£¬»òÕßÒÔ¶ººÅ½á⣬²åÈë¿Õ´®Õ¼Î»·û */
779 {
780 *pDest++ = '9'; //±£Áô²ÎÊýÓÃ9ÔÝʱ´úÌæ
781 }
782 else if ('\0' == *(pSource + 1)) /* ¶ººÅºóÃæ½ô¸ú¶ººÅ£¬»òÕßÒÔ¶ººÅ½á⣬²åÈë¿Õ´®Õ¼Î»·û */
783 {
784 *pDest++ = (CHAR)ZAT_NULL_FILL;
785 }
786 }
787 else if (('\r' == *pSource) ||('\n' == *pSource))
788 {
789 pSource++;
790 }
791 else
792 {
793 *pDest++ = ((' ' == *pSource) && (1 == flg))?(CHAR)ZAT_SPACE_REPLACE:((('\t' == *pSource) && (1 == flg))?(CHAR)ZAT_TAB_REPLACE:(*pSource));
794 }
795 pSource++;
796 }
797
798 memset(pParaLine, 0, length); /* ½«Ô¤´¦ÀíºóµÄÄÚÈÝ¿½±´»Ø²ÎÊýÐÐÖÐ */
799 strcpy(pParaLine, pStrDestMalloc);
800 free(pStrDestMalloc);
801}
802#endif
803UINT8 zCc_CallCount(VOID)
804{
805 UINT8 slave = 0, cnt = 0;
806
807 for (slave = 1; slave < ZCC_SLAVES; slave++)
808 {
809 if (g_Cc_CallDetail.slaveObj[slave].state != ZCC_S_IDLE_S
810 && g_Cc_CallDetail.slaveObj[slave].waitDSCI6 == 0)
811 //&& !(g_Cc_CallDetail.slaveObj[slave].waitDSCI6 == 1
812 //&& g_Cc_CallDetail.slaveObj[slave].state ==ZCC_S_TRYING_S))
813 {
814 cnt++;
815 }
816 }
817
818 return cnt;
819}
820
821UINT8 zCc_FlashClearCall(VOID)
822{
823 UINT8 slave = 0, cnt = 0;
824
825 for (slave = 1; slave < ZCC_SLAVES; slave++)
826 {
827 if (g_Cc_CallDetail.slaveObj[slave].state == ZCC_S_DACCM_S//Õª»úµ½atdÏ·¢Ç°
828 || g_Cc_CallDetail.slaveObj[slave].state == ZCC_S_BSYT_S
829 || g_Cc_CallDetail.slaveObj[slave].state == ZCC_S_TKYT_S
830 || g_Cc_CallDetail.slaveObj[slave].state == ZCC_S_SIL_S//·ÅæÒô¡¢º¿ÃùÒô¡¢¾²Òô
831 && g_Cc_CallDetail.slaveObj[slave].waitDSCI6 == 0)
832 {
833 zCc_InitSlaveObj(slave);
834 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
835 cnt++;
836 }
837 }
838
839 return cnt;
840}
841
842UINT8 zCc_MoInactiveCall(VOID)
843{
844 UINT8 slave = 0, cnt = 0;
845
846 for (slave = 0; slave < ZCC_SLAVES; slave++)
847 {
848 if (g_Cc_CallDetail.slaveObj[slave].state > ZCC_S_IDLE_S
849 && g_Cc_CallDetail.slaveObj[slave].state < ZCC_S_BSYT_S
850 && g_Cc_CallDetail.slaveObj[slave].waitDSCI6 == 0)
851 {
852 cnt++;
853 }
854 }
855
856 return cnt;
857}
858UINT8 zCc_MoBeforDialingCall(VOID)
859{
860 UINT8 slave = 0, cnt = 0;
861
862 for (slave = 0; slave < ZCC_SLAVES; slave++)
863 {
864 if (g_Cc_CallDetail.slaveObj[slave].state != ZCC_S_IDLE_S)
865 {
866 ccapp_log("zCc_MoBeforDialingCall slave[%d]=%d",
867 slave,
868 g_Cc_CallDetail.slaveObj[slave].state);
869 }
870
871 if (g_Cc_CallDetail.slaveObj[slave].state > ZCC_S_IDLE_S
872 && g_Cc_CallDetail.slaveObj[slave].state < ZCC_S_DIALING_S
873 && g_Cc_CallDetail.slaveObj[slave].waitDSCI6 == 0)
874 {
875 cnt++;
876 }
877 }
878
879 return cnt;
880}
881
882int zCc_GetMoBeforDialingCallCID(VOID)
883{
884 UINT8 slave = 0, cnt = 0;
885
886 for (slave = 0; slave < ZCC_SLAVES; slave++)
887 {
888 if (g_Cc_CallDetail.slaveObj[slave].state != ZCC_S_IDLE_S)
889 {
890 ccapp_log("zCc_GetMoBeforDialingCallCID slave[%d]=%d",
891 slave,
892 g_Cc_CallDetail.slaveObj[slave].state);
893 }
894
895 if (g_Cc_CallDetail.slaveObj[slave].state > ZCC_S_IDLE_S
896 && g_Cc_CallDetail.slaveObj[slave].state < ZCC_S_DIALING_S
897 && g_Cc_CallDetail.slaveObj[slave].waitDSCI6 == 0)
898 {
899 return slave;
900 }
901 }
902
903 return -1;
904}
905
906
907int zCc_findCID_by_number(const char *number)
908{
909 UINT8 slave = 0, len = 0;
910 char slave_number[ZDIAL_NUM_MAX];
911
912 for (slave = 1; slave < ZCC_SLAVES; slave++)
913 {
914 if (g_Cc_CallDetail.slaveObj[slave].state != ZCC_S_IDLE_S)
915 {
916 ccapp_log("zCc_findCID_by_number[%s] slave[%d]=%d num=%s",
917 number,
918 slave,
919 g_Cc_CallDetail.slaveObj[slave].state,
920 g_Cc_CallDetail.slaveObj[slave].number);
921 }
922
923 strcpy(slave_number, g_Cc_CallDetail.slaveObj[slave].number);
924 len = strlen(slave_number);
925 if(len>0)
926 {
927 if(slave_number[len-1]=='T')
928 slave_number[len-1]='\0';
929 }
930
931 if (strcmp(slave_number, number)==0)
932 return slave;
933 }
934
935 return 0;
936}
937
938int check_incoming_call_is_in_slave(MSG_BUF *ptMsgBuf)
939{
940 T_zCcApp_DsciInd tDiscInd = {0};
941 memcpy(&tDiscInd, (T_zCcApp_DsciInd*)ptMsgBuf->aucDataBuf, sizeof(T_zCcApp_DsciInd));
942
943 if(tDiscInd.cid==0)
944 return 0;
945
946 return zCc_findCID_by_number(tDiscInd.num);
947}
948
949
950UINT8 zCc_MtInactiveCall(VOID)
951{
952 UINT8 slave = 0, cnt = 0;
953
954 for (slave = 0; slave < ZCC_SLAVES; slave++)
955 {
956 if (g_Cc_CallDetail.slaveObj[slave].state == ZCC_S_TRYING_S
957 || g_Cc_CallDetail.slaveObj[slave].state == ZCC_S_WAIT_RESOURCE_S)
958 //&& g_Cc_CallDetail.slaveObj[slave].waitDSCI6 == 0)
959 {
960 cnt++;
961 }
962 }
963
964 return cnt;
965}
966UINT8 zCc_GetCallSlave(UINT8 heldcall)//°´×î¶àÁ½Â·ÊµÏÖ
967{
968 UINT8 slave = 0;
969
970 for (slave = 1; slave < ZCC_SLAVES; slave++) // slave[0] ²»¿ÉÄÜ
971 {
972 if (g_Cc_CallDetail.slaveObj[slave].state == ZCC_S_TALKING_S
973 && g_Cc_CallDetail.slaveObj[slave].heldcall == heldcall
974 && g_Cc_CallDetail.slaveObj[slave].waitDSCI6 == 0)
975 {
976 return slave;
977 }
978 }
979 return 0;
980}
981
982VOID zCc_ControlTone(VOID)
983{
984 T_zCc_Tone tone = ZCC_TONE_OFF_A; /* What tone to play */
985 SIGNAL_DATA tSig;
986 memset(tSig.cid, 0, 32);
987 UINT8 slave = 0;
988
989 for (slave = 0; slave < ZCC_SLAVES; slave++)
990 {
991 if (g_Cc_CallDetail.slaveObj[slave].tone != ZCC_TONE_OFF_A)
992 {
993 tone = g_Cc_CallDetail.slaveObj[slave].tone;
994 break;
995 }
996 }
997 printf("[ccapp_debug]:zCc_ControlTone,cur_tone=%d, last_tone=%d\n",tone,g_Cc_CallDetail.lastTone);
998 if (g_Cc_CallDetail.lastTone == tone || ZCC_TONE_OFF_A == tone)
999 {
1000 return;
1001 }
1002
1003 if(local_test_call_st != 0)
1004 {
1005 g_Cc_CallDetail.lastTone = tone;
1006 return ;
1007 }
1008
1009 switch (tone)
1010 {
1011 case ZCC_TONE_DIAL_A:
1012 if (g_Cc_CallDetail.lastTone == ZCC_TONE_CIDCW_A)//¶à²»¶àÓà
1013 {
1014 SLIC_Stop_PCM();
1015 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ControlTone: SLIC_Stop_PCM <---\n",__FUNCTION__);
1016 }
1017 tSig.signal_type= TONE_SIGNAL;
1018 tSig.tone_type = TONE_DIAL;
1019 SLIC_Play_Signal(0, 0, &tSig);
1020 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ControlTone: SLIC_Play_Signal TONE_DIAL<---\n",__FUNCTION__);
1021 break;
1022 case ZCC_TONE_RB_A:
1023 tSig.signal_type= TONE_SIGNAL;
1024 tSig.tone_type = TONE_RINGBACK;
1025 SLIC_Play_Signal(0, 0, &tSig);
1026 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ControlTone: SLIC_Play_Signal ZCC_TONE_RB_A<---\n",__FUNCTION__);
1027 break;
1028 case ZCC_TONE_BSY_A:
1029 tSig.signal_type= TONE_SIGNAL;
1030 tSig.tone_type = TONE_BUSY;
1031 SLIC_Play_Signal(0, 0, &tSig);
1032 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ControlTone: SLIC_Play_Signal TONE_BUSY<---\n",__FUNCTION__);
1033 break;
1034 case ZCC_TONE_SIL_A:
1035 SLIC_Stop_Signal(0, TONE_SIGNAL);
1036 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ControlTone: SLIC_Stop_Signal <---\n",__FUNCTION__);
1037 break;
1038 case ZCC_TONE_CIDCW_A:
1039 memset(&tSig, 0, sizeof(tSig));
1040 tSig.signal_type= TONE_SIGNAL;
1041 tSig.tone_type = TONE_CW;
1042 //memcpy(tSig.cid, g_Cc_CallDetail.number, strlen(g_Cc_CallDetail.number));
1043 strncpy(tSig.cid, g_Cc_CallDetail.number, sizeof(tSig.cid)-1);
1044 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ControlTone ZCC_TONE_CIDCW_A,number = %s\n",__FUNCTION__,g_Cc_CallDetail.number);
1045 zCc_sleep(100);
1046 SLIC_Play_Signal(0, 0, &tSig);
1047 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ControlTone: SLIC_Play_Signal TONE_CW<---\n",__FUNCTION__);
1048 break;
1049 case ZCC_TONE_TKY_A:
1050 tSig.signal_type= TONE_SIGNAL;
1051 tSig.tone_type = TONE_TKY;
1052 SLIC_Play_Signal(0, 0, &tSig);
1053 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ControlTone: SLIC_Play_Signal TONE_TKY<---\n",__FUNCTION__);
1054 break;
1055 }
1056 g_Cc_CallDetail.lastTone = tone;
1057
1058}
1059void zCcApp_SetAtChnlCmdId(E_CC_APP_AtReqCmdId AtCmdId)
1060{
1061 g_Cc_CallDetail.curAtCmdId = AtCmdId;
1062}
1063VOID zCc_SendSsReq(PSTR pAtCmdPara)
1064{
1065 CHAR pw[5] = {0};
1066 CHAR dn[ZDIAL_NUM_MAX] = {0};
1067 UINT8 scSum = sizeof(g_zCc_SCTab)/sizeof(T_zCc_ScTab);
1068 UINT8 scName = 0;
1069 UINT8 i = 0;
1070 T_zCcapp_ClckReq tclckreq = {0};
1071 T_zCcapp_CcfcReq tccfcreq = {0};
1072
1073 for (i = 0; i<scSum; i++)
1074 {
1075 if (strncmp((CHAR *)g_zCc_SCTab[i].sc, (CHAR *)g_Cc_CallDetail.digits,
1076 (UINT32)(strlen(g_zCc_SCTab[i].sc)<g_Cc_CallDetail.dCount)?strlen(g_zCc_SCTab[i].sc):g_Cc_CallDetail.dCount) == 0)
1077 {
1078 scName = g_zCc_SCTab[i].scName;
1079 break;
1080 }
1081 }
1082 switch(scName)
1083 {
1084 case ZCC_BAOC_REG:
1085 sscanf(pAtCmdPara, "%*5s%4s#", pw);
1086 pw[4] = '\0';
1087 tclckreq.type = 0;//AO
1088 tclckreq.act = 1;
1089 strncpy(tclckreq.pw,pw,sizeof(tclckreq.pw)-1);
1090 break;
1091 case ZCC_BAOC_DEREG:
1092 sscanf(pAtCmdPara, "%*5s%4s#", pw);
1093 pw[4] = '\0';
1094 tclckreq.type = 0;//AO
1095 tclckreq.act = 0;
1096 strncpy(tclckreq.pw,pw,sizeof(tclckreq.pw)-1);
1097 break;
1098 case ZCC_BOIC_REG:
1099 sscanf(pAtCmdPara, "%*5s%4s#", pw);
1100 pw[4] = '\0';
1101 tclckreq.type = 1;//OI
1102 tclckreq.act = 1;
1103 strncpy(tclckreq.pw,pw,sizeof(tclckreq.pw)-1);
1104 break;
1105 case ZCC_BOIC_DEREG:
1106 sscanf(pAtCmdPara, "%*5s%4s#", pw);
1107 pw[4] = '\0';
1108 tclckreq.type = 1;//OI
1109 tclckreq.act = 0;
1110 strncpy(tclckreq.pw,pw,sizeof(tclckreq.pw)-1);
1111 break;
1112 case ZCC_CFU_REG:
1113 sscanf(pAtCmdPara, "%*4s%47s#", dn);
1114 dn[strlen(dn)-1] = '\0';
1115 tccfcreq.type = 0;
1116 tccfcreq.act = 1;
1117 strncpy(tccfcreq.dn, dn, strlen(dn));
1118 break;
1119 case ZCC_CFU_DEREG:
1120 tccfcreq.type = 0;
1121 tccfcreq.act = 0;
1122 break;
1123 case ZCC_CFNRY_REG:
1124 sscanf(pAtCmdPara, "%*4s%47s#", dn);
1125 dn[strlen(dn)-1] = '\0';
1126 tccfcreq.type = 2;
1127 tccfcreq.act = 1;
1128 strncpy(tccfcreq.dn, dn, strlen(dn));
1129 break;
1130 case ZCC_CFNRY_DEREG:
1131 tccfcreq.type = 2;
1132 tccfcreq.act = 0;
1133 break;
1134 case ZCC_CFB_REG:
1135 sscanf(pAtCmdPara, "%*4s%47s#", dn);
1136 dn[strlen(dn)-1] = '\0';
1137 tccfcreq.type = 1;
1138 tccfcreq.act = 1;
1139 strncpy(tccfcreq.dn, dn, strlen(dn));
1140 break;
1141 case ZCC_CFB_DEREG:
1142 tccfcreq.type = 1;
1143 tccfcreq.act = 0;
1144 break;
1145 }
1146
1147
1148 if (scName > ZCC_BOIC_DEREG)
1149 {
1150 zCcApp_Ccfc(&tccfcreq);
1151 }
1152 else
1153 {
1154 zCcApp_Clck(&tclckreq);
1155 }
1156
1157}
1158
1159VOID zCc_SendAtDialReq(PSTR pAtCmdPara)
1160{
1161 UINT8 slave =0;
1162
1163 //ccapp_log("pAtCmdPara=%s len=%s", pAtCmdPara, strlen(pAtCmdPara));
1164
1165 if (strlen(pAtCmdPara)+1 > ZDIAL_NUM_MAX)
1166 {
1167 return;
1168 }
1169 else if (strlen(pAtCmdPara) <= 2)
1170 {
1171 slave = zCc_GetDialingSlave(1);
1172 if (1 == zCc_BusyToneAllowed() && g_Cc_CallDetail.slaveObj[slave].waitDSCI6 == 0 && g_Cc_CallDetail.state == ZCC_M_SEIZE_S)//ÓÐÆäËûºô½ÐÇÒÒѹһúʱ²»·ÅæÒô
1173 {
1174 CreateSoftTimer(ZCCAPP_TIMER_BUSYTONE_DETECT,
1175 0,
1176 ZCCAPP_TIMER_BUSYTONE_INTERVAL,
1177 zCcApp_BusyToneTimer,
1178 NULL);
1179 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SendAtDialReq CreateSoftTimer zCcApp_BusyToneTimer\n",__FUNCTION__);
1180 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_BSY_A;
1181 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_BSYT_S;
1182 g_Cc_CallDetail.slaveObj[slave].confcall = 0;
1183 g_Cc_CallDetail.slaveObj[slave].heldcall = 0;
1184 }
1185 else
1186 {
1187 int index;
1188 zCc_InitSlaveObj(slave);
1189 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
1190 index = zCc_find_held_cid(); // hookflash + onekey and dtmf timeout
1191 if(index!=0)
1192 zCc_SendAtChldReq(2);
1193 }
1194 return;
1195 }
1196 g_Cc_CallDetail.curAtCmdId = CC_APP_AT_CMD_REQ_D;
1197 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SendAtDialReq:AtcmdMsg = %s\n",__FUNCTION__,pAtCmdPara);
1198 zCcApp_Dial((char *)pAtCmdPara);
1199
1200}
1201
1202VOID zCc_SendAtAnswerReq(VOID)
1203{
1204 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SendAtAnswerReq\n",__FUNCTION__);
1205 g_Cc_CallDetail.curAtCmdId = CC_APP_AT_CMD_REQ_A;
1206 zCcApp_Answer();
1207}
1208
1209VOID zCc_SendAtHangupReq(VOID)
1210{
1211 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SendAtHangupReq\n",__FUNCTION__);
1212 g_Cc_CallDetail.curAtCmdId = CC_APP_AT_CMD_REQ_CHUP;
1213 zCcApp_Chup();
1214}
1215
1216VOID zCc_SendAtDtmfReq(char* dtmfchar)
1217{
1218 g_Cc_CallDetail.curAtCmdId = CC_APP_AT_CMD_REQ_VTS;
1219 zCcApp_Vts(dtmfchar);
1220}
1221
1222VOID zCc_SendAtImsPlusReq(int rate, int setfg)
1223{
1224 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SendAtImsPlusReq\n",__FUNCTION__);
1225 g_Cc_CallDetail.curAtCmdId = CC_APP_AT_CMD_REQ_IMSPLUS;
1226 zCcApp_SetImsPlus(rate, setfg);
1227}
1228#if 0
1229VOID zCc_SendAtVolumnReq(PSTR pAtCmdPara)
1230{
1231 CHAR AtcmdMsg[ZAT_PARAM_LEN50] = {0};
1232
1233 if (pAtCmdPara[0] == 0 || strlen(pAtCmdPara)+1 > ZDIAL_NUM_MAX)
1234 {
1235 return;
1236 }
1237 g_Cc_CallDetail.curAtCmdId = CC_APP_AT_CMD_REQ_VTS;
1238 sprintf(AtcmdMsg, "AT+VTS=\"%s\",20\r\n", pAtCmdPara);
1239 printf( "---> ccApp zCc_SendAtDtmfReq:AtcmdMsg = %s\n", AtcmdMsg);
1240 zCcApp_Vts(AtcmdMsg);
1241}
1242#endif
1243SINT32 zCc_SendAtChldReq(int chldtype)
1244{
1245 SINT32 ret = -1;
1246
1247 if (g_Cc_CallDetail.digits[0] == ZCC_FLASH_SIGN)
1248 {
1249 zCc_ClearDigits();
1250 }
1251 DeleteSoftTimer(ZCCAPP_TIMER_SSDIALTONE_DETECT);
1252 g_Cc_CallDetail.curAtCmdId = CC_APP_AT_CMD_REQ_SET_CHLD;
1253 ret = zCcApp_Chld(chldtype);
1254 return ret;
1255}
1256
1257VOID zCc_SendLedInformMsg(VOID)
1258{
1259 int lRet = -1;
1260 int lTgtMsgID = 0;
1261 MSG_BUF stMsg;
1262 LONG msgSize = sizeof(MSG_BUF) - sizeof(LONG);
1263
1264#ifndef TEST_CCAPP
1265 lTgtMsgID = msgget(MODULE_ID_MMI, 0);
1266 if (-1 == lTgtMsgID)
1267 {
1268 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SendLedInformMsg msgget MMI fail\n",__FUNCTION__);
1269 return;
1270 }
1271
1272 memset(&stMsg, 0, sizeof(MSG_BUF));
1273 stMsg.ulMagic = MSG_MAGIC_WORD;
1274 stMsg.lMsgType = MSG_TYPE_DEFAULT;
1275 stMsg.src_id = MODULE_ID_CALL_CTRL;
1276 stMsg.dst_id = MODULE_ID_MMI;
1277 stMsg.usMsgCmd = MSG_CMD_VOIP_STATUS_INFO;
1278 stMsg.usDataLen = 0;
1279 lRet = msgsnd(lTgtMsgID, &stMsg, msgSize, IPC_NOWAIT);
1280 if (lRet < 0)
1281 {
1282 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SendLedInformMsg msgsnd to MMI fail\n",__FUNCTION__);
1283 return;
1284 }
1285#endif
1286}
1287
1288VOID zCc_SetLedStatus(char* LedStatus)
1289{
1290
1291#ifndef TEST_CCAPP
1292 cfg_set("voip_status", LedStatus);
1293#endif
1294 zCc_SendLedInformMsg();
1295 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SetLedStatus = %s\n",__FUNCTION__,LedStatus);
1296}
1297
1298SINT32 zCc_RecvDsciInd(MSG_BUF *ptMsgBuf)
1299{
1300 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","RECV dsciind!!!<---\n");
1301 //ptMsgBuf->usMsgCmd = ZCC_NO_E;
1302 //ptMsgBuf->usMsgCmd = ZCCAPP_ATIND_DSCI;
1303 //ptMsgBuf->usSourceModuleID = MSG_ID_CALL_CTRL;
1304
1305 zCc_SendMsgToSub(ptMsgBuf); /* ·¢¸øÖ÷Ïß³Ì */
1306 return 0;
1307}
1308
1309int is_onecall_in_help_and_ready_to_input_new_call(void)
1310{
1311 int i;
1312 if(zCc_find_held_cid()==0)
1313 return 0;
1314
1315 for(i=0;i<ZCC_SLAVES;i++) // should start from 0, it'll be 0 when hookflash comes but not input any key
1316 if(g_Cc_CallDetail.slaveObj[i].state==ZCC_S_DT_S ||
1317 g_Cc_CallDetail.slaveObj[i].state==ZCC_S_DACCM_S)
1318 return 1;
1319
1320 return 0;
1321}
1322
1323void tz_lock_cellid_active_for_call(int state)
1324{
1325 static int old_state = -1;
1326 static int cellid_active_count = 0;
1327 char tz_lock_cellid_active[4] = {0};
1328
1329 cfg_get_item("tz_lock_cellid_active",tz_lock_cellid_active,sizeof(tz_lock_cellid_active));
1330 if(strcmp(tz_lock_cellid_active, "1") == 0)
1331 return;
1332
1333 if((old_state == 3) && (state == 0) && (cellid_active_count < 3))
1334 {
1335 cellid_active_count++;
1336 if(cellid_active_count == 3)
1337 {
1338 cfg_set("tz_lock_cellid_call_active", "1");
1339 }
1340 }
1341 old_state = state;
1342 return;
1343}
1344
1345SINT32 zCc_DsciIndProc(MSG_BUF *ptMsgBuf)
1346{
1347 int inMpty = 0;
1348 int cid = 0;
1349 int state = 0;
1350 int dir = 0;
1351 CHAR num[ZDIAL_NUM_MAX] = {0};
1352 CHAR voip_status[ZDIAL_NUM_MAX] = {0};
1353 T_zCcApp_DsciInd tDiscInd = {0};
1354
1355 int n;
1356 int slave_callout[ZCC_SLAVES];
1357
mj.qu58875012025-06-19 02:45:53 -07001358 MSG_BUF msgBuf = {0};
1359 char callback_enable[4] = {0};
1360 char callback_number[20] = {0};
1361 cfg_get_item("callback_enable", callback_enable, sizeof(callback_enable));
1362 cfg_get_item("callback_number", callback_number, sizeof(callback_number));
1363
mj.qu1524fc92025-06-11 04:34:13 -07001364 memcpy(&tDiscInd, (T_zCcApp_DsciInd*)ptMsgBuf->aucDataBuf, sizeof(T_zCcApp_DsciInd));
1365 cid = tDiscInd.cid;
1366 inMpty = tDiscInd.inMpty;
1367 dir = tDiscInd.dir;
1368 state = tDiscInd.state;
1369 strncpy(num, tDiscInd.num,sizeof(num)-1);
1370 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s RECV dsciind: cid=%d num=%s dir=%d inMpty=%d state=%d !!!<---\n",
1371 __FUNCTION__, cid, num, dir,inMpty,state);
1372 zCc_ShowAllSlave();
1373
1374 if (cid < ZCC_MINCID || cid > ZCC_MAXCID)
1375 {
1376 return 0;
1377 }
1378 if (num[0] < 0)
1379 {
1380 memset(num,0,ZDIAL_NUM_MAX);
1381 }
1382 ptMsgBuf->dst_id = cid;
1383 tz_lock_cellid_active_for_call(state);
1384 switch(state)
1385 {
1386 case 0://Z_MMIACC_CALL_STATE_ACTIVE
1387 if (g_Cc_CallDetail.slaveObj[cid].state == ZCC_S_TALKING_S)//held->active
1388 {
1389 SLIC_Start_PCM();
1390 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_DsciIndProc: SLIC_Start_PCM <---\n",__FUNCTION__);
1391
1392 if (g_Cc_CallDetail.lastTone == ZCC_TONE_DIAL_A
1393 && g_Cc_CallDetail.slaveObj[0].tone == ZCC_TONE_DIAL_A)
1394 {
1395 SLIC_Stop_Signal(0, TONE_SIGNAL);
1396 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_DsciIndProc: SLIC_Stop_Signal <---\n",__FUNCTION__);
1397 g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
1398 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_DsciIndProc handling zCc_InitSlaveObj(0)\n",__FUNCTION__);
1399 zCc_InitSlaveObj(0);
1400 }
1401 g_Cc_CallDetail.slaveObj[cid].heldcall = 0;
1402 g_Cc_CallDetail.slaveObj[cid].confcall = inMpty;
1403 }
1404 else
1405 {
1406 ptMsgBuf->usMsgCmd = ZCC_SANS_E;
1407 }
1408
1409#ifndef TEST_CCAPP
1410 cfg_get_item("voip_status",voip_status,sizeof(voip_status));
1411 if (0 != strcmp("ledon" , voip_status))
1412#endif
1413 {
1414 zCc_SetLedStatus("ledon");
1415 }
1416 break;
1417 case 1://Z_MMIACC_CALL_STATE_HELD
1418 if (g_Cc_CallDetail.slaveObj[cid].state == ZCC_S_TALKING_S)//active->held
1419 {
1420 if (1 == zCc_CallCount())
1421 {
1422 //SLIC_Stop_PCM();
1423 }
1424 g_Cc_CallDetail.slaveObj[cid].heldcall = 1;
1425 g_Cc_CallDetail.slaveObj[cid].confcall = inMpty;
1426
1427 }
1428 break;
1429 case 3://Z_MMIACC_CALL_STATE_MO_ALERTING
1430 ptMsgBuf->usMsgCmd = ZCC_SRING_E;
1431 break;
1432 case 4://Z_MMIACC_CALL_STATE_MT_INCOMING
1433 if(tz_lock_cellid_is_limit_callin())
1434 {
1435 zCc_SendAtChldReq(10+cid);
1436 break;
1437 }
1438
1439 if(g_Cc_CallDetail.state==ZCC_M_SEIZE_S)
1440 {
1441 int cnt;
1442
1443 cnt= zCc_CallCount();
1444 ccapp_log("cnt=%d slave[0]=%d", cnt, g_Cc_CallDetail.slaveObj[0].state);
1445
1446 if(cnt==0) // hookoff but not dail out utill dtmf-timer timeout
1447 {
1448 if(ZCC_S_BSYT_S<=g_Cc_CallDetail.slaveObj[0].state &&
1449 g_Cc_CallDetail.slaveObj[0].state<=ZCC_S_SIL_S)
1450 {
1451 zCc_SendAtChldReq(10+cid);
1452 break;
1453 }
1454 }
1455
1456 if(zCc_GetSpecSlaveIgnoreWaitDSCI6(ZCC_S_BSYT_S)||
1457 zCc_GetSpecSlaveIgnoreWaitDSCI6(ZCC_S_TKYT_S)|| // fast dududu is being ....
1458 zCc_GetSpecSlaveIgnoreWaitDSCI6(ZCC_S_SIL_S)) // fast dududu is end ....
1459 {
1460 zCc_SendAtChldReq(10+cid);
1461 break;
1462 }
1463 }
1464 else if(g_Cc_CallDetail.state==ZCC_M_RELEASE_S)
1465 {
1466 int dsci6_cid = zCc_Find_waitDSCI6_cid();
1467 if(dsci6_cid!=0 && dsci6_cid==cid)
1468 {
1469 zCc_SendAtChldReq(10+cid);
1470 zCc_InitSlaveObj(cid);
1471 ccapp_log("zCc_Find_waitDSCI6_cid and skip this call %s", num);
1472
1473 char temp[200];
1474 sprintf(temp, "echo \"%s get error incoming call cid=%d num=%s\" > /tmp/log.ccapp.callin.err",
1475 get_local_date_time(), cid, num);
1476 soft_system(temp);
1477 break;
1478 }
1479 }
1480
1481 ptMsgBuf->usMsgCmd = ZCC_SINVITE_E;
1482 memset(g_Cc_CallDetail.number, 0, sizeof(g_Cc_CallDetail.number));
1483 memcpy(g_Cc_CallDetail.number, num, ZDIAL_NUM_MAX);
1484 break;
1485 case 5://Z_MMIACC_CALL_STATE_MT_WAITING
1486 if(g_Cc_CallDetail.state==ZCC_M_RINGING_S && zCc_find_held_cid())
1487 {
1488 zCc_SendAtChldReq(10+cid);
1489 break;
1490 }
1491 else if(is_onecall_in_help_and_ready_to_input_new_call())
1492 {
1493 zCc_SendAtChldReq(10+cid);
1494 break;
1495 }
1496
1497 if(zCc_CallCount()>=2)
1498 {
1499 zCc_SendAtChldReq(10+cid);
1500 break;
1501 }
1502
1503 ptMsgBuf->usMsgCmd = ZCC_CIDCW_E;
1504 memset(g_Cc_CallDetail.number, 0, sizeof(g_Cc_CallDetail.number));
1505 memcpy(g_Cc_CallDetail.number, num, ZDIAL_NUM_MAX);
1506 break;
1507 case 6://Z_MMIACC_CALL_STATE_END
1508 zCcApp_Vts_CleanReq();
1509 if(zCc_findCID_by_number(num)==0)
1510 break;
1511
1512 ptMsgBuf->usMsgCmd = dir?ZCC_SDISCN_MT_E: ZCC_SDISCN_MO_E;
1513 g_Cc_CallDetail.chupSent = 0;
1514
1515 memset(slave_callout, 0, sizeof(slave_callout));
1516 n = zCc_find_all_callout(slave_callout);
1517
1518 ccapp_log("DscInd 6, dir=%d is_callout=%d, find_all_callout=%d",
1519 dir,
1520 g_Cc_CallDetail.slaveObj[cid].is_callout,
1521 n);
1522
1523 if(dir==0 && g_Cc_CallDetail.slaveObj[cid].is_callout == TRUE)
1524 {
1525 if(n<1 || (n==1 && slave_callout[0]==cid))
1526 SLIC_PolarityReverse(0, FALSE);
1527 }
1528
1529 if ((cid == g_Cc_CallDetail.ringCid) && (ZCC_TONE_CIDCW_A == g_Cc_CallDetail.lastTone))
1530 {
1531 SLIC_Stop_Signal(0, 0);//Í£Ö¹ºô½ÐµÈ´ýÒô
1532 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_DsciIndProc: SLIC_Stop_Signal <---\n",__FUNCTION__);
1533 g_Cc_CallDetail.slaveObj[0].tone = ZCC_TONE_OFF_A;
1534 g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
1535 }
mj.qu58875012025-06-19 02:45:53 -07001536
1537 if(1 == g_chup_flag && 1 == dir && 0 == strcmp(callback_enable, "1") && 1 == check_phone_number_in_file(callback_number, "/cache/call_back_list"))
1538 {
1539 g_chup_flag = 0;
1540 msgBuf.usMsgCmd = ZCC_SEIZE_E;
1541 msgBuf.src_id = MODULE_ID_SLIC;
1542 zCc_SendMsgToSub(&msgBuf);
1543
1544 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_DsciIndProc: send ZCC_SEIZE_E to sub <---\n",__FUNCTION__);
1545 }
mj.qu1524fc92025-06-11 04:34:13 -07001546
1547 break;
1548 case 2://Z_MMIACC_CALL_STATE_MO_DIALING
1549 ptMsgBuf->usMsgCmd = ZCC_SDIALLING_E;
1550 break;
1551 case 7://Z_MMIACC_CALL_STATE_MT_CONNREQ
1552 case 8://Z_MMIACC_CALL_STATE_DISC
1553 default:
1554 break;
1555 }
1556 return 0;
1557}
1558
1559
1560
1561SINT32 zCc_RecvZvoiceChnl(MSG_BUF *ptMsgBuf)
1562{
1563 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","RECV zvoicechnl!!!<---\n");
1564 //if (g_Cc_CallDetail.state == ZCC_M_RELEASE_S)
1565 //{
1566 // return 0;
1567 //}
1568 printf("[ccapp_debug]:recv zvoicechnl and send to local cc\n");
1569
1570 //ptMsgBuf->usMsgCmd = ZCC_NO_E;
1571 //ptMsgBuf->usMsgCmd = ZCCAPP_ATIND_IMSPLUS;
1572 //ptMsgBuf->usSourceModuleID = MSG_ID_CALL_CTRL;
1573
1574 zCc_SendMsgToSub(ptMsgBuf); /* ·¢¸øÖ÷Ïß³Ì */
1575 return 0;
1576}
1577
1578
1579
1580SINT32 zCc_RecvImsplusInd(MSG_BUF *ptMsgBuf)
1581{
1582 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","RECV imsplusind!!!<---\n");
1583 //if (g_Cc_CallDetail.state == ZCC_M_RELEASE_S)
1584 //{
1585 // return 0;
1586 //}
1587 printf("[ccapp_debug]:recv imsplus and send to local cc\n");
1588
1589 //ptMsgBuf->usMsgCmd = ZCC_NO_E;
1590 //ptMsgBuf->usMsgCmd = ZCCAPP_ATIND_IMSPLUS;
1591 //ptMsgBuf->usSourceModuleID = MSG_ID_CALL_CTRL;
1592
1593 zCc_SendMsgToSub(ptMsgBuf); /* ·¢¸øÖ÷Ïß³Ì */
1594 return 0;
1595}
1596SINT32 zCc_RecvRsp(MSG_BUF *ptMsgBuf)
1597{
1598 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","RECV at_rsp %d !!!<---\n", ptMsgBuf->usMsgCmd);
1599
1600 zCc_SendMsgToSub(ptMsgBuf); /* ·¢¸øÖ÷Ïß³Ì */
1601 return 0;
1602}
1603
1604static inline unsigned char zCc_MapVoiceChnlAct(unsigned char act)
1605{
1606 if (act == 3)
1607 {
1608 return 0; //gsm
1609 }
1610 else if (act == 5)
1611 {
1612 return 2; //wcdma
1613 }
1614 else if (act == 15)
1615 {
1616 return 1;
1617 }
1618 else
1619 {
1620 assert(0);
1621 }
1622 return 3;
1623}
1624
1625static unsigned char g_zCc_VoiceOpenSucc = 1;
1626
1627static T_Voice_Para g_zCc_VoicePara_bak;
1628
1629static unsigned int g_zCc_pcm_bak = 0; /*new add*/
1630
1631SINT32 zCc_ZvoicechnlProc(MSG_BUF *ptMsgBuf)
1632{
1633 T_zCcApp_VoiceChnl tVoiceChnl;
1634 T_Voice_Para tVoicePara = {0};
1635 memcpy(&tVoiceChnl, (T_zCcApp_VoiceChnl*)ptMsgBuf->aucDataBuf, sizeof(T_zCcApp_VoiceChnl));
1636
1637 tVoicePara.mode = zCc_MapVoiceChnlAct(tVoiceChnl.act);
1638 tVoicePara.codec_type = tVoiceChnl.codetype; //0-nb, 1-wb
1639 if ( tVoicePara.codec_type == 1)
1640 tVoicePara.clock_rate = 16000;
1641 else
1642 tVoicePara.clock_rate = 8000;
1643
1644 tVoicePara.codec_path = tVoiceChnl.amrpath;
1645
1646 printf("[ccapp_debug]:recv zvoicechnl, tVoicePara=%d,%d,%d,%d\n",tVoicePara.clock_rate,tVoicePara.mode,tVoicePara.codec_type,tVoicePara.codec_path);
1647 if (tVoiceChnl.op == 1)
1648 {
1649 /* new add begin*/
1650 //start voice
1651 if (/*voice_open(&tVoicePara) != 0 ||*/ g_Cc_CallDetail.state == ZCC_M_RINGING_S)
1652 {
1653 printf("[ccapp]:voice open fail");//´ò¿ªvoiceʧ°Ü£¬»òÕßÕñÁå̬ÊÕµ½zvoicechnl£¬¶¼ÈÏΪʧ°Ü
1654 g_zCc_VoiceOpenSucc = 0;
1655 g_zCc_VoicePara_bak = tVoicePara;
1656 }
1657 else if (g_Cc_CallDetail.state == ZCC_M_SEIZE_S)
1658 {
1659
1660 if ( voice_open(&tVoicePara) != 0)
1661
1662 {
1663
1664 printf("[ccapp_debug]:mo call voice_open fail!!!\n");
1665
1666 voice_close(&tVoicePara);
1667
1668 }
1669
1670 }
1671/* new add end*/
1672 printf("[ccapp_debug]:voice_open:rlt=%d\n",g_zCc_VoiceOpenSucc);
1673
1674 }
1675 else
1676 {
1677 //close voice
1678 g_zCc_VoiceOpenSucc = 1;
1679 voice_close(&tVoicePara);
1680 printf("[ccapp_debug]:voice_close:rlt=%d\n",g_zCc_VoiceOpenSucc);
1681
1682 }
1683 return 0;
1684}
1685
1686
1687
1688
1689
1690SINT32 zCc_ZimsplusProc(MSG_BUF *ptMsgBuf)
1691{
1692 int act = 0;
1693 int rate = 0;
1694 T_zCcApp_ImsplusInd tImsplusInd = {0};
1695
1696 memcpy(&tImsplusInd, (T_zCcApp_ImsplusInd*)ptMsgBuf->aucDataBuf, sizeof(T_zCcApp_ImsplusInd));
1697 act = tImsplusInd.act;
1698 rate = tImsplusInd.rate;
1699 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ZimsplusProc: act = %d rate = %d new!!!<---\n",__FUNCTION__, act, rate);
1700 printf("[ccapp_debug]:recv imsplus, tImsplusInd=%d,%d\n",tImsplusInd.act,tImsplusInd.rate);
1701
1702
1703 if (act == 0)
1704 {
1705 SLIC_Stop_PCM();
1706 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ZimsplusProc: SLIC_Stop_PCM <---\n",__FUNCTION__);
1707 }
1708 else if (act == 1)
1709 {
1710 /* new add begin*/
1711 if ( g_Cc_CallDetail.state == ZCC_M_RINGING_S)
1712 {
1713 g_zCc_pcm_bak = rate;
1714 return 0;
1715 }
1716 /* new add end */
1717
1718 if (rate == 8000)
1719 {
1720 SLIC_PCM_Set_NB();
1721 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ZimsplusProc: SLIC_PCM_Set_NB <---\n",__FUNCTION__);
1722 SLIC_Start_PCM();
1723 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ZimsplusProc: SLIC_Start_PCM <---\n",__FUNCTION__);
1724 }
1725 else if (rate == 16000)
1726 {
1727 SLIC_PCM_Set_WB();
1728 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ZimsplusProc: SLIC_PCM_Set_WB <---\n",__FUNCTION__);
1729 SLIC_Start_PCM();
1730 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ZimsplusProc: SLIC_Start_PCM <---\n",__FUNCTION__);
1731 }
1732 }
1733 else if (act == 2)//¹Ø±Õpcm£¬·Å±¾µØ»ØÁåÒô
1734 {
1735 if (ZCC_S_RINGBACK_S != g_Cc_CallDetail.slaveObj[rate].state)
1736 {
1737 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ZimsplusProc: act 2,cid err <---\n",__FUNCTION__);
1738 return 0;
1739 }
1740 SLIC_Stop_PCM();
1741 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ZimsplusProc: SLIC_Stop_PCM <---\n",__FUNCTION__);
1742 g_Cc_CallDetail.slaveObj[rate].tone = ZCC_TONE_RB_A;
1743 }
1744 else if (act == 3)//ºóÐø»áÔÙÓÐact1Éϱ¨£¬ËùÒÔ´Ëʱ²»´ò¿ªpcm
1745 {
1746 SLIC_Stop_Signal(0,0);
1747 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ZimsplusProc: SLIC_Stop_Signal <---\n",__FUNCTION__);
1748
1749 zCc_SendAtImsPlusReq(rate,0);
1750 g_Cc_CallDetail.slaveObj[rate].tone = ZCC_TONE_OFF_A;
1751 }
1752 return 0;
1753}
1754SINT32 zCc_RecvZcpiInd(MSG_BUF *ptMsgBuf)
1755{
1756 //ptMsgBuf->usMsgCmd = ZCCAPP_ATIND_ZCPI;
1757 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","RECV zcpiind!!!<---\n");
1758 //ptMsgBuf->usSourceModuleID = MSG_ID_CALL_CTRL;
1759 zCc_SendMsgToSub(ptMsgBuf); /* ·¢¸øÖ÷Ïß³Ì */
1760 return 0;
1761}
1762
1763SINT32 zCc_ZcpiIndProc(MSG_BUF *ptMsgBuf)
1764{
1765 int state = 0;
1766 int cid = 0;
1767 int progdsp = 0;
1768 T_zCcApp_ZcpiInd tZcpiInd = {0};
1769
1770 memcpy(&tZcpiInd, (T_zCcApp_ZcpiInd*)ptMsgBuf->aucDataBuf, sizeof(T_zCcApp_ZcpiInd));
1771 state = tZcpiInd.state;
1772 cid = tZcpiInd.cid;
1773 progdsp = tZcpiInd.progdsp;
1774
1775 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ZcpiIndProc: cid= %d, state=%d, progdsp=%d <---\n",__FUNCTION__,cid,state,progdsp);
1776 if (5 == state)
1777 {
1778 ptMsgBuf->dst_id = cid;
1779 ptMsgBuf->usMsgCmd = ZCC_RESOURCE_READY_E;
1780 g_Cc_CallDetail.resourceReady = 1;
1781 }
1782 else if (6 == state)
1783 {
1784 g_Cc_CallDetail.resourceReady = 0;
1785 }
1786
1787 if (8 == progdsp)
1788 {
1789 SLIC_Start_PCM();
1790 }
1791
1792 return 0;
1793}
1794
1795LONG zCcApp_send_message(unsigned short Msg_cmd,unsigned short us_DataLen,unsigned char *pData)
1796{
1797 ipc_send_message(MODULE_ID_CALL_CTRL, MODULE_ID_AT_CTL, Msg_cmd, us_DataLen, (unsigned char *)pData,0);
1798 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s ipc_send_message:Msg_cmd is %d<---\n",__FUNCTION__, Msg_cmd);
1799
1800 return 0;
1801}
1802
1803VOID zCcApp_Dial(char *ptMsgBuf)
1804{
1805 SINT32 ret = -1;
1806 MSG_BUF stMsg;
1807 LONG msgSize = sizeof(MSG_BUF)-sizeof(LONG);
1808 T_zCcapp_CallMoReq tcallReq = {0};
1809
1810 memset(tcallReq.number, 0, sizeof(tcallReq.number));
1811 //strncpy(tcallReq.number, ptMsgBuf,strlen(ptMsgBuf));
1812 strncpy(tcallReq.number, ptMsgBuf,sizeof(tcallReq.number)-1);
1813 zCcApp_send_message(MSG_CMD_ATD_DIAL_REQ, sizeof(T_zCcapp_CallMoReq), (unsigned char *) &tcallReq);
1814 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s ipc_send_message:Msg is MSG_CMD_ATD_DIAL_REQ<---\n",__FUNCTION__);
1815
1816}
1817SINT32 zCcApp_Ccfc(T_zCcapp_CcfcReq *ptccfcreq)
1818{
1819 SINT32 ret = -1;
1820 MSG_BUF stMsg;
1821 LONG msgSize = sizeof(MSG_BUF)-sizeof(LONG);
1822
1823 zCcApp_send_message(MSG_CMD_CCFC_REQ, sizeof(T_zCcapp_CcfcReq), (unsigned char *) ptccfcreq);
1824 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s ipc_send_message:Msg is MSG_CMD_CCFC_REQ<---\n",__FUNCTION__);
1825
1826 return 0;
1827}
1828SINT32 zCcApp_Clck(T_zCcapp_ClckReq *ptclckreq)
1829{
1830 SINT32 ret = -1;
1831 MSG_BUF stMsg;
1832 LONG msgSize = sizeof(MSG_BUF)-sizeof(LONG);
1833
1834 zCcApp_send_message( MSG_CMD_CLCK_REQ, sizeof(T_zCcapp_ClckReq), (unsigned char *) ptclckreq);
1835 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s ipc_send_message:Msg is MSG_CMD_CLCK_REQ<---\n",__FUNCTION__);
1836
1837 return 0;
1838}
1839
1840SINT32 zCcApp_Answer(VOID)
1841{
1842 SINT32 ret = -1;
1843 MSG_BUF stMsg;
1844 LONG msgSize = sizeof(MSG_BUF)-sizeof(LONG);
1845
1846 zCcApp_send_message(MSG_CMD_ATA_REQ, 0, NULL);
1847 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s ipc_send_message:Msg is MSG_CMD_ATA_REQ<---\n",__FUNCTION__);
1848
1849 return 0;
1850}
1851
1852SINT32 zCcApp_Chup(void)
1853{
1854 SINT32 ret = -1;
1855 MSG_BUF stMsg;
1856 LONG msgSize = sizeof(MSG_BUF)-sizeof(LONG);
1857
1858 zCcApp_send_message(MSG_CMD_CHUP_REQ, 0, NULL);
1859 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s ipc_send_message:Msg isMSG_CMD_CHUP_REQ<---\n",__FUNCTION__);
1860
1861 return 0;
1862}
1863
1864//µ±ÉÏÒ»¸öVTSûÓÐÊÕµ½OKǰ£¬ÆäËûµÄVTSÈ«²¿»º´æÔÚÁ´±íÀ´ýÊÕµ½ÉÏÒ»¸öOKʱÔÚÏ·¢ÏÂÒ»¸ö
1865//¶¼ÔÚmainÏ̴߳¦Àí£¬ÎÞÐ軥³â
1866typedef struct {
1867 struct list_head list;
1868 T_zCcapp_VtsReq vts;
1869}T_zCcapp_VtsReq_list;
1870
1871static LIST_HEAD(ccapp_vts_waitqueue);
1872static int ccapp_vts_flag = 0;
1873
1874void zCcApp_Vts_CleanReq(void)
1875{
1876 struct list_head *head = &ccapp_vts_waitqueue;
1877 T_zCcapp_VtsReq_list *l, *tmp;
1878
1879 if(!list_empty(head))
1880 {
1881 list_for_each_entry_safe(l, tmp, head, list)
1882 {
1883 list_del(&l->list);
1884 free(l);
1885 }
1886 ccapp_vts_flag = 0;
1887 }
1888}
1889
1890void zCcApp_Vts_Rsp(void)
1891{
1892 struct list_head *head = &ccapp_vts_waitqueue;
1893 printf("[ccapp_debug]:Vts_Rsp flag=%d\n",ccapp_vts_flag);
1894 if(list_empty(head))
1895 {
1896 ccapp_vts_flag = 0;
1897 }
1898 else
1899 {
1900 T_zCcapp_VtsReq_list *node = list_entry(head->next,T_zCcapp_VtsReq_list,list);
1901
1902 zCcApp_send_message(MSG_CMD_VTS_REQ, sizeof(T_zCcapp_VtsReq), (unsigned char *) &node->vts);
1903 ccapp_vts_flag = 1;
1904 list_del(&node->list);
1905 free(node);
1906 }
1907}
1908
1909SINT32 zCcApp_Vts(char* dtmfchar)
1910{
1911 T_zCcapp_VtsReq tvtsreq = {0};
1912 struct list_head *head = &ccapp_vts_waitqueue;
1913
1914 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","vtschar=%s<---\n",dtmfchar);
1915 tvtsreq.dtmfchar=*dtmfchar;
1916 printf("[ccapp_debug]:Vts_Req flag=%d\n",ccapp_vts_flag);
1917 if(list_empty(head) && ccapp_vts_flag == 0)
1918 {
1919 zCcApp_send_message(MSG_CMD_VTS_REQ, sizeof(T_zCcapp_VtsReq), (unsigned char *) &tvtsreq);
1920 ccapp_vts_flag = 1;
1921 }
1922 else
1923 {
1924 T_zCcapp_VtsReq_list *node = (T_zCcapp_VtsReq_list *)malloc(sizeof(T_zCcapp_VtsReq_list));
1925 if(node == NULL)
1926 {
1927 printf("[ccapp_debug]: zCcApp_Vts malloc fail!!!\n");
1928 return 0;
1929 }
1930 memset(node, 0 , sizeof(T_zCcapp_VtsReq_list));
1931 node->vts.dtmfchar = tvtsreq.dtmfchar;
1932 list_add_tail(&node->list,head);
1933 }
1934 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s ipc_send_message:Msg is MSG_CMD_VTS_REQ<---\n",__FUNCTION__);
1935
1936 return 0;
1937}
1938SINT32 zCcApp_SetImsPlus(int rate, int setfg)
1939{
1940 SINT32 ret = -1;
1941 MSG_BUF stMsg;
1942 LONG msgSize = sizeof(MSG_BUF)-sizeof(LONG);
1943 T_zCcapp_ImsplusReq timsplusreq= {0};
1944
1945 timsplusreq.act = rate;
1946 timsplusreq.setfg = setfg;
1947
1948 zCcApp_send_message(MSG_CMD_ZIMSPLUS_REQ, sizeof(T_zCcapp_ImsplusReq), (unsigned char *) &timsplusreq);
1949 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s ipc_send_message:Msg is MSG_CMD_ZIMSPLUS_REQ<---\n",__FUNCTION__);
1950
1951 return 0;
1952}
1953
1954SINT32 zCcApp_Chld(int chldtype)
1955{
1956 SINT32 ret = -1;
1957 MSG_BUF stMsg;
1958 LONG msgSize = sizeof(MSG_BUF)-sizeof(LONG);
1959
1960 T_zCcapp_ChldReq tchldreq = {0};
1961
1962 tchldreq.type = chldtype;
1963
1964 zCcApp_send_message(MSG_CMD_CHLD_REQ, sizeof(T_zCcapp_ChldReq), (unsigned char *) &tchldreq);
1965 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s ipc_send_message:Msg is MSG_CMD_CHLD_REQ[%d]<---\n",__FUNCTION__,chldtype);
1966
1967 return 0;
1968}
1969
1970SINT32 zCcApp_AtIndRspProc(MSG_BUF *ptMsgBuf)
1971{
1972 SINT32 i ;
1973 SINT32 ret = -1;
1974 for(i=0;i< gCcAppRecvAtIndProcCnt;i++)
1975 {
1976 if(ptMsgBuf->usMsgCmd == gCcAppRecvAtIndProc[i].AtIndCmd)
1977 {
1978 if(NULL!= gCcAppRecvAtIndProc[i].RecvAtIndProcFun)
1979 {
1980 ret = gCcAppRecvAtIndProc[i].RecvAtIndProcFun(ptMsgBuf);
1981 }
1982 break;
1983 }
1984 }
1985
1986 return ret;
1987}
1988VOID zCc_MReleaseState(MSG_BUF *ptMsgBuf)
1989{
1990 CHAR voip_status[ZDIAL_NUM_MAX] = {0};
1991 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MReleaseState ptMsgBuf->usMsgCmd = %d\n",__FUNCTION__,ptMsgBuf->usMsgCmd);
1992
1993 printf("[ccapp_debug]: Release State Recv MsgCmd: %d\n",ptMsgBuf->usMsgCmd);
1994
1995 switch (ptMsgBuf->usMsgCmd)
1996 {
1997 case ZCC_SEIZE_E: // ͻȜ
1998 // slave[0] to play dial tone
1999 g_Cc_CallDetail.evt[0] = ZCC_DIAL_E;
2000 g_Cc_CallDetail.state = ZCC_M_SEIZE_S;
2001 g_Cc_CallDetail.chupSent = FALSE;
2002 g_Cc_CallDetail.hookofffg = TRUE;
2003 if (g_Cc_CallDetail.ringCid)// ¾Ü¾øµÈ´ý×ÊԴ״̬µÄincoming call
2004 {
2005 zCc_SendAtHangupReq();
2006 g_Cc_CallDetail.slaveObj[g_Cc_CallDetail.ringCid].waitDSCI6 = 1;
2007 }
2008
2009#ifndef TEST_CCAPP
2010 cfg_get_item("voip_status",voip_status,sizeof(voip_status));
2011
2012 if (0 != strcmp("ledblink" , voip_status))
2013#endif
2014 {
2015 zCc_SetLedStatus("ledblink");
2016 }
2017 break;
2018
2019 case ZCC_SINVITE_E:
2020 g_Cc_CallDetail.evt[ptMsgBuf->dst_id] = ZCC_SINVITE_E;
2021 //g_Cc_CallDetail.state = ZCC_M_RINGING_S; È·ÈÏ×ÊÔ´·ÖÅäºóÔÙǨ״̬
2022 break;
2023
2024 case ZCC_RESOURCE_READY_E:
2025 ccapp_log("g_Cc_CallDetail.ringCid=%d", g_Cc_CallDetail.ringCid);
2026 if (g_Cc_CallDetail.ringCid)
2027 {
2028 g_Cc_CallDetail.evt[g_Cc_CallDetail.ringCid] = ZCC_RESOURCE_READY_E;
2029 }
2030 break;
2031
2032 case ZCC_SDISCN_MO_E:
2033 case ZCC_SDISCN_MT_E:
2034 g_Cc_CallDetail.evt[ptMsgBuf->dst_id] = ptMsgBuf->usMsgCmd;
2035 break;
2036
2037 case ZCC_RELEASE_E:
2038 case ZCC_FLASH_E:
2039 default:
2040 // do nothing
2041 break;
2042 }
2043}
2044
2045pthread_t slic_ring_test_pid;
2046void* slic_ring_test_thread(void * ptr)
2047{
2048 SIGNAL_DATA tSig;
2049 while(1)
2050 {
2051 sleep(30);
2052 printf("ring stop\n");
2053 SLIC_Stop_Signal(0, RING_SIGNAL);
2054 zCc_SetLedStatus("ledoff");
2055
2056 sleep(30);
2057 printf("ringing\n");
2058 memset(&tSig, 0, sizeof(tSig));
2059 tSig.signal_type = RING_SIGNAL;
2060 strcpy(g_Cc_CallDetail.number, "1234567890");
2061 strncpy(tSig.cid, g_Cc_CallDetail.number,sizeof(tSig.cid)-1);
2062 get_local_datetime(tSig.date_time);
2063 ccapp_log("local test call RING_SIGNAL,number = %s\n",g_Cc_CallDetail.number);
2064 SLIC_Play_Signal(0, 0, &tSig);
2065 zCc_SetLedStatus("ledblink");
2066 }
2067 return NULL;
2068}
2069
2070VOID zCc_MRingingState(MSG_BUF *ptMsgBuf)
2071{
2072 int held_call_cid = 0;
2073 int incoming_call_cid = 0;
2074 int shall_ring_cid;
mj.qu58875012025-06-19 02:45:53 -07002075
2076 MSG_BUF msgBuf = {0};
2077 char callback_enable[4] = {0};
2078 char callback_number[20] = {0};
2079 cfg_get_item("callback_enable", callback_enable, sizeof(callback_enable));
2080 cfg_get_item("callback_number", callback_number, sizeof(callback_number));
mj.qu1524fc92025-06-11 04:34:13 -07002081
2082 SIGNAL_DATA tSig;
2083
2084 CHAR voip_status[ZDIAL_NUM_MAX] = {0};
2085 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MRingingState ptMsgBuf->usMsgCmd = %d\n",__FUNCTION__,ptMsgBuf->usMsgCmd);
2086 switch (ptMsgBuf->usMsgCmd)
2087 {
2088 case ZCC_SEIZE_E: // ͻȜ
2089 g_Cc_CallDetail.state = ZCC_M_SEIZE_S;
2090 SLIC_Stop_Signal(0, RING_SIGNAL);
2091 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MRingingState: SLIC_Stop_Signal <---\n",__FUNCTION__);
2092 if (g_zCc_VoiceOpenSucc == 0)
2093 {
2094 g_zCc_VoiceOpenSucc = 1;
2095 voice_open(&g_zCc_VoicePara_bak);
2096 /* new add begin */
2097 if (g_zCc_pcm_bak == 8000)
2098 {
2099 SLIC_PCM_Set_NB();
2100 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ZimsplusProc: SLIC_PCM_Set_NB <---\n",__FUNCTION__);
2101 SLIC_Start_PCM();
2102 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ZimsplusProc: SLIC_Start_PCM <---\n",__FUNCTION__);
2103 }
2104 else if (g_zCc_pcm_bak == 16000)
2105 {
2106 SLIC_PCM_Set_WB();
2107 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ZimsplusProc: SLIC_PCM_Set_WB <---\n",__FUNCTION__);
2108 SLIC_Start_PCM();
2109 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ZimsplusProc: SLIC_Start_PCM <---\n",__FUNCTION__);
2110 }
2111 g_zCc_pcm_bak = 0;
2112 /* new add end */
2113 }
2114
2115 g_Cc_CallDetail.chupSent = FALSE;
2116
2117 ccapp_log("ZCC_SEIZE_E held_cid=%d held_incoming_cid=%d",
2118 zCc_find_held_cid(),
2119 zCc_find_held_incoming_cid());
2120
2121 if(local_test_call_st==LocalTestCallST_Ring)
2122 {
2123 /*memset(&tSig, 0, sizeof(tSig));
2124 tSig.signal_type= TONE_SIGNAL;
2125 tSig.tone_type = TONE_TKY;
2126 SLIC_Play_Signal(0, 0, &tSig);*/
2127 if(local_test_call_type == LocalTestCallType_LOOP)
2128 pthread_cancel(slic_ring_test_pid);
2129
2130 g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
2131 g_Cc_CallDetail.evt[0]= ZCC_NO_E;
2132 g_Cc_CallDetail.slaveObj[0].sMsg = ZCC_SNO_M;
2133
2134 local_test_call_st = LocalTestCallST_End;
2135
2136 //system("echo loop_1 >> /tmp/log.ccapp.vploop");
2137 //system("( sleep 1 && at_cmd AT+VPLOOP=1 ) &");
2138 cfg_set("tz_vploop", "1");
2139 ipc_send_message(MODULE_ID_CALL_CTRL_LOCAL,
2140 MODULE_ID_AT_CTL,
2141 MSG_CMD_SET_VPLOOP_REQ,
2142 0,
2143 NULL,
2144 0);
2145
2146 zCc_ShowAllSlaveWithTips("testCall-end");
2147 break;
2148 }
2149
2150 incoming_call_cid = zCc_find_held_incoming_cid();
2151 ccapp_log("incoming_call_cid=%d is_cidcw=%d",
2152 incoming_call_cid,
2153 g_Cc_CallDetail.slaveObj[incoming_call_cid].is_cidcw);
2154
2155 if(zCc_find_held_cid())
2156 {
2157 zCc_SendAtChldReq(1);
2158 }
2159 else if(incoming_call_cid)
2160 {
2161 if(g_Cc_CallDetail.slaveObj[incoming_call_cid].is_cidcw == TRUE)
2162 zCc_SendAtChldReq(1);
2163 else
2164 {
2165 if (g_Cc_CallDetail.ringCid)
2166 {
2167 g_Cc_CallDetail.evt[g_Cc_CallDetail.ringCid] = ZCC_CNCT_E;
2168 zCc_SendAtAnswerReq();
2169 }
2170 }
2171 }
2172 else
2173 {
2174 if (g_Cc_CallDetail.ringCid)
2175 {
2176 g_Cc_CallDetail.evt[g_Cc_CallDetail.ringCid] = ZCC_CNCT_E;
2177 zCc_SendAtAnswerReq();
2178 }
2179 }
mj.qu58875012025-06-19 02:45:53 -07002180
2181 if(0 == strcmp(callback_enable, "1") && 1 == check_phone_number_in_file(callback_number, "/cache/call_back_list"))
2182 {
2183 g_chup_flag = 1;
2184 msgBuf.usMsgCmd = ZCC_RELEASE_E;
2185 msgBuf.src_id = MODULE_ID_SLIC;
2186 zCc_SendMsgToSub(&msgBuf);
2187
2188 zCc_SendAtHangupReq();
2189 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MRingingState: ZCC_RELEASE_E <---\n",__FUNCTION__);
2190 }
2191
mj.qu1524fc92025-06-11 04:34:13 -07002192 break;
2193
2194// case ZCC_SINVITE_E:
2195 case ZCC_SDISCN_MT_E:
2196 case ZCC_SDISCN_MO_E:
2197 if(check_incoming_call_is_in_slave(ptMsgBuf)==0)
2198 break;
2199
2200 g_Cc_CallDetail.evt[ptMsgBuf->dst_id] = ptMsgBuf->usMsgCmd;
2201 g_Cc_CallDetail.state = ZCC_M_RELEASE_S;
2202 SLIC_Stop_Signal(0, RING_SIGNAL);
2203 g_zCc_VoiceOpenSucc = 1;
2204 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MRingingState: SLIC_Stop_Signal <---\n",__FUNCTION__);
2205#ifndef TEST_CCAPP
2206 cfg_get_item("voip_status",voip_status,sizeof(voip_status));
2207
2208 if (0 != strcmp("ledoff" , voip_status ))
2209#endif
2210 {
2211 zCc_SetLedStatus("ledoff");
2212 }
2213
2214 shall_ring_cid = 0;
2215 held_call_cid = zCc_find_held_cid();
2216 incoming_call_cid = zCc_find_held_incoming_cid();
2217 if(held_call_cid && (ptMsgBuf->dst_id!=held_call_cid))
2218 shall_ring_cid = held_call_cid;
2219 else if(incoming_call_cid && (ptMsgBuf->dst_id!=incoming_call_cid))
2220 shall_ring_cid = incoming_call_cid;
2221
2222 if(shall_ring_cid!=0)
2223 {
2224 memset(&tSig, 0, sizeof(tSig));
2225 g_Cc_CallDetail.state = ZCC_M_RINGING_S;
2226 tSig.signal_type = RING_SIGNAL;
2227 /*memcpy(tSig.cid,
2228 g_Cc_CallDetail.slaveObj[shall_ring_cid].number,
2229 strlen(g_Cc_CallDetail.slaveObj[shall_ring_cid].number));*/
2230 strncpy(tSig.cid, g_Cc_CallDetail.slaveObj[shall_ring_cid].number, sizeof(tSig.cid)-1);
2231 get_local_datetime(tSig.date_time);
2232 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_RunMaster RING_SIGNAL,number = %s\n",__FUNCTION__,g_Cc_CallDetail.slaveObj[held_call_cid].number);
2233 SLIC_Play_Signal(0, 0, &tSig);
2234 zCc_SetLedStatus("ledblink");
2235 }
2236 break;
2237
2238 default:
2239 // do nothing
2240 break;
2241 }
2242}
2243
2244VOID zCc_MSeizeState(MSG_BUF *ptMsgBuf)
2245{
2246 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState ptMsgBuf->usMsgCmd = %d\n",__FUNCTION__,ptMsgBuf->usMsgCmd);
2247 UINT8 slave = (UINT8)ptMsgBuf->dst_id;
2248 UINT8 callCnt = 0;
2249 UINT8 ret = 0;
2250 SINT32 chldret = -1;
2251 UINT8 tmpslave = 0;
2252 CHAR voip_status[ZDIAL_NUM_MAX] = {0};
mj.qu8ddc7642025-06-11 04:37:19 -07002253 char hotline_time[4] = {0};
mj.qu1524fc92025-06-11 04:34:13 -07002254
mj.qu58875012025-06-19 02:45:53 -07002255 char callback_enable[4] = {0};
2256 char callback_number[20] = {0};
2257 cfg_get_item("callback_enable", callback_enable, sizeof(callback_enable));
2258 cfg_get_item("callback_number", callback_number, sizeof(callback_number));
2259
mj.qu1524fc92025-06-11 04:34:13 -07002260 printf("[ccapp_debug]: Seize State Recv MsgCmd: %d,localtest=%d\n",ptMsgBuf->usMsgCmd,local_test_call_st);
2261
2262 switch (ptMsgBuf->usMsgCmd)
2263 {
2264 case ZCC_DTMF_E: // ²¦ºÅ
2265 // slave[0] dial , or other call's DTMF
2266 ccapp_log("--> ZCC_DTMF_E[%c] lastTone=%d Count=%d Held=%d Active=%d getSlave(DACCM)=%d getSlave(RINGBACK)=%d ringCid=%d dig=%s",
2267 ptMsgBuf->aucDataBuf[0],
2268 g_Cc_CallDetail.lastTone,
2269 zCc_CallCount(),
2270 zCc_HeldCall(),
2271 zCc_ActiveCall(),
2272 zCc_GetSpecSlave(ZCC_S_DACCM_S),
2273 zCc_GetSpecSlave(ZCC_S_RINGBACK_S),
2274 g_Cc_CallDetail.ringCid,
2275 g_Cc_CallDetail.digits);
2276 printf("[ccapp_debug]: ZCC_DTMF_E[%c] lastTone=%d Count=%d Held=%d Active=%d getSlave(DACCM)=%d getSlave(RINGBACK)=%d ringCid=%d dig=%s\n",
2277 ptMsgBuf->aucDataBuf[0],
2278 g_Cc_CallDetail.lastTone,
2279 zCc_CallCount(),
2280 zCc_HeldCall(),
2281 zCc_ActiveCall(),
2282 zCc_GetSpecSlave(ZCC_S_DACCM_S),
2283 zCc_GetSpecSlave(ZCC_S_RINGBACK_S),
2284 g_Cc_CallDetail.ringCid,
2285 g_Cc_CallDetail.digits);
2286
2287 /* callwait ringback but he drop then we hookflash+1
2288lastTone=6 Count=2 Held=1 Active=0 getSlave(DACCM)=0 getSlave(RINGBACK)=2 ringCid=0 dig[0]=F
2289 */
2290 if ((g_Cc_CallDetail.lastTone == ZCC_TONE_BSY_A) || (g_Cc_CallDetail.lastTone == ZCC_TONE_TKY_A))//æÒôºÍÃùº¿Òô£¬²»´¦Àí°´¼üÏûÏ¢
2291 {
2292 zCc_ClearDigits();
2293 break;
2294 }
2295 callCnt = zCc_CallCount();
2296 if ( (g_Cc_CallDetail.lastTone == ZCC_TONE_DIAL_A || callCnt == zCc_HeldCall()) //Ö»Óб£³Öºô½Ð£¬²¦ºÅ·¢Æðкô½Ð
2297 && g_Cc_CallDetail.digits[0] != ZCC_FLASH_SIGN
2298 && 0 == zCc_ActiveCall())//·Å²¦ºÅÒô»òÒÑÓб£³Öºô½ÐʱÓû§²¦ºÅ,µÚÒ»¸ö×Ö·û£¬Åųýactive+heldʱÏ·¢F2
2299 {
2300 slave = zCc_GetSpecSlave(ZCC_S_IDLE_S);
2301 if (0 == slave )
2302 {
2303 return;
2304 }
2305 g_Cc_CallDetail.slaveObj[slave] = g_Cc_CallDetail.slaveObj[0];
2306 g_Cc_CallDetail.evt[slave] = ZCC_DTMF_E;
2307 DeleteSoftTimer(ZCCAPP_TIMER_SSDIALTONE_DETECT);
2308 zCc_InitSlaveObj(0);
2309 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState ZCC_DTMF_E \n",__FUNCTION__);
2310 break;
2311 }
2312 else if ((g_Cc_CallDetail.lastTone == ZCC_TONE_SIL_A) && (0 != zCc_GetSpecSlave(ZCC_S_DACCM_S)))//¼ÌÐø²¦ºÅ
2313 {
2314 slave = zCc_GetSpecSlave(ZCC_S_DACCM_S);
2315 g_Cc_CallDetail.evt[slave] = ZCC_DTMF_E;
2316 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState ZCC_DTMF_E \n",__FUNCTION__);
2317 break;
2318 }
2319 else if ((g_Cc_CallDetail.digits[0] != ZCC_FLASH_SIGN) && ((0 != zCc_ActiveCall())
2320 ||((0 == zCc_ActiveCall()) && (0 != zCc_GetSpecSlave(ZCC_S_RINGBACK_S)))))//·¢dtmf
2321 {
2322 if (0 != zCc_ActiveCall())
2323 {
2324 slave = zCc_GetCallSlave(0);
2325 }
2326 else
2327 {
2328 slave = zCc_GetSpecSlave(ZCC_S_RINGBACK_S);
2329 }
2330 g_Cc_CallDetail.evt[slave] = ZCC_DTMF_E;
2331 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState ZCC_DTMF_E \n",__FUNCTION__);
2332 break;
2333 }
2334 else if ((0 == zCc_ActiveCall()) && (0 == zCc_GetSpecSlave(ZCC_S_RINGBACK_S))
2335 && (g_Cc_CallDetail.digits[0] != ZCC_FLASH_SIGN))//·ÇÎÈ̬·Ç»ØÁåÒô״̬ÊÕµ½×Ö·û£¬¶ªÆú
2336 {
2337 zCc_ClearDigits();
2338 return;
2339 }
2340 else
2341 {
2342 if (g_Cc_CallDetail.ringCid && (g_Cc_CallDetail.slaveObj[g_Cc_CallDetail.ringCid].tone == ZCC_TONE_CIDCW_A))//active+waiting+flashordtmf
2343 {
2344 DeleteSoftTimer(ZCCAPP_TIMER_SSDIALTONE_DETECT);
2345 if (g_Cc_CallDetail.digits[0] != ZCC_FLASH_SIGN)
2346 {
2347 slave = zCc_GetSpecSlave(ZCC_S_TALKING_S);
2348 if (0 == slave )
2349 {
2350 return;
2351 }
2352 g_Cc_CallDetail.evt[slave] = ZCC_DTMF_E;
2353 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState ZCC_DTMF_E \n",__FUNCTION__);
2354 break;
2355 }
2356 }
2357
2358 DeleteSoftTimer(ZCCAPP_TIMER_DTMF_DETECT);
2359 ret = zCc_DigitsMatch();
2360 if ((ZCC_NO_RESULT != ret && ZCC_MATCHERR != ret && g_Cc_CallDetail.lastTone == ZCC_TONE_DIAL_A)
2361 ||(ZCC_MATCHERR == ret && g_Cc_CallDetail.lastTone == ZCC_TONE_DIAL_A && 2 <= zCc_CallCount()))
2362 {//call waitingÊÕµ½flash4£¬Í£Ö¹²¦ºÅÒô»Ö¸´ºô½ÐµÈ´ýÒô
2363 SLIC_Stop_Signal(0, TONE_SIGNAL);
2364 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState: SLIC_Stop_Signal <---\n",__FUNCTION__);
2365 g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
2366 if (g_Cc_CallDetail.slaveObj[0].tone != ZCC_TONE_OFF_A)
2367 {
2368 zCc_InitSlaveObj(0);
2369 }
2370 if (0 != zCc_ActiveCall())
2371 {
2372 SLIC_Start_PCM();
2373 }
2374 if ((ZCC_FLASH_1 == ret || ZCC_FLASH_2 == ret) && (g_Cc_CallDetail.ringCid != 0))//½ÓÌýwaiting call£¬ºô½ÐµÈ´ýÒôÓ¦Çå¿Õ
2375 {
2376 g_Cc_CallDetail.slaveObj[g_Cc_CallDetail.ringCid].tone = ZCC_TONE_OFF_A;
2377 }
2378 }
2379 zCc_DigitsMatchRltProc(ret);
2380 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState ZCC_DTMF_E \n",__FUNCTION__);
2381 }
2382
2383 break;
2384
2385 case ZCC_SDIALLING_E: // ·¢³öÁËSIP INVITE »ò CC SETUP , ͨ¹ýÕâ¸öÏûÏ¢Éϱ¨ cid
2386 if (0 != zCc_GetDialingSlave(0))
2387 {
2388 tmpslave = zCc_GetDialingSlave(0);
2389 if (tmpslave != slave)
2390 {
2391 g_Cc_CallDetail.slaveObj[slave] = g_Cc_CallDetail.slaveObj[tmpslave];
2392 zCc_InitSlaveObj(tmpslave);
2393 }
2394 }
2395 break;
2396
2397 case ZCC_SRING_E:
2398 case ZCC_SANS_E:
2399 case ZCC_SINVITE_E:
2400 case ZCC_CIDCW_E:
2401 g_Cc_CallDetail.evt[slave] = ptMsgBuf->usMsgCmd;
2402 break;
2403
2404 case ZCC_SDISCN_MT_E:
2405 case ZCC_SDISCN_MO_E:
2406 { //cov m
2407 if(check_incoming_call_is_in_slave(ptMsgBuf)==0)
2408 break;
2409
2410 g_Cc_CallDetail.evt[slave] = ptMsgBuf->usMsgCmd;
2411
2412 T_zCcApp_DsciInd *ptr = ptMsgBuf->aucDataBuf;
2413
2414 /* somebody drop the call
2415 zCc_MSeizeState zCc_MSeizeState ptMsgBuf->usMsgCmd = 43
2416 zCc_MSeizeState ==> get MT/MO cid=1 num=13088877803 stat=6 inMp=0 getCnt=2
2417 zCc_MSeizeState slv=1 cid=0 held=1 stat=8
2418 zCc_MSeizeState slv=2 cid=0 held=0 stat=8
2419 zCc_STalkingState zCc_STalkingState g_Cc_CallDetail.evt[1] = 43
2420 */
2421 ccapp_log("==> get MT/MO cid=%d num=%s stat=%d inMp=%d getCnt=%d",
2422 ptr->cid, ptr->num, ptr->state, ptr->inMpty,
2423 zCc_CallCount());
2424
2425 for (tmpslave = 0; tmpslave < ZCC_SLAVES; tmpslave++)
2426 {
2427 if (g_Cc_CallDetail.slaveObj[tmpslave].state != ZCC_S_IDLE_S)
2428 {
2429 ccapp_log(" slave=%d cid=%d held=%d stat=%d",
2430 tmpslave,
2431 g_Cc_CallDetail.slaveObj[tmpslave].cid,
2432 g_Cc_CallDetail.slaveObj[tmpslave].heldcall,
2433 g_Cc_CallDetail.slaveObj[tmpslave].state);
2434 }
2435 }
2436
2437 if(zCc_CallCount()<2)
2438 break;
2439
2440 if(ptr->cid>=ZCC_SLAVES) //cov m
2441 break;
2442
2443 if(g_Cc_CallDetail.slaveObj[ptr->cid].heldcall==0 &&
2444 g_Cc_CallDetail.slaveObj[ptr->cid].confcall==0)
2445 {
2446 if(zCc_HeldCall())
2447 {
2448 zCc_SendAtChldReq(1);
2449 break;
2450 }
2451 }
2452
2453 int incoming_call_cid = zCc_GetSpecSlave(ZCC_S_TRYING_S);
2454 if(incoming_call_cid!=0 && incoming_call_cid!=ptr->cid)
2455 zCc_SendAtChldReq(2);
2456
2457 #if 0
2458 tmpslave = zCc_GetSpecSlave(ZCC_S_TRYING_S); // incoming call here and wait for to be accepted
2459 ccapp_log("zCc_CallCount()=%d zCc_GetSpecSlave(ZCC_S_TRYING_S)=%d",
2460 zCc_CallCount(),
2461 tmpslave);
2462 if(tmpslave!=0 && ptMsgBuf->usMsgCmd==ZCC_SDISCN_MO_E) // foreground drop, automaticly accept the incoming call
2463 {
2464 SLIC_Stop_Signal(0, TONE_SIGNAL);
2465 zCc_SendAtChldReq(1);
2466 break;
2467 }
2468
2469 if(zCc_CallCount()<2)
2470 break;
2471
2472 if(ptr->cid<0 || ptr->cid>=ZCC_SLAVES)
2473 break;
2474
2475 if(g_Cc_CallDetail.slaveObj[ptr->cid].heldcall==0 &&
2476 g_Cc_CallDetail.slaveObj[ptr->cid].confcall==0)
2477 {
2478 /*if(g_Cc_CallDetail.slaveObj[ptr->cid].state==ZCC_S_DIALING_S ||
2479 g_Cc_CallDetail.slaveObj[ptr->cid].state==ZCC_S_RINGBACK_S ||
2480 g_Cc_CallDetail.slaveObj[ptr->cid].state==ZCC_S_TALKING_S) */
2481 if(zCc_HeldCall())
2482 {
2483 zCc_SendAtChldReq(1);
2484 }
2485 }
2486 #endif
2487 break;
2488 }
2489 case ZCC_RELEASE_E:
2490 if(local_test_call_st==LocalTestCallST_Start)
2491 {
2492 SIGNAL_DATA tSig;
2493
2494 SLIC_Stop_Signal(0, TONE_SIGNAL);
2495
2496 memset(&tSig, 0, sizeof(tSig));
2497 tSig.signal_type = RING_SIGNAL;
2498 strcpy(g_Cc_CallDetail.number, "1234567890");
2499 strncpy(tSig.cid, g_Cc_CallDetail.number,sizeof(tSig.cid)-1);
2500 get_local_datetime(tSig.date_time);
2501 ccapp_log("local test call RING_SIGNAL,number = %s\n",g_Cc_CallDetail.number);
2502 SLIC_Play_Signal(0, 0, &tSig);
2503 zCc_SetLedStatus("ledblink");
2504
2505 if(local_test_call_type == LocalTestCallType_LOOP) {
2506 if (pthread_create(&slic_ring_test_pid, NULL, slic_ring_test_thread,0) != 0) //cov m
2507 printf("slic_ring_test_thread create fail\n");
2508 }
2509
2510 g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
2511 g_Cc_CallDetail.evt[slave]= ZCC_NO_E;
2512 g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SNO_M;
2513 g_Cc_CallDetail.state = ZCC_M_RINGING_S;
2514
2515 local_test_call_st = LocalTestCallST_Ring;
2516 zCc_ShowAllSlaveWithTips("testCall-ring");
2517 break;
2518 }
2519 else if(local_test_call_st==LocalTestCallST_End)
2520 {
2521 zCc_ClearDigits();
2522 zCc_InitSlaveObj(0);
2523 for (slave = 1; slave < ZCC_SLAVES; slave++)
2524 {
2525 if (g_Cc_CallDetail.slaveObj[slave].state != ZCC_S_IDLE_S)
2526 zCc_InitSlaveObj(slave);
2527 }
2528
2529 SLIC_Stop_Signal(0, TONE_SIGNAL);
2530 SLIC_Stop_PCM();
2531 zCc_SetLedStatus("ledoff");
2532
2533 g_Cc_CallDetail.resourceReady = 0;
2534 g_Cc_CallDetail.hookofffg = FALSE;
2535 g_Cc_CallDetail.state = ZCC_M_RELEASE_S;
2536
2537 //system("echo loop_0 >> /tmp/log.ccapp.vploop");
2538 //system("( sleep 1 && at_cmd AT+VPLOOP=0 ) &");
2539 cfg_set("tz_vploop", "0");
2540 ipc_send_message(MODULE_ID_CALL_CTRL_LOCAL,
2541 MODULE_ID_AT_CTL,
2542 MSG_CMD_SET_VPLOOP_REQ,
2543 0,
2544 NULL,
2545 0);
2546
2547 DeleteSoftTimer(ZCCAPP_TIMER_HOOKOFF_DETECT);
2548 DeleteSoftTimer(ZCCAPP_TIMER_DTMF_DETECT);
2549 DeleteSoftTimer(ZCCAPP_TIMER_BUSYTONE_DETECT);
2550 DeleteSoftTimer(ZCCAPP_TIMER_TKYTONE_DETECT);
2551 DeleteSoftTimer(ZCCAPP_TIMER_SSDIALTONE_DETECT);
2552 DeleteSoftTimer(ZCCAPP_TIMER_HOOKOFF_IDLE);
2553
2554 local_test_call_st = LocalTestCallST_None;
2555 zCc_ShowAllSlaveWithTips("testCall-end-none");
2556 break;
2557 }
2558
2559 for (slave = 1; slave < ZCC_SLAVES; slave++)
2560 {
2561 if (g_Cc_CallDetail.slaveObj[slave].state != ZCC_S_IDLE_S && g_Cc_CallDetail.slaveObj[slave].waitDSCI6 == 0)
2562 {
2563 g_Cc_CallDetail.evt[slave] = ZCC_DISCN_E;
2564 }
2565 }
2566 //if(slave == ZCC_SLAVES)
2567 // return;
2568 if (g_Cc_CallDetail.slaveObj[0].state != ZCC_S_IDLE_S)//slave0½öÓÃÓÚ·ÅÒô£¬²»¶ÔÓ¦ºô½Ð
2569 {
2570 zCc_InitSlaveObj(0);
2571 }
2572 SLIC_Stop_Signal(0, TONE_SIGNAL);
2573 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState: SLIC_Stop_Signal <---\n",__FUNCTION__);
2574 g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
2575 //g_Cc_CallDetail.chupSent = FALSE;
2576 //SLIC_Stop_PCM();
2577 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState: SLIC_Stop_PCM <---\n",__FUNCTION__);
2578
2579#ifndef TEST_CCAPP
2580
2581
2582 cfg_get_item("voip_status",voip_status,sizeof(voip_status));
2583
2584 if (0 != strcmp("ledoff" , voip_status ))
2585#endif
2586 {
2587 zCc_SetLedStatus("ledoff");
2588 }
2589 g_Cc_CallDetail.state = ZCC_M_RELEASE_S;
2590 if (!(0 != zCc_GetSpecSlave(ZCC_S_TRYING_S) && (1 == zCc_CallCount())))//Õª»úʱµÄÀ´µç£¬²»Çå
2591 {
2592 g_Cc_CallDetail.resourceReady = 0;
2593 }
2594 zCc_ClearDigits();
2595 g_Cc_CallDetail.hookofffg = FALSE;
2596 DeleteSoftTimer(ZCCAPP_TIMER_HOOKOFF_DETECT);//ÊÕµ½ÉÁ¶Ï£¬µ±Ç°¶¨Ê±Æ÷¶¼ÐèҪֹͣ£¬ºóÐøÔÙÆô¶¯
2597 DeleteSoftTimer(ZCCAPP_TIMER_DTMF_DETECT);
2598 DeleteSoftTimer(ZCCAPP_TIMER_BUSYTONE_DETECT);
2599 DeleteSoftTimer(ZCCAPP_TIMER_TKYTONE_DETECT);
2600 DeleteSoftTimer(ZCCAPP_TIMER_SSDIALTONE_DETECT);
2601
2602 DeleteSoftTimer(ZCCAPP_TIMER_HOOKOFF_IDLE);
2603 for (slave = 1; slave < ZCC_SLAVES; slave++)
2604 {
2605 g_Cc_CallDetail.slaveObj[slave].idle_second = 0;//hook off ldle timer is killed, time_cnt reset
2606 }
2607
2608 break;
2609 case ZCC_BUSYTONETIMER_E:
2610 for (slave = 0; slave < ZCC_SLAVES; slave++)
2611 {
2612 if(g_Cc_CallDetail.slaveObj[slave].tone == ZCC_TONE_BSY_A)
2613 break;
2614 }
2615 if(slave == ZCC_SLAVES)
2616 return;
2617 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_TKY_A;
2618 CreateSoftTimer(ZCCAPP_TIMER_TKYTONE_DETECT,
2619 0,
2620 ZCCAPP_TIMER_TKYTONE_INTERVAL,
2621 zCcApp_TkyToneTimer,
2622 NULL);
2623 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState CreateSoftTimer zCcApp_TkyToneTimer\n",__FUNCTION__);
2624 if (!(0 == zCc_GetSpecSlave(ZCC_S_BSYT_S)
2625 &&(g_Cc_CallDetail.slaveObj[slave].state== ZCC_S_WAIT_RESOURCE_S
2626 ||g_Cc_CallDetail.slaveObj[slave].state== ZCC_S_TRYING_S)
2627 && g_Cc_CallDetail.lastTone == ZCC_TONE_BSY_A))
2628 {
2629 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_TKYT_S;
2630 }
2631 return;
2632 case ZCC_HOOKOFFTIMER_E:
2633 for (slave = 0; slave < ZCC_SLAVES; slave++)
2634 {
2635 if(g_Cc_CallDetail.slaveObj[slave].state == ZCC_S_DT_S)
2636 break;
2637 }
2638 if(slave == ZCC_SLAVES)
2639 return;
2640 if (1 == zCc_BusyToneAllowed() && g_Cc_CallDetail.state == ZCC_M_SEIZE_S)//ÓÐÆäËûºô½Ðʱ²»·ÅæÒô
2641 {
2642 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_BSY_A;
2643 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_BSYT_S;
2644 g_Cc_CallDetail.slaveObj[slave].confcall = 0;
2645 g_Cc_CallDetail.slaveObj[slave].heldcall = 0;
2646 CreateSoftTimer(ZCCAPP_TIMER_BUSYTONE_DETECT,
2647 0,
2648 ZCCAPP_TIMER_BUSYTONE_INTERVAL,
2649 zCcApp_BusyToneTimer,
2650 NULL);
2651 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState CreateSoftTimer zCcApp_BusyToneTimer22222\n",__FUNCTION__);
2652 }
2653 else
2654 {
2655 zCc_InitSlaveObj(slave);
2656 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
2657 }
2658 return;
2659 case ZCC_HOOKOFF_IDLE_TIMER_E:
2660 for (slave = 0; slave < ZCC_SLAVES; slave++)
2661 {
2662 if(g_Cc_CallDetail.slaveObj[slave].state == ZCC_S_DT_S)
2663 {
mj.qu58875012025-06-19 02:45:53 -07002664 if(0 == strcmp(callback_enable, "1") && 1 == check_phone_number_in_file(callback_number, "/cache/call_back_list"))
2665 {
2666 if(strlen(callback_number) <=0 )
2667 {
2668 DeleteSoftTimer(ZCCAPP_TIMER_HOOKOFF_IDLE);
2669 break;
2670 }
2671
2672 strcpy(g_Cc_CallDetail.digits, callback_number);
2673 g_Cc_CallDetail.dCount = strlen(callback_number);
2674
2675 MSG_BUF msgBuf = {0};
2676 msgBuf.usMsgCmd = ZCC_DTMF_E;
2677 msgBuf.src_id = MODULE_ID_SLIC;
2678 msgBuf.aucDataBuf[0] = (UINT8)'#';
2679 msgBuf.usDataLen = 1;
2680 zCc_SendMsgToSub(&msgBuf);
2681
2682 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_SIL_A;
2683 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_DACCM_S;
2684
2685 DeleteSoftTimer(ZCCAPP_TIMER_HOOKOFF_DETECT);
2686
2687 ccapp_log("==> HOOKOFF_IDLE_TIMER send callback_number=%s\n", callback_number);
2688
2689 break;
2690 }
2691
mj.qu8ddc7642025-06-11 04:37:19 -07002692 cfg_get_item("hotline_time", hotline_time, sizeof(hotline_time));
mj.qu1524fc92025-06-11 04:34:13 -07002693 g_Cc_CallDetail.slaveObj[slave].idle_second++;
mj.qu8ddc7642025-06-11 04:37:19 -07002694 if(g_Cc_CallDetail.slaveObj[slave].idle_second >= atoi(hotline_time) * 2)
mj.qu1524fc92025-06-11 04:34:13 -07002695 {
2696 int rt;
2697 char hotline[ZDIAL_NUM_MAX-1];
2698
2699 memset(hotline, 0, sizeof(hotline));
mj.qu8ddc7642025-06-11 04:37:19 -07002700 rt = cfg_get_item("hotline_number", hotline, sizeof(hotline)-1);
mj.qu1524fc92025-06-11 04:34:13 -07002701 if(rt!=0 || strlen(hotline)<=0)
2702 {
2703 DeleteSoftTimer(ZCCAPP_TIMER_HOOKOFF_IDLE);
2704 break;
2705 }
2706
2707 strcpy(g_Cc_CallDetail.digits, hotline);
2708 g_Cc_CallDetail.dCount = strlen(hotline);
2709
2710 MSG_BUF msgBuf = {0};
2711 msgBuf.usMsgCmd = ZCC_DTMF_E;
2712 msgBuf.src_id = MODULE_ID_SLIC;
2713 msgBuf.aucDataBuf[0] = (UINT8)'#';
2714 msgBuf.usDataLen = 1;
2715 zCc_SendMsgToSub(&msgBuf);
2716
2717 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_SIL_A;
2718 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_DACCM_S;
2719
2720 DeleteSoftTimer(ZCCAPP_TIMER_HOOKOFF_DETECT);
2721
2722 ccapp_log("==> HOOKOFF_IDLE_TIMER send hotline=%s\n", hotline);
2723 }
2724 }
2725 }
2726 break;
2727 case ZCC_DTMFTIMER_E:
2728 for (slave = 0; slave < ZCC_SLAVES; slave++)
2729 {
2730 if(g_Cc_CallDetail.slaveObj[slave].state == ZCC_S_DACCM_S)
2731 break;
2732 }
2733 if(slave == ZCC_SLAVES)
2734 return;
2735 g_Cc_CallDetail.digits[g_Cc_CallDetail.dCount++] = ZCC_TIMEOUT_SIGN;
2736 ret = zCc_DigitsMatch();
2737 zCc_DigitsMatchRltProc(ret);
2738 if (ZCC_MATCHERR != ret)
2739 {
2740 if (g_Cc_CallDetail.slaveObj[slave].state == ZCC_S_IDLE_S)//ss
2741 {
2742 zCc_SendSsReq(g_Cc_CallDetail.digits);
2743 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_OFF_A;
2744 }
2745 else
2746 {
2747 zCc_SendAtDialReq(g_Cc_CallDetail.digits);
2748 }
2749 }
2750 g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SNO_M;
2751 zCc_ClearDigits();
2752 return;
2753 case ZCC_TKYTIMER_E:
2754 for (slave = 0; slave < ZCC_SLAVES; slave++)
2755 {
2756 if(g_Cc_CallDetail.slaveObj[slave].tone == ZCC_TONE_TKY_A)
2757 break;
2758 }
2759 if(slave == ZCC_SLAVES)
2760 return;
2761 SLIC_Stop_Signal(0, TONE_SIGNAL);
2762 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState: SLIC_Stop_Signal <---\n",__FUNCTION__);
2763 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_SIL_A;
2764 if (!(0 == zCc_GetSpecSlave(ZCC_S_TKYT_S)
2765 &&(g_Cc_CallDetail.slaveObj[slave].state== ZCC_S_WAIT_RESOURCE_S
2766 ||g_Cc_CallDetail.slaveObj[slave].state== ZCC_S_TRYING_S)
2767 && g_Cc_CallDetail.lastTone == ZCC_TONE_TKY_A))
2768 {
2769 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_SIL_S;
2770 }
2771 g_Cc_CallDetail.lastTone = ZCC_TONE_SIL_A;
2772 return;
2773 case ZCC_SSDIALTONETIMER_E:
2774 zCc_InitSlaveObj(0);//·Å²¦ºÅÒôµÄslave0 Çå¿Õ
2775 zCc_ClearDigits();
2776 if (1 == zCc_CallCount()
2777 && (g_Cc_CallDetail.lastTone == ZCC_TONE_DIAL_A))//µ±Ç°Ö»ÓÐһ·£¬Í£Ö¹²¦ºÅÒô
2778 {
2779 SLIC_Stop_Signal(0,0);
2780 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState: SLIC_Stop_Signal <---\n",__FUNCTION__);
2781 g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
2782 if (1 == zCc_HeldCall())//Òѱ£³Ö£¬»Ö¸´
2783 {
2784 chldret = zCc_SendAtChldReq(2);
2785 }
2786 else if (0 != zCc_ActiveCall())
2787 {
2788 SLIC_Start_PCM();
2789 }
2790 }
2791 else if (1 < zCc_CallCount() && (g_Cc_CallDetail.lastTone == ZCC_TONE_DIAL_A))//active/held mpty and held+waiting
2792 {
2793 SLIC_Stop_Signal(0,0);
2794 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState: SLIC_Stop_Signal <---\n",__FUNCTION__);
2795 g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
2796 if((0 == zCc_HeldCall() && 0 != g_Cc_CallDetail.ringCid)//active+waiting »Ö¸´ÓïÒô£¬held+waiting, ²»»Ö¸´ÓïÒô£¬·Åºô½ÐµÈ´ýÒô
2797 ||(0 != zCc_HeldCall() && 0 !=zCc_ActiveCall()))//active+held»Ö¸´ÓïÒô
2798 {
2799 SLIC_Start_PCM();
2800 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState: SLIC_Start_PCM <---\n",__FUNCTION__);
2801 }
2802 }
2803 return;
2804 case ZCC_FLASH_E:
2805 ccapp_log("ZCC_FLASH_E cnt=%d held=%d active=%d BefDial=%d",
2806 zCc_CallCount(),
2807 zCc_HeldCall(),
2808 zCc_ActiveCall(),
2809 zCc_MoBeforDialingCall());
2810
2811 if (!(zCc_CallCount() > 1 && g_Cc_CallDetail.digits[0] == ZCC_FLASH_SIGN))//¶à·ºô½Ðʱ£¬ÐèÒªÅжÏflashÁ¬·¢Á½´ÎµÄ³¡¾°£¬²»Çå³ý
2812 {
2813 zCc_ClearDigits();
2814 }
2815 DeleteSoftTimer(ZCCAPP_TIMER_HOOKOFF_DETECT);//ÊÕµ½ÉÁ¶Ï£¬µ±Ç°¶¨Ê±Æ÷¶¼ÐèҪֹͣ£¬ºóÐøÔÙÆô¶¯
2816 DeleteSoftTimer(ZCCAPP_TIMER_DTMF_DETECT);
2817 DeleteSoftTimer(ZCCAPP_TIMER_BUSYTONE_DETECT);
2818 DeleteSoftTimer(ZCCAPP_TIMER_TKYTONE_DETECT);
2819 DeleteSoftTimer(ZCCAPP_TIMER_SSDIALTONE_DETECT);
2820
2821 callCnt = zCc_CallCount();
2822
2823 if (g_Cc_CallDetail.ringCid && (g_Cc_CallDetail.slaveObj[g_Cc_CallDetail.ringCid].tone == ZCC_TONE_CIDCW_A))//ºô½ÐµÈ´ý£¬¸ù¾ÝflashºóÃæµÄ×Ö·û¾ö¶¨ºóÐø²Ù×÷
2824 {
2825 if(g_Cc_CallDetail.digits[0] == ZCC_FLASH_SIGN)
2826 {
2827 zCc_InitSlaveObj(0);
2828 zCc_ClearDigits();
2829 SLIC_Stop_Signal(0,0);
2830 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState: SLIC_Stop_Signal <---\n",__FUNCTION__);
2831 g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
2832 if (0 != zCc_ActiveCall())
2833 {
2834 SLIC_Start_PCM();
2835 }
2836 break;
2837 }
2838 g_Cc_CallDetail.digits[g_Cc_CallDetail.dCount++] = ZCC_FLASH_SIGN;
2839 // slave[0] to play dial tone
2840 CreateSoftTimer(ZCCAPP_TIMER_SSDIALTONE_DETECT,
2841 0,
2842 ZCCAPP_TIMER_HOOKOFF_INTERVAL,
2843 zCcApp_SsDialToneTimer,
2844 NULL);
2845 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState: CreateSoftTimer zCcApp_SsDialToneTimer\n",__FUNCTION__);
2846 g_Cc_CallDetail.evt[0] = ZCC_DIAL_E;
2847 //g_Cc_CallDetail.slaveObj[g_Cc_CallDetail.ringCid].tone = ZCC_TONE_OFF_A;±£Áô¸Ã×ֶΣ¬ÓÃÓÚflash4µÈʧ°Üʱ»Ö¸´ºô½ÐµÈ´ýÒô
2848 SLIC_Stop_PCM();
2849 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState: SLIC_Stop_PCM2222\n",__FUNCTION__);
2850 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState:ZCC_FLASH_E\n",__FUNCTION__);
2851 break;
2852 }
2853
2854 if ( callCnt==0 //·Å²¦ºÅÒô»¹Î´Íê³É²¦ºÅ»òÕª»ú䲦ºÅ·ÅæÒôº¿ÃùÒô¾²Òô
2855 ||(callCnt ==1 && zCc_FlashClearCall() > 0)) //ÕÒµ½½¨Á¢ÖеÄÖ÷½ÐÒÔ¼°ÊÍ·ÅÖеĺô½Ð£¬ÊÍ·Å£¬²¢·Å²¦ºÅÒô
2856 {
2857 zCc_InitSlaveObj(0);
2858 g_Cc_CallDetail.evt[0] = ZCC_DIAL_E;
2859 SLIC_Stop_PCM();
2860 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState:SLIC_Stop_PCM\n",__FUNCTION__);
2861 g_Cc_CallDetail.hookofffg = TRUE;
2862 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState:ZCC_FLASH_E\n",__FUNCTION__);
2863 break;
2864 }
2865
2866 if (zCc_ActiveCall() == callCnt) //Ö»ÓÐactive call£¬±£³ÖËü£¬²¢·Å²¦ºÅÒô
2867 {
2868 if (callCnt > 1) // conf call, ·Å²¦ºÅÒô
2869 {
2870 g_Cc_CallDetail.digits[g_Cc_CallDetail.dCount++] = ZCC_FLASH_SIGN;
2871 g_Cc_CallDetail.digits[ZDIAL_NUM_MAX-1] = 1;// ¼Ç¼±¾´Î²Ù×÷ΪÕë¶Ôconf µÄ
2872 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState:ZCC_FLASH_E\n",__FUNCTION__);
2873 }
2874 else
2875 {
2876 chldret = zCc_SendAtChldReq(2);
2877 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState:ZCC_FLASH_E\n",__FUNCTION__);
2878 g_Cc_CallDetail.waitchldresult = 1;
2879 }
2880 break;
2881 }
2882
2883 if (zCc_HeldCall() == callCnt) //Ö»ÓÐheld call£¬»Ö¸´
2884 {
2885 if (callCnt == 1 )
2886 {
2887 chldret = zCc_SendAtChldReq(2);
2888 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState:ZCC_FLASH_E\n",__FUNCTION__);
2889 }
2890 else
2891 {
2892 g_Cc_CallDetail.digits[g_Cc_CallDetail.dCount++] = ZCC_FLASH_SIGN;
2893 CreateSoftTimer(ZCCAPP_TIMER_SSDIALTONE_DETECT,
2894 0,
2895 ZCCAPP_TIMER_HOOKOFF_INTERVAL,
2896 zCcApp_SsDialToneTimer,
2897 NULL);
2898 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState:CreateSoftTimer zCcApp_SsDialToneTimer\n",__FUNCTION__);
2899 g_Cc_CallDetail.evt[0] = ZCC_DIAL_E;
2900
2901 }
2902 break;
2903 }
2904 //active + held
2905
2906 if(g_Cc_CallDetail.digits[0] == ZCC_FLASH_SIGN)
2907 {
2908 zCc_InitSlaveObj(0);
2909 zCc_ClearDigits();
2910 SLIC_Stop_Signal(0,0);
2911 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState: SLIC_Stop_Signal <---\n",__FUNCTION__);
2912 g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
2913 if (0 != zCc_ActiveCall())
2914 {
2915 SLIC_Start_PCM();
2916 }
2917 break;
2918 }
2919
2920 /*
2921 zCc_MSeizeState befor=1 act=0 held=1 callCnt=2
2922 zCc_MoBeforDialingCall slave[1]=8
2923 zCc_MoBeforDialingCall slave[2]=4
2924 */
2925 ccapp_log("ZCC_FLASH_E befor=%d active=%d held=%d callCnt=%d",
2926 zCc_MoBeforDialingCall(),
2927 zCc_ActiveCall(),
2928 zCc_HeldCall(),
2929 callCnt);
2930
2931 if (((0 != zCc_MoBeforDialingCall())
2932 && (0 != zCc_ActiveCall() || 0 != zCc_HeldCall())) //active or held + ½¨Á¢Öеĺô½Ð
2933 ||(0 != zCc_MoBeforDialingCall() && 1 == callCnt))
2934 {
2935 /*if(g_Cc_CallDetail.digits[0]==ZCC_FLASH_SIGN &&
2936 strlen(g_Cc_CallDetail.digits)<=3)
2937 {
2938 zCc_InitSlaveObj(0);
2939 zCc_ClearDigits();
2940 zCc_SendAtChldReq(2);
2941 ccapp_log("get ZCC_FLASH_SIGN and return to old talk");
2942 }*/
2943
2944 int cid = zCc_GetMoBeforDialingCallCID();
2945 if(cid>=0 && zCc_HeldCall()!=0) // drop the beforeDialing call
2946 {
2947 zCc_InitSlaveObj(cid);
2948 zCc_ClearDigits();
2949 zCc_SendAtChldReq(1);
2950 ccapp_log("drop the beforeDialing call cid=%d", cid);
2951 }
2952
2953 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState:ZCC_FLASH_E return\n",__FUNCTION__);
2954 return;
2955 }
2956
2957 g_Cc_CallDetail.digits[g_Cc_CallDetail.dCount++] = ZCC_FLASH_SIGN;
2958 g_Cc_CallDetail.evt[0] = ZCC_DIAL_E;
2959 CreateSoftTimer(ZCCAPP_TIMER_SSDIALTONE_DETECT,
2960 0,
2961 ZCCAPP_TIMER_HOOKOFF_INTERVAL,
2962 zCcApp_SsDialToneTimer,
2963 NULL);
2964 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState:CreateSoftTimer zCcApp_SsDialToneTimer\n",__FUNCTION__);
2965 SLIC_Stop_PCM();
2966 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState:SLIC_Stop_PCM\n",__FUNCTION__);
2967 break;
2968
2969 case ZCC_RESOURCE_READY_E:
2970 g_Cc_CallDetail.evt[slave] = ZCC_RESOURCE_READY_E;
2971 break;
2972 /*ATÃüÁîÏìÓ¦£¬Ä¿Ç°Ö»ÓÐatdµÄÏìÓ¦ÐèÒª´¦Àí*/
2973 case MSG_CMD_ATD_DIAL_RSP:
2974 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s ATD_rsp=%d\n",__FUNCTION__,((T_zCcapp_optRsp*)ptMsgBuf->aucDataBuf)->result);
2975 if(((T_zCcapp_optRsp*)ptMsgBuf->aucDataBuf)->result == 0)
2976 break;
2977 slave = zCc_GetDialingSlave(1);
2978 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SendAtDialReq:RECV ERROR\n",__FUNCTION__);
2979 slave = zCc_GetDialingSlave(1);
2980 if (1 == zCc_BusyToneAllowed() && g_Cc_CallDetail.slaveObj[slave].waitDSCI6 == 0 && g_Cc_CallDetail.state == ZCC_M_SEIZE_S)//ÓÐÆäËûºô½ÐÇÒÒѹһúʱ²»·ÅæÒô
2981 {
2982 CreateSoftTimer(ZCCAPP_TIMER_BUSYTONE_DETECT,
2983 0,
2984 ZCCAPP_TIMER_BUSYTONE_INTERVAL,
2985 zCcApp_BusyToneTimer,
2986 NULL);
2987 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SendAtDialReq CreateSoftTimer zCcApp_BusyToneTimer\n",__FUNCTION__);
2988 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_BSY_A;
2989 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_BSYT_S;
2990 g_Cc_CallDetail.slaveObj[slave].confcall = 0;
2991 g_Cc_CallDetail.slaveObj[slave].heldcall = 0;
2992 }
2993 else
2994 {
2995 char num[ZDIAL_NUM_MAX+1];
2996 strcpy(num, g_Cc_CallDetail.slaveObj[slave].number);
2997
2998 zCc_InitSlaveObj(slave);
2999 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
3000
3001 if(zCc_find_held_cid()|| zCc_find_held_incoming_cid()) // restore prvious talk to active
3002 {
3003 zCc_SendAtChldReq(2);
3004
3005 char temp[200];
3006 sprintf(temp, "echo \"%s get error dialout cid=%d num=%s\" > /tmp/log.ccapp.callout.err",
3007 get_local_date_time(), slave, num);
3008 soft_system(temp);
3009 }
3010 }
3011 break;
3012 /*case MSG_CMD_ATA_RSP:
3013 case MSG_CMD_CHUP_RSP:
3014 case MSG_CMD_VTS_RSP:
3015 case MSG_CMD_ZIMSPLUS_RSP:
3016 case MSG_CMD_CCFC_RSP:
3017 case MSG_CMD_CLCK_RSP:
3018 break;*/
3019 case MSG_CMD_CHLD_RSP:
3020 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s CHLD_rsp=%d\n",__FUNCTION__,((T_zCcapp_optRsp*)ptMsgBuf->aucDataBuf)->result);
3021 if(g_Cc_CallDetail.waitchldresult == 1 )
3022 {
3023 g_Cc_CallDetail.waitchldresult = 0;
3024 if (((T_zCcapp_optRsp*)ptMsgBuf->aucDataBuf)->result == 0)
3025 {
3026 CreateSoftTimer(ZCCAPP_TIMER_SSDIALTONE_DETECT,
3027 0,
3028 ZCCAPP_TIMER_HOOKOFF_INTERVAL,
3029 zCcApp_SsDialToneTimer,
3030 NULL);
3031 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState:CreateSoftTimer zCcApp_SsDialToneTimer\n",__FUNCTION__);
3032 g_Cc_CallDetail.evt[0] = ZCC_DIAL_E;
3033 SLIC_Stop_PCM();
3034 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState:SLIC_Stop_PCM\n",__FUNCTION__);
3035 }
3036 }
3037 break;
3038
3039 case ZCC_SEIZE_E: // ͻȜ
3040 default:
3041 // do nothing
3042 break;
3043 }
3044}
3045
3046
3047//get local time string , format"YYYY-MM-DD HH:MM:SS"
3048char *get_local_date_time(void)
3049{
3050 time_t now;
3051 struct tm *timenow;
3052 static char localtimestr[32];
3053
3054 time(&now);
3055 timenow = localtime(&now);
3056 memset(localtimestr, 0, 32);
3057 if(timenow)
3058 snprintf(localtimestr, 32, "%04d-%02d-%02d %02d:%02d:%02d",
3059 timenow->tm_year + 1900, timenow->tm_mon+1, timenow->tm_mday,
3060 timenow->tm_hour, timenow->tm_min, timenow->tm_sec);
3061 return localtimestr;
3062}
3063
3064
3065//get local time string , format"MMDDHHMM"
3066char *get_local_datetime(char *buff)
3067{
3068 time_t now;
3069 struct tm *timenow;
3070 static char localtimestr[48];
3071
3072 memset(localtimestr, 0, sizeof(localtimestr));
3073
3074 time(&now);
3075 timenow = localtime(&now);
3076 if(timenow)
3077 sprintf(localtimestr, "%02d%02d%02d%02d",
3078 timenow->tm_mon+1, timenow->tm_mday,
3079 timenow->tm_hour, timenow->tm_min);
3080
3081 if(buff!=NULL)
3082 strcpy(buff, localtimestr);
3083
3084 return localtimestr;
3085}
3086
3087
3088int zCc_find_held_cid(void)
3089{
3090 int slavetmp;
3091
3092 for (slavetmp = 1; slavetmp < ZCC_SLAVES; slavetmp++)
3093 {
3094 if (g_Cc_CallDetail.slaveObj[slavetmp].heldcall!=0)
3095 {
3096 return slavetmp;
3097 }
3098 }
3099
3100 return 0;
3101}
3102
3103int zCc_talking_count(void)
3104{
3105 int cnt = 0;
3106 int slavetmp;
3107
3108 for (slavetmp = 1; slavetmp < ZCC_SLAVES; slavetmp++)
3109 {
3110 if (g_Cc_CallDetail.slaveObj[slavetmp].state==ZCC_S_TALKING_S)
3111 cnt++;
3112 }
3113
3114 return cnt;
3115}
3116
3117
3118int zCc_find_held_incoming_cid(void)
3119{
3120 int slavetmp;
3121
3122 for (slavetmp = 1; slavetmp < ZCC_SLAVES; slavetmp++)
3123 {
3124 if (g_Cc_CallDetail.slaveObj[slavetmp].state==ZCC_S_TRYING_S)
3125 {
3126 return slavetmp;
3127 }
3128 }
3129
3130 return 0;
3131}
3132
3133
3134int zCc_find_all_callout(int slave[ZCC_SLAVES])
3135{
3136 int n=0;
3137
3138 int i;
3139 for (i = 1; i < ZCC_SLAVES; i++)
3140 {
3141 if (g_Cc_CallDetail.slaveObj[i].is_callout!=0)
3142 {
3143 slave[n] = i;
3144 n++;
3145 }
3146 }
3147
3148 return n;
3149}
3150
3151
3152void zCc_hungup_all(int slave)
3153{
3154 int slavetmp;
3155 if (!g_Cc_CallDetail.chupSent)
3156 {
3157 zCc_SendAtHangupReq();
3158 for (slavetmp = 1; slavetmp < ZCC_SLAVES; slavetmp++)
3159 {
3160 if (g_Cc_CallDetail.slaveObj[slavetmp].state == ZCC_S_DIALING_S
3161 || g_Cc_CallDetail.slaveObj[slavetmp].state == ZCC_S_RINGBACK_S
3162 || g_Cc_CallDetail.slaveObj[slavetmp].state == ZCC_S_TALKING_S
3163 || g_Cc_CallDetail.slaveObj[slavetmp].state == ZCC_S_TRYING_S
3164 || g_Cc_CallDetail.slaveObj[slavetmp].state == ZCC_S_WAIT_RESOURCE_S)
3165 {
3166 g_Cc_CallDetail.slaveObj[slavetmp].waitDSCI6 = 1;
3167 }
3168 }
3169 if (!((zCc_CallCount() == 1) && ((ZCC_S_DACCM_S == g_Cc_CallDetail.slaveObj[slave].state)
3170 || (ZCC_S_DIALING_S == g_Cc_CallDetail.slaveObj[slave].state)))
3171 && !((zCc_CallCount() > 1) && (0 != zCc_MtInactiveCall()) && (0 != zCc_MoInactiveCall())))//·Çidle״̬¶¼ÊÇÕª»ú̬ÊÕµ½À´µçÇҾܽÓÀ´µç
3172 {
3173 g_Cc_CallDetail.chupSent = TRUE;//»¹ÓÐÆäËûºô½Ð£¬²»ÔÙÖØ¸´·¢chup
3174 }
3175 }
3176}
3177
3178VOID zCc_RunMaster(MSG_BUF *ptMsgBuf)
3179{
3180 UINT8 slave = 0;
3181 UINT8 slavetmp = 0;
3182 SIGNAL_DATA tSig;
3183 int held_call_cid;
3184 int incoming_call_cid;
3185
3186 static int old_state = -1;
3187 if(old_state != g_Cc_CallDetail.state)
3188 {
3189 ccapp_log("=======================\n");
3190 ccapp_log("zCc_RunMaster state %d --> %d\n", old_state, g_Cc_CallDetail.state);
3191 old_state = g_Cc_CallDetail.state;
3192 }
3193
3194 memset(tSig.cid, 0, 32);
3195
3196 zCc_CheckSlaveState("start zCc_RunMaster");
3197 switch (g_Cc_CallDetail.state)
3198 {
3199 case ZCC_M_RELEASE_S:
3200 zCc_MReleaseState(ptMsgBuf);
3201 break;
3202
3203 case ZCC_M_RINGING_S:
3204 zCc_MRingingState(ptMsgBuf);
3205 break;
3206
3207 case ZCC_M_SEIZE_S:
3208 default:
3209 zCc_MSeizeState(ptMsgBuf);
3210 break;
3211 }
3212
3213 zCc_CheckSlaveState("in zCc_RunSlave");
3214 /* Now run the slaves. Since the slaves will always be run with the master , run them now. */
3215 for (slave = 0; slave < ZCC_SLAVES; slave++)
3216 {
3217 zCc_RunSlave(slave);
3218 g_Cc_CallDetail.evt[slave] = ZCC_NO_E;
3219 }
3220
3221
3222 /* Process sMsg. */
3223 for (slave = 1; slave < ZCC_SLAVES; slave++)
3224 {
3225 if(g_Cc_CallDetail.slaveObj[slave].sMsg!=ZCC_SNO_M)
3226 {
3227 zCc_CheckSlaveState("in slaveObj[slave].sMsg");
3228 ccapp_log("g_Cc_CallDetail.slaveObj[%d].sMsg=%d",
3229 slave,
3230 g_Cc_CallDetail.slaveObj[slave].sMsg);
3231 }
3232
3233 switch (g_Cc_CallDetail.slaveObj[slave].sMsg)
3234 {
3235 case ZCC_SINV_M:
3236 if (g_Cc_CallDetail.slaveObj[slave].state == ZCC_S_IDLE_S)//ss
3237 {
3238 zCc_SendSsReq(g_Cc_CallDetail.digits);
3239 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_OFF_A;
3240 }
3241 else
3242 {
3243 zCc_SendAtDialReq(g_Cc_CallDetail.digits);
3244 }
3245 g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SNO_M;
3246 zCc_ClearDigits();
3247 break;
3248 case ZCC_SDTMF_M:
3249 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s ZCC_SDTMF_M handling ptMsgBuf->aucDataBuf[0] = %d\n",__FUNCTION__,ptMsgBuf->aucDataBuf[0]);
3250 zCc_SendAtDtmfReq((char*)(&(ptMsgBuf->aucDataBuf[0])));
3251 g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SNO_M;
3252 if(g_Cc_CallDetail.waitchldresult == 0)//chld´¦Àí¹ý³ÌÖв»Çå³ý²¦ºÅ°´¼üadd by zpr
3253 zCc_ClearDigits();
3254 break;
3255 case ZCC_SRING_M:
3256 if (g_Cc_CallDetail.state == ZCC_M_RELEASE_S)// && g_Cc_CallDetail.ringCid)
3257 {
3258 g_Cc_CallDetail.state = ZCC_M_RINGING_S;
3259 memset(&tSig, 0, sizeof(tSig));
3260 tSig.signal_type = RING_SIGNAL;
3261 //memcpy(tSig.cid, g_Cc_CallDetail.number, strlen(g_Cc_CallDetail.number));
3262 strncpy(tSig.cid, g_Cc_CallDetail.number, sizeof(tSig.cid)-1);
3263 get_local_datetime(tSig.date_time);
3264 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_RunMaster RING_SIGNAL,number = %s\n",__FUNCTION__,g_Cc_CallDetail.number);
3265 SLIC_Play_Signal(0, 0, &tSig);
3266 zCc_SetLedStatus("ledblink");
3267 }
3268 g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SNO_M;
3269 break;
3270 case ZCC_SANS_M://ʲô³¡¾°?
3271 if (zCc_CallCount() == 1)
3272 {
3273 SLIC_Stop_Signal(0, TONE_SIGNAL);
3274 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s : SLIC_Stop_Signal <---\n",__FUNCTION__);
3275 g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
3276 }
3277 g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SNO_M;
3278 break;
3279 case ZCC_SDISCN_M:
3280 held_call_cid = zCc_find_held_cid();
3281 incoming_call_cid = zCc_GetSpecSlave(ZCC_S_TRYING_S);
3282 ccapp_log("ZCC_SDISCN_M held_call_cid=%d incoming_call_cid=%d chupSent=%d",
3283 held_call_cid,
3284 incoming_call_cid,
3285 g_Cc_CallDetail.chupSent);
3286
3287 if((held_call_cid!=0 ||incoming_call_cid!=0) && g_Cc_CallDetail.chupSent==FALSE)
3288 {
3289 int active_call_cid = 0;
3290
3291 for (slavetmp = 1; slavetmp < ZCC_SLAVES; slavetmp++)
3292 {
3293 if( (g_Cc_CallDetail.slaveObj[slavetmp].state == ZCC_S_DIALING_S
3294 || g_Cc_CallDetail.slaveObj[slavetmp].state == ZCC_S_RINGBACK_S
3295 || g_Cc_CallDetail.slaveObj[slavetmp].state == ZCC_S_TALKING_S
3296// || g_Cc_CallDetail.slaveObj[slavetmp].state == ZCC_S_TRYING_S // incoming_call_cid
3297 || g_Cc_CallDetail.slaveObj[slavetmp].state == ZCC_S_WAIT_RESOURCE_S) &&
3298 g_Cc_CallDetail.slaveObj[slavetmp].heldcall==0)
3299 {
3300 active_call_cid = slavetmp;
3301 break;
3302 }
3303 }
3304
3305 ccapp_log("ZCC_SDISCN_M active_call_cid=%d", active_call_cid);
3306
3307 if(active_call_cid!=0)
3308 {
3309 zCc_SendAtChldReq(10+active_call_cid);
3310
3311 g_Cc_CallDetail.chupSent = TRUE;
3312 g_Cc_CallDetail.state = ZCC_M_RINGING_S;
3313
3314 /*MSG_BUF msgBuff = {0}; // let while(1) run one more time
3315 msgBuff.usMsgCmd = ZCC_ASSIST_MSG_E;
3316 msgBuff.src_id = MODULE_ID_SLIC;
3317 zCc_SendMsgToSub(&msgBuff);
3318
3319 ccapp_log("sendMsg ZCC_ASSIST_MSG_E"); */
3320 }
3321 else
3322 {
3323 zCc_hungup_all(slave);
3324 }
3325 }
3326 else
3327 {
3328 zCc_hungup_all(slave);
3329 }
3330
3331 g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SNO_M;
3332 break;
3333 default:
3334 break;
3335 }
3336 }
3337
3338 if (g_Cc_CallDetail.state == ZCC_M_RINGING_S
3339 && g_Cc_CallDetail.ringCid == 0
3340 && zCc_find_held_cid()==0
3341 && zCc_find_held_incoming_cid()==0
3342 && local_test_call_st==0)
3343 {
3344 g_Cc_CallDetail.state = ZCC_M_RELEASE_S;
3345 SLIC_Stop_Signal(0, RING_SIGNAL);
3346 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s : SLIC_Stop_Signal <---\n",__FUNCTION__);
3347 }
3348 /*else if (g_Cc_CallDetail.state == ZCC_M_SEIZE_S && g_Cc_CallDetail.ringCid > 0 && zCc_CallCount() == 1)
3349 {
3350 //תΪ½ÓÌý
3351 ¹Ò»úºó¿ÉÒÔÖªµÀÀ´µç²¢½ÓÌý£¬ÎÞÐèÌØÊâ´¦Àí¡£
3352 }*/
3353 zCc_ControlTone();
3354
3355 // ´¦Àíslave·µ»ØµÄÏûÏ¢
3356 zCc_CheckSlaveState("End zCc_RunMaster");
3357}
3358
3359VOID zCc_RunSlave(UINT8 slave)
3360{
3361 if (g_Cc_CallDetail.evt[slave] == ZCC_NO_E)
3362 {
3363 return;
3364 }
3365
3366 /* Call respective state function based on the current state. */
3367 printf("[ccapp_debug]:Slave Run,slave:%d, state=%d,event=%d\n", slave, g_Cc_CallDetail.slaveObj[slave].state,g_Cc_CallDetail.evt[slave]);
3368 zCcSlaveFsmFunc[g_Cc_CallDetail.slaveObj[slave].state](slave);
3369}
3370
3371VOID zCc_SIdleState(UINT8 slave)
3372{
3373 UINT8 tmpslave = 0;
3374 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SIdleState g_Cc_CallDetail.evt[%d] = %d\n",__FUNCTION__,slave,g_Cc_CallDetail.evt[slave]);
3375 g_Cc_CallDetail.slaveObj[slave].cid = slave;
3376 switch (g_Cc_CallDetail.evt[slave])
3377 {
3378 case ZCC_DIAL_E:
3379 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_DIAL_A;
3380 g_Cc_CallDetail.slaveObj[slave].state = g_Cc_CallDetail.digits[0] != ZCC_FLASH_SIGN ? ZCC_S_DT_S : ZCC_S_DACCM_S;
3381
3382 if (g_Cc_CallDetail.hookofffg == TRUE)
3383 {
3384 g_Cc_CallDetail.hookofffg = FALSE;
3385 CreateSoftTimer(ZCCAPP_TIMER_HOOKOFF_DETECT,
3386 0,
3387 ZCCAPP_TIMER_HOOKOFF_INTERVAL,
3388 zCcApp_HookOffTimer,
3389 NULL);
3390 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SIdleState CreateSoftTimer zCcApp_HookOffTimer\n",__FUNCTION__);
3391
3392 g_Cc_CallDetail.slaveObj[slave].idle_second = 0;
3393 CreateSoftTimer(ZCCAPP_TIMER_HOOKOFF_IDLE,
3394 TIMER_FLAG_RESTART,
3395 ZCCAPP_TIMER_HOOKOFF_IDLE_INTERVAL,
3396 zCcApp_HookOff_Idle_Timer,
3397 NULL);
3398 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SIdleState CreateSoftTimer zCcApp_HookOff_Idle_Timer\n",__FUNCTION__);
3399 }
3400 break;
3401 case ZCC_DTMF_E://held+dailing
3402 if ( 0 != zCc_HeldCall() && 0 == zCc_ActiveCall())
3403 {
3404 DeleteSoftTimer(ZCCAPP_TIMER_SSDIALTONE_DETECT);
3405 CreateSoftTimer(ZCCAPP_TIMER_DTMF_DETECT,
3406 0,
3407 ZCCAPP_TIMER_DTMF_INTERVAL,
3408 zCcApp_DtmfTimer,
3409 NULL);
3410 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SIdleState CreateSoftTimer zCcApp_DtmfTimer\n",__FUNCTION__);
3411 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_SIL_A;
3412 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_DACCM_S;
3413 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SIdleState handling ZCC_DTMF_E\n",__FUNCTION__);
3414 }
3415 break;
3416 case ZCC_CIDCW_E:
3417 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_CIDCW_A;
3418 //lint -fallthrough
3419 case ZCC_SINVITE_E:
3420 zCc_ShowAllSlaveWithTips("zCc_SIdleState");
3421 if (((0 != zCc_GetDialingSlave(1)) || (0 != zCc_GetSpecSlave(ZCC_S_RINGBACK_S)))//ÓÐÒѾ­Ï·¢atd µÄºô½Ðʱ¾Ü¾øÐÂÀ´µç
3422 || (0 != zCc_MoInactiveCall()))//
3423 {
3424 //zCc_InitSlaveObj(slave);¼ÌÐøµÈdsci6Éϱ¨
3425 g_Cc_CallDetail.slaveObj[slave].state = g_Cc_CallDetail.resourceReady?ZCC_S_TRYING_S:ZCC_S_WAIT_RESOURCE_S;
3426 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
3427 g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SDISCN_M;
3428 return;
3429 }
3430
3431 g_Cc_CallDetail.ringCid = slave;
3432 if(g_Cc_CallDetail.evt[slave]==ZCC_CIDCW_E)
3433 g_Cc_CallDetail.slaveObj[slave].is_cidcw = TRUE;
3434 else
3435 g_Cc_CallDetail.slaveObj[slave].is_cidcw = FALSE;
3436 strcpy(g_Cc_CallDetail.slaveObj[slave].number, g_Cc_CallDetail.number);
3437
3438 if (g_Cc_CallDetail.resourceReady == 1)
3439 {
3440 g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SRING_M;
3441 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_TRYING_S;
3442 }
3443 else
3444 {
3445 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_WAIT_RESOURCE_S;
3446 }
3447 break;
3448
3449 case ZCC_SRING_E://cid²»Æ¥ÅäµÄ³¡¾°
3450 tmpslave = zCc_GetDialingSlave(0);
3451 if (0 == tmpslave )
3452 {
3453 return;
3454 }
3455 g_Cc_CallDetail.slaveObj[slave] = g_Cc_CallDetail.slaveObj[tmpslave];
3456 zCc_InitSlaveObj(tmpslave);
3457 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_RINGBACK_S;
3458 break;
3459 case ZCC_SDISCN_MO_E://cid²»Æ¥ÅäµÄ³¡¾°
3460 tmpslave = zCc_GetDialingSlave(0);
3461 if (0 == tmpslave )
3462 {
3463 return;
3464 }
3465 g_Cc_CallDetail.slaveObj[slave] = g_Cc_CallDetail.slaveObj[tmpslave];
3466 zCc_InitSlaveObj(tmpslave);
3467 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, tmpslave);
3468 if (1 == zCc_BusyToneAllowed() && g_Cc_CallDetail.slaveObj[slave].waitDSCI6 == 0&& g_Cc_CallDetail.state == ZCC_M_SEIZE_S)//ÓÐÆäËûºô½ÐÇÒÒѹһúʱ²»·ÅæÒô
3469 {
3470 CreateSoftTimer(ZCCAPP_TIMER_BUSYTONE_DETECT,
3471 0,
3472 ZCCAPP_TIMER_BUSYTONE_INTERVAL,
3473 zCcApp_BusyToneTimer,
3474 NULL);
3475 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SIdleState CreateSoftTimer zCcApp_BusyToneTimer\n",__FUNCTION__);
3476 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_BSY_A;
3477 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_BSYT_S;
3478 g_Cc_CallDetail.slaveObj[slave].confcall = 0;
3479 g_Cc_CallDetail.slaveObj[slave].heldcall = 0;
3480 }
3481 else
3482 {
3483 zCc_InitSlaveObj(slave);
3484 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
3485 }
3486 return;
3487 default:
3488 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SIdleState:evt=%d\n",__FUNCTION__,g_Cc_CallDetail.evt[slave]);
3489 break;
3490 }
3491}
3492
3493VOID zCc_SDtState(UINT8 slave)
3494{
3495 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SDtState g_Cc_CallDetail.evt[%d] = %d\n",__FUNCTION__,slave, g_Cc_CallDetail.evt[slave]);
3496 switch (g_Cc_CallDetail.evt[slave])
3497 {
3498 case ZCC_DTMF_E:
3499 DeleteSoftTimer(ZCCAPP_TIMER_HOOKOFF_IDLE);
3500 g_Cc_CallDetail.slaveObj[slave].idle_second = 0;
3501
3502 DeleteSoftTimer(ZCCAPP_TIMER_HOOKOFF_DETECT);
3503
3504 CreateSoftTimer(ZCCAPP_TIMER_DTMF_DETECT,
3505 0,
3506 ZCCAPP_TIMER_DTMF_INTERVAL,
3507 zCcApp_DtmfTimer,
3508 NULL);
3509 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SDtState CreateSoftTimer zCcApp_DtmfTimer\n",__FUNCTION__);
3510 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_SIL_A;
3511 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_DACCM_S;
3512 break;
3513
3514 case ZCC_DISCN_E:
3515 //zCc_ClearDigits();
3516 zCc_InitSlaveObj(slave);
3517 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
3518 return;
3519
3520 default://Ö»»áÊÇslave0£¬²»¿ÉÄÜÓëdsciµÄcid³åÍ»
3521 break;
3522 }
3523}
3524
3525VOID zCc_SDaccmState(UINT8 slave)
3526{
3527 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SDaccmState g_Cc_CallDetail.evt[%d] = %d\n",__FUNCTION__,slave, g_Cc_CallDetail.evt[slave]);
3528 UINT8 ret = 0;
3529 UINT8 tmpslave = 0;
3530
3531 switch (g_Cc_CallDetail.evt[slave])
3532 {
3533 case ZCC_DTMF_E:
3534 DeleteSoftTimer(ZCCAPP_TIMER_DTMF_DETECT);
3535 ret = zCc_DigitsMatch();
3536 break;
3537
3538 case ZCC_DISCN_E:
3539 zCc_ClearDigits();
3540 zCc_InitSlaveObj(slave);
3541 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
3542 return;
3543 case ZCC_CIDCW_E:
3544 case ZCC_SINVITE_E://ÒÔdsciµÄcidΪ׼£¬ÖØÐ¸ømoµÄºô½Ð·ÖÅäidle cid
3545 tmpslave = zCc_GetSpecSlave(ZCC_S_IDLE_S);
3546 if (0 == tmpslave )
3547 {
3548 return;
3549 }
3550 g_Cc_CallDetail.slaveObj[tmpslave] = g_Cc_CallDetail.slaveObj[slave];
3551 zCc_InitSlaveObj(slave);
3552 g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SDISCN_M;
3553 g_Cc_CallDetail.slaveObj[slave].state = g_Cc_CallDetail.resourceReady?ZCC_S_TRYING_S:ZCC_S_WAIT_RESOURCE_S;
3554 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SDaccmState: reject mtcall\n",__FUNCTION__, slave);
3555 return;
3556 default:
3557 return;
3558 }
3559
3560 if(ret==ZCC_LOCAL_TEST_CALL)
3561 {
3562 SIGNAL_DATA tSig;
3563 if(zCc_talking_count())
3564 {
3565 zCc_ClearDigits();
3566 zCc_InitSlaveObj(slave);
3567 return;
3568 }
3569
3570 SLIC_Stop_Signal(0, TONE_SIGNAL);
3571 memset(&tSig, 0, sizeof(tSig));
3572 tSig.signal_type= TONE_SIGNAL;
3573 tSig.tone_type = TONE_CW;
3574 SLIC_Play_Signal(0, 0, &tSig);
3575
3576 zCc_ClearDigits();
3577
3578 g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
3579 g_Cc_CallDetail.evt[slave]= ZCC_NO_E;
3580 g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SNO_M;
3581
3582 local_test_call_st = LocalTestCallST_Start;
3583
3584 zCc_ShowAllSlaveWithTips("testCall-start");
3585 return ;
3586 }
3587
3588 zCc_DigitsMatchRltProc(ret);
3589}
3590
3591VOID zCc_SDialingState(UINT8 slave)
3592{
3593 UINT8 tmpslave = 0;
3594 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SDialingState g_Cc_CallDetail.evt[%d] = %d\n",__FUNCTION__,slave, g_Cc_CallDetail.evt[slave]);
3595 switch (g_Cc_CallDetail.evt[slave])
3596 {
3597 case ZCC_SRING_E:
3598 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_RINGBACK_S;
3599 break;
3600
3601 case ZCC_SANS_E:
3602 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_OFF_A;
3603 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_TALKING_S;
3604 SLIC_Stop_Signal(0, TONE_SIGNAL);
3605 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SDialingState: SLIC_Stop_Signal <---\n",__FUNCTION__);
3606 g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
3607 SLIC_Start_PCM();
3608 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SDialingState: SLIC_Start_PCM <---\n",__FUNCTION__);
3609 break;
3610
3611 case ZCC_DISCN_E:
3612 //zCc_InitSlaveObj(slave);
3613 g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SDISCN_M;
3614 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_OFF_A;
3615 return;
3616
3617 case ZCC_SDISCN_MO_E:
3618 if (1 == zCc_BusyToneAllowed() && g_Cc_CallDetail.slaveObj[slave].waitDSCI6 == 0 && g_Cc_CallDetail.state == ZCC_M_SEIZE_S)//ÓÐÆäËûºô½ÐÇÒÒѹһúʱ²»·ÅæÒô
3619 {
3620 CreateSoftTimer(ZCCAPP_TIMER_BUSYTONE_DETECT,
3621 0,
3622 ZCCAPP_TIMER_BUSYTONE_INTERVAL,
3623 zCcApp_BusyToneTimer,
3624 NULL);
3625 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SDialingState CreateSoftTimer zCcApp_BusyToneTimer\n",__FUNCTION__);
3626 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_BSY_A;
3627 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_BSYT_S;
3628 g_Cc_CallDetail.slaveObj[slave].confcall = 0;
3629 g_Cc_CallDetail.slaveObj[slave].heldcall = 0;
3630 }
3631 else
3632 {
3633 zCc_InitSlaveObj(slave);
3634 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
3635 }
3636 return;
3637 case ZCC_SDISCN_MT_E:
3638 zCc_InitSlaveObj(slave);//Ö÷±»½Ð²¢·¢
3639 //g_Cc_CallDetail.slaveObj[slave].waitDSCI6 = 0;
3640 return;
3641 case ZCC_CIDCW_E:
3642 case ZCC_SINVITE_E://ÒÔdsciµÄcidΪ׼£¬ÖØÐ¸ømoµÄºô½Ð·ÖÅäidle cid
3643 tmpslave = zCc_GetSpecSlave(ZCC_S_IDLE_S);
3644 if (0 == tmpslave )
3645 {
3646 return;
3647 }
3648 g_Cc_CallDetail.slaveObj[tmpslave] = g_Cc_CallDetail.slaveObj[slave];
3649 zCc_InitSlaveObj(slave);
3650 g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SDISCN_M;
3651 g_Cc_CallDetail.slaveObj[slave].state = g_Cc_CallDetail.resourceReady?ZCC_S_TRYING_S:ZCC_S_WAIT_RESOURCE_S;
3652 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SDaccmState: reject mtcall\n",__FUNCTION__, slave);
3653 return;
3654
3655 default:
3656 return;
3657 }
3658}
3659
3660VOID zCc_SRingbackState(UINT8 slave)
3661{
3662 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SRingbackState g_Cc_CallDetail.evt[%d] = %d\n",__FUNCTION__,slave, g_Cc_CallDetail.evt[slave]);
3663 switch (g_Cc_CallDetail.evt[slave])
3664 {
3665 case ZCC_SANS_E:
3666 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_OFF_A;
3667 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_TALKING_S;
3668 SLIC_Stop_Signal(0, TONE_SIGNAL);
3669 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SRingbackState: SLIC_Stop_Signal <---\n",__FUNCTION__);
3670 g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
3671
3672 if(g_Cc_CallDetail.slaveObj[slave].is_callout)
3673 SLIC_PolarityReverse(0, TRUE);
3674
3675 SLIC_Start_PCM();
3676 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SRingbackState SLIC_Start_PCM2222\n",__FUNCTION__);
3677 break;
3678
3679 case ZCC_DISCN_E:
3680 //zCc_InitSlaveObj(slave);
3681 g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SDISCN_M;
3682 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_OFF_A;
3683 return;
3684
3685 case ZCC_SDISCN_MO_E:
3686 if (1 == zCc_BusyToneAllowed() && g_Cc_CallDetail.slaveObj[slave].waitDSCI6 == 0 && g_Cc_CallDetail.state == ZCC_M_SEIZE_S)//ÓÐÆäËûºô½Ðʱ²»·ÅæÒô
3687 {
3688 CreateSoftTimer(ZCCAPP_TIMER_BUSYTONE_DETECT,
3689 0,
3690 ZCCAPP_TIMER_BUSYTONE_INTERVAL,
3691 zCcApp_BusyToneTimer,
3692 NULL);
3693 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SRingbackState CreateSoftTimer zCcApp_BusyToneTimer\n",__FUNCTION__);
3694 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_BSY_A;
3695 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_BSYT_S;
3696 g_Cc_CallDetail.slaveObj[slave].confcall = 0;
3697 g_Cc_CallDetail.slaveObj[slave].heldcall = 0;
3698 SLIC_Stop_PCM();
3699 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SRingbackState SLIC_Stop_PCM\n",__FUNCTION__);
3700 }
3701 else
3702 {
3703 zCc_InitSlaveObj(slave);
3704 if ( 0 == zCc_ActiveCall() && 0 == zCc_HeldCall())
3705 {
3706 SLIC_Stop_PCM();
3707 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SRingbackState SLIC_Stop_PCM\n",__FUNCTION__);
3708 }
3709 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
3710 }
3711 return;
3712 case ZCC_SDISCN_MT_E:
3713 g_Cc_CallDetail.slaveObj[slave].waitDSCI6 = 0;
3714 return;
3715
3716 case ZCC_DTMF_E: // ²¦ºÅ
3717 g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SDTMF_M;///???
3718 return;
3719
3720 case ZCC_RESOURCE_READY_E:
3721 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_OFF_A;
3722 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SRingbackState: SLIC_Stop_Signal <---\n",__FUNCTION__);
3723 SLIC_Stop_Signal(0, TONE_SIGNAL);
3724 g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
3725 SLIC_Start_PCM();//×ÊÔ´ÒÑ·ÖÅä£¬Íø²à·ÅÒô
3726 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SRingbackState SLIC_Start_PCM\n",__FUNCTION__);
3727 return;
3728
3729 default:
3730 return;
3731 }
3732}
3733
3734VOID zCc_STalkingState(UINT8 slave)
3735{
3736 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_STalkingState g_Cc_CallDetail.evt[%d] = %d\n",__FUNCTION__,slave, g_Cc_CallDetail.evt[slave]);
3737 switch (g_Cc_CallDetail.evt[slave])
3738 {
3739 case ZCC_DISCN_E:
3740 //zCc_InitSlaveObj(slave);
3741 g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SDISCN_M;
3742 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_OFF_A;
3743 return;
3744
3745 case ZCC_SDISCN_MO_E:
3746 case ZCC_SDISCN_MT_E:
3747 //zCc_InitSlaveObj(slave);
3748 if (zCc_CallCount() >= 2 || g_Cc_CallDetail.state == ZCC_M_RELEASE_S)//»¹Ê£¶àÓÚһ·ºô½Ð
3749 {
3750 zCc_InitSlaveObj(slave);
3751 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
3752 break;
3753 }
3754 if (g_Cc_CallDetail.slaveObj[0].tone != ZCC_TONE_OFF_A)
3755 {
3756 zCc_InitSlaveObj(0);
3757 }
3758 if (1 == zCc_BusyToneAllowed() && g_Cc_CallDetail.slaveObj[slave].waitDSCI6 == 0)//ÓÐÆäËûºô½Ðʱ²»·ÅæÒô
3759 {
3760 CreateSoftTimer(ZCCAPP_TIMER_BUSYTONE_DETECT,
3761 0,
3762 ZCCAPP_TIMER_BUSYTONE_INTERVAL,
3763 zCcApp_BusyToneTimer,
3764 NULL);
3765 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_STalkingState CreateSoftTimer zCcApp_BusyToneTimer\n",__FUNCTION__);
3766 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_BSY_A;
3767 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_BSYT_S;
3768 g_Cc_CallDetail.slaveObj[slave].confcall = 0;
3769 g_Cc_CallDetail.slaveObj[slave].heldcall = 0;
3770 }
3771 else
3772 {
3773 zCc_InitSlaveObj(slave);
3774 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
3775 }
3776 return;
3777
3778 case ZCC_DTMF_E: // ²¦ºÅ. µ÷ÕûÒôÁ¿µÄ´¦Àí´ýÔö¼Ó
3779 if (g_Cc_CallDetail.slaveObj[slave].heldcall == 0)
3780 {
3781 g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SDTMF_M;///???
3782 }
3783 return;
3784 default:
3785 return;
3786 }
3787}
3788
3789VOID zCc_SWaitResourceState(UINT8 slave)
3790{
3791 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SWaitResourceState g_Cc_CallDetail.evt[%d] = %d\n",__FUNCTION__,slave, g_Cc_CallDetail.evt[slave]);
3792 switch (g_Cc_CallDetail.evt[slave])
3793 {
3794 case ZCC_RESOURCE_READY_E:
3795 g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SRING_M;
3796 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_TRYING_S;
3797 break;
3798
3799 case ZCC_SDISCN_MT_E:
3800 zCc_InitSlaveObj(slave);
3801 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
3802 return;
3803
3804 default:
3805 return;
3806 }
3807}
3808
3809VOID zCc_STryingState(UINT8 slave)
3810{
3811 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_STryingState g_Cc_CallDetail.evt[%d] = %d\n",__FUNCTION__,slave, g_Cc_CallDetail.evt[slave]);
3812 switch (g_Cc_CallDetail.evt[slave])
3813 {
3814 case ZCC_CNCT_E:
3815 g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SANS_M;
3816 //lint -fallthrough
3817 case ZCC_SANS_E: //CHLD=2, ÊÕµ½DSCIǨ״̬
3818 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_OFF_A;
3819 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_TALKING_S;
3820 g_Cc_CallDetail.ringCid = 0;
3821 SLIC_Stop_Signal(0, TONE_SIGNAL);
3822 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_STryingState: SLIC_Stop_Signal <---\n",__FUNCTION__);
3823 g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
3824 SLIC_Start_PCM();
3825 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_STryingState SLIC_Start_PCM\n",__FUNCTION__);
3826 break;
3827
3828 case ZCC_SDISCN_MT_E:
3829 zCc_InitSlaveObj(slave);
3830 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
3831 return;
3832
3833 case ZCC_DISCN_E://trying ̬ÊÕµ½¹Ò»úÏûÏ¢£¬Ö»ÄÜÊÇÕª»ú̬À´µç(²»°üÀ¨ºô½ÐµÈ´ý)µÄ³¡¾°
3834 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_OFF_A;
3835 SLIC_Stop_Signal(0, TONE_SIGNAL);
3836 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_STryingState: SLIC_Stop_Signal <---\n",__FUNCTION__);
3837 g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
3838 if (1 == zCc_CallCount() && (zCc_GetDiscSlave(ZCC_SDISCN_M) == 0)// Õª»ú̬À´µçʱ¹Ò»ú£¬Èç¹ûµ±Ç°Ö»ÓÐһ·ºô½Ð£¬»°»úתÈëÕñÁå
3839 ||(2 == zCc_CallCount()
3840 && (0 != zCc_GetSpecSlave(ZCC_S_DACCM_S)
3841 ||0 != zCc_GetSpecSlave(ZCC_S_BSYT_S)
3842 ||0 != zCc_GetSpecSlave(ZCC_S_TKYT_S)
3843 ||0 != zCc_GetSpecSlave(ZCC_S_SIL_S))))//Õª»úºó£¬À´µç£¬ÔÙ²¦ºÅ£¬¹Ò»ú£¬Ò²ÐèÒªÕñÁå
3844 {
3845 g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SRING_M;
3846 }
3847 else
3848 {
3849 //zCc_InitSlaveObj(slave);
3850 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_OFF_A;
3851 g_Cc_CallDetail.ringCid = 0;
3852 g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SDISCN_M;
3853 }
3854 return;
3855
3856 default:
3857 return;
3858 }
3859}
3860
3861VOID zCc_SBsyToneState(UINT8 slave)
3862{
3863 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SBsyToneState g_Cc_CallDetail.evt[%d] = %d\n",__FUNCTION__,slave, g_Cc_CallDetail.evt[slave]);
3864 switch (g_Cc_CallDetail.evt[slave])
3865 {
3866 case ZCC_DISCN_E:
3867 zCc_InitSlaveObj(slave);
3868 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
3869 return;
3870 case ZCC_CIDCW_E:
3871 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_CIDCW_A;
3872 //lint -fallthrough
3873 case ZCC_SINVITE_E:
3874 if ((0 != zCc_GetDialingSlave(1)) || (0 != zCc_GetSpecSlave(ZCC_S_RINGBACK_S)))//ÓÐÒѾ­Ï·¢atd µÄºô½Ðʱ¾Ü¾øÐÂÀ´µç
3875 {
3876 zCc_InitSlaveObj(slave);
3877 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
3878 g_Cc_CallDetail.evt[slave] = ZCC_DISCN_E;
3879 return;
3880 }
3881 g_Cc_CallDetail.ringCid = slave;
3882
3883 if(g_Cc_CallDetail.evt[slave]==ZCC_CIDCW_E)
3884 g_Cc_CallDetail.slaveObj[slave].is_cidcw = TRUE;
3885 else
3886 g_Cc_CallDetail.slaveObj[slave].is_cidcw = FALSE;
3887
3888 if (g_Cc_CallDetail.resourceReady == 1)
3889 {
3890 g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SRING_M;
3891 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_TRYING_S;
3892 }
3893 else
3894 {
3895 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_WAIT_RESOURCE_S;
3896 }
3897 break;
3898 default:
3899 return;
3900 }
3901}
3902
3903VOID zCc_STkytState(UINT8 slave)
3904{
3905 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_STkytState g_Cc_CallDetail.evt[%d] = %d\n",__FUNCTION__,slave, g_Cc_CallDetail.evt[slave]);
3906 switch (g_Cc_CallDetail.evt[slave])
3907 {
3908 case ZCC_DISCN_E:
3909 zCc_InitSlaveObj(slave);
3910 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
3911 return;
3912 case ZCC_CIDCW_E:
3913 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_CIDCW_A;
3914 //lint -fallthrough
3915 case ZCC_SINVITE_E:
3916 if ((0 != zCc_GetDialingSlave(1)) || (0 != zCc_GetSpecSlave(ZCC_S_RINGBACK_S)))//ÓÐÒѾ­Ï·¢atd µÄºô½Ðʱ¾Ü¾øÐÂÀ´µç
3917 {
3918 zCc_InitSlaveObj(slave);
3919 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
3920 g_Cc_CallDetail.evt[slave] = ZCC_DISCN_E;
3921 return;
3922 }
3923 g_Cc_CallDetail.ringCid = slave;
3924
3925 if(g_Cc_CallDetail.evt[slave]==ZCC_CIDCW_E)
3926 g_Cc_CallDetail.slaveObj[slave].is_cidcw = TRUE;
3927 else
3928 g_Cc_CallDetail.slaveObj[slave].is_cidcw = FALSE;
3929
3930 if (g_Cc_CallDetail.resourceReady == 1)
3931 {
3932 g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SRING_M;
3933 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_TRYING_S;
3934 }
3935 else
3936 {
3937 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_WAIT_RESOURCE_S;
3938 }
3939 break;
3940 default:
3941 return;
3942 }
3943}
3944
3945VOID zCc_SSilState(UINT8 slave)
3946{
3947 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SSilState g_Cc_CallDetail.evt[%d] = %d\n",__FUNCTION__,slave, g_Cc_CallDetail.evt[slave]);
3948 switch (g_Cc_CallDetail.evt[slave])
3949 {
3950 case ZCC_DISCN_E:
3951 zCc_InitSlaveObj(slave);
3952 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
3953 return;
3954 case ZCC_CIDCW_E:
3955 g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_CIDCW_A;
3956 //lint -fallthrough
3957 case ZCC_SINVITE_E:
3958 if ((0 != zCc_GetDialingSlave(1)) || (0 != zCc_GetSpecSlave(ZCC_S_RINGBACK_S)))//ÓÐÒѾ­Ï·¢atd µÄºô½Ðʱ¾Ü¾øÐÂÀ´µç
3959 {
3960 zCc_InitSlaveObj(slave);
3961 zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
3962 g_Cc_CallDetail.evt[slave] = ZCC_DISCN_E;
3963 return;
3964 }
3965 g_Cc_CallDetail.ringCid = slave;
3966
3967 if(g_Cc_CallDetail.evt[slave]==ZCC_CIDCW_E)
3968 g_Cc_CallDetail.slaveObj[slave].is_cidcw = TRUE;
3969 else
3970 g_Cc_CallDetail.slaveObj[slave].is_cidcw = FALSE;
3971
3972 if (g_Cc_CallDetail.resourceReady == 1)
3973 {
3974 g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SRING_M;
3975 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_TRYING_S;
3976 }
3977 else
3978 {
3979 g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_WAIT_RESOURCE_S;
3980 }
3981 break;
3982
3983 default:
3984 return;
3985 }
3986}
3987
3988