mj.qu | 1524fc9 | 2025-06-11 04:34:13 -0700 | [diff] [blame] | 1 | /**************************************************************************
|
| 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*#"
|
| 46 | typedef enum{
|
| 47 | LocalTestCallST_None = 0,
|
| 48 | LocalTestCallST_Start,
|
| 49 | LocalTestCallST_Ring,
|
| 50 | LocalTestCallST_End
|
| 51 | }eLocalTestCallST;
|
| 52 | int local_test_call_st = 0;
|
| 53 | typedef enum{
|
| 54 | LocalTestCallType_None = 0,
|
| 55 | LocalTestCallType_LOOP
|
| 56 | }eLocalTestCallType;
|
| 57 | int local_test_call_type = 0;
|
| 58 |
|
| 59 | extern SINT32 g_zCc_AtRspId;
|
| 60 |
|
| 61 | int zCc_find_held_cid(void);
|
| 62 | int zCc_find_held_incoming_cid(void);
|
| 63 | int zCc_find_all_callout(int slave[ZCC_SLAVES]);
|
| 64 | int zCc_talking_count(void);
|
| 65 | char *get_local_date_time(void);
|
| 66 | char *get_local_datetime(char *buff);
|
mj.qu | 5887501 | 2025-06-19 02:45:53 -0700 | [diff] [blame] | 67 | int g_chup_flag = 0;
|
mj.qu | 1524fc9 | 2025-06-11 04:34:13 -0700 | [diff] [blame] | 68 |
|
| 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 | } */
|
| 87 | const 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 | */
|
| 123 | static 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 |
|
| 141 | T_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 |
|
| 165 | SINT32 gCcAppRecvAtIndProcCnt = sizeof(gCcAppRecvAtIndProc)/sizeof(gCcAppRecvAtIndProc[0]);
|
| 166 | SINT32 gCcAppRecvAtIndCnt = sizeof(gCcAppAtIndProc)/sizeof(gCcAppAtIndProc[0]);
|
| 167 | char g_zCcApp_AtRecvBuf[ZCC_APP_AT_BUF_MAX_LEN+1] = {0};
|
| 168 | T_zCc_CurAtCmdInfo * g_Cc_AtIndRspMsg;
|
| 169 |
|
mj.qu | 5887501 | 2025-06-19 02:45:53 -0700 | [diff] [blame] | 170 | static 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.qu | 1524fc9 | 2025-06-11 04:34:13 -0700 | [diff] [blame] | 195 | VOID 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 |
|
| 214 | VOID 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 |
|
| 236 | VOID 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 |
|
| 265 | VOID 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 |
|
| 272 | VOID 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 |
|
| 281 | UINT8 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 |
|
| 298 | UINT8 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 |
|
| 312 | UINT8 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 |
|
| 338 | UINT8 zCc_ActiveCall(VOID)
|
| 339 | {
|
| 340 | return zCc_TalkingCall(0);
|
| 341 | }
|
| 342 |
|
| 343 | UINT8 zCc_HeldCall(VOID)
|
| 344 | {
|
| 345 | return zCc_TalkingCall(1);
|
| 346 | }
|
| 347 |
|
| 348 | UINT8 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 |
|
| 362 | UINT8 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 |
|
| 376 | UINT8 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 |
|
| 394 | UINT8 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 |
|
| 418 | UINT8 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 |
|
| 434 | int 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 |
|
| 445 | int 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 |
|
| 467 | extern int digit_map_call(char *num);
|
| 468 | /* µ±Ç°Ò»Â· ·Ç ±£³ÖµÄ ºô½Ð£¬FLASH£¬µ±Ç°ºô½Ð±»±£³Ö»òÊÍ·Å£¬digitsÖ»¼Ç¼Óû§²¦´òµÄºÅÂ룻
|
| 469 | µ±Ç°Ò»Â· ·Ç ±£³ÖµÄ ºô½Ð£¬FLASH£¬µ±Ç°ºô½Ð±»»Ö¸´£»
|
| 470 | ÆäËü³¡¾°ÐèÒªdigits ¼Ç¼ZCC_FLASH_SIGNºÍÓû§ ²¦´òµÄһλºÅÂë */
|
| 471 | UINT8 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 |
|
| 597 | VOID zCc_DigitsMatchRltProc(UINT8 ret)
|
| 598 | {
|
| 599 | UINT8 callCnt = 0, slave = 0;
|
| 600 | SINT32 chldret = -1;
|
mj.qu | 8ddc764 | 2025-06-11 04:37:19 -0700 | [diff] [blame] | 601 | char voice_dial_time[4] = {0};
|
| 602 | unsigned int dtmf_interval;
|
mj.qu | 1524fc9 | 2025-06-11 04:34:13 -0700 | [diff] [blame] | 603 |
|
mj.qu | 8ddc764 | 2025-06-11 04:37:19 -0700 | [diff] [blame] | 604 | cfg_get_item("voice_dial_time", voice_dial_time, sizeof(voice_dial_time));
|
| 605 | dtmf_interval = atoi(voice_dial_time) * 1000;
|
mj.qu | 1524fc9 | 2025-06-11 04:34:13 -0700 | [diff] [blame] | 606 | 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.qu | 8ddc764 | 2025-06-11 04:37:19 -0700 | [diff] [blame] | 614 | dtmf_interval,
|
mj.qu | 1524fc9 | 2025-06-11 04:34:13 -0700 | [diff] [blame] | 615 | 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
|
| 741 | VOID 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
|
| 803 | UINT8 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 |
|
| 821 | UINT8 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 |
|
| 842 | UINT8 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 | }
|
| 858 | UINT8 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 |
|
| 882 | int 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 |
|
| 907 | int 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 |
|
| 938 | int 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 |
|
| 950 | UINT8 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 | }
|
| 966 | UINT8 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 |
|
| 982 | VOID 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 | }
|
| 1059 | void zCcApp_SetAtChnlCmdId(E_CC_APP_AtReqCmdId AtCmdId)
|
| 1060 | {
|
| 1061 | g_Cc_CallDetail.curAtCmdId = AtCmdId;
|
| 1062 | }
|
| 1063 | VOID 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 |
|
| 1159 | VOID 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 |
|
| 1202 | VOID 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 |
|
| 1209 | VOID 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 |
|
| 1216 | VOID zCc_SendAtDtmfReq(char* dtmfchar)
|
| 1217 | {
|
| 1218 | g_Cc_CallDetail.curAtCmdId = CC_APP_AT_CMD_REQ_VTS;
|
| 1219 | zCcApp_Vts(dtmfchar);
|
| 1220 | }
|
| 1221 |
|
| 1222 | VOID 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
|
| 1229 | VOID 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
|
| 1243 | SINT32 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 |
|
| 1257 | VOID 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 |
|
| 1288 | VOID 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 |
|
| 1298 | SINT32 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 |
|
| 1309 | int 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 |
|
| 1323 | void 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 |
|
| 1345 | SINT32 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.qu | 5887501 | 2025-06-19 02:45:53 -0700 | [diff] [blame] | 1358 | 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.qu | 1524fc9 | 2025-06-11 04:34:13 -0700 | [diff] [blame] | 1364 | 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.qu | 5887501 | 2025-06-19 02:45:53 -0700 | [diff] [blame] | 1536 |
|
| 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.qu | ebc6605 | 2025-06-19 18:19:54 -0700 | [diff] [blame] | 1546 | else
|
| 1547 | {
|
| 1548 | cfg_set("callback_number", "");
|
| 1549 | }
|
mj.qu | 1524fc9 | 2025-06-11 04:34:13 -0700 | [diff] [blame] | 1550 |
|
| 1551 | break;
|
| 1552 | case 2://Z_MMIACC_CALL_STATE_MO_DIALING
|
| 1553 | ptMsgBuf->usMsgCmd = ZCC_SDIALLING_E;
|
| 1554 | break;
|
| 1555 | case 7://Z_MMIACC_CALL_STATE_MT_CONNREQ
|
| 1556 | case 8://Z_MMIACC_CALL_STATE_DISC
|
| 1557 | default:
|
| 1558 | break;
|
| 1559 | }
|
| 1560 | return 0;
|
| 1561 | }
|
| 1562 |
|
| 1563 |
|
| 1564 |
|
| 1565 | SINT32 zCc_RecvZvoiceChnl(MSG_BUF *ptMsgBuf)
|
| 1566 | {
|
| 1567 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","RECV zvoicechnl!!!<---\n");
|
| 1568 | //if (g_Cc_CallDetail.state == ZCC_M_RELEASE_S)
|
| 1569 | //{
|
| 1570 | // return 0;
|
| 1571 | //}
|
| 1572 | printf("[ccapp_debug]:recv zvoicechnl and send to local cc\n");
|
| 1573 |
|
| 1574 | //ptMsgBuf->usMsgCmd = ZCC_NO_E;
|
| 1575 | //ptMsgBuf->usMsgCmd = ZCCAPP_ATIND_IMSPLUS;
|
| 1576 | //ptMsgBuf->usSourceModuleID = MSG_ID_CALL_CTRL;
|
| 1577 |
|
| 1578 | zCc_SendMsgToSub(ptMsgBuf); /* ·¢¸øÖ÷Ïß³Ì */
|
| 1579 | return 0;
|
| 1580 | }
|
| 1581 |
|
| 1582 |
|
| 1583 |
|
| 1584 | SINT32 zCc_RecvImsplusInd(MSG_BUF *ptMsgBuf)
|
| 1585 | {
|
| 1586 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","RECV imsplusind!!!<---\n");
|
| 1587 | //if (g_Cc_CallDetail.state == ZCC_M_RELEASE_S)
|
| 1588 | //{
|
| 1589 | // return 0;
|
| 1590 | //}
|
| 1591 | printf("[ccapp_debug]:recv imsplus and send to local cc\n");
|
| 1592 |
|
| 1593 | //ptMsgBuf->usMsgCmd = ZCC_NO_E;
|
| 1594 | //ptMsgBuf->usMsgCmd = ZCCAPP_ATIND_IMSPLUS;
|
| 1595 | //ptMsgBuf->usSourceModuleID = MSG_ID_CALL_CTRL;
|
| 1596 |
|
| 1597 | zCc_SendMsgToSub(ptMsgBuf); /* ·¢¸øÖ÷Ïß³Ì */
|
| 1598 | return 0;
|
| 1599 | }
|
| 1600 | SINT32 zCc_RecvRsp(MSG_BUF *ptMsgBuf)
|
| 1601 | {
|
| 1602 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","RECV at_rsp %d !!!<---\n", ptMsgBuf->usMsgCmd);
|
| 1603 |
|
| 1604 | zCc_SendMsgToSub(ptMsgBuf); /* ·¢¸øÖ÷Ïß³Ì */
|
| 1605 | return 0;
|
| 1606 | }
|
| 1607 |
|
| 1608 | static inline unsigned char zCc_MapVoiceChnlAct(unsigned char act)
|
| 1609 | {
|
| 1610 | if (act == 3)
|
| 1611 | {
|
| 1612 | return 0; //gsm
|
| 1613 | }
|
| 1614 | else if (act == 5)
|
| 1615 | {
|
| 1616 | return 2; //wcdma
|
| 1617 | }
|
| 1618 | else if (act == 15)
|
| 1619 | {
|
| 1620 | return 1;
|
| 1621 | }
|
| 1622 | else
|
| 1623 | {
|
| 1624 | assert(0);
|
| 1625 | }
|
| 1626 | return 3;
|
| 1627 | }
|
| 1628 |
|
| 1629 | static unsigned char g_zCc_VoiceOpenSucc = 1;
|
| 1630 |
|
| 1631 | static T_Voice_Para g_zCc_VoicePara_bak;
|
| 1632 |
|
| 1633 | static unsigned int g_zCc_pcm_bak = 0; /*new add*/
|
| 1634 |
|
| 1635 | SINT32 zCc_ZvoicechnlProc(MSG_BUF *ptMsgBuf)
|
| 1636 | {
|
| 1637 | T_zCcApp_VoiceChnl tVoiceChnl;
|
| 1638 | T_Voice_Para tVoicePara = {0};
|
| 1639 | memcpy(&tVoiceChnl, (T_zCcApp_VoiceChnl*)ptMsgBuf->aucDataBuf, sizeof(T_zCcApp_VoiceChnl));
|
| 1640 |
|
| 1641 | tVoicePara.mode = zCc_MapVoiceChnlAct(tVoiceChnl.act);
|
| 1642 | tVoicePara.codec_type = tVoiceChnl.codetype; //0-nb, 1-wb
|
| 1643 | if ( tVoicePara.codec_type == 1)
|
| 1644 | tVoicePara.clock_rate = 16000;
|
| 1645 | else
|
| 1646 | tVoicePara.clock_rate = 8000;
|
| 1647 |
|
| 1648 | tVoicePara.codec_path = tVoiceChnl.amrpath;
|
| 1649 |
|
| 1650 | printf("[ccapp_debug]:recv zvoicechnl, tVoicePara=%d,%d,%d,%d\n",tVoicePara.clock_rate,tVoicePara.mode,tVoicePara.codec_type,tVoicePara.codec_path);
|
| 1651 | if (tVoiceChnl.op == 1)
|
| 1652 | {
|
| 1653 | /* new add begin*/
|
| 1654 | //start voice
|
| 1655 | if (/*voice_open(&tVoicePara) != 0 ||*/ g_Cc_CallDetail.state == ZCC_M_RINGING_S)
|
| 1656 | {
|
| 1657 | printf("[ccapp]:voice open fail");//´ò¿ªvoiceʧ°Ü£¬»òÕßÕñÁå̬ÊÕµ½zvoicechnl£¬¶¼ÈÏΪʧ°Ü
|
| 1658 | g_zCc_VoiceOpenSucc = 0;
|
| 1659 | g_zCc_VoicePara_bak = tVoicePara;
|
| 1660 | }
|
| 1661 | else if (g_Cc_CallDetail.state == ZCC_M_SEIZE_S)
|
| 1662 | {
|
| 1663 |
|
| 1664 | if ( voice_open(&tVoicePara) != 0)
|
| 1665 |
|
| 1666 | {
|
| 1667 |
|
| 1668 | printf("[ccapp_debug]:mo call voice_open fail!!!\n");
|
| 1669 |
|
| 1670 | voice_close(&tVoicePara);
|
| 1671 |
|
| 1672 | }
|
| 1673 |
|
| 1674 | }
|
| 1675 | /* new add end*/
|
| 1676 | printf("[ccapp_debug]:voice_open:rlt=%d\n",g_zCc_VoiceOpenSucc);
|
| 1677 |
|
| 1678 | }
|
| 1679 | else
|
| 1680 | {
|
| 1681 | //close voice
|
| 1682 | g_zCc_VoiceOpenSucc = 1;
|
| 1683 | voice_close(&tVoicePara);
|
| 1684 | printf("[ccapp_debug]:voice_close:rlt=%d\n",g_zCc_VoiceOpenSucc);
|
| 1685 |
|
| 1686 | }
|
| 1687 | return 0;
|
| 1688 | }
|
| 1689 |
|
| 1690 |
|
| 1691 |
|
| 1692 |
|
| 1693 |
|
| 1694 | SINT32 zCc_ZimsplusProc(MSG_BUF *ptMsgBuf)
|
| 1695 | {
|
| 1696 | int act = 0;
|
| 1697 | int rate = 0;
|
| 1698 | T_zCcApp_ImsplusInd tImsplusInd = {0};
|
| 1699 |
|
| 1700 | memcpy(&tImsplusInd, (T_zCcApp_ImsplusInd*)ptMsgBuf->aucDataBuf, sizeof(T_zCcApp_ImsplusInd));
|
| 1701 | act = tImsplusInd.act;
|
| 1702 | rate = tImsplusInd.rate;
|
| 1703 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ZimsplusProc: act = %d rate = %d new!!!<---\n",__FUNCTION__, act, rate);
|
| 1704 | printf("[ccapp_debug]:recv imsplus, tImsplusInd=%d,%d\n",tImsplusInd.act,tImsplusInd.rate);
|
| 1705 |
|
| 1706 |
|
| 1707 | if (act == 0)
|
| 1708 | {
|
| 1709 | SLIC_Stop_PCM();
|
| 1710 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ZimsplusProc: SLIC_Stop_PCM <---\n",__FUNCTION__);
|
| 1711 | }
|
| 1712 | else if (act == 1)
|
| 1713 | {
|
| 1714 | /* new add begin*/
|
| 1715 | if ( g_Cc_CallDetail.state == ZCC_M_RINGING_S)
|
| 1716 | {
|
| 1717 | g_zCc_pcm_bak = rate;
|
| 1718 | return 0;
|
| 1719 | }
|
| 1720 | /* new add end */
|
| 1721 |
|
| 1722 | if (rate == 8000)
|
| 1723 | {
|
| 1724 | SLIC_PCM_Set_NB();
|
| 1725 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ZimsplusProc: SLIC_PCM_Set_NB <---\n",__FUNCTION__);
|
| 1726 | SLIC_Start_PCM();
|
| 1727 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ZimsplusProc: SLIC_Start_PCM <---\n",__FUNCTION__);
|
| 1728 | }
|
| 1729 | else if (rate == 16000)
|
| 1730 | {
|
| 1731 | SLIC_PCM_Set_WB();
|
| 1732 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ZimsplusProc: SLIC_PCM_Set_WB <---\n",__FUNCTION__);
|
| 1733 | SLIC_Start_PCM();
|
| 1734 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ZimsplusProc: SLIC_Start_PCM <---\n",__FUNCTION__);
|
| 1735 | }
|
| 1736 | }
|
| 1737 | else if (act == 2)//¹Ø±Õpcm£¬·Å±¾µØ»ØÁåÒô
|
| 1738 | {
|
| 1739 | if (ZCC_S_RINGBACK_S != g_Cc_CallDetail.slaveObj[rate].state)
|
| 1740 | {
|
| 1741 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ZimsplusProc: act 2,cid err <---\n",__FUNCTION__);
|
| 1742 | return 0;
|
| 1743 | }
|
| 1744 | SLIC_Stop_PCM();
|
| 1745 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ZimsplusProc: SLIC_Stop_PCM <---\n",__FUNCTION__);
|
| 1746 | g_Cc_CallDetail.slaveObj[rate].tone = ZCC_TONE_RB_A;
|
| 1747 | }
|
| 1748 | else if (act == 3)//ºóÐø»áÔÙÓÐact1Éϱ¨£¬ËùÒÔ´Ëʱ²»´ò¿ªpcm
|
| 1749 | {
|
| 1750 | SLIC_Stop_Signal(0,0);
|
| 1751 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ZimsplusProc: SLIC_Stop_Signal <---\n",__FUNCTION__);
|
| 1752 |
|
| 1753 | zCc_SendAtImsPlusReq(rate,0);
|
| 1754 | g_Cc_CallDetail.slaveObj[rate].tone = ZCC_TONE_OFF_A;
|
| 1755 | }
|
| 1756 | return 0;
|
| 1757 | }
|
| 1758 | SINT32 zCc_RecvZcpiInd(MSG_BUF *ptMsgBuf)
|
| 1759 | {
|
| 1760 | //ptMsgBuf->usMsgCmd = ZCCAPP_ATIND_ZCPI;
|
| 1761 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","RECV zcpiind!!!<---\n");
|
| 1762 | //ptMsgBuf->usSourceModuleID = MSG_ID_CALL_CTRL;
|
| 1763 | zCc_SendMsgToSub(ptMsgBuf); /* ·¢¸øÖ÷Ïß³Ì */
|
| 1764 | return 0;
|
| 1765 | }
|
| 1766 |
|
| 1767 | SINT32 zCc_ZcpiIndProc(MSG_BUF *ptMsgBuf)
|
| 1768 | {
|
| 1769 | int state = 0;
|
| 1770 | int cid = 0;
|
| 1771 | int progdsp = 0;
|
| 1772 | T_zCcApp_ZcpiInd tZcpiInd = {0};
|
| 1773 |
|
| 1774 | memcpy(&tZcpiInd, (T_zCcApp_ZcpiInd*)ptMsgBuf->aucDataBuf, sizeof(T_zCcApp_ZcpiInd));
|
| 1775 | state = tZcpiInd.state;
|
| 1776 | cid = tZcpiInd.cid;
|
| 1777 | progdsp = tZcpiInd.progdsp;
|
| 1778 |
|
| 1779 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ZcpiIndProc: cid= %d, state=%d, progdsp=%d <---\n",__FUNCTION__,cid,state,progdsp);
|
| 1780 | if (5 == state)
|
| 1781 | {
|
| 1782 | ptMsgBuf->dst_id = cid;
|
| 1783 | ptMsgBuf->usMsgCmd = ZCC_RESOURCE_READY_E;
|
| 1784 | g_Cc_CallDetail.resourceReady = 1;
|
| 1785 | }
|
| 1786 | else if (6 == state)
|
| 1787 | {
|
| 1788 | g_Cc_CallDetail.resourceReady = 0;
|
| 1789 | }
|
| 1790 |
|
| 1791 | if (8 == progdsp)
|
| 1792 | {
|
| 1793 | SLIC_Start_PCM();
|
| 1794 | }
|
| 1795 |
|
| 1796 | return 0;
|
| 1797 | }
|
| 1798 |
|
| 1799 | LONG zCcApp_send_message(unsigned short Msg_cmd,unsigned short us_DataLen,unsigned char *pData)
|
| 1800 | {
|
| 1801 | ipc_send_message(MODULE_ID_CALL_CTRL, MODULE_ID_AT_CTL, Msg_cmd, us_DataLen, (unsigned char *)pData,0);
|
| 1802 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s ipc_send_message:Msg_cmd is %d<---\n",__FUNCTION__, Msg_cmd);
|
| 1803 |
|
| 1804 | return 0;
|
| 1805 | }
|
| 1806 |
|
| 1807 | VOID zCcApp_Dial(char *ptMsgBuf)
|
| 1808 | {
|
| 1809 | SINT32 ret = -1;
|
| 1810 | MSG_BUF stMsg;
|
| 1811 | LONG msgSize = sizeof(MSG_BUF)-sizeof(LONG);
|
| 1812 | T_zCcapp_CallMoReq tcallReq = {0};
|
| 1813 |
|
| 1814 | memset(tcallReq.number, 0, sizeof(tcallReq.number));
|
| 1815 | //strncpy(tcallReq.number, ptMsgBuf,strlen(ptMsgBuf));
|
| 1816 | strncpy(tcallReq.number, ptMsgBuf,sizeof(tcallReq.number)-1);
|
| 1817 | zCcApp_send_message(MSG_CMD_ATD_DIAL_REQ, sizeof(T_zCcapp_CallMoReq), (unsigned char *) &tcallReq);
|
| 1818 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s ipc_send_message:Msg is MSG_CMD_ATD_DIAL_REQ<---\n",__FUNCTION__);
|
| 1819 |
|
| 1820 | }
|
| 1821 | SINT32 zCcApp_Ccfc(T_zCcapp_CcfcReq *ptccfcreq)
|
| 1822 | {
|
| 1823 | SINT32 ret = -1;
|
| 1824 | MSG_BUF stMsg;
|
| 1825 | LONG msgSize = sizeof(MSG_BUF)-sizeof(LONG);
|
| 1826 |
|
| 1827 | zCcApp_send_message(MSG_CMD_CCFC_REQ, sizeof(T_zCcapp_CcfcReq), (unsigned char *) ptccfcreq);
|
| 1828 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s ipc_send_message:Msg is MSG_CMD_CCFC_REQ<---\n",__FUNCTION__);
|
| 1829 |
|
| 1830 | return 0;
|
| 1831 | }
|
| 1832 | SINT32 zCcApp_Clck(T_zCcapp_ClckReq *ptclckreq)
|
| 1833 | {
|
| 1834 | SINT32 ret = -1;
|
| 1835 | MSG_BUF stMsg;
|
| 1836 | LONG msgSize = sizeof(MSG_BUF)-sizeof(LONG);
|
| 1837 |
|
| 1838 | zCcApp_send_message( MSG_CMD_CLCK_REQ, sizeof(T_zCcapp_ClckReq), (unsigned char *) ptclckreq);
|
| 1839 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s ipc_send_message:Msg is MSG_CMD_CLCK_REQ<---\n",__FUNCTION__);
|
| 1840 |
|
| 1841 | return 0;
|
| 1842 | }
|
| 1843 |
|
| 1844 | SINT32 zCcApp_Answer(VOID)
|
| 1845 | {
|
| 1846 | SINT32 ret = -1;
|
| 1847 | MSG_BUF stMsg;
|
| 1848 | LONG msgSize = sizeof(MSG_BUF)-sizeof(LONG);
|
| 1849 |
|
| 1850 | zCcApp_send_message(MSG_CMD_ATA_REQ, 0, NULL);
|
| 1851 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s ipc_send_message:Msg is MSG_CMD_ATA_REQ<---\n",__FUNCTION__);
|
| 1852 |
|
| 1853 | return 0;
|
| 1854 | }
|
| 1855 |
|
| 1856 | SINT32 zCcApp_Chup(void)
|
| 1857 | {
|
| 1858 | SINT32 ret = -1;
|
| 1859 | MSG_BUF stMsg;
|
| 1860 | LONG msgSize = sizeof(MSG_BUF)-sizeof(LONG);
|
| 1861 |
|
| 1862 | zCcApp_send_message(MSG_CMD_CHUP_REQ, 0, NULL);
|
| 1863 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s ipc_send_message:Msg isMSG_CMD_CHUP_REQ<---\n",__FUNCTION__);
|
| 1864 |
|
| 1865 | return 0;
|
| 1866 | }
|
| 1867 |
|
| 1868 | //µ±ÉÏÒ»¸öVTSûÓÐÊÕµ½OKǰ£¬ÆäËûµÄVTSÈ«²¿»º´æÔÚÁ´±íÀ´ýÊÕµ½ÉÏÒ»¸öOKʱÔÚÏ·¢ÏÂÒ»¸ö
|
| 1869 | //¶¼ÔÚmainÏ̴߳¦Àí£¬ÎÞÐ軥³â
|
| 1870 | typedef struct {
|
| 1871 | struct list_head list;
|
| 1872 | T_zCcapp_VtsReq vts;
|
| 1873 | }T_zCcapp_VtsReq_list;
|
| 1874 |
|
| 1875 | static LIST_HEAD(ccapp_vts_waitqueue);
|
| 1876 | static int ccapp_vts_flag = 0;
|
| 1877 |
|
| 1878 | void zCcApp_Vts_CleanReq(void)
|
| 1879 | {
|
| 1880 | struct list_head *head = &ccapp_vts_waitqueue;
|
| 1881 | T_zCcapp_VtsReq_list *l, *tmp;
|
| 1882 |
|
| 1883 | if(!list_empty(head))
|
| 1884 | {
|
| 1885 | list_for_each_entry_safe(l, tmp, head, list)
|
| 1886 | {
|
| 1887 | list_del(&l->list);
|
| 1888 | free(l);
|
| 1889 | }
|
| 1890 | ccapp_vts_flag = 0;
|
| 1891 | }
|
| 1892 | }
|
| 1893 |
|
| 1894 | void zCcApp_Vts_Rsp(void)
|
| 1895 | {
|
| 1896 | struct list_head *head = &ccapp_vts_waitqueue;
|
| 1897 | printf("[ccapp_debug]:Vts_Rsp flag=%d\n",ccapp_vts_flag);
|
| 1898 | if(list_empty(head))
|
| 1899 | {
|
| 1900 | ccapp_vts_flag = 0;
|
| 1901 | }
|
| 1902 | else
|
| 1903 | {
|
| 1904 | T_zCcapp_VtsReq_list *node = list_entry(head->next,T_zCcapp_VtsReq_list,list);
|
| 1905 |
|
| 1906 | zCcApp_send_message(MSG_CMD_VTS_REQ, sizeof(T_zCcapp_VtsReq), (unsigned char *) &node->vts);
|
| 1907 | ccapp_vts_flag = 1;
|
| 1908 | list_del(&node->list);
|
| 1909 | free(node);
|
| 1910 | }
|
| 1911 | }
|
| 1912 |
|
| 1913 | SINT32 zCcApp_Vts(char* dtmfchar)
|
| 1914 | {
|
| 1915 | T_zCcapp_VtsReq tvtsreq = {0};
|
| 1916 | struct list_head *head = &ccapp_vts_waitqueue;
|
| 1917 |
|
| 1918 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","vtschar=%s<---\n",dtmfchar);
|
| 1919 | tvtsreq.dtmfchar=*dtmfchar;
|
| 1920 | printf("[ccapp_debug]:Vts_Req flag=%d\n",ccapp_vts_flag);
|
| 1921 | if(list_empty(head) && ccapp_vts_flag == 0)
|
| 1922 | {
|
| 1923 | zCcApp_send_message(MSG_CMD_VTS_REQ, sizeof(T_zCcapp_VtsReq), (unsigned char *) &tvtsreq);
|
| 1924 | ccapp_vts_flag = 1;
|
| 1925 | }
|
| 1926 | else
|
| 1927 | {
|
| 1928 | T_zCcapp_VtsReq_list *node = (T_zCcapp_VtsReq_list *)malloc(sizeof(T_zCcapp_VtsReq_list));
|
| 1929 | if(node == NULL)
|
| 1930 | {
|
| 1931 | printf("[ccapp_debug]: zCcApp_Vts malloc fail!!!\n");
|
| 1932 | return 0;
|
| 1933 | }
|
| 1934 | memset(node, 0 , sizeof(T_zCcapp_VtsReq_list));
|
| 1935 | node->vts.dtmfchar = tvtsreq.dtmfchar;
|
| 1936 | list_add_tail(&node->list,head);
|
| 1937 | }
|
| 1938 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s ipc_send_message:Msg is MSG_CMD_VTS_REQ<---\n",__FUNCTION__);
|
| 1939 |
|
| 1940 | return 0;
|
| 1941 | }
|
| 1942 | SINT32 zCcApp_SetImsPlus(int rate, int setfg)
|
| 1943 | {
|
| 1944 | SINT32 ret = -1;
|
| 1945 | MSG_BUF stMsg;
|
| 1946 | LONG msgSize = sizeof(MSG_BUF)-sizeof(LONG);
|
| 1947 | T_zCcapp_ImsplusReq timsplusreq= {0};
|
| 1948 |
|
| 1949 | timsplusreq.act = rate;
|
| 1950 | timsplusreq.setfg = setfg;
|
| 1951 |
|
| 1952 | zCcApp_send_message(MSG_CMD_ZIMSPLUS_REQ, sizeof(T_zCcapp_ImsplusReq), (unsigned char *) &timsplusreq);
|
| 1953 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s ipc_send_message:Msg is MSG_CMD_ZIMSPLUS_REQ<---\n",__FUNCTION__);
|
| 1954 |
|
| 1955 | return 0;
|
| 1956 | }
|
| 1957 |
|
| 1958 | SINT32 zCcApp_Chld(int chldtype)
|
| 1959 | {
|
| 1960 | SINT32 ret = -1;
|
| 1961 | MSG_BUF stMsg;
|
| 1962 | LONG msgSize = sizeof(MSG_BUF)-sizeof(LONG);
|
| 1963 |
|
| 1964 | T_zCcapp_ChldReq tchldreq = {0};
|
| 1965 |
|
| 1966 | tchldreq.type = chldtype;
|
| 1967 |
|
| 1968 | zCcApp_send_message(MSG_CMD_CHLD_REQ, sizeof(T_zCcapp_ChldReq), (unsigned char *) &tchldreq);
|
| 1969 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s ipc_send_message:Msg is MSG_CMD_CHLD_REQ[%d]<---\n",__FUNCTION__,chldtype);
|
| 1970 |
|
| 1971 | return 0;
|
| 1972 | }
|
| 1973 |
|
| 1974 | SINT32 zCcApp_AtIndRspProc(MSG_BUF *ptMsgBuf)
|
| 1975 | {
|
| 1976 | SINT32 i ;
|
| 1977 | SINT32 ret = -1;
|
| 1978 | for(i=0;i< gCcAppRecvAtIndProcCnt;i++)
|
| 1979 | {
|
| 1980 | if(ptMsgBuf->usMsgCmd == gCcAppRecvAtIndProc[i].AtIndCmd)
|
| 1981 | {
|
| 1982 | if(NULL!= gCcAppRecvAtIndProc[i].RecvAtIndProcFun)
|
| 1983 | {
|
| 1984 | ret = gCcAppRecvAtIndProc[i].RecvAtIndProcFun(ptMsgBuf);
|
| 1985 | }
|
| 1986 | break;
|
| 1987 | }
|
| 1988 | }
|
| 1989 |
|
| 1990 | return ret;
|
| 1991 | }
|
| 1992 | VOID zCc_MReleaseState(MSG_BUF *ptMsgBuf)
|
| 1993 | {
|
| 1994 | CHAR voip_status[ZDIAL_NUM_MAX] = {0};
|
| 1995 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MReleaseState ptMsgBuf->usMsgCmd = %d\n",__FUNCTION__,ptMsgBuf->usMsgCmd);
|
| 1996 |
|
| 1997 | printf("[ccapp_debug]: Release State Recv MsgCmd: %d\n",ptMsgBuf->usMsgCmd);
|
| 1998 |
|
| 1999 | switch (ptMsgBuf->usMsgCmd)
|
| 2000 | {
|
| 2001 | case ZCC_SEIZE_E: // ͻȜ
|
| 2002 | // slave[0] to play dial tone
|
| 2003 | g_Cc_CallDetail.evt[0] = ZCC_DIAL_E;
|
| 2004 | g_Cc_CallDetail.state = ZCC_M_SEIZE_S;
|
| 2005 | g_Cc_CallDetail.chupSent = FALSE;
|
| 2006 | g_Cc_CallDetail.hookofffg = TRUE;
|
| 2007 | if (g_Cc_CallDetail.ringCid)// ¾Ü¾øµÈ´ý×ÊԴ״̬µÄincoming call
|
| 2008 | {
|
| 2009 | zCc_SendAtHangupReq();
|
| 2010 | g_Cc_CallDetail.slaveObj[g_Cc_CallDetail.ringCid].waitDSCI6 = 1;
|
| 2011 | }
|
| 2012 |
|
| 2013 | #ifndef TEST_CCAPP
|
| 2014 | cfg_get_item("voip_status",voip_status,sizeof(voip_status));
|
| 2015 |
|
| 2016 | if (0 != strcmp("ledblink" , voip_status))
|
| 2017 | #endif
|
| 2018 | {
|
| 2019 | zCc_SetLedStatus("ledblink");
|
| 2020 | }
|
| 2021 | break;
|
| 2022 |
|
| 2023 | case ZCC_SINVITE_E:
|
| 2024 | g_Cc_CallDetail.evt[ptMsgBuf->dst_id] = ZCC_SINVITE_E;
|
| 2025 | //g_Cc_CallDetail.state = ZCC_M_RINGING_S; È·ÈÏ×ÊÔ´·ÖÅäºóÔÙǨ״̬
|
| 2026 | break;
|
| 2027 |
|
| 2028 | case ZCC_RESOURCE_READY_E:
|
| 2029 | ccapp_log("g_Cc_CallDetail.ringCid=%d", g_Cc_CallDetail.ringCid);
|
| 2030 | if (g_Cc_CallDetail.ringCid)
|
| 2031 | {
|
| 2032 | g_Cc_CallDetail.evt[g_Cc_CallDetail.ringCid] = ZCC_RESOURCE_READY_E;
|
| 2033 | }
|
| 2034 | break;
|
| 2035 |
|
| 2036 | case ZCC_SDISCN_MO_E:
|
| 2037 | case ZCC_SDISCN_MT_E:
|
| 2038 | g_Cc_CallDetail.evt[ptMsgBuf->dst_id] = ptMsgBuf->usMsgCmd;
|
| 2039 | break;
|
| 2040 |
|
| 2041 | case ZCC_RELEASE_E:
|
| 2042 | case ZCC_FLASH_E:
|
| 2043 | default:
|
| 2044 | // do nothing
|
| 2045 | break;
|
| 2046 | }
|
| 2047 | }
|
| 2048 |
|
| 2049 | pthread_t slic_ring_test_pid;
|
| 2050 | void* slic_ring_test_thread(void * ptr)
|
| 2051 | {
|
| 2052 | SIGNAL_DATA tSig;
|
| 2053 | while(1)
|
| 2054 | {
|
| 2055 | sleep(30);
|
| 2056 | printf("ring stop\n");
|
| 2057 | SLIC_Stop_Signal(0, RING_SIGNAL);
|
| 2058 | zCc_SetLedStatus("ledoff");
|
| 2059 |
|
| 2060 | sleep(30);
|
| 2061 | printf("ringing\n");
|
| 2062 | memset(&tSig, 0, sizeof(tSig));
|
| 2063 | tSig.signal_type = RING_SIGNAL;
|
| 2064 | strcpy(g_Cc_CallDetail.number, "1234567890");
|
| 2065 | strncpy(tSig.cid, g_Cc_CallDetail.number,sizeof(tSig.cid)-1);
|
| 2066 | get_local_datetime(tSig.date_time);
|
| 2067 | ccapp_log("local test call RING_SIGNAL,number = %s\n",g_Cc_CallDetail.number);
|
| 2068 | SLIC_Play_Signal(0, 0, &tSig);
|
| 2069 | zCc_SetLedStatus("ledblink");
|
| 2070 | }
|
| 2071 | return NULL;
|
| 2072 | }
|
| 2073 |
|
| 2074 | VOID zCc_MRingingState(MSG_BUF *ptMsgBuf)
|
| 2075 | {
|
| 2076 | int held_call_cid = 0;
|
| 2077 | int incoming_call_cid = 0;
|
| 2078 | int shall_ring_cid;
|
mj.qu | 5887501 | 2025-06-19 02:45:53 -0700 | [diff] [blame] | 2079 |
|
| 2080 | MSG_BUF msgBuf = {0};
|
| 2081 | char callback_enable[4] = {0};
|
| 2082 | char callback_number[20] = {0};
|
| 2083 | cfg_get_item("callback_enable", callback_enable, sizeof(callback_enable));
|
| 2084 | cfg_get_item("callback_number", callback_number, sizeof(callback_number));
|
mj.qu | 1524fc9 | 2025-06-11 04:34:13 -0700 | [diff] [blame] | 2085 |
|
| 2086 | SIGNAL_DATA tSig;
|
| 2087 |
|
| 2088 | CHAR voip_status[ZDIAL_NUM_MAX] = {0};
|
| 2089 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MRingingState ptMsgBuf->usMsgCmd = %d\n",__FUNCTION__,ptMsgBuf->usMsgCmd);
|
| 2090 | switch (ptMsgBuf->usMsgCmd)
|
| 2091 | {
|
| 2092 | case ZCC_SEIZE_E: // ͻȜ
|
| 2093 | g_Cc_CallDetail.state = ZCC_M_SEIZE_S;
|
| 2094 | SLIC_Stop_Signal(0, RING_SIGNAL);
|
| 2095 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MRingingState: SLIC_Stop_Signal <---\n",__FUNCTION__);
|
| 2096 | if (g_zCc_VoiceOpenSucc == 0)
|
| 2097 | {
|
| 2098 | g_zCc_VoiceOpenSucc = 1;
|
| 2099 | voice_open(&g_zCc_VoicePara_bak);
|
| 2100 | /* new add begin */
|
| 2101 | if (g_zCc_pcm_bak == 8000)
|
| 2102 | {
|
| 2103 | SLIC_PCM_Set_NB();
|
| 2104 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ZimsplusProc: SLIC_PCM_Set_NB <---\n",__FUNCTION__);
|
| 2105 | SLIC_Start_PCM();
|
| 2106 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ZimsplusProc: SLIC_Start_PCM <---\n",__FUNCTION__);
|
| 2107 | }
|
| 2108 | else if (g_zCc_pcm_bak == 16000)
|
| 2109 | {
|
| 2110 | SLIC_PCM_Set_WB();
|
| 2111 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ZimsplusProc: SLIC_PCM_Set_WB <---\n",__FUNCTION__);
|
| 2112 | SLIC_Start_PCM();
|
| 2113 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_ZimsplusProc: SLIC_Start_PCM <---\n",__FUNCTION__);
|
| 2114 | }
|
| 2115 | g_zCc_pcm_bak = 0;
|
| 2116 | /* new add end */
|
| 2117 | }
|
| 2118 |
|
| 2119 | g_Cc_CallDetail.chupSent = FALSE;
|
| 2120 |
|
| 2121 | ccapp_log("ZCC_SEIZE_E held_cid=%d held_incoming_cid=%d",
|
| 2122 | zCc_find_held_cid(),
|
| 2123 | zCc_find_held_incoming_cid());
|
| 2124 |
|
| 2125 | if(local_test_call_st==LocalTestCallST_Ring)
|
| 2126 | {
|
| 2127 | /*memset(&tSig, 0, sizeof(tSig));
|
| 2128 | tSig.signal_type= TONE_SIGNAL;
|
| 2129 | tSig.tone_type = TONE_TKY;
|
| 2130 | SLIC_Play_Signal(0, 0, &tSig);*/
|
| 2131 | if(local_test_call_type == LocalTestCallType_LOOP)
|
| 2132 | pthread_cancel(slic_ring_test_pid);
|
| 2133 |
|
| 2134 | g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
|
| 2135 | g_Cc_CallDetail.evt[0]= ZCC_NO_E;
|
| 2136 | g_Cc_CallDetail.slaveObj[0].sMsg = ZCC_SNO_M;
|
| 2137 |
|
| 2138 | local_test_call_st = LocalTestCallST_End;
|
| 2139 |
|
| 2140 | //system("echo loop_1 >> /tmp/log.ccapp.vploop");
|
| 2141 | //system("( sleep 1 && at_cmd AT+VPLOOP=1 ) &");
|
| 2142 | cfg_set("tz_vploop", "1");
|
| 2143 | ipc_send_message(MODULE_ID_CALL_CTRL_LOCAL,
|
| 2144 | MODULE_ID_AT_CTL,
|
| 2145 | MSG_CMD_SET_VPLOOP_REQ,
|
| 2146 | 0,
|
| 2147 | NULL,
|
| 2148 | 0);
|
| 2149 |
|
| 2150 | zCc_ShowAllSlaveWithTips("testCall-end");
|
| 2151 | break;
|
| 2152 | }
|
| 2153 |
|
| 2154 | incoming_call_cid = zCc_find_held_incoming_cid();
|
| 2155 | ccapp_log("incoming_call_cid=%d is_cidcw=%d",
|
| 2156 | incoming_call_cid,
|
| 2157 | g_Cc_CallDetail.slaveObj[incoming_call_cid].is_cidcw);
|
| 2158 |
|
| 2159 | if(zCc_find_held_cid())
|
| 2160 | {
|
| 2161 | zCc_SendAtChldReq(1);
|
| 2162 | }
|
| 2163 | else if(incoming_call_cid)
|
| 2164 | {
|
| 2165 | if(g_Cc_CallDetail.slaveObj[incoming_call_cid].is_cidcw == TRUE)
|
| 2166 | zCc_SendAtChldReq(1);
|
| 2167 | else
|
| 2168 | {
|
| 2169 | if (g_Cc_CallDetail.ringCid)
|
| 2170 | {
|
| 2171 | g_Cc_CallDetail.evt[g_Cc_CallDetail.ringCid] = ZCC_CNCT_E;
|
| 2172 | zCc_SendAtAnswerReq();
|
| 2173 | }
|
| 2174 | }
|
| 2175 | }
|
| 2176 | else
|
| 2177 | {
|
| 2178 | if (g_Cc_CallDetail.ringCid)
|
| 2179 | {
|
| 2180 | g_Cc_CallDetail.evt[g_Cc_CallDetail.ringCid] = ZCC_CNCT_E;
|
| 2181 | zCc_SendAtAnswerReq();
|
| 2182 | }
|
| 2183 | }
|
mj.qu | 5887501 | 2025-06-19 02:45:53 -0700 | [diff] [blame] | 2184 |
|
| 2185 | if(0 == strcmp(callback_enable, "1") && 1 == check_phone_number_in_file(callback_number, "/cache/call_back_list"))
|
| 2186 | {
|
| 2187 | g_chup_flag = 1;
|
| 2188 | msgBuf.usMsgCmd = ZCC_RELEASE_E;
|
| 2189 | msgBuf.src_id = MODULE_ID_SLIC;
|
| 2190 | zCc_SendMsgToSub(&msgBuf);
|
mj.qu | 435a4e4 | 2025-08-06 19:00:49 -0700 | [diff] [blame] | 2191 |
|
mj.qu | d2d5ce1 | 2025-08-10 18:51:34 -0700 | [diff] [blame^] | 2192 | /*fix the issue of probability callback failure, call has not been established yet, with a probability of hanging up*/
|
mj.qu | 435a4e4 | 2025-08-06 19:00:49 -0700 | [diff] [blame] | 2193 | sleep(1);
|
mj.qu | 5887501 | 2025-06-19 02:45:53 -0700 | [diff] [blame] | 2194 |
|
| 2195 | zCc_SendAtHangupReq();
|
| 2196 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MRingingState: ZCC_RELEASE_E <---\n",__FUNCTION__);
|
| 2197 | }
|
| 2198 |
|
mj.qu | 1524fc9 | 2025-06-11 04:34:13 -0700 | [diff] [blame] | 2199 | break;
|
| 2200 |
|
| 2201 | // case ZCC_SINVITE_E:
|
| 2202 | case ZCC_SDISCN_MT_E:
|
| 2203 | case ZCC_SDISCN_MO_E:
|
| 2204 | if(check_incoming_call_is_in_slave(ptMsgBuf)==0)
|
| 2205 | break;
|
| 2206 |
|
| 2207 | g_Cc_CallDetail.evt[ptMsgBuf->dst_id] = ptMsgBuf->usMsgCmd;
|
| 2208 | g_Cc_CallDetail.state = ZCC_M_RELEASE_S;
|
| 2209 | SLIC_Stop_Signal(0, RING_SIGNAL);
|
| 2210 | g_zCc_VoiceOpenSucc = 1;
|
| 2211 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MRingingState: SLIC_Stop_Signal <---\n",__FUNCTION__);
|
| 2212 | #ifndef TEST_CCAPP
|
| 2213 | cfg_get_item("voip_status",voip_status,sizeof(voip_status));
|
| 2214 |
|
| 2215 | if (0 != strcmp("ledoff" , voip_status ))
|
| 2216 | #endif
|
| 2217 | {
|
| 2218 | zCc_SetLedStatus("ledoff");
|
| 2219 | }
|
| 2220 |
|
| 2221 | shall_ring_cid = 0;
|
| 2222 | held_call_cid = zCc_find_held_cid();
|
| 2223 | incoming_call_cid = zCc_find_held_incoming_cid();
|
| 2224 | if(held_call_cid && (ptMsgBuf->dst_id!=held_call_cid))
|
| 2225 | shall_ring_cid = held_call_cid;
|
| 2226 | else if(incoming_call_cid && (ptMsgBuf->dst_id!=incoming_call_cid))
|
| 2227 | shall_ring_cid = incoming_call_cid;
|
| 2228 |
|
| 2229 | if(shall_ring_cid!=0)
|
| 2230 | {
|
| 2231 | memset(&tSig, 0, sizeof(tSig));
|
| 2232 | g_Cc_CallDetail.state = ZCC_M_RINGING_S;
|
| 2233 | tSig.signal_type = RING_SIGNAL;
|
| 2234 | /*memcpy(tSig.cid,
|
| 2235 | g_Cc_CallDetail.slaveObj[shall_ring_cid].number,
|
| 2236 | strlen(g_Cc_CallDetail.slaveObj[shall_ring_cid].number));*/
|
| 2237 | strncpy(tSig.cid, g_Cc_CallDetail.slaveObj[shall_ring_cid].number, sizeof(tSig.cid)-1);
|
| 2238 | get_local_datetime(tSig.date_time);
|
| 2239 | 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);
|
| 2240 | SLIC_Play_Signal(0, 0, &tSig);
|
| 2241 | zCc_SetLedStatus("ledblink");
|
| 2242 | }
|
| 2243 | break;
|
| 2244 |
|
| 2245 | default:
|
| 2246 | // do nothing
|
| 2247 | break;
|
| 2248 | }
|
| 2249 | }
|
| 2250 |
|
| 2251 | VOID zCc_MSeizeState(MSG_BUF *ptMsgBuf)
|
| 2252 | {
|
| 2253 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState ptMsgBuf->usMsgCmd = %d\n",__FUNCTION__,ptMsgBuf->usMsgCmd);
|
| 2254 | UINT8 slave = (UINT8)ptMsgBuf->dst_id;
|
| 2255 | UINT8 callCnt = 0;
|
| 2256 | UINT8 ret = 0;
|
| 2257 | SINT32 chldret = -1;
|
| 2258 | UINT8 tmpslave = 0;
|
| 2259 | CHAR voip_status[ZDIAL_NUM_MAX] = {0};
|
mj.qu | 8ddc764 | 2025-06-11 04:37:19 -0700 | [diff] [blame] | 2260 | char hotline_time[4] = {0};
|
mj.qu | 1524fc9 | 2025-06-11 04:34:13 -0700 | [diff] [blame] | 2261 |
|
mj.qu | 5887501 | 2025-06-19 02:45:53 -0700 | [diff] [blame] | 2262 | char callback_enable[4] = {0};
|
| 2263 | char callback_number[20] = {0};
|
| 2264 | cfg_get_item("callback_enable", callback_enable, sizeof(callback_enable));
|
| 2265 | cfg_get_item("callback_number", callback_number, sizeof(callback_number));
|
| 2266 |
|
mj.qu | 1524fc9 | 2025-06-11 04:34:13 -0700 | [diff] [blame] | 2267 | printf("[ccapp_debug]: Seize State Recv MsgCmd: %d,localtest=%d\n",ptMsgBuf->usMsgCmd,local_test_call_st);
|
| 2268 |
|
| 2269 | switch (ptMsgBuf->usMsgCmd)
|
| 2270 | {
|
| 2271 | case ZCC_DTMF_E: // ²¦ºÅ
|
| 2272 | // slave[0] dial , or other call's DTMF
|
| 2273 | ccapp_log("--> ZCC_DTMF_E[%c] lastTone=%d Count=%d Held=%d Active=%d getSlave(DACCM)=%d getSlave(RINGBACK)=%d ringCid=%d dig=%s",
|
| 2274 | ptMsgBuf->aucDataBuf[0],
|
| 2275 | g_Cc_CallDetail.lastTone,
|
| 2276 | zCc_CallCount(),
|
| 2277 | zCc_HeldCall(),
|
| 2278 | zCc_ActiveCall(),
|
| 2279 | zCc_GetSpecSlave(ZCC_S_DACCM_S),
|
| 2280 | zCc_GetSpecSlave(ZCC_S_RINGBACK_S),
|
| 2281 | g_Cc_CallDetail.ringCid,
|
| 2282 | g_Cc_CallDetail.digits);
|
| 2283 | 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",
|
| 2284 | ptMsgBuf->aucDataBuf[0],
|
| 2285 | g_Cc_CallDetail.lastTone,
|
| 2286 | zCc_CallCount(),
|
| 2287 | zCc_HeldCall(),
|
| 2288 | zCc_ActiveCall(),
|
| 2289 | zCc_GetSpecSlave(ZCC_S_DACCM_S),
|
| 2290 | zCc_GetSpecSlave(ZCC_S_RINGBACK_S),
|
| 2291 | g_Cc_CallDetail.ringCid,
|
| 2292 | g_Cc_CallDetail.digits);
|
| 2293 |
|
| 2294 | /* callwait ringback but he drop then we hookflash+1
|
| 2295 | lastTone=6 Count=2 Held=1 Active=0 getSlave(DACCM)=0 getSlave(RINGBACK)=2 ringCid=0 dig[0]=F
|
| 2296 | */
|
| 2297 | if ((g_Cc_CallDetail.lastTone == ZCC_TONE_BSY_A) || (g_Cc_CallDetail.lastTone == ZCC_TONE_TKY_A))//æÒôºÍÃùº¿Òô£¬²»´¦Àí°´¼üÏûÏ¢
|
| 2298 | {
|
| 2299 | zCc_ClearDigits();
|
| 2300 | break;
|
| 2301 | }
|
| 2302 | callCnt = zCc_CallCount();
|
| 2303 | if ( (g_Cc_CallDetail.lastTone == ZCC_TONE_DIAL_A || callCnt == zCc_HeldCall()) //Ö»Óб£³Öºô½Ð£¬²¦ºÅ·¢Æðкô½Ð
|
| 2304 | && g_Cc_CallDetail.digits[0] != ZCC_FLASH_SIGN
|
| 2305 | && 0 == zCc_ActiveCall())//·Å²¦ºÅÒô»òÒÑÓб£³Öºô½ÐʱÓû§²¦ºÅ,µÚÒ»¸ö×Ö·û£¬Åųýactive+heldʱÏ·¢F2
|
| 2306 | {
|
| 2307 | slave = zCc_GetSpecSlave(ZCC_S_IDLE_S);
|
| 2308 | if (0 == slave )
|
| 2309 | {
|
| 2310 | return;
|
| 2311 | }
|
| 2312 | g_Cc_CallDetail.slaveObj[slave] = g_Cc_CallDetail.slaveObj[0];
|
| 2313 | g_Cc_CallDetail.evt[slave] = ZCC_DTMF_E;
|
| 2314 | DeleteSoftTimer(ZCCAPP_TIMER_SSDIALTONE_DETECT);
|
| 2315 | zCc_InitSlaveObj(0);
|
| 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.lastTone == ZCC_TONE_SIL_A) && (0 != zCc_GetSpecSlave(ZCC_S_DACCM_S)))//¼ÌÐø²¦ºÅ
|
| 2320 | {
|
| 2321 | slave = zCc_GetSpecSlave(ZCC_S_DACCM_S);
|
| 2322 | g_Cc_CallDetail.evt[slave] = ZCC_DTMF_E;
|
| 2323 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState ZCC_DTMF_E \n",__FUNCTION__);
|
| 2324 | break;
|
| 2325 | }
|
| 2326 | else if ((g_Cc_CallDetail.digits[0] != ZCC_FLASH_SIGN) && ((0 != zCc_ActiveCall())
|
| 2327 | ||((0 == zCc_ActiveCall()) && (0 != zCc_GetSpecSlave(ZCC_S_RINGBACK_S)))))//·¢dtmf
|
| 2328 | {
|
| 2329 | if (0 != zCc_ActiveCall())
|
| 2330 | {
|
| 2331 | slave = zCc_GetCallSlave(0);
|
| 2332 | }
|
| 2333 | else
|
| 2334 | {
|
| 2335 | slave = zCc_GetSpecSlave(ZCC_S_RINGBACK_S);
|
| 2336 | }
|
| 2337 | g_Cc_CallDetail.evt[slave] = ZCC_DTMF_E;
|
| 2338 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState ZCC_DTMF_E \n",__FUNCTION__);
|
| 2339 | break;
|
| 2340 | }
|
| 2341 | else if ((0 == zCc_ActiveCall()) && (0 == zCc_GetSpecSlave(ZCC_S_RINGBACK_S))
|
| 2342 | && (g_Cc_CallDetail.digits[0] != ZCC_FLASH_SIGN))//·ÇÎÈ̬·Ç»ØÁåÒô״̬ÊÕµ½×Ö·û£¬¶ªÆú
|
| 2343 | {
|
| 2344 | zCc_ClearDigits();
|
| 2345 | return;
|
| 2346 | }
|
| 2347 | else
|
| 2348 | {
|
| 2349 | if (g_Cc_CallDetail.ringCid && (g_Cc_CallDetail.slaveObj[g_Cc_CallDetail.ringCid].tone == ZCC_TONE_CIDCW_A))//active+waiting+flashordtmf
|
| 2350 | {
|
| 2351 | DeleteSoftTimer(ZCCAPP_TIMER_SSDIALTONE_DETECT);
|
| 2352 | if (g_Cc_CallDetail.digits[0] != ZCC_FLASH_SIGN)
|
| 2353 | {
|
| 2354 | slave = zCc_GetSpecSlave(ZCC_S_TALKING_S);
|
| 2355 | if (0 == slave )
|
| 2356 | {
|
| 2357 | return;
|
| 2358 | }
|
| 2359 | g_Cc_CallDetail.evt[slave] = ZCC_DTMF_E;
|
| 2360 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState ZCC_DTMF_E \n",__FUNCTION__);
|
| 2361 | break;
|
| 2362 | }
|
| 2363 | }
|
| 2364 |
|
| 2365 | DeleteSoftTimer(ZCCAPP_TIMER_DTMF_DETECT);
|
| 2366 | ret = zCc_DigitsMatch();
|
| 2367 | if ((ZCC_NO_RESULT != ret && ZCC_MATCHERR != ret && g_Cc_CallDetail.lastTone == ZCC_TONE_DIAL_A)
|
| 2368 | ||(ZCC_MATCHERR == ret && g_Cc_CallDetail.lastTone == ZCC_TONE_DIAL_A && 2 <= zCc_CallCount()))
|
| 2369 | {//call waitingÊÕµ½flash4£¬Í£Ö¹²¦ºÅÒô»Ö¸´ºô½ÐµÈ´ýÒô
|
| 2370 | SLIC_Stop_Signal(0, TONE_SIGNAL);
|
| 2371 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState: SLIC_Stop_Signal <---\n",__FUNCTION__);
|
| 2372 | g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
|
| 2373 | if (g_Cc_CallDetail.slaveObj[0].tone != ZCC_TONE_OFF_A)
|
| 2374 | {
|
| 2375 | zCc_InitSlaveObj(0);
|
| 2376 | }
|
| 2377 | if (0 != zCc_ActiveCall())
|
| 2378 | {
|
| 2379 | SLIC_Start_PCM();
|
| 2380 | }
|
| 2381 | if ((ZCC_FLASH_1 == ret || ZCC_FLASH_2 == ret) && (g_Cc_CallDetail.ringCid != 0))//½ÓÌýwaiting call£¬ºô½ÐµÈ´ýÒôÓ¦Çå¿Õ
|
| 2382 | {
|
| 2383 | g_Cc_CallDetail.slaveObj[g_Cc_CallDetail.ringCid].tone = ZCC_TONE_OFF_A;
|
| 2384 | }
|
| 2385 | }
|
| 2386 | zCc_DigitsMatchRltProc(ret);
|
| 2387 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState ZCC_DTMF_E \n",__FUNCTION__);
|
| 2388 | }
|
| 2389 |
|
| 2390 | break;
|
| 2391 |
|
| 2392 | case ZCC_SDIALLING_E: // ·¢³öÁËSIP INVITE »ò CC SETUP , ͨ¹ýÕâ¸öÏûÏ¢Éϱ¨ cid
|
| 2393 | if (0 != zCc_GetDialingSlave(0))
|
| 2394 | {
|
| 2395 | tmpslave = zCc_GetDialingSlave(0);
|
| 2396 | if (tmpslave != slave)
|
| 2397 | {
|
| 2398 | g_Cc_CallDetail.slaveObj[slave] = g_Cc_CallDetail.slaveObj[tmpslave];
|
| 2399 | zCc_InitSlaveObj(tmpslave);
|
| 2400 | }
|
| 2401 | }
|
| 2402 | break;
|
| 2403 |
|
| 2404 | case ZCC_SRING_E:
|
| 2405 | case ZCC_SANS_E:
|
| 2406 | case ZCC_SINVITE_E:
|
| 2407 | case ZCC_CIDCW_E:
|
| 2408 | g_Cc_CallDetail.evt[slave] = ptMsgBuf->usMsgCmd;
|
| 2409 | break;
|
| 2410 |
|
| 2411 | case ZCC_SDISCN_MT_E:
|
| 2412 | case ZCC_SDISCN_MO_E:
|
| 2413 | { //cov m
|
| 2414 | if(check_incoming_call_is_in_slave(ptMsgBuf)==0)
|
| 2415 | break;
|
| 2416 |
|
| 2417 | g_Cc_CallDetail.evt[slave] = ptMsgBuf->usMsgCmd;
|
| 2418 |
|
| 2419 | T_zCcApp_DsciInd *ptr = ptMsgBuf->aucDataBuf;
|
| 2420 |
|
| 2421 | /* somebody drop the call
|
| 2422 | zCc_MSeizeState zCc_MSeizeState ptMsgBuf->usMsgCmd = 43
|
| 2423 | zCc_MSeizeState ==> get MT/MO cid=1 num=13088877803 stat=6 inMp=0 getCnt=2
|
| 2424 | zCc_MSeizeState slv=1 cid=0 held=1 stat=8
|
| 2425 | zCc_MSeizeState slv=2 cid=0 held=0 stat=8
|
| 2426 | zCc_STalkingState zCc_STalkingState g_Cc_CallDetail.evt[1] = 43
|
| 2427 | */
|
| 2428 | ccapp_log("==> get MT/MO cid=%d num=%s stat=%d inMp=%d getCnt=%d",
|
| 2429 | ptr->cid, ptr->num, ptr->state, ptr->inMpty,
|
| 2430 | zCc_CallCount());
|
| 2431 |
|
| 2432 | for (tmpslave = 0; tmpslave < ZCC_SLAVES; tmpslave++)
|
| 2433 | {
|
| 2434 | if (g_Cc_CallDetail.slaveObj[tmpslave].state != ZCC_S_IDLE_S)
|
| 2435 | {
|
| 2436 | ccapp_log(" slave=%d cid=%d held=%d stat=%d",
|
| 2437 | tmpslave,
|
| 2438 | g_Cc_CallDetail.slaveObj[tmpslave].cid,
|
| 2439 | g_Cc_CallDetail.slaveObj[tmpslave].heldcall,
|
| 2440 | g_Cc_CallDetail.slaveObj[tmpslave].state);
|
| 2441 | }
|
| 2442 | }
|
| 2443 |
|
| 2444 | if(zCc_CallCount()<2)
|
| 2445 | break;
|
| 2446 |
|
| 2447 | if(ptr->cid>=ZCC_SLAVES) //cov m
|
| 2448 | break;
|
| 2449 |
|
| 2450 | if(g_Cc_CallDetail.slaveObj[ptr->cid].heldcall==0 &&
|
| 2451 | g_Cc_CallDetail.slaveObj[ptr->cid].confcall==0)
|
| 2452 | {
|
| 2453 | if(zCc_HeldCall())
|
| 2454 | {
|
| 2455 | zCc_SendAtChldReq(1);
|
| 2456 | break;
|
| 2457 | }
|
| 2458 | }
|
| 2459 |
|
| 2460 | int incoming_call_cid = zCc_GetSpecSlave(ZCC_S_TRYING_S);
|
| 2461 | if(incoming_call_cid!=0 && incoming_call_cid!=ptr->cid)
|
| 2462 | zCc_SendAtChldReq(2);
|
| 2463 |
|
| 2464 | #if 0
|
| 2465 | tmpslave = zCc_GetSpecSlave(ZCC_S_TRYING_S); // incoming call here and wait for to be accepted
|
| 2466 | ccapp_log("zCc_CallCount()=%d zCc_GetSpecSlave(ZCC_S_TRYING_S)=%d",
|
| 2467 | zCc_CallCount(),
|
| 2468 | tmpslave);
|
| 2469 | if(tmpslave!=0 && ptMsgBuf->usMsgCmd==ZCC_SDISCN_MO_E) // foreground drop, automaticly accept the incoming call
|
| 2470 | {
|
| 2471 | SLIC_Stop_Signal(0, TONE_SIGNAL);
|
| 2472 | zCc_SendAtChldReq(1);
|
| 2473 | break;
|
| 2474 | }
|
| 2475 |
|
| 2476 | if(zCc_CallCount()<2)
|
| 2477 | break;
|
| 2478 |
|
| 2479 | if(ptr->cid<0 || ptr->cid>=ZCC_SLAVES)
|
| 2480 | break;
|
| 2481 |
|
| 2482 | if(g_Cc_CallDetail.slaveObj[ptr->cid].heldcall==0 &&
|
| 2483 | g_Cc_CallDetail.slaveObj[ptr->cid].confcall==0)
|
| 2484 | {
|
| 2485 | /*if(g_Cc_CallDetail.slaveObj[ptr->cid].state==ZCC_S_DIALING_S ||
|
| 2486 | g_Cc_CallDetail.slaveObj[ptr->cid].state==ZCC_S_RINGBACK_S ||
|
| 2487 | g_Cc_CallDetail.slaveObj[ptr->cid].state==ZCC_S_TALKING_S) */
|
| 2488 | if(zCc_HeldCall())
|
| 2489 | {
|
| 2490 | zCc_SendAtChldReq(1);
|
| 2491 | }
|
| 2492 | }
|
| 2493 | #endif
|
| 2494 | break;
|
| 2495 | }
|
| 2496 | case ZCC_RELEASE_E:
|
| 2497 | if(local_test_call_st==LocalTestCallST_Start)
|
| 2498 | {
|
| 2499 | SIGNAL_DATA tSig;
|
| 2500 |
|
| 2501 | SLIC_Stop_Signal(0, TONE_SIGNAL);
|
| 2502 |
|
| 2503 | memset(&tSig, 0, sizeof(tSig));
|
| 2504 | tSig.signal_type = RING_SIGNAL;
|
| 2505 | strcpy(g_Cc_CallDetail.number, "1234567890");
|
| 2506 | strncpy(tSig.cid, g_Cc_CallDetail.number,sizeof(tSig.cid)-1);
|
| 2507 | get_local_datetime(tSig.date_time);
|
| 2508 | ccapp_log("local test call RING_SIGNAL,number = %s\n",g_Cc_CallDetail.number);
|
| 2509 | SLIC_Play_Signal(0, 0, &tSig);
|
| 2510 | zCc_SetLedStatus("ledblink");
|
| 2511 |
|
| 2512 | if(local_test_call_type == LocalTestCallType_LOOP) {
|
| 2513 | if (pthread_create(&slic_ring_test_pid, NULL, slic_ring_test_thread,0) != 0) //cov m
|
| 2514 | printf("slic_ring_test_thread create fail\n");
|
| 2515 | }
|
| 2516 |
|
| 2517 | g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
|
| 2518 | g_Cc_CallDetail.evt[slave]= ZCC_NO_E;
|
| 2519 | g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SNO_M;
|
| 2520 | g_Cc_CallDetail.state = ZCC_M_RINGING_S;
|
| 2521 |
|
| 2522 | local_test_call_st = LocalTestCallST_Ring;
|
| 2523 | zCc_ShowAllSlaveWithTips("testCall-ring");
|
| 2524 | break;
|
| 2525 | }
|
| 2526 | else if(local_test_call_st==LocalTestCallST_End)
|
| 2527 | {
|
| 2528 | zCc_ClearDigits();
|
| 2529 | zCc_InitSlaveObj(0);
|
| 2530 | for (slave = 1; slave < ZCC_SLAVES; slave++)
|
| 2531 | {
|
| 2532 | if (g_Cc_CallDetail.slaveObj[slave].state != ZCC_S_IDLE_S)
|
| 2533 | zCc_InitSlaveObj(slave);
|
| 2534 | }
|
| 2535 |
|
| 2536 | SLIC_Stop_Signal(0, TONE_SIGNAL);
|
| 2537 | SLIC_Stop_PCM();
|
| 2538 | zCc_SetLedStatus("ledoff");
|
| 2539 |
|
| 2540 | g_Cc_CallDetail.resourceReady = 0;
|
| 2541 | g_Cc_CallDetail.hookofffg = FALSE;
|
| 2542 | g_Cc_CallDetail.state = ZCC_M_RELEASE_S;
|
| 2543 |
|
| 2544 | //system("echo loop_0 >> /tmp/log.ccapp.vploop");
|
| 2545 | //system("( sleep 1 && at_cmd AT+VPLOOP=0 ) &");
|
| 2546 | cfg_set("tz_vploop", "0");
|
| 2547 | ipc_send_message(MODULE_ID_CALL_CTRL_LOCAL,
|
| 2548 | MODULE_ID_AT_CTL,
|
| 2549 | MSG_CMD_SET_VPLOOP_REQ,
|
| 2550 | 0,
|
| 2551 | NULL,
|
| 2552 | 0);
|
| 2553 |
|
| 2554 | DeleteSoftTimer(ZCCAPP_TIMER_HOOKOFF_DETECT);
|
| 2555 | DeleteSoftTimer(ZCCAPP_TIMER_DTMF_DETECT);
|
| 2556 | DeleteSoftTimer(ZCCAPP_TIMER_BUSYTONE_DETECT);
|
| 2557 | DeleteSoftTimer(ZCCAPP_TIMER_TKYTONE_DETECT);
|
| 2558 | DeleteSoftTimer(ZCCAPP_TIMER_SSDIALTONE_DETECT);
|
| 2559 | DeleteSoftTimer(ZCCAPP_TIMER_HOOKOFF_IDLE);
|
| 2560 |
|
| 2561 | local_test_call_st = LocalTestCallST_None;
|
| 2562 | zCc_ShowAllSlaveWithTips("testCall-end-none");
|
| 2563 | break;
|
| 2564 | }
|
| 2565 |
|
| 2566 | for (slave = 1; slave < ZCC_SLAVES; slave++)
|
| 2567 | {
|
| 2568 | if (g_Cc_CallDetail.slaveObj[slave].state != ZCC_S_IDLE_S && g_Cc_CallDetail.slaveObj[slave].waitDSCI6 == 0)
|
| 2569 | {
|
| 2570 | g_Cc_CallDetail.evt[slave] = ZCC_DISCN_E;
|
| 2571 | }
|
| 2572 | }
|
| 2573 | //if(slave == ZCC_SLAVES)
|
| 2574 | // return;
|
| 2575 | if (g_Cc_CallDetail.slaveObj[0].state != ZCC_S_IDLE_S)//slave0½öÓÃÓÚ·ÅÒô£¬²»¶ÔÓ¦ºô½Ð
|
| 2576 | {
|
| 2577 | zCc_InitSlaveObj(0);
|
| 2578 | }
|
| 2579 | SLIC_Stop_Signal(0, TONE_SIGNAL);
|
| 2580 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState: SLIC_Stop_Signal <---\n",__FUNCTION__);
|
| 2581 | g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
|
| 2582 | //g_Cc_CallDetail.chupSent = FALSE;
|
| 2583 | //SLIC_Stop_PCM();
|
| 2584 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState: SLIC_Stop_PCM <---\n",__FUNCTION__);
|
| 2585 |
|
| 2586 | #ifndef TEST_CCAPP
|
| 2587 |
|
| 2588 |
|
| 2589 | cfg_get_item("voip_status",voip_status,sizeof(voip_status));
|
| 2590 |
|
| 2591 | if (0 != strcmp("ledoff" , voip_status ))
|
| 2592 | #endif
|
| 2593 | {
|
| 2594 | zCc_SetLedStatus("ledoff");
|
| 2595 | }
|
| 2596 | g_Cc_CallDetail.state = ZCC_M_RELEASE_S;
|
| 2597 | if (!(0 != zCc_GetSpecSlave(ZCC_S_TRYING_S) && (1 == zCc_CallCount())))//Õª»úʱµÄÀ´µç£¬²»Çå
|
| 2598 | {
|
| 2599 | g_Cc_CallDetail.resourceReady = 0;
|
| 2600 | }
|
| 2601 | zCc_ClearDigits();
|
| 2602 | g_Cc_CallDetail.hookofffg = FALSE;
|
| 2603 | DeleteSoftTimer(ZCCAPP_TIMER_HOOKOFF_DETECT);//ÊÕµ½ÉÁ¶Ï£¬µ±Ç°¶¨Ê±Æ÷¶¼ÐèҪֹͣ£¬ºóÐøÔÙÆô¶¯
|
| 2604 | DeleteSoftTimer(ZCCAPP_TIMER_DTMF_DETECT);
|
| 2605 | DeleteSoftTimer(ZCCAPP_TIMER_BUSYTONE_DETECT);
|
| 2606 | DeleteSoftTimer(ZCCAPP_TIMER_TKYTONE_DETECT);
|
| 2607 | DeleteSoftTimer(ZCCAPP_TIMER_SSDIALTONE_DETECT);
|
| 2608 |
|
| 2609 | DeleteSoftTimer(ZCCAPP_TIMER_HOOKOFF_IDLE);
|
| 2610 | for (slave = 1; slave < ZCC_SLAVES; slave++)
|
| 2611 | {
|
| 2612 | g_Cc_CallDetail.slaveObj[slave].idle_second = 0;//hook off ldle timer is killed, time_cnt reset
|
| 2613 | }
|
| 2614 |
|
| 2615 | break;
|
| 2616 | case ZCC_BUSYTONETIMER_E:
|
| 2617 | for (slave = 0; slave < ZCC_SLAVES; slave++)
|
| 2618 | {
|
| 2619 | if(g_Cc_CallDetail.slaveObj[slave].tone == ZCC_TONE_BSY_A)
|
| 2620 | break;
|
| 2621 | }
|
| 2622 | if(slave == ZCC_SLAVES)
|
| 2623 | return;
|
| 2624 | g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_TKY_A;
|
| 2625 | CreateSoftTimer(ZCCAPP_TIMER_TKYTONE_DETECT,
|
| 2626 | 0,
|
| 2627 | ZCCAPP_TIMER_TKYTONE_INTERVAL,
|
| 2628 | zCcApp_TkyToneTimer,
|
| 2629 | NULL);
|
| 2630 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState CreateSoftTimer zCcApp_TkyToneTimer\n",__FUNCTION__);
|
| 2631 | if (!(0 == zCc_GetSpecSlave(ZCC_S_BSYT_S)
|
| 2632 | &&(g_Cc_CallDetail.slaveObj[slave].state== ZCC_S_WAIT_RESOURCE_S
|
| 2633 | ||g_Cc_CallDetail.slaveObj[slave].state== ZCC_S_TRYING_S)
|
| 2634 | && g_Cc_CallDetail.lastTone == ZCC_TONE_BSY_A))
|
| 2635 | {
|
| 2636 | g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_TKYT_S;
|
| 2637 | }
|
| 2638 | return;
|
| 2639 | case ZCC_HOOKOFFTIMER_E:
|
| 2640 | for (slave = 0; slave < ZCC_SLAVES; slave++)
|
| 2641 | {
|
| 2642 | if(g_Cc_CallDetail.slaveObj[slave].state == ZCC_S_DT_S)
|
| 2643 | break;
|
| 2644 | }
|
| 2645 | if(slave == ZCC_SLAVES)
|
| 2646 | return;
|
| 2647 | if (1 == zCc_BusyToneAllowed() && g_Cc_CallDetail.state == ZCC_M_SEIZE_S)//ÓÐÆäËûºô½Ðʱ²»·ÅæÒô
|
| 2648 | {
|
| 2649 | g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_BSY_A;
|
| 2650 | g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_BSYT_S;
|
| 2651 | g_Cc_CallDetail.slaveObj[slave].confcall = 0;
|
| 2652 | g_Cc_CallDetail.slaveObj[slave].heldcall = 0;
|
| 2653 | CreateSoftTimer(ZCCAPP_TIMER_BUSYTONE_DETECT,
|
| 2654 | 0,
|
| 2655 | ZCCAPP_TIMER_BUSYTONE_INTERVAL,
|
| 2656 | zCcApp_BusyToneTimer,
|
| 2657 | NULL);
|
| 2658 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState CreateSoftTimer zCcApp_BusyToneTimer22222\n",__FUNCTION__);
|
| 2659 | }
|
| 2660 | else
|
| 2661 | {
|
| 2662 | zCc_InitSlaveObj(slave);
|
| 2663 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
|
| 2664 | }
|
| 2665 | return;
|
| 2666 | case ZCC_HOOKOFF_IDLE_TIMER_E:
|
| 2667 | for (slave = 0; slave < ZCC_SLAVES; slave++)
|
| 2668 | {
|
| 2669 | if(g_Cc_CallDetail.slaveObj[slave].state == ZCC_S_DT_S)
|
| 2670 | {
|
mj.qu | 5887501 | 2025-06-19 02:45:53 -0700 | [diff] [blame] | 2671 | if(0 == strcmp(callback_enable, "1") && 1 == check_phone_number_in_file(callback_number, "/cache/call_back_list"))
|
| 2672 | {
|
| 2673 | if(strlen(callback_number) <=0 )
|
| 2674 | {
|
| 2675 | DeleteSoftTimer(ZCCAPP_TIMER_HOOKOFF_IDLE);
|
| 2676 | break;
|
| 2677 | }
|
| 2678 |
|
| 2679 | strcpy(g_Cc_CallDetail.digits, callback_number);
|
| 2680 | g_Cc_CallDetail.dCount = strlen(callback_number);
|
| 2681 |
|
| 2682 | MSG_BUF msgBuf = {0};
|
| 2683 | msgBuf.usMsgCmd = ZCC_DTMF_E;
|
| 2684 | msgBuf.src_id = MODULE_ID_SLIC;
|
| 2685 | msgBuf.aucDataBuf[0] = (UINT8)'#';
|
| 2686 | msgBuf.usDataLen = 1;
|
| 2687 | zCc_SendMsgToSub(&msgBuf);
|
| 2688 |
|
| 2689 | g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_SIL_A;
|
| 2690 | g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_DACCM_S;
|
| 2691 |
|
| 2692 | DeleteSoftTimer(ZCCAPP_TIMER_HOOKOFF_DETECT);
|
| 2693 |
|
| 2694 | ccapp_log("==> HOOKOFF_IDLE_TIMER send callback_number=%s\n", callback_number);
|
| 2695 |
|
| 2696 | break;
|
| 2697 | }
|
| 2698 |
|
mj.qu | 8ddc764 | 2025-06-11 04:37:19 -0700 | [diff] [blame] | 2699 | cfg_get_item("hotline_time", hotline_time, sizeof(hotline_time));
|
mj.qu | 1524fc9 | 2025-06-11 04:34:13 -0700 | [diff] [blame] | 2700 | g_Cc_CallDetail.slaveObj[slave].idle_second++;
|
mj.qu | 8ddc764 | 2025-06-11 04:37:19 -0700 | [diff] [blame] | 2701 | if(g_Cc_CallDetail.slaveObj[slave].idle_second >= atoi(hotline_time) * 2)
|
mj.qu | 1524fc9 | 2025-06-11 04:34:13 -0700 | [diff] [blame] | 2702 | {
|
| 2703 | int rt;
|
| 2704 | char hotline[ZDIAL_NUM_MAX-1];
|
| 2705 |
|
| 2706 | memset(hotline, 0, sizeof(hotline));
|
mj.qu | 8ddc764 | 2025-06-11 04:37:19 -0700 | [diff] [blame] | 2707 | rt = cfg_get_item("hotline_number", hotline, sizeof(hotline)-1);
|
mj.qu | 1524fc9 | 2025-06-11 04:34:13 -0700 | [diff] [blame] | 2708 | if(rt!=0 || strlen(hotline)<=0)
|
| 2709 | {
|
| 2710 | DeleteSoftTimer(ZCCAPP_TIMER_HOOKOFF_IDLE);
|
| 2711 | break;
|
| 2712 | }
|
| 2713 |
|
| 2714 | strcpy(g_Cc_CallDetail.digits, hotline);
|
| 2715 | g_Cc_CallDetail.dCount = strlen(hotline);
|
| 2716 |
|
| 2717 | MSG_BUF msgBuf = {0};
|
| 2718 | msgBuf.usMsgCmd = ZCC_DTMF_E;
|
| 2719 | msgBuf.src_id = MODULE_ID_SLIC;
|
| 2720 | msgBuf.aucDataBuf[0] = (UINT8)'#';
|
| 2721 | msgBuf.usDataLen = 1;
|
| 2722 | zCc_SendMsgToSub(&msgBuf);
|
| 2723 |
|
| 2724 | g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_SIL_A;
|
| 2725 | g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_DACCM_S;
|
| 2726 |
|
| 2727 | DeleteSoftTimer(ZCCAPP_TIMER_HOOKOFF_DETECT);
|
| 2728 |
|
| 2729 | ccapp_log("==> HOOKOFF_IDLE_TIMER send hotline=%s\n", hotline);
|
| 2730 | }
|
| 2731 | }
|
| 2732 | }
|
| 2733 | break;
|
| 2734 | case ZCC_DTMFTIMER_E:
|
| 2735 | for (slave = 0; slave < ZCC_SLAVES; slave++)
|
| 2736 | {
|
| 2737 | if(g_Cc_CallDetail.slaveObj[slave].state == ZCC_S_DACCM_S)
|
| 2738 | break;
|
| 2739 | }
|
| 2740 | if(slave == ZCC_SLAVES)
|
| 2741 | return;
|
| 2742 | g_Cc_CallDetail.digits[g_Cc_CallDetail.dCount++] = ZCC_TIMEOUT_SIGN;
|
| 2743 | ret = zCc_DigitsMatch();
|
| 2744 | zCc_DigitsMatchRltProc(ret);
|
| 2745 | if (ZCC_MATCHERR != ret)
|
| 2746 | {
|
| 2747 | if (g_Cc_CallDetail.slaveObj[slave].state == ZCC_S_IDLE_S)//ss
|
| 2748 | {
|
| 2749 | zCc_SendSsReq(g_Cc_CallDetail.digits);
|
| 2750 | g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_OFF_A;
|
| 2751 | }
|
| 2752 | else
|
| 2753 | {
|
| 2754 | zCc_SendAtDialReq(g_Cc_CallDetail.digits);
|
| 2755 | }
|
| 2756 | }
|
| 2757 | g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SNO_M;
|
| 2758 | zCc_ClearDigits();
|
| 2759 | return;
|
| 2760 | case ZCC_TKYTIMER_E:
|
| 2761 | for (slave = 0; slave < ZCC_SLAVES; slave++)
|
| 2762 | {
|
| 2763 | if(g_Cc_CallDetail.slaveObj[slave].tone == ZCC_TONE_TKY_A)
|
| 2764 | break;
|
| 2765 | }
|
| 2766 | if(slave == ZCC_SLAVES)
|
| 2767 | return;
|
| 2768 | SLIC_Stop_Signal(0, TONE_SIGNAL);
|
| 2769 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState: SLIC_Stop_Signal <---\n",__FUNCTION__);
|
| 2770 | g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_SIL_A;
|
| 2771 | if (!(0 == zCc_GetSpecSlave(ZCC_S_TKYT_S)
|
| 2772 | &&(g_Cc_CallDetail.slaveObj[slave].state== ZCC_S_WAIT_RESOURCE_S
|
| 2773 | ||g_Cc_CallDetail.slaveObj[slave].state== ZCC_S_TRYING_S)
|
| 2774 | && g_Cc_CallDetail.lastTone == ZCC_TONE_TKY_A))
|
| 2775 | {
|
| 2776 | g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_SIL_S;
|
| 2777 | }
|
| 2778 | g_Cc_CallDetail.lastTone = ZCC_TONE_SIL_A;
|
| 2779 | return;
|
| 2780 | case ZCC_SSDIALTONETIMER_E:
|
| 2781 | zCc_InitSlaveObj(0);//·Å²¦ºÅÒôµÄslave0 Çå¿Õ
|
| 2782 | zCc_ClearDigits();
|
| 2783 | if (1 == zCc_CallCount()
|
| 2784 | && (g_Cc_CallDetail.lastTone == ZCC_TONE_DIAL_A))//µ±Ç°Ö»ÓÐһ·£¬Í£Ö¹²¦ºÅÒô
|
| 2785 | {
|
| 2786 | SLIC_Stop_Signal(0,0);
|
| 2787 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState: SLIC_Stop_Signal <---\n",__FUNCTION__);
|
| 2788 | g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
|
| 2789 | if (1 == zCc_HeldCall())//Òѱ£³Ö£¬»Ö¸´
|
| 2790 | {
|
| 2791 | chldret = zCc_SendAtChldReq(2);
|
| 2792 | }
|
| 2793 | else if (0 != zCc_ActiveCall())
|
| 2794 | {
|
| 2795 | SLIC_Start_PCM();
|
| 2796 | }
|
| 2797 | }
|
| 2798 | else if (1 < zCc_CallCount() && (g_Cc_CallDetail.lastTone == ZCC_TONE_DIAL_A))//active/held mpty and held+waiting
|
| 2799 | {
|
| 2800 | SLIC_Stop_Signal(0,0);
|
| 2801 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState: SLIC_Stop_Signal <---\n",__FUNCTION__);
|
| 2802 | g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
|
| 2803 | if((0 == zCc_HeldCall() && 0 != g_Cc_CallDetail.ringCid)//active+waiting »Ö¸´ÓïÒô£¬held+waiting, ²»»Ö¸´ÓïÒô£¬·Åºô½ÐµÈ´ýÒô
|
| 2804 | ||(0 != zCc_HeldCall() && 0 !=zCc_ActiveCall()))//active+held»Ö¸´ÓïÒô
|
| 2805 | {
|
| 2806 | SLIC_Start_PCM();
|
| 2807 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState: SLIC_Start_PCM <---\n",__FUNCTION__);
|
| 2808 | }
|
| 2809 | }
|
| 2810 | return;
|
| 2811 | case ZCC_FLASH_E:
|
| 2812 | ccapp_log("ZCC_FLASH_E cnt=%d held=%d active=%d BefDial=%d",
|
| 2813 | zCc_CallCount(),
|
| 2814 | zCc_HeldCall(),
|
| 2815 | zCc_ActiveCall(),
|
| 2816 | zCc_MoBeforDialingCall());
|
| 2817 |
|
| 2818 | if (!(zCc_CallCount() > 1 && g_Cc_CallDetail.digits[0] == ZCC_FLASH_SIGN))//¶à·ºô½Ðʱ£¬ÐèÒªÅжÏflashÁ¬·¢Á½´ÎµÄ³¡¾°£¬²»Çå³ý
|
| 2819 | {
|
| 2820 | zCc_ClearDigits();
|
| 2821 | }
|
| 2822 | DeleteSoftTimer(ZCCAPP_TIMER_HOOKOFF_DETECT);//ÊÕµ½ÉÁ¶Ï£¬µ±Ç°¶¨Ê±Æ÷¶¼ÐèҪֹͣ£¬ºóÐøÔÙÆô¶¯
|
| 2823 | DeleteSoftTimer(ZCCAPP_TIMER_DTMF_DETECT);
|
| 2824 | DeleteSoftTimer(ZCCAPP_TIMER_BUSYTONE_DETECT);
|
| 2825 | DeleteSoftTimer(ZCCAPP_TIMER_TKYTONE_DETECT);
|
| 2826 | DeleteSoftTimer(ZCCAPP_TIMER_SSDIALTONE_DETECT);
|
| 2827 |
|
| 2828 | callCnt = zCc_CallCount();
|
| 2829 |
|
| 2830 | if (g_Cc_CallDetail.ringCid && (g_Cc_CallDetail.slaveObj[g_Cc_CallDetail.ringCid].tone == ZCC_TONE_CIDCW_A))//ºô½ÐµÈ´ý£¬¸ù¾ÝflashºóÃæµÄ×Ö·û¾ö¶¨ºóÐø²Ù×÷
|
| 2831 | {
|
| 2832 | if(g_Cc_CallDetail.digits[0] == ZCC_FLASH_SIGN)
|
| 2833 | {
|
| 2834 | zCc_InitSlaveObj(0);
|
| 2835 | zCc_ClearDigits();
|
| 2836 | SLIC_Stop_Signal(0,0);
|
| 2837 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState: SLIC_Stop_Signal <---\n",__FUNCTION__);
|
| 2838 | g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
|
| 2839 | if (0 != zCc_ActiveCall())
|
| 2840 | {
|
| 2841 | SLIC_Start_PCM();
|
| 2842 | }
|
| 2843 | break;
|
| 2844 | }
|
| 2845 | g_Cc_CallDetail.digits[g_Cc_CallDetail.dCount++] = ZCC_FLASH_SIGN;
|
| 2846 | // slave[0] to play dial tone
|
| 2847 | CreateSoftTimer(ZCCAPP_TIMER_SSDIALTONE_DETECT,
|
| 2848 | 0,
|
| 2849 | ZCCAPP_TIMER_HOOKOFF_INTERVAL,
|
| 2850 | zCcApp_SsDialToneTimer,
|
| 2851 | NULL);
|
| 2852 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState: CreateSoftTimer zCcApp_SsDialToneTimer\n",__FUNCTION__);
|
| 2853 | g_Cc_CallDetail.evt[0] = ZCC_DIAL_E;
|
| 2854 | //g_Cc_CallDetail.slaveObj[g_Cc_CallDetail.ringCid].tone = ZCC_TONE_OFF_A;±£Áô¸Ã×ֶΣ¬ÓÃÓÚflash4µÈʧ°Üʱ»Ö¸´ºô½ÐµÈ´ýÒô
|
| 2855 | SLIC_Stop_PCM();
|
| 2856 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState: SLIC_Stop_PCM2222\n",__FUNCTION__);
|
| 2857 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState:ZCC_FLASH_E\n",__FUNCTION__);
|
| 2858 | break;
|
| 2859 | }
|
| 2860 |
|
| 2861 | if ( callCnt==0 //·Å²¦ºÅÒô»¹Î´Íê³É²¦ºÅ»òÕª»ú䲦ºÅ·ÅæÒôº¿ÃùÒô¾²Òô
|
| 2862 | ||(callCnt ==1 && zCc_FlashClearCall() > 0)) //ÕÒµ½½¨Á¢ÖеÄÖ÷½ÐÒÔ¼°ÊÍ·ÅÖеĺô½Ð£¬ÊÍ·Å£¬²¢·Å²¦ºÅÒô
|
| 2863 | {
|
| 2864 | zCc_InitSlaveObj(0);
|
| 2865 | g_Cc_CallDetail.evt[0] = ZCC_DIAL_E;
|
| 2866 | SLIC_Stop_PCM();
|
| 2867 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState:SLIC_Stop_PCM\n",__FUNCTION__);
|
| 2868 | g_Cc_CallDetail.hookofffg = TRUE;
|
| 2869 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState:ZCC_FLASH_E\n",__FUNCTION__);
|
| 2870 | break;
|
| 2871 | }
|
| 2872 |
|
| 2873 | if (zCc_ActiveCall() == callCnt) //Ö»ÓÐactive call£¬±£³ÖËü£¬²¢·Å²¦ºÅÒô
|
| 2874 | {
|
| 2875 | if (callCnt > 1) // conf call, ·Å²¦ºÅÒô
|
| 2876 | {
|
| 2877 | g_Cc_CallDetail.digits[g_Cc_CallDetail.dCount++] = ZCC_FLASH_SIGN;
|
| 2878 | g_Cc_CallDetail.digits[ZDIAL_NUM_MAX-1] = 1;// ¼Ç¼±¾´Î²Ù×÷ΪÕë¶Ôconf µÄ
|
| 2879 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState:ZCC_FLASH_E\n",__FUNCTION__);
|
| 2880 | }
|
| 2881 | else
|
| 2882 | {
|
| 2883 | chldret = zCc_SendAtChldReq(2);
|
| 2884 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState:ZCC_FLASH_E\n",__FUNCTION__);
|
| 2885 | g_Cc_CallDetail.waitchldresult = 1;
|
| 2886 | }
|
| 2887 | break;
|
| 2888 | }
|
| 2889 |
|
| 2890 | if (zCc_HeldCall() == callCnt) //Ö»ÓÐheld call£¬»Ö¸´
|
| 2891 | {
|
| 2892 | if (callCnt == 1 )
|
| 2893 | {
|
| 2894 | chldret = zCc_SendAtChldReq(2);
|
| 2895 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState:ZCC_FLASH_E\n",__FUNCTION__);
|
| 2896 | }
|
| 2897 | else
|
| 2898 | {
|
| 2899 | g_Cc_CallDetail.digits[g_Cc_CallDetail.dCount++] = ZCC_FLASH_SIGN;
|
| 2900 | CreateSoftTimer(ZCCAPP_TIMER_SSDIALTONE_DETECT,
|
| 2901 | 0,
|
| 2902 | ZCCAPP_TIMER_HOOKOFF_INTERVAL,
|
| 2903 | zCcApp_SsDialToneTimer,
|
| 2904 | NULL);
|
| 2905 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState:CreateSoftTimer zCcApp_SsDialToneTimer\n",__FUNCTION__);
|
| 2906 | g_Cc_CallDetail.evt[0] = ZCC_DIAL_E;
|
| 2907 |
|
| 2908 | }
|
| 2909 | break;
|
| 2910 | }
|
| 2911 | //active + held
|
| 2912 |
|
| 2913 | if(g_Cc_CallDetail.digits[0] == ZCC_FLASH_SIGN)
|
| 2914 | {
|
| 2915 | zCc_InitSlaveObj(0);
|
| 2916 | zCc_ClearDigits();
|
| 2917 | SLIC_Stop_Signal(0,0);
|
| 2918 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState: SLIC_Stop_Signal <---\n",__FUNCTION__);
|
| 2919 | g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
|
| 2920 | if (0 != zCc_ActiveCall())
|
| 2921 | {
|
| 2922 | SLIC_Start_PCM();
|
| 2923 | }
|
| 2924 | break;
|
| 2925 | }
|
| 2926 |
|
| 2927 | /*
|
| 2928 | zCc_MSeizeState befor=1 act=0 held=1 callCnt=2
|
| 2929 | zCc_MoBeforDialingCall slave[1]=8
|
| 2930 | zCc_MoBeforDialingCall slave[2]=4
|
| 2931 | */
|
| 2932 | ccapp_log("ZCC_FLASH_E befor=%d active=%d held=%d callCnt=%d",
|
| 2933 | zCc_MoBeforDialingCall(),
|
| 2934 | zCc_ActiveCall(),
|
| 2935 | zCc_HeldCall(),
|
| 2936 | callCnt);
|
| 2937 |
|
| 2938 | if (((0 != zCc_MoBeforDialingCall())
|
| 2939 | && (0 != zCc_ActiveCall() || 0 != zCc_HeldCall())) //active or held + ½¨Á¢Öеĺô½Ð
|
| 2940 | ||(0 != zCc_MoBeforDialingCall() && 1 == callCnt))
|
| 2941 | {
|
| 2942 | /*if(g_Cc_CallDetail.digits[0]==ZCC_FLASH_SIGN &&
|
| 2943 | strlen(g_Cc_CallDetail.digits)<=3)
|
| 2944 | {
|
| 2945 | zCc_InitSlaveObj(0);
|
| 2946 | zCc_ClearDigits();
|
| 2947 | zCc_SendAtChldReq(2);
|
| 2948 | ccapp_log("get ZCC_FLASH_SIGN and return to old talk");
|
| 2949 | }*/
|
| 2950 |
|
| 2951 | int cid = zCc_GetMoBeforDialingCallCID();
|
| 2952 | if(cid>=0 && zCc_HeldCall()!=0) // drop the beforeDialing call
|
| 2953 | {
|
| 2954 | zCc_InitSlaveObj(cid);
|
| 2955 | zCc_ClearDigits();
|
| 2956 | zCc_SendAtChldReq(1);
|
| 2957 | ccapp_log("drop the beforeDialing call cid=%d", cid);
|
| 2958 | }
|
| 2959 |
|
| 2960 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState:ZCC_FLASH_E return\n",__FUNCTION__);
|
| 2961 | return;
|
| 2962 | }
|
| 2963 |
|
| 2964 | g_Cc_CallDetail.digits[g_Cc_CallDetail.dCount++] = ZCC_FLASH_SIGN;
|
| 2965 | g_Cc_CallDetail.evt[0] = ZCC_DIAL_E;
|
| 2966 | CreateSoftTimer(ZCCAPP_TIMER_SSDIALTONE_DETECT,
|
| 2967 | 0,
|
| 2968 | ZCCAPP_TIMER_HOOKOFF_INTERVAL,
|
| 2969 | zCcApp_SsDialToneTimer,
|
| 2970 | NULL);
|
| 2971 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState:CreateSoftTimer zCcApp_SsDialToneTimer\n",__FUNCTION__);
|
| 2972 | SLIC_Stop_PCM();
|
| 2973 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState:SLIC_Stop_PCM\n",__FUNCTION__);
|
| 2974 | break;
|
| 2975 |
|
| 2976 | case ZCC_RESOURCE_READY_E:
|
| 2977 | g_Cc_CallDetail.evt[slave] = ZCC_RESOURCE_READY_E;
|
| 2978 | break;
|
| 2979 | /*ATÃüÁîÏìÓ¦£¬Ä¿Ç°Ö»ÓÐatdµÄÏìÓ¦ÐèÒª´¦Àí*/
|
| 2980 | case MSG_CMD_ATD_DIAL_RSP:
|
| 2981 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s ATD_rsp=%d\n",__FUNCTION__,((T_zCcapp_optRsp*)ptMsgBuf->aucDataBuf)->result);
|
| 2982 | if(((T_zCcapp_optRsp*)ptMsgBuf->aucDataBuf)->result == 0)
|
| 2983 | break;
|
| 2984 | slave = zCc_GetDialingSlave(1);
|
| 2985 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SendAtDialReq:RECV ERROR\n",__FUNCTION__);
|
| 2986 | slave = zCc_GetDialingSlave(1);
|
| 2987 | if (1 == zCc_BusyToneAllowed() && g_Cc_CallDetail.slaveObj[slave].waitDSCI6 == 0 && g_Cc_CallDetail.state == ZCC_M_SEIZE_S)//ÓÐÆäËûºô½ÐÇÒÒѹһúʱ²»·ÅæÒô
|
| 2988 | {
|
| 2989 | CreateSoftTimer(ZCCAPP_TIMER_BUSYTONE_DETECT,
|
| 2990 | 0,
|
| 2991 | ZCCAPP_TIMER_BUSYTONE_INTERVAL,
|
| 2992 | zCcApp_BusyToneTimer,
|
| 2993 | NULL);
|
| 2994 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SendAtDialReq CreateSoftTimer zCcApp_BusyToneTimer\n",__FUNCTION__);
|
| 2995 | g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_BSY_A;
|
| 2996 | g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_BSYT_S;
|
| 2997 | g_Cc_CallDetail.slaveObj[slave].confcall = 0;
|
| 2998 | g_Cc_CallDetail.slaveObj[slave].heldcall = 0;
|
| 2999 | }
|
| 3000 | else
|
| 3001 | {
|
| 3002 | char num[ZDIAL_NUM_MAX+1];
|
| 3003 | strcpy(num, g_Cc_CallDetail.slaveObj[slave].number);
|
| 3004 |
|
| 3005 | zCc_InitSlaveObj(slave);
|
| 3006 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
|
| 3007 |
|
| 3008 | if(zCc_find_held_cid()|| zCc_find_held_incoming_cid()) // restore prvious talk to active
|
| 3009 | {
|
| 3010 | zCc_SendAtChldReq(2);
|
| 3011 |
|
| 3012 | char temp[200];
|
| 3013 | sprintf(temp, "echo \"%s get error dialout cid=%d num=%s\" > /tmp/log.ccapp.callout.err",
|
| 3014 | get_local_date_time(), slave, num);
|
| 3015 | soft_system(temp);
|
| 3016 | }
|
| 3017 | }
|
| 3018 | break;
|
| 3019 | /*case MSG_CMD_ATA_RSP:
|
| 3020 | case MSG_CMD_CHUP_RSP:
|
| 3021 | case MSG_CMD_VTS_RSP:
|
| 3022 | case MSG_CMD_ZIMSPLUS_RSP:
|
| 3023 | case MSG_CMD_CCFC_RSP:
|
| 3024 | case MSG_CMD_CLCK_RSP:
|
| 3025 | break;*/
|
| 3026 | case MSG_CMD_CHLD_RSP:
|
| 3027 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s CHLD_rsp=%d\n",__FUNCTION__,((T_zCcapp_optRsp*)ptMsgBuf->aucDataBuf)->result);
|
| 3028 | if(g_Cc_CallDetail.waitchldresult == 1 )
|
| 3029 | {
|
| 3030 | g_Cc_CallDetail.waitchldresult = 0;
|
| 3031 | if (((T_zCcapp_optRsp*)ptMsgBuf->aucDataBuf)->result == 0)
|
| 3032 | {
|
| 3033 | CreateSoftTimer(ZCCAPP_TIMER_SSDIALTONE_DETECT,
|
| 3034 | 0,
|
| 3035 | ZCCAPP_TIMER_HOOKOFF_INTERVAL,
|
| 3036 | zCcApp_SsDialToneTimer,
|
| 3037 | NULL);
|
| 3038 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState:CreateSoftTimer zCcApp_SsDialToneTimer\n",__FUNCTION__);
|
| 3039 | g_Cc_CallDetail.evt[0] = ZCC_DIAL_E;
|
| 3040 | SLIC_Stop_PCM();
|
| 3041 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_MSeizeState:SLIC_Stop_PCM\n",__FUNCTION__);
|
| 3042 | }
|
| 3043 | }
|
| 3044 | break;
|
| 3045 |
|
| 3046 | case ZCC_SEIZE_E: // ͻȜ
|
| 3047 | default:
|
| 3048 | // do nothing
|
| 3049 | break;
|
| 3050 | }
|
| 3051 | }
|
| 3052 |
|
| 3053 |
|
| 3054 | //get local time string , format"YYYY-MM-DD HH:MM:SS"
|
| 3055 | char *get_local_date_time(void)
|
| 3056 | {
|
| 3057 | time_t now;
|
| 3058 | struct tm *timenow;
|
| 3059 | static char localtimestr[32];
|
| 3060 |
|
| 3061 | time(&now);
|
| 3062 | timenow = localtime(&now);
|
| 3063 | memset(localtimestr, 0, 32);
|
| 3064 | if(timenow)
|
| 3065 | snprintf(localtimestr, 32, "%04d-%02d-%02d %02d:%02d:%02d",
|
| 3066 | timenow->tm_year + 1900, timenow->tm_mon+1, timenow->tm_mday,
|
| 3067 | timenow->tm_hour, timenow->tm_min, timenow->tm_sec);
|
| 3068 | return localtimestr;
|
| 3069 | }
|
| 3070 |
|
| 3071 |
|
| 3072 | //get local time string , format"MMDDHHMM"
|
| 3073 | char *get_local_datetime(char *buff)
|
| 3074 | {
|
| 3075 | time_t now;
|
| 3076 | struct tm *timenow;
|
| 3077 | static char localtimestr[48];
|
| 3078 |
|
| 3079 | memset(localtimestr, 0, sizeof(localtimestr));
|
| 3080 |
|
| 3081 | time(&now);
|
| 3082 | timenow = localtime(&now);
|
| 3083 | if(timenow)
|
| 3084 | sprintf(localtimestr, "%02d%02d%02d%02d",
|
| 3085 | timenow->tm_mon+1, timenow->tm_mday,
|
| 3086 | timenow->tm_hour, timenow->tm_min);
|
| 3087 |
|
| 3088 | if(buff!=NULL)
|
| 3089 | strcpy(buff, localtimestr);
|
| 3090 |
|
| 3091 | return localtimestr;
|
| 3092 | }
|
| 3093 |
|
| 3094 |
|
| 3095 | int zCc_find_held_cid(void)
|
| 3096 | {
|
| 3097 | int slavetmp;
|
| 3098 |
|
| 3099 | for (slavetmp = 1; slavetmp < ZCC_SLAVES; slavetmp++)
|
| 3100 | {
|
| 3101 | if (g_Cc_CallDetail.slaveObj[slavetmp].heldcall!=0)
|
| 3102 | {
|
| 3103 | return slavetmp;
|
| 3104 | }
|
| 3105 | }
|
| 3106 |
|
| 3107 | return 0;
|
| 3108 | }
|
| 3109 |
|
| 3110 | int zCc_talking_count(void)
|
| 3111 | {
|
| 3112 | int cnt = 0;
|
| 3113 | int slavetmp;
|
| 3114 |
|
| 3115 | for (slavetmp = 1; slavetmp < ZCC_SLAVES; slavetmp++)
|
| 3116 | {
|
| 3117 | if (g_Cc_CallDetail.slaveObj[slavetmp].state==ZCC_S_TALKING_S)
|
| 3118 | cnt++;
|
| 3119 | }
|
| 3120 |
|
| 3121 | return cnt;
|
| 3122 | }
|
| 3123 |
|
| 3124 |
|
| 3125 | int zCc_find_held_incoming_cid(void)
|
| 3126 | {
|
| 3127 | int slavetmp;
|
| 3128 |
|
| 3129 | for (slavetmp = 1; slavetmp < ZCC_SLAVES; slavetmp++)
|
| 3130 | {
|
| 3131 | if (g_Cc_CallDetail.slaveObj[slavetmp].state==ZCC_S_TRYING_S)
|
| 3132 | {
|
| 3133 | return slavetmp;
|
| 3134 | }
|
| 3135 | }
|
| 3136 |
|
| 3137 | return 0;
|
| 3138 | }
|
| 3139 |
|
| 3140 |
|
| 3141 | int zCc_find_all_callout(int slave[ZCC_SLAVES])
|
| 3142 | {
|
| 3143 | int n=0;
|
| 3144 |
|
| 3145 | int i;
|
| 3146 | for (i = 1; i < ZCC_SLAVES; i++)
|
| 3147 | {
|
| 3148 | if (g_Cc_CallDetail.slaveObj[i].is_callout!=0)
|
| 3149 | {
|
| 3150 | slave[n] = i;
|
| 3151 | n++;
|
| 3152 | }
|
| 3153 | }
|
| 3154 |
|
| 3155 | return n;
|
| 3156 | }
|
| 3157 |
|
| 3158 |
|
| 3159 | void zCc_hungup_all(int slave)
|
| 3160 | {
|
| 3161 | int slavetmp;
|
| 3162 | if (!g_Cc_CallDetail.chupSent)
|
| 3163 | {
|
| 3164 | zCc_SendAtHangupReq();
|
| 3165 | for (slavetmp = 1; slavetmp < ZCC_SLAVES; slavetmp++)
|
| 3166 | {
|
| 3167 | if (g_Cc_CallDetail.slaveObj[slavetmp].state == ZCC_S_DIALING_S
|
| 3168 | || g_Cc_CallDetail.slaveObj[slavetmp].state == ZCC_S_RINGBACK_S
|
| 3169 | || g_Cc_CallDetail.slaveObj[slavetmp].state == ZCC_S_TALKING_S
|
| 3170 | || g_Cc_CallDetail.slaveObj[slavetmp].state == ZCC_S_TRYING_S
|
| 3171 | || g_Cc_CallDetail.slaveObj[slavetmp].state == ZCC_S_WAIT_RESOURCE_S)
|
| 3172 | {
|
| 3173 | g_Cc_CallDetail.slaveObj[slavetmp].waitDSCI6 = 1;
|
| 3174 | }
|
| 3175 | }
|
| 3176 | if (!((zCc_CallCount() == 1) && ((ZCC_S_DACCM_S == g_Cc_CallDetail.slaveObj[slave].state)
|
| 3177 | || (ZCC_S_DIALING_S == g_Cc_CallDetail.slaveObj[slave].state)))
|
| 3178 | && !((zCc_CallCount() > 1) && (0 != zCc_MtInactiveCall()) && (0 != zCc_MoInactiveCall())))//·Çidle״̬¶¼ÊÇÕª»ú̬ÊÕµ½À´µçÇҾܽÓÀ´µç
|
| 3179 | {
|
| 3180 | g_Cc_CallDetail.chupSent = TRUE;//»¹ÓÐÆäËûºô½Ð£¬²»ÔÙÖØ¸´·¢chup
|
| 3181 | }
|
| 3182 | }
|
| 3183 | }
|
| 3184 |
|
| 3185 | VOID zCc_RunMaster(MSG_BUF *ptMsgBuf)
|
| 3186 | {
|
| 3187 | UINT8 slave = 0;
|
| 3188 | UINT8 slavetmp = 0;
|
| 3189 | SIGNAL_DATA tSig;
|
| 3190 | int held_call_cid;
|
| 3191 | int incoming_call_cid;
|
| 3192 |
|
| 3193 | static int old_state = -1;
|
| 3194 | if(old_state != g_Cc_CallDetail.state)
|
| 3195 | {
|
| 3196 | ccapp_log("=======================\n");
|
| 3197 | ccapp_log("zCc_RunMaster state %d --> %d\n", old_state, g_Cc_CallDetail.state);
|
| 3198 | old_state = g_Cc_CallDetail.state;
|
| 3199 | }
|
| 3200 |
|
| 3201 | memset(tSig.cid, 0, 32);
|
| 3202 |
|
| 3203 | zCc_CheckSlaveState("start zCc_RunMaster");
|
| 3204 | switch (g_Cc_CallDetail.state)
|
| 3205 | {
|
| 3206 | case ZCC_M_RELEASE_S:
|
| 3207 | zCc_MReleaseState(ptMsgBuf);
|
| 3208 | break;
|
| 3209 |
|
| 3210 | case ZCC_M_RINGING_S:
|
| 3211 | zCc_MRingingState(ptMsgBuf);
|
| 3212 | break;
|
| 3213 |
|
| 3214 | case ZCC_M_SEIZE_S:
|
| 3215 | default:
|
| 3216 | zCc_MSeizeState(ptMsgBuf);
|
| 3217 | break;
|
| 3218 | }
|
| 3219 |
|
| 3220 | zCc_CheckSlaveState("in zCc_RunSlave");
|
| 3221 | /* Now run the slaves. Since the slaves will always be run with the master , run them now. */
|
| 3222 | for (slave = 0; slave < ZCC_SLAVES; slave++)
|
| 3223 | {
|
| 3224 | zCc_RunSlave(slave);
|
| 3225 | g_Cc_CallDetail.evt[slave] = ZCC_NO_E;
|
| 3226 | }
|
| 3227 |
|
| 3228 |
|
| 3229 | /* Process sMsg. */
|
| 3230 | for (slave = 1; slave < ZCC_SLAVES; slave++)
|
| 3231 | {
|
| 3232 | if(g_Cc_CallDetail.slaveObj[slave].sMsg!=ZCC_SNO_M)
|
| 3233 | {
|
| 3234 | zCc_CheckSlaveState("in slaveObj[slave].sMsg");
|
| 3235 | ccapp_log("g_Cc_CallDetail.slaveObj[%d].sMsg=%d",
|
| 3236 | slave,
|
| 3237 | g_Cc_CallDetail.slaveObj[slave].sMsg);
|
| 3238 | }
|
| 3239 |
|
| 3240 | switch (g_Cc_CallDetail.slaveObj[slave].sMsg)
|
| 3241 | {
|
| 3242 | case ZCC_SINV_M:
|
| 3243 | if (g_Cc_CallDetail.slaveObj[slave].state == ZCC_S_IDLE_S)//ss
|
| 3244 | {
|
| 3245 | zCc_SendSsReq(g_Cc_CallDetail.digits);
|
| 3246 | g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_OFF_A;
|
| 3247 | }
|
| 3248 | else
|
| 3249 | {
|
| 3250 | zCc_SendAtDialReq(g_Cc_CallDetail.digits);
|
| 3251 | }
|
| 3252 | g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SNO_M;
|
| 3253 | zCc_ClearDigits();
|
| 3254 | break;
|
| 3255 | case ZCC_SDTMF_M:
|
| 3256 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s ZCC_SDTMF_M handling ptMsgBuf->aucDataBuf[0] = %d\n",__FUNCTION__,ptMsgBuf->aucDataBuf[0]);
|
| 3257 | zCc_SendAtDtmfReq((char*)(&(ptMsgBuf->aucDataBuf[0])));
|
| 3258 | g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SNO_M;
|
| 3259 | if(g_Cc_CallDetail.waitchldresult == 0)//chld´¦Àí¹ý³ÌÖв»Çå³ý²¦ºÅ°´¼üadd by zpr
|
| 3260 | zCc_ClearDigits();
|
| 3261 | break;
|
| 3262 | case ZCC_SRING_M:
|
| 3263 | if (g_Cc_CallDetail.state == ZCC_M_RELEASE_S)// && g_Cc_CallDetail.ringCid)
|
| 3264 | {
|
| 3265 | g_Cc_CallDetail.state = ZCC_M_RINGING_S;
|
| 3266 | memset(&tSig, 0, sizeof(tSig));
|
| 3267 | tSig.signal_type = RING_SIGNAL;
|
| 3268 | //memcpy(tSig.cid, g_Cc_CallDetail.number, strlen(g_Cc_CallDetail.number));
|
| 3269 | strncpy(tSig.cid, g_Cc_CallDetail.number, sizeof(tSig.cid)-1);
|
| 3270 | get_local_datetime(tSig.date_time);
|
| 3271 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_RunMaster RING_SIGNAL,number = %s\n",__FUNCTION__,g_Cc_CallDetail.number);
|
| 3272 | SLIC_Play_Signal(0, 0, &tSig);
|
| 3273 | zCc_SetLedStatus("ledblink");
|
| 3274 | }
|
| 3275 | g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SNO_M;
|
| 3276 | break;
|
| 3277 | case ZCC_SANS_M://ʲô³¡¾°?
|
| 3278 | if (zCc_CallCount() == 1)
|
| 3279 | {
|
| 3280 | SLIC_Stop_Signal(0, TONE_SIGNAL);
|
| 3281 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s : SLIC_Stop_Signal <---\n",__FUNCTION__);
|
| 3282 | g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
|
| 3283 | }
|
| 3284 | g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SNO_M;
|
| 3285 | break;
|
| 3286 | case ZCC_SDISCN_M:
|
| 3287 | held_call_cid = zCc_find_held_cid();
|
| 3288 | incoming_call_cid = zCc_GetSpecSlave(ZCC_S_TRYING_S);
|
| 3289 | ccapp_log("ZCC_SDISCN_M held_call_cid=%d incoming_call_cid=%d chupSent=%d",
|
| 3290 | held_call_cid,
|
| 3291 | incoming_call_cid,
|
| 3292 | g_Cc_CallDetail.chupSent);
|
| 3293 |
|
| 3294 | if((held_call_cid!=0 ||incoming_call_cid!=0) && g_Cc_CallDetail.chupSent==FALSE)
|
| 3295 | {
|
| 3296 | int active_call_cid = 0;
|
| 3297 |
|
| 3298 | for (slavetmp = 1; slavetmp < ZCC_SLAVES; slavetmp++)
|
| 3299 | {
|
| 3300 | if( (g_Cc_CallDetail.slaveObj[slavetmp].state == ZCC_S_DIALING_S
|
| 3301 | || g_Cc_CallDetail.slaveObj[slavetmp].state == ZCC_S_RINGBACK_S
|
| 3302 | || g_Cc_CallDetail.slaveObj[slavetmp].state == ZCC_S_TALKING_S
|
| 3303 | // || g_Cc_CallDetail.slaveObj[slavetmp].state == ZCC_S_TRYING_S // incoming_call_cid
|
| 3304 | || g_Cc_CallDetail.slaveObj[slavetmp].state == ZCC_S_WAIT_RESOURCE_S) &&
|
| 3305 | g_Cc_CallDetail.slaveObj[slavetmp].heldcall==0)
|
| 3306 | {
|
| 3307 | active_call_cid = slavetmp;
|
| 3308 | break;
|
| 3309 | }
|
| 3310 | }
|
| 3311 |
|
| 3312 | ccapp_log("ZCC_SDISCN_M active_call_cid=%d", active_call_cid);
|
| 3313 |
|
| 3314 | if(active_call_cid!=0)
|
| 3315 | {
|
| 3316 | zCc_SendAtChldReq(10+active_call_cid);
|
| 3317 |
|
| 3318 | g_Cc_CallDetail.chupSent = TRUE;
|
| 3319 | g_Cc_CallDetail.state = ZCC_M_RINGING_S;
|
| 3320 |
|
| 3321 | /*MSG_BUF msgBuff = {0}; // let while(1) run one more time
|
| 3322 | msgBuff.usMsgCmd = ZCC_ASSIST_MSG_E;
|
| 3323 | msgBuff.src_id = MODULE_ID_SLIC;
|
| 3324 | zCc_SendMsgToSub(&msgBuff);
|
| 3325 |
|
| 3326 | ccapp_log("sendMsg ZCC_ASSIST_MSG_E"); */
|
| 3327 | }
|
| 3328 | else
|
| 3329 | {
|
| 3330 | zCc_hungup_all(slave);
|
| 3331 | }
|
| 3332 | }
|
| 3333 | else
|
| 3334 | {
|
| 3335 | zCc_hungup_all(slave);
|
| 3336 | }
|
| 3337 |
|
| 3338 | g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SNO_M;
|
| 3339 | break;
|
| 3340 | default:
|
| 3341 | break;
|
| 3342 | }
|
| 3343 | }
|
| 3344 |
|
| 3345 | if (g_Cc_CallDetail.state == ZCC_M_RINGING_S
|
| 3346 | && g_Cc_CallDetail.ringCid == 0
|
| 3347 | && zCc_find_held_cid()==0
|
| 3348 | && zCc_find_held_incoming_cid()==0
|
| 3349 | && local_test_call_st==0)
|
| 3350 | {
|
| 3351 | g_Cc_CallDetail.state = ZCC_M_RELEASE_S;
|
| 3352 | SLIC_Stop_Signal(0, RING_SIGNAL);
|
| 3353 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s : SLIC_Stop_Signal <---\n",__FUNCTION__);
|
| 3354 | }
|
| 3355 | /*else if (g_Cc_CallDetail.state == ZCC_M_SEIZE_S && g_Cc_CallDetail.ringCid > 0 && zCc_CallCount() == 1)
|
| 3356 | {
|
| 3357 | //תΪ½ÓÌý
|
| 3358 | ¹Ò»úºó¿ÉÒÔÖªµÀÀ´µç²¢½ÓÌý£¬ÎÞÐèÌØÊâ´¦Àí¡£
|
| 3359 | }*/
|
| 3360 | zCc_ControlTone();
|
| 3361 |
|
| 3362 | // ´¦Àíslave·µ»ØµÄÏûÏ¢
|
| 3363 | zCc_CheckSlaveState("End zCc_RunMaster");
|
| 3364 | }
|
| 3365 |
|
| 3366 | VOID zCc_RunSlave(UINT8 slave)
|
| 3367 | {
|
| 3368 | if (g_Cc_CallDetail.evt[slave] == ZCC_NO_E)
|
| 3369 | {
|
| 3370 | return;
|
| 3371 | }
|
| 3372 |
|
| 3373 | /* Call respective state function based on the current state. */
|
| 3374 | printf("[ccapp_debug]:Slave Run,slave:%d, state=%d,event=%d\n", slave, g_Cc_CallDetail.slaveObj[slave].state,g_Cc_CallDetail.evt[slave]);
|
| 3375 | zCcSlaveFsmFunc[g_Cc_CallDetail.slaveObj[slave].state](slave);
|
| 3376 | }
|
| 3377 |
|
| 3378 | VOID zCc_SIdleState(UINT8 slave)
|
| 3379 | {
|
| 3380 | UINT8 tmpslave = 0;
|
| 3381 | 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]);
|
| 3382 | g_Cc_CallDetail.slaveObj[slave].cid = slave;
|
| 3383 | switch (g_Cc_CallDetail.evt[slave])
|
| 3384 | {
|
| 3385 | case ZCC_DIAL_E:
|
| 3386 | g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_DIAL_A;
|
| 3387 | g_Cc_CallDetail.slaveObj[slave].state = g_Cc_CallDetail.digits[0] != ZCC_FLASH_SIGN ? ZCC_S_DT_S : ZCC_S_DACCM_S;
|
| 3388 |
|
| 3389 | if (g_Cc_CallDetail.hookofffg == TRUE)
|
| 3390 | {
|
| 3391 | g_Cc_CallDetail.hookofffg = FALSE;
|
| 3392 | CreateSoftTimer(ZCCAPP_TIMER_HOOKOFF_DETECT,
|
| 3393 | 0,
|
| 3394 | ZCCAPP_TIMER_HOOKOFF_INTERVAL,
|
| 3395 | zCcApp_HookOffTimer,
|
| 3396 | NULL);
|
| 3397 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SIdleState CreateSoftTimer zCcApp_HookOffTimer\n",__FUNCTION__);
|
| 3398 |
|
| 3399 | g_Cc_CallDetail.slaveObj[slave].idle_second = 0;
|
| 3400 | CreateSoftTimer(ZCCAPP_TIMER_HOOKOFF_IDLE,
|
| 3401 | TIMER_FLAG_RESTART,
|
| 3402 | ZCCAPP_TIMER_HOOKOFF_IDLE_INTERVAL,
|
| 3403 | zCcApp_HookOff_Idle_Timer,
|
| 3404 | NULL);
|
| 3405 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SIdleState CreateSoftTimer zCcApp_HookOff_Idle_Timer\n",__FUNCTION__);
|
| 3406 | }
|
| 3407 | break;
|
| 3408 | case ZCC_DTMF_E://held+dailing
|
| 3409 | if ( 0 != zCc_HeldCall() && 0 == zCc_ActiveCall())
|
| 3410 | {
|
| 3411 | DeleteSoftTimer(ZCCAPP_TIMER_SSDIALTONE_DETECT);
|
| 3412 | CreateSoftTimer(ZCCAPP_TIMER_DTMF_DETECT,
|
| 3413 | 0,
|
| 3414 | ZCCAPP_TIMER_DTMF_INTERVAL,
|
| 3415 | zCcApp_DtmfTimer,
|
| 3416 | NULL);
|
| 3417 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SIdleState CreateSoftTimer zCcApp_DtmfTimer\n",__FUNCTION__);
|
| 3418 | g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_SIL_A;
|
| 3419 | g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_DACCM_S;
|
| 3420 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SIdleState handling ZCC_DTMF_E\n",__FUNCTION__);
|
| 3421 | }
|
| 3422 | break;
|
| 3423 | case ZCC_CIDCW_E:
|
| 3424 | g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_CIDCW_A;
|
| 3425 | //lint -fallthrough
|
| 3426 | case ZCC_SINVITE_E:
|
| 3427 | zCc_ShowAllSlaveWithTips("zCc_SIdleState");
|
| 3428 | if (((0 != zCc_GetDialingSlave(1)) || (0 != zCc_GetSpecSlave(ZCC_S_RINGBACK_S)))//ÓÐÒѾÏ·¢atd µÄºô½Ðʱ¾Ü¾øÐÂÀ´µç
|
| 3429 | || (0 != zCc_MoInactiveCall()))//
|
| 3430 | {
|
| 3431 | //zCc_InitSlaveObj(slave);¼ÌÐøµÈdsci6Éϱ¨
|
| 3432 | g_Cc_CallDetail.slaveObj[slave].state = g_Cc_CallDetail.resourceReady?ZCC_S_TRYING_S:ZCC_S_WAIT_RESOURCE_S;
|
| 3433 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
|
| 3434 | g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SDISCN_M;
|
| 3435 | return;
|
| 3436 | }
|
| 3437 |
|
| 3438 | g_Cc_CallDetail.ringCid = slave;
|
| 3439 | if(g_Cc_CallDetail.evt[slave]==ZCC_CIDCW_E)
|
| 3440 | g_Cc_CallDetail.slaveObj[slave].is_cidcw = TRUE;
|
| 3441 | else
|
| 3442 | g_Cc_CallDetail.slaveObj[slave].is_cidcw = FALSE;
|
| 3443 | strcpy(g_Cc_CallDetail.slaveObj[slave].number, g_Cc_CallDetail.number);
|
| 3444 |
|
| 3445 | if (g_Cc_CallDetail.resourceReady == 1)
|
| 3446 | {
|
| 3447 | g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SRING_M;
|
| 3448 | g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_TRYING_S;
|
| 3449 | }
|
| 3450 | else
|
| 3451 | {
|
| 3452 | g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_WAIT_RESOURCE_S;
|
| 3453 | }
|
| 3454 | break;
|
| 3455 |
|
| 3456 | case ZCC_SRING_E://cid²»Æ¥ÅäµÄ³¡¾°
|
| 3457 | tmpslave = zCc_GetDialingSlave(0);
|
| 3458 | if (0 == tmpslave )
|
| 3459 | {
|
| 3460 | return;
|
| 3461 | }
|
| 3462 | g_Cc_CallDetail.slaveObj[slave] = g_Cc_CallDetail.slaveObj[tmpslave];
|
| 3463 | zCc_InitSlaveObj(tmpslave);
|
| 3464 | g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_RINGBACK_S;
|
| 3465 | break;
|
| 3466 | case ZCC_SDISCN_MO_E://cid²»Æ¥ÅäµÄ³¡¾°
|
| 3467 | tmpslave = zCc_GetDialingSlave(0);
|
| 3468 | if (0 == tmpslave )
|
| 3469 | {
|
| 3470 | return;
|
| 3471 | }
|
| 3472 | g_Cc_CallDetail.slaveObj[slave] = g_Cc_CallDetail.slaveObj[tmpslave];
|
| 3473 | zCc_InitSlaveObj(tmpslave);
|
| 3474 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, tmpslave);
|
| 3475 | if (1 == zCc_BusyToneAllowed() && g_Cc_CallDetail.slaveObj[slave].waitDSCI6 == 0&& g_Cc_CallDetail.state == ZCC_M_SEIZE_S)//ÓÐÆäËûºô½ÐÇÒÒѹһúʱ²»·ÅæÒô
|
| 3476 | {
|
| 3477 | CreateSoftTimer(ZCCAPP_TIMER_BUSYTONE_DETECT,
|
| 3478 | 0,
|
| 3479 | ZCCAPP_TIMER_BUSYTONE_INTERVAL,
|
| 3480 | zCcApp_BusyToneTimer,
|
| 3481 | NULL);
|
| 3482 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SIdleState CreateSoftTimer zCcApp_BusyToneTimer\n",__FUNCTION__);
|
| 3483 | g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_BSY_A;
|
| 3484 | g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_BSYT_S;
|
| 3485 | g_Cc_CallDetail.slaveObj[slave].confcall = 0;
|
| 3486 | g_Cc_CallDetail.slaveObj[slave].heldcall = 0;
|
| 3487 | }
|
| 3488 | else
|
| 3489 | {
|
| 3490 | zCc_InitSlaveObj(slave);
|
| 3491 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
|
| 3492 | }
|
| 3493 | return;
|
| 3494 | default:
|
| 3495 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SIdleState:evt=%d\n",__FUNCTION__,g_Cc_CallDetail.evt[slave]);
|
| 3496 | break;
|
| 3497 | }
|
| 3498 | }
|
| 3499 |
|
| 3500 | VOID zCc_SDtState(UINT8 slave)
|
| 3501 | {
|
| 3502 | 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]);
|
| 3503 | switch (g_Cc_CallDetail.evt[slave])
|
| 3504 | {
|
| 3505 | case ZCC_DTMF_E:
|
| 3506 | DeleteSoftTimer(ZCCAPP_TIMER_HOOKOFF_IDLE);
|
| 3507 | g_Cc_CallDetail.slaveObj[slave].idle_second = 0;
|
| 3508 |
|
| 3509 | DeleteSoftTimer(ZCCAPP_TIMER_HOOKOFF_DETECT);
|
| 3510 |
|
| 3511 | CreateSoftTimer(ZCCAPP_TIMER_DTMF_DETECT,
|
| 3512 | 0,
|
| 3513 | ZCCAPP_TIMER_DTMF_INTERVAL,
|
| 3514 | zCcApp_DtmfTimer,
|
| 3515 | NULL);
|
| 3516 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SDtState CreateSoftTimer zCcApp_DtmfTimer\n",__FUNCTION__);
|
| 3517 | g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_SIL_A;
|
| 3518 | g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_DACCM_S;
|
| 3519 | break;
|
| 3520 |
|
| 3521 | case ZCC_DISCN_E:
|
| 3522 | //zCc_ClearDigits();
|
| 3523 | zCc_InitSlaveObj(slave);
|
| 3524 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
|
| 3525 | return;
|
| 3526 |
|
| 3527 | default://Ö»»áÊÇslave0£¬²»¿ÉÄÜÓëdsciµÄcid³åÍ»
|
| 3528 | break;
|
| 3529 | }
|
| 3530 | }
|
| 3531 |
|
| 3532 | VOID zCc_SDaccmState(UINT8 slave)
|
| 3533 | {
|
| 3534 | 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]);
|
| 3535 | UINT8 ret = 0;
|
| 3536 | UINT8 tmpslave = 0;
|
| 3537 |
|
| 3538 | switch (g_Cc_CallDetail.evt[slave])
|
| 3539 | {
|
| 3540 | case ZCC_DTMF_E:
|
| 3541 | DeleteSoftTimer(ZCCAPP_TIMER_DTMF_DETECT);
|
| 3542 | ret = zCc_DigitsMatch();
|
| 3543 | break;
|
| 3544 |
|
| 3545 | case ZCC_DISCN_E:
|
| 3546 | zCc_ClearDigits();
|
| 3547 | zCc_InitSlaveObj(slave);
|
| 3548 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
|
| 3549 | return;
|
| 3550 | case ZCC_CIDCW_E:
|
| 3551 | case ZCC_SINVITE_E://ÒÔdsciµÄcidΪ׼£¬ÖØÐ¸ømoµÄºô½Ð·ÖÅäidle cid
|
| 3552 | tmpslave = zCc_GetSpecSlave(ZCC_S_IDLE_S);
|
| 3553 | if (0 == tmpslave )
|
| 3554 | {
|
| 3555 | return;
|
| 3556 | }
|
| 3557 | g_Cc_CallDetail.slaveObj[tmpslave] = g_Cc_CallDetail.slaveObj[slave];
|
| 3558 | zCc_InitSlaveObj(slave);
|
| 3559 | g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SDISCN_M;
|
| 3560 | g_Cc_CallDetail.slaveObj[slave].state = g_Cc_CallDetail.resourceReady?ZCC_S_TRYING_S:ZCC_S_WAIT_RESOURCE_S;
|
| 3561 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SDaccmState: reject mtcall\n",__FUNCTION__, slave);
|
| 3562 | return;
|
| 3563 | default:
|
| 3564 | return;
|
| 3565 | }
|
| 3566 |
|
| 3567 | if(ret==ZCC_LOCAL_TEST_CALL)
|
| 3568 | {
|
| 3569 | SIGNAL_DATA tSig;
|
| 3570 | if(zCc_talking_count())
|
| 3571 | {
|
| 3572 | zCc_ClearDigits();
|
| 3573 | zCc_InitSlaveObj(slave);
|
| 3574 | return;
|
| 3575 | }
|
| 3576 |
|
| 3577 | SLIC_Stop_Signal(0, TONE_SIGNAL);
|
| 3578 | memset(&tSig, 0, sizeof(tSig));
|
| 3579 | tSig.signal_type= TONE_SIGNAL;
|
| 3580 | tSig.tone_type = TONE_CW;
|
| 3581 | SLIC_Play_Signal(0, 0, &tSig);
|
| 3582 |
|
| 3583 | zCc_ClearDigits();
|
| 3584 |
|
| 3585 | g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
|
| 3586 | g_Cc_CallDetail.evt[slave]= ZCC_NO_E;
|
| 3587 | g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SNO_M;
|
| 3588 |
|
| 3589 | local_test_call_st = LocalTestCallST_Start;
|
| 3590 |
|
| 3591 | zCc_ShowAllSlaveWithTips("testCall-start");
|
| 3592 | return ;
|
| 3593 | }
|
| 3594 |
|
| 3595 | zCc_DigitsMatchRltProc(ret);
|
| 3596 | }
|
| 3597 |
|
| 3598 | VOID zCc_SDialingState(UINT8 slave)
|
| 3599 | {
|
| 3600 | UINT8 tmpslave = 0;
|
| 3601 | 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]);
|
| 3602 | switch (g_Cc_CallDetail.evt[slave])
|
| 3603 | {
|
| 3604 | case ZCC_SRING_E:
|
| 3605 | g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_RINGBACK_S;
|
| 3606 | break;
|
| 3607 |
|
| 3608 | case ZCC_SANS_E:
|
| 3609 | g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_OFF_A;
|
| 3610 | g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_TALKING_S;
|
| 3611 | SLIC_Stop_Signal(0, TONE_SIGNAL);
|
| 3612 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SDialingState: SLIC_Stop_Signal <---\n",__FUNCTION__);
|
| 3613 | g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
|
| 3614 | SLIC_Start_PCM();
|
| 3615 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SDialingState: SLIC_Start_PCM <---\n",__FUNCTION__);
|
| 3616 | break;
|
| 3617 |
|
| 3618 | case ZCC_DISCN_E:
|
| 3619 | //zCc_InitSlaveObj(slave);
|
| 3620 | g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SDISCN_M;
|
| 3621 | g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_OFF_A;
|
| 3622 | return;
|
| 3623 |
|
| 3624 | case ZCC_SDISCN_MO_E:
|
| 3625 | if (1 == zCc_BusyToneAllowed() && g_Cc_CallDetail.slaveObj[slave].waitDSCI6 == 0 && g_Cc_CallDetail.state == ZCC_M_SEIZE_S)//ÓÐÆäËûºô½ÐÇÒÒѹһúʱ²»·ÅæÒô
|
| 3626 | {
|
| 3627 | CreateSoftTimer(ZCCAPP_TIMER_BUSYTONE_DETECT,
|
| 3628 | 0,
|
| 3629 | ZCCAPP_TIMER_BUSYTONE_INTERVAL,
|
| 3630 | zCcApp_BusyToneTimer,
|
| 3631 | NULL);
|
| 3632 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SDialingState CreateSoftTimer zCcApp_BusyToneTimer\n",__FUNCTION__);
|
| 3633 | g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_BSY_A;
|
| 3634 | g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_BSYT_S;
|
| 3635 | g_Cc_CallDetail.slaveObj[slave].confcall = 0;
|
| 3636 | g_Cc_CallDetail.slaveObj[slave].heldcall = 0;
|
| 3637 | }
|
| 3638 | else
|
| 3639 | {
|
| 3640 | zCc_InitSlaveObj(slave);
|
| 3641 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
|
| 3642 | }
|
| 3643 | return;
|
| 3644 | case ZCC_SDISCN_MT_E:
|
| 3645 | zCc_InitSlaveObj(slave);//Ö÷±»½Ð²¢·¢
|
| 3646 | //g_Cc_CallDetail.slaveObj[slave].waitDSCI6 = 0;
|
| 3647 | return;
|
| 3648 | case ZCC_CIDCW_E:
|
| 3649 | case ZCC_SINVITE_E://ÒÔdsciµÄcidΪ׼£¬ÖØÐ¸ømoµÄºô½Ð·ÖÅäidle cid
|
| 3650 | tmpslave = zCc_GetSpecSlave(ZCC_S_IDLE_S);
|
| 3651 | if (0 == tmpslave )
|
| 3652 | {
|
| 3653 | return;
|
| 3654 | }
|
| 3655 | g_Cc_CallDetail.slaveObj[tmpslave] = g_Cc_CallDetail.slaveObj[slave];
|
| 3656 | zCc_InitSlaveObj(slave);
|
| 3657 | g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SDISCN_M;
|
| 3658 | g_Cc_CallDetail.slaveObj[slave].state = g_Cc_CallDetail.resourceReady?ZCC_S_TRYING_S:ZCC_S_WAIT_RESOURCE_S;
|
| 3659 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SDaccmState: reject mtcall\n",__FUNCTION__, slave);
|
| 3660 | return;
|
| 3661 |
|
| 3662 | default:
|
| 3663 | return;
|
| 3664 | }
|
| 3665 | }
|
| 3666 |
|
| 3667 | VOID zCc_SRingbackState(UINT8 slave)
|
| 3668 | {
|
| 3669 | 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]);
|
| 3670 | switch (g_Cc_CallDetail.evt[slave])
|
| 3671 | {
|
| 3672 | case ZCC_SANS_E:
|
| 3673 | g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_OFF_A;
|
| 3674 | g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_TALKING_S;
|
| 3675 | SLIC_Stop_Signal(0, TONE_SIGNAL);
|
| 3676 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SRingbackState: SLIC_Stop_Signal <---\n",__FUNCTION__);
|
| 3677 | g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
|
| 3678 |
|
| 3679 | if(g_Cc_CallDetail.slaveObj[slave].is_callout)
|
| 3680 | SLIC_PolarityReverse(0, TRUE);
|
| 3681 |
|
| 3682 | SLIC_Start_PCM();
|
| 3683 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SRingbackState SLIC_Start_PCM2222\n",__FUNCTION__);
|
| 3684 | break;
|
| 3685 |
|
| 3686 | case ZCC_DISCN_E:
|
| 3687 | //zCc_InitSlaveObj(slave);
|
| 3688 | g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SDISCN_M;
|
| 3689 | g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_OFF_A;
|
| 3690 | return;
|
| 3691 |
|
| 3692 | case ZCC_SDISCN_MO_E:
|
| 3693 | if (1 == zCc_BusyToneAllowed() && g_Cc_CallDetail.slaveObj[slave].waitDSCI6 == 0 && g_Cc_CallDetail.state == ZCC_M_SEIZE_S)//ÓÐÆäËûºô½Ðʱ²»·ÅæÒô
|
| 3694 | {
|
| 3695 | CreateSoftTimer(ZCCAPP_TIMER_BUSYTONE_DETECT,
|
| 3696 | 0,
|
| 3697 | ZCCAPP_TIMER_BUSYTONE_INTERVAL,
|
| 3698 | zCcApp_BusyToneTimer,
|
| 3699 | NULL);
|
| 3700 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SRingbackState CreateSoftTimer zCcApp_BusyToneTimer\n",__FUNCTION__);
|
| 3701 | g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_BSY_A;
|
| 3702 | g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_BSYT_S;
|
| 3703 | g_Cc_CallDetail.slaveObj[slave].confcall = 0;
|
| 3704 | g_Cc_CallDetail.slaveObj[slave].heldcall = 0;
|
| 3705 | SLIC_Stop_PCM();
|
| 3706 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SRingbackState SLIC_Stop_PCM\n",__FUNCTION__);
|
| 3707 | }
|
| 3708 | else
|
| 3709 | {
|
| 3710 | zCc_InitSlaveObj(slave);
|
| 3711 | if ( 0 == zCc_ActiveCall() && 0 == zCc_HeldCall())
|
| 3712 | {
|
| 3713 | SLIC_Stop_PCM();
|
| 3714 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SRingbackState SLIC_Stop_PCM\n",__FUNCTION__);
|
| 3715 | }
|
| 3716 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
|
| 3717 | }
|
| 3718 | return;
|
| 3719 | case ZCC_SDISCN_MT_E:
|
| 3720 | g_Cc_CallDetail.slaveObj[slave].waitDSCI6 = 0;
|
| 3721 | return;
|
| 3722 |
|
| 3723 | case ZCC_DTMF_E: // ²¦ºÅ
|
| 3724 | g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SDTMF_M;///???
|
| 3725 | return;
|
| 3726 |
|
| 3727 | case ZCC_RESOURCE_READY_E:
|
| 3728 | g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_OFF_A;
|
| 3729 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SRingbackState: SLIC_Stop_Signal <---\n",__FUNCTION__);
|
| 3730 | SLIC_Stop_Signal(0, TONE_SIGNAL);
|
| 3731 | g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
|
| 3732 | SLIC_Start_PCM();//×ÊÔ´ÒÑ·ÖÅä£¬Íø²à·ÅÒô
|
| 3733 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_SRingbackState SLIC_Start_PCM\n",__FUNCTION__);
|
| 3734 | return;
|
| 3735 |
|
| 3736 | default:
|
| 3737 | return;
|
| 3738 | }
|
| 3739 | }
|
| 3740 |
|
| 3741 | VOID zCc_STalkingState(UINT8 slave)
|
| 3742 | {
|
| 3743 | 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]);
|
| 3744 | switch (g_Cc_CallDetail.evt[slave])
|
| 3745 | {
|
| 3746 | case ZCC_DISCN_E:
|
| 3747 | //zCc_InitSlaveObj(slave);
|
| 3748 | g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SDISCN_M;
|
| 3749 | g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_OFF_A;
|
| 3750 | return;
|
| 3751 |
|
| 3752 | case ZCC_SDISCN_MO_E:
|
| 3753 | case ZCC_SDISCN_MT_E:
|
| 3754 | //zCc_InitSlaveObj(slave);
|
| 3755 | if (zCc_CallCount() >= 2 || g_Cc_CallDetail.state == ZCC_M_RELEASE_S)//»¹Ê£¶àÓÚһ·ºô½Ð
|
| 3756 | {
|
| 3757 | zCc_InitSlaveObj(slave);
|
| 3758 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
|
| 3759 | break;
|
| 3760 | }
|
| 3761 | if (g_Cc_CallDetail.slaveObj[0].tone != ZCC_TONE_OFF_A)
|
| 3762 | {
|
| 3763 | zCc_InitSlaveObj(0);
|
| 3764 | }
|
| 3765 | if (1 == zCc_BusyToneAllowed() && g_Cc_CallDetail.slaveObj[slave].waitDSCI6 == 0)//ÓÐÆäËûºô½Ðʱ²»·ÅæÒô
|
| 3766 | {
|
| 3767 | CreateSoftTimer(ZCCAPP_TIMER_BUSYTONE_DETECT,
|
| 3768 | 0,
|
| 3769 | ZCCAPP_TIMER_BUSYTONE_INTERVAL,
|
| 3770 | zCcApp_BusyToneTimer,
|
| 3771 | NULL);
|
| 3772 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_STalkingState CreateSoftTimer zCcApp_BusyToneTimer\n",__FUNCTION__);
|
| 3773 | g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_BSY_A;
|
| 3774 | g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_BSYT_S;
|
| 3775 | g_Cc_CallDetail.slaveObj[slave].confcall = 0;
|
| 3776 | g_Cc_CallDetail.slaveObj[slave].heldcall = 0;
|
| 3777 | }
|
| 3778 | else
|
| 3779 | {
|
| 3780 | zCc_InitSlaveObj(slave);
|
| 3781 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
|
| 3782 | }
|
| 3783 | return;
|
| 3784 |
|
| 3785 | case ZCC_DTMF_E: // ²¦ºÅ. µ÷ÕûÒôÁ¿µÄ´¦Àí´ýÔö¼Ó
|
| 3786 | if (g_Cc_CallDetail.slaveObj[slave].heldcall == 0)
|
| 3787 | {
|
| 3788 | g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SDTMF_M;///???
|
| 3789 | }
|
| 3790 | return;
|
| 3791 | default:
|
| 3792 | return;
|
| 3793 | }
|
| 3794 | }
|
| 3795 |
|
| 3796 | VOID zCc_SWaitResourceState(UINT8 slave)
|
| 3797 | {
|
| 3798 | 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]);
|
| 3799 | switch (g_Cc_CallDetail.evt[slave])
|
| 3800 | {
|
| 3801 | case ZCC_RESOURCE_READY_E:
|
| 3802 | g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SRING_M;
|
| 3803 | g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_TRYING_S;
|
| 3804 | break;
|
| 3805 |
|
| 3806 | case ZCC_SDISCN_MT_E:
|
| 3807 | zCc_InitSlaveObj(slave);
|
| 3808 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
|
| 3809 | return;
|
| 3810 |
|
| 3811 | default:
|
| 3812 | return;
|
| 3813 | }
|
| 3814 | }
|
| 3815 |
|
| 3816 | VOID zCc_STryingState(UINT8 slave)
|
| 3817 | {
|
| 3818 | 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]);
|
| 3819 | switch (g_Cc_CallDetail.evt[slave])
|
| 3820 | {
|
| 3821 | case ZCC_CNCT_E:
|
| 3822 | g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SANS_M;
|
| 3823 | //lint -fallthrough
|
| 3824 | case ZCC_SANS_E: //CHLD=2, ÊÕµ½DSCIǨ״̬
|
| 3825 | g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_OFF_A;
|
| 3826 | g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_TALKING_S;
|
| 3827 | g_Cc_CallDetail.ringCid = 0;
|
| 3828 | SLIC_Stop_Signal(0, TONE_SIGNAL);
|
| 3829 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_STryingState: SLIC_Stop_Signal <---\n",__FUNCTION__);
|
| 3830 | g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
|
| 3831 | SLIC_Start_PCM();
|
| 3832 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_STryingState SLIC_Start_PCM\n",__FUNCTION__);
|
| 3833 | break;
|
| 3834 |
|
| 3835 | case ZCC_SDISCN_MT_E:
|
| 3836 | zCc_InitSlaveObj(slave);
|
| 3837 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
|
| 3838 | return;
|
| 3839 |
|
| 3840 | case ZCC_DISCN_E://trying ̬ÊÕµ½¹Ò»úÏûÏ¢£¬Ö»ÄÜÊÇÕª»ú̬À´µç(²»°üÀ¨ºô½ÐµÈ´ý)µÄ³¡¾°
|
| 3841 | g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_OFF_A;
|
| 3842 | SLIC_Stop_Signal(0, TONE_SIGNAL);
|
| 3843 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_STryingState: SLIC_Stop_Signal <---\n",__FUNCTION__);
|
| 3844 | g_Cc_CallDetail.lastTone = ZCC_TONE_OFF_A;
|
| 3845 | if (1 == zCc_CallCount() && (zCc_GetDiscSlave(ZCC_SDISCN_M) == 0)// Õª»ú̬À´µçʱ¹Ò»ú£¬Èç¹ûµ±Ç°Ö»ÓÐһ·ºô½Ð£¬»°»úתÈëÕñÁå
|
| 3846 | ||(2 == zCc_CallCount()
|
| 3847 | && (0 != zCc_GetSpecSlave(ZCC_S_DACCM_S)
|
| 3848 | ||0 != zCc_GetSpecSlave(ZCC_S_BSYT_S)
|
| 3849 | ||0 != zCc_GetSpecSlave(ZCC_S_TKYT_S)
|
| 3850 | ||0 != zCc_GetSpecSlave(ZCC_S_SIL_S))))//Õª»úºó£¬À´µç£¬ÔÙ²¦ºÅ£¬¹Ò»ú£¬Ò²ÐèÒªÕñÁå
|
| 3851 | {
|
| 3852 | g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SRING_M;
|
| 3853 | }
|
| 3854 | else
|
| 3855 | {
|
| 3856 | //zCc_InitSlaveObj(slave);
|
| 3857 | g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_OFF_A;
|
| 3858 | g_Cc_CallDetail.ringCid = 0;
|
| 3859 | g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SDISCN_M;
|
| 3860 | }
|
| 3861 | return;
|
| 3862 |
|
| 3863 | default:
|
| 3864 | return;
|
| 3865 | }
|
| 3866 | }
|
| 3867 |
|
| 3868 | VOID zCc_SBsyToneState(UINT8 slave)
|
| 3869 | {
|
| 3870 | 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]);
|
| 3871 | switch (g_Cc_CallDetail.evt[slave])
|
| 3872 | {
|
| 3873 | case ZCC_DISCN_E:
|
| 3874 | zCc_InitSlaveObj(slave);
|
| 3875 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
|
| 3876 | return;
|
| 3877 | case ZCC_CIDCW_E:
|
| 3878 | g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_CIDCW_A;
|
| 3879 | //lint -fallthrough
|
| 3880 | case ZCC_SINVITE_E:
|
| 3881 | if ((0 != zCc_GetDialingSlave(1)) || (0 != zCc_GetSpecSlave(ZCC_S_RINGBACK_S)))//ÓÐÒѾÏ·¢atd µÄºô½Ðʱ¾Ü¾øÐÂÀ´µç
|
| 3882 | {
|
| 3883 | zCc_InitSlaveObj(slave);
|
| 3884 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
|
| 3885 | g_Cc_CallDetail.evt[slave] = ZCC_DISCN_E;
|
| 3886 | return;
|
| 3887 | }
|
| 3888 | g_Cc_CallDetail.ringCid = slave;
|
| 3889 |
|
| 3890 | if(g_Cc_CallDetail.evt[slave]==ZCC_CIDCW_E)
|
| 3891 | g_Cc_CallDetail.slaveObj[slave].is_cidcw = TRUE;
|
| 3892 | else
|
| 3893 | g_Cc_CallDetail.slaveObj[slave].is_cidcw = FALSE;
|
| 3894 |
|
| 3895 | if (g_Cc_CallDetail.resourceReady == 1)
|
| 3896 | {
|
| 3897 | g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SRING_M;
|
| 3898 | g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_TRYING_S;
|
| 3899 | }
|
| 3900 | else
|
| 3901 | {
|
| 3902 | g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_WAIT_RESOURCE_S;
|
| 3903 | }
|
| 3904 | break;
|
| 3905 | default:
|
| 3906 | return;
|
| 3907 | }
|
| 3908 | }
|
| 3909 |
|
| 3910 | VOID zCc_STkytState(UINT8 slave)
|
| 3911 | {
|
| 3912 | 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]);
|
| 3913 | switch (g_Cc_CallDetail.evt[slave])
|
| 3914 | {
|
| 3915 | case ZCC_DISCN_E:
|
| 3916 | zCc_InitSlaveObj(slave);
|
| 3917 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
|
| 3918 | return;
|
| 3919 | case ZCC_CIDCW_E:
|
| 3920 | g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_CIDCW_A;
|
| 3921 | //lint -fallthrough
|
| 3922 | case ZCC_SINVITE_E:
|
| 3923 | if ((0 != zCc_GetDialingSlave(1)) || (0 != zCc_GetSpecSlave(ZCC_S_RINGBACK_S)))//ÓÐÒѾÏ·¢atd µÄºô½Ðʱ¾Ü¾øÐÂÀ´µç
|
| 3924 | {
|
| 3925 | zCc_InitSlaveObj(slave);
|
| 3926 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
|
| 3927 | g_Cc_CallDetail.evt[slave] = ZCC_DISCN_E;
|
| 3928 | return;
|
| 3929 | }
|
| 3930 | g_Cc_CallDetail.ringCid = slave;
|
| 3931 |
|
| 3932 | if(g_Cc_CallDetail.evt[slave]==ZCC_CIDCW_E)
|
| 3933 | g_Cc_CallDetail.slaveObj[slave].is_cidcw = TRUE;
|
| 3934 | else
|
| 3935 | g_Cc_CallDetail.slaveObj[slave].is_cidcw = FALSE;
|
| 3936 |
|
| 3937 | if (g_Cc_CallDetail.resourceReady == 1)
|
| 3938 | {
|
| 3939 | g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SRING_M;
|
| 3940 | g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_TRYING_S;
|
| 3941 | }
|
| 3942 | else
|
| 3943 | {
|
| 3944 | g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_WAIT_RESOURCE_S;
|
| 3945 | }
|
| 3946 | break;
|
| 3947 | default:
|
| 3948 | return;
|
| 3949 | }
|
| 3950 | }
|
| 3951 |
|
| 3952 | VOID zCc_SSilState(UINT8 slave)
|
| 3953 | {
|
| 3954 | 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]);
|
| 3955 | switch (g_Cc_CallDetail.evt[slave])
|
| 3956 | {
|
| 3957 | case ZCC_DISCN_E:
|
| 3958 | zCc_InitSlaveObj(slave);
|
| 3959 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
|
| 3960 | return;
|
| 3961 | case ZCC_CIDCW_E:
|
| 3962 | g_Cc_CallDetail.slaveObj[slave].tone = ZCC_TONE_CIDCW_A;
|
| 3963 | //lint -fallthrough
|
| 3964 | case ZCC_SINVITE_E:
|
| 3965 | if ((0 != zCc_GetDialingSlave(1)) || (0 != zCc_GetSpecSlave(ZCC_S_RINGBACK_S)))//ÓÐÒѾÏ·¢atd µÄºô½Ðʱ¾Ü¾øÐÂÀ´µç
|
| 3966 | {
|
| 3967 | zCc_InitSlaveObj(slave);
|
| 3968 | zte_log_append(__FILE__, __LINE__, "zte_ccapp.log","%s zCc_InitSlaveObj: slaveObj[%d] cleared\n",__FUNCTION__, slave);
|
| 3969 | g_Cc_CallDetail.evt[slave] = ZCC_DISCN_E;
|
| 3970 | return;
|
| 3971 | }
|
| 3972 | g_Cc_CallDetail.ringCid = slave;
|
| 3973 |
|
| 3974 | if(g_Cc_CallDetail.evt[slave]==ZCC_CIDCW_E)
|
| 3975 | g_Cc_CallDetail.slaveObj[slave].is_cidcw = TRUE;
|
| 3976 | else
|
| 3977 | g_Cc_CallDetail.slaveObj[slave].is_cidcw = FALSE;
|
| 3978 |
|
| 3979 | if (g_Cc_CallDetail.resourceReady == 1)
|
| 3980 | {
|
| 3981 | g_Cc_CallDetail.slaveObj[slave].sMsg = ZCC_SRING_M;
|
| 3982 | g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_TRYING_S;
|
| 3983 | }
|
| 3984 | else
|
| 3985 | {
|
| 3986 | g_Cc_CallDetail.slaveObj[slave].state = ZCC_S_WAIT_RESOURCE_S;
|
| 3987 | }
|
| 3988 | break;
|
| 3989 |
|
| 3990 | default:
|
| 3991 | return;
|
| 3992 | }
|
| 3993 | }
|
| 3994 |
|
| 3995 |
|