FreeCalypso > hg > fc-magnetite
comparison src/g23m-aci/aci/cmh_ccf.c @ 162:53929b40109c
src/g23m-aci: initial import from TCS3.2/LoCosto
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 11 Oct 2016 02:02:43 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
161:4557e2a9c18e | 162:53929b40109c |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GSM-PS (6147) | |
4 | Modul : CMH_CCF | |
5 +----------------------------------------------------------------------------- | |
6 | Copyright 2002 Texas Instruments Berlin, AG | |
7 | All rights reserved. | |
8 | | |
9 | This file is confidential and a trade secret of Texas | |
10 | Instruments Berlin, AG | |
11 | The receipt of or possession of this file does not convey | |
12 | any rights to reproduce or disclose its contents or to | |
13 | manufacture, use, or sell anything it may describe, in | |
14 | whole, or in part, without the specific written consent of | |
15 | Texas Instruments Berlin, AG. | |
16 +----------------------------------------------------------------------------- | |
17 | Purpose : This module defines the functions used by the command | |
18 | handler for call control. | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifndef CMH_CCF_C | |
23 #define CMH_CCF_C | |
24 #endif | |
25 | |
26 #include "aci_all.h" | |
27 | |
28 /*==== INCLUDES ===================================================*/ | |
29 | |
30 #include "aci_cmh.h" | |
31 #include "ati_cmd.h" | |
32 #include "aci_cmd.h" | |
33 #include "aci_mem.h" | |
34 | |
35 #ifdef FAX_AND_DATA | |
36 #include "aci_fd.h" | |
37 #endif | |
38 | |
39 #ifdef FF_TTY | |
40 #include "audio.h" | |
41 #endif | |
42 | |
43 #include "aci_io.h" | |
44 | |
45 #include "phb.h" | |
46 #include "ksd.h" | |
47 #include "aoc.h" | |
48 #include "aci.h" | |
49 #include "psa.h" | |
50 #include "psa_cc.h" | |
51 #include "psa_ss.h" | |
52 #include "psa_util.h" | |
53 #include "cmh.h" | |
54 #include "cmh_cc.h" | |
55 #include "cmh_ss.h" | |
56 #include "cmh_phb.h" | |
57 | |
58 #include "aci_lst.h" | |
59 | |
60 #ifdef DTI | |
61 #include "dti.h" /* functionality of the dti library */ | |
62 #include "dti_conn_mng.h" | |
63 #include "dti_cntrl_mng.h" | |
64 #endif | |
65 | |
66 #ifdef UART | |
67 #include "psa_uart.h" | |
68 #include "cmh_uart.h" | |
69 #endif | |
70 | |
71 #ifdef FAX_AND_DATA | |
72 | |
73 #include "psa_ra.h" | |
74 #include "cmh_ra.h" | |
75 #include "psa_l2r.h" | |
76 #include "cmh_l2r.h" | |
77 | |
78 #ifdef FF_FAX | |
79 #include "psa_t30.h" | |
80 #include "cmh_t30.h" | |
81 #endif /* FF_FAX */ | |
82 | |
83 #endif /* FAX_AND_DATA */ | |
84 | |
85 #if defined (FF_WAP) || defined (FF_PPP) || defined(FF_GPF_TCPIP) || defined (FF_SAT_E) | |
86 #include "wap_aci.h" | |
87 #include "psa_ppp_w.h" | |
88 #include "cmh_ppp.h" | |
89 #endif /* of FF_WAP or FF_PPP || (FF_GPF_TCPIP)|| (FF_SAT_E)*/ | |
90 | |
91 #ifdef FF_GPF_TCPIP | |
92 #include "dcm_utils.h" | |
93 #include "dcm_state.h" | |
94 #include "dcm_env.h" | |
95 #endif | |
96 | |
97 #ifdef SIM_TOOLKIT | |
98 #include "psa_sat.h" | |
99 #include "cmh_sat.h" | |
100 #include "psa_sim.h" | |
101 #endif | |
102 | |
103 #ifdef FF_PSI | |
104 #include "psa_psi.h" | |
105 #include "cmh_psi.h" | |
106 #endif /*FF_PSI*/ | |
107 #include "l4_tim.h" | |
108 | |
109 #if defined(_TARGET_) | |
110 #include "ffs/ffs.h" | |
111 #include "ffs_coat.h" | |
112 #endif /* _TARGET_ */ | |
113 | |
114 #include "dcm_f.h" | |
115 | |
116 /*==== CONSTANTS ==================================================*/ | |
117 #define ACI_MAX_DIAL_SHORT_STRING_LEN 2 | |
118 #ifdef TI_PS_FF_AT_P_CMD_RDLB | |
119 EXTERN T_ACI_CC_REDIAL_BLACKL * cc_blacklist_ptr; | |
120 #endif /* TI_PS_FF_AT_P_CMD_RDLB */ | |
121 /*==== TYPES ======================================================*/ | |
122 | |
123 /*==== EXPORT =====================================================*/ | |
124 | |
125 /*==== VARIABLES ==================================================*/ | |
126 GLOBAL T_ACI_CUSCFG_PARAMS cuscfgParams; | |
127 | |
128 /* Implements Measure#32: Row 73, 74, 103, 114 & 1071 */ | |
129 const char * const gsm_com_path="/gsm/com"; | |
130 const char * const gsm_com_redialmode_path="/gsm/com/redialMode"; | |
131 const char * const gsm_com_alslock_path="/gsm/com/ALSlock"; | |
132 const char * const gsm_com_rfcap_path="/gsm/com/rfcap"; | |
133 /*==== FUNCTIONS ==================================================*/ | |
134 /* Implements Measure 197, 198 and 199 */ | |
135 LOCAL void cmhCC_redialAttempt( SHORT cId, UBYTE rdlCnt ); | |
136 | |
137 /* | |
138 +-------------------------------------------------------------------+ | |
139 | PROJECT : GSM-PS (6147) MODULE : CMH | | |
140 | ROUTINE : cmhCC_PrepareCmdEnd | | |
141 +-------------------------------------------------------------------+ | |
142 | |
143 PURPOSE : Prepares the end of a CC related AT command. | |
144 cId describes a valid (non-NULL) call table entry. | |
145 | |
146 */ | |
147 | |
148 GLOBAL void cmhCC_PrepareCmdEnd (SHORT cId, UBYTE *cmdBuf, UBYTE *srcBuf) | |
149 { | |
150 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
151 | |
152 if (cmdBuf NEQ NULL) | |
153 *cmdBuf = ctb->curCmd; | |
154 if (srcBuf NEQ NULL) | |
155 *srcBuf = ctb->curSrc; | |
156 ctb->curCmd = AT_CMD_NONE; | |
157 ctb->curSrc = CMD_SRC_NONE; | |
158 } | |
159 | |
160 | |
161 GLOBAL UBYTE cmhCC_set_speech_serv (T_CC_CMD_PRM *pCCCmdPrm) | |
162 { | |
163 #ifdef FF_TTY | |
164 UBYTE ctmReq; | |
165 | |
166 /* check temporary inversion of CTM service request */ | |
167 if (!ccShrdPrm.ctmOvwr) | |
168 { | |
169 ctmReq = ccShrdPrm.ctmReq; | |
170 } | |
171 else | |
172 { | |
173 if (ccShrdPrm.ctmReq EQ MNCC_CTM_ENABLED) | |
174 { | |
175 ctmReq = MNCC_CTM_DISABLED; | |
176 ccShrdPrm.ttyCmd = (UBYTE)TTY_OFF; | |
177 } | |
178 else | |
179 { | |
180 ctmReq = MNCC_CTM_ENABLED; | |
181 ccShrdPrm.ttyCmd = (UBYTE)TTY_ALL; | |
182 } | |
183 /* reset temporary inversion */ | |
184 ccShrdPrm.ctmOvwr = FALSE; | |
185 } | |
186 #endif /* FF_TTY */ | |
187 #ifdef FF_TTY | |
188 if (ctmReq EQ MNCC_CTM_ENABLED) | |
189 { | |
190 if (ccShrdPrm.ctmState EQ TTY_STATE_NONE) | |
191 { | |
192 ccShrdPrm.ctmState = TTY_STATE_IDLE; | |
193 } | |
194 if (pCCCmdPrm->ALSmode EQ ALS_MOD_AUX_SPEECH) | |
195 { | |
196 return MNCC_BEARER_SERV_AUX_SPEECH_CTM; | |
197 } | |
198 else | |
199 { | |
200 return MNCC_BEARER_SERV_SPEECH_CTM; | |
201 } | |
202 } | |
203 else | |
204 #endif /* FF_TTY */ | |
205 { | |
206 #ifdef FF_TTY | |
207 if (ccShrdPrm.ctmState EQ TTY_STATE_IDLE) | |
208 { | |
209 ccShrdPrm.ctmState = TTY_STATE_NONE; | |
210 } | |
211 #endif /* FF_TTY */ | |
212 if (pCCCmdPrm->ALSmode EQ ALS_MOD_AUX_SPEECH) | |
213 { | |
214 return MNCC_BEARER_SERV_AUX_SPEECH; | |
215 } | |
216 } | |
217 return MNCC_BEARER_SERV_SPEECH; | |
218 } | |
219 | |
220 GLOBAL T_ACI_RETURN cmhCC_chkShortString (T_ACI_CMD_SRC srcId, | |
221 SHORT cId, | |
222 T_CLPTY_PRM *cldPty) | |
223 { | |
224 USHORT num_len; | |
225 T_ACI_KSD_USSD_PRM ksdString; | |
226 | |
227 num_len = strlen (cldPty->num); | |
228 | |
229 /* check the length */ | |
230 if (!num_len OR (num_len > ACI_MAX_DIAL_SHORT_STRING_LEN)) | |
231 { | |
232 return (AT_EXCT); | |
233 } | |
234 | |
235 ksdString.ussd = (UBYTE*)cldPty->num; | |
236 | |
237 /* check if MS is in a call */ | |
238 if (cId NEQ NO_ENTRY) | |
239 { | |
240 /* call is active */ | |
241 return (cmhSS_ksdUSSD (srcId, &ksdString)); | |
242 } | |
243 | |
244 /* check if input string is 2 digit starting with a 1 */ | |
245 if ((num_len EQ ACI_MAX_DIAL_SHORT_STRING_LEN) AND | |
246 (*(cldPty->num) EQ '1') OR cuscfgParams.Two_digit_MO_Call) | |
247 { | |
248 /* normal dial */ | |
249 return (AT_EXCT); | |
250 } | |
251 | |
252 return (cmhSS_ksdUSSD (srcId, &ksdString)); | |
253 } | |
254 | |
255 /* | |
256 +-------------------------------------------------------------------+ | |
257 | PROJECT : GSM-PS (6147) MODULE : CMH | | |
258 | ROUTINE : cmhCC_find_call_for_DTMF| | |
259 +-------------------------------------------------------------------+ | |
260 | |
261 PURPOSE :searches for a call where it is possible to | |
262 send DTMF tones. | |
263 */ | |
264 GLOBAL BOOL is_call_ok_for_dtmf( SHORT cId ) | |
265 { | |
266 T_CC_CALL_TYPE calltype = cmhCC_getcalltype(cId); | |
267 | |
268 if(calltype NEQ VOICE_CALL) | |
269 { | |
270 TRACE_EVENT_P1("calltype NEQ VOICE_CALL: %d", calltype); | |
271 return(FALSE); | |
272 } | |
273 | |
274 if (ccShrdPrm.ctb[cId] EQ NULL) | |
275 { | |
276 TRACE_EVENT("ccShrdPrm.ctb[cId] EQ NULL"); | |
277 return(FALSE); | |
278 } | |
279 | |
280 switch(psaCC_ctb(cId)->calStat) | |
281 { | |
282 case(CS_ACT): | |
283 case(CS_ACT_REQ): | |
284 case(CS_DSC_REQ): | |
285 case(CS_CPL_REQ): | |
286 return(TRUE); | |
287 | |
288 default: | |
289 TRACE_EVENT_P1("unexpected call status: %d", psaCC_ctb(cId)->calStat); | |
290 return(FALSE); | |
291 } | |
292 } | |
293 | |
294 GLOBAL SHORT cmhCC_find_call_for_DTMF( void ) | |
295 { | |
296 SHORT ctbIdx; /* holds call table index */ | |
297 | |
298 TRACE_FUNCTION("cmhCC_find_call_for_DTMF"); | |
299 | |
300 for( ctbIdx = 0; ctbIdx < MAX_CALL_NR; ctbIdx++ ) | |
301 { | |
302 if( is_call_ok_for_dtmf(ctbIdx) ) | |
303 { | |
304 return(ctbIdx); | |
305 } | |
306 } | |
307 return( NO_ENTRY ); | |
308 } | |
309 | |
310 /* | |
311 +-------------------------------------------------------------------+ | |
312 | PROJECT : GSM-PS (6147) MODULE : CMH | | |
313 | ROUTINE : cmhCC_SendDTMFdig | | |
314 +-------------------------------------------------------------------+ | |
315 | |
316 PURPOSE : send a DTMF digit for that call. | |
317 return value: TRUE if digit has been correctly proceeded. | |
318 FALSE if an error occured. | |
319 */ | |
320 | |
321 GLOBAL BOOL cmhCC_SendDTMFdig( T_ACI_AT_CMD cmd, SHORT cId, CHAR digit, UBYTE mode) | |
322 { | |
323 TRACE_FUNCTION("cmhCC_SendDTMFdig"); | |
324 | |
325 TRACE_EVENT_P1("Sending DTMF tone: %d", digit); | |
326 | |
327 switch( digit ) | |
328 { | |
329 case( '0' ): | |
330 case( '1' ): | |
331 case( '2' ): | |
332 case( '3' ): | |
333 case( '4' ): | |
334 case( '5' ): | |
335 case( '6' ): | |
336 case( '7' ): | |
337 case( '8' ): | |
338 case( '9' ): | |
339 case( '*' ): | |
340 case( '#' ): | |
341 case( 'A' ): | |
342 case( 'B' ): | |
343 case( 'C' ): | |
344 case( 'D' ): | |
345 psaCC_SendDTMF( cId, digit, mode ); | |
346 return( TRUE ); | |
347 | |
348 case( 'W' ): /* FIXME: w should prompt the user for starting sending the following DTMF tones */ | |
349 case( 'w' ): /* since BMI does not support 'w' we assume to be the same as 'p' */ | |
350 case( 'P' ): | |
351 case( 'p' ): | |
352 if(cmd NEQ AT_CMD_VTS) /* this is only valid within a number to dial */ | |
353 { | |
354 /* p within a number string: this is a 3 seconds pause */ | |
355 TRACE_EVENT("DTMF pause requested: 3 seconds"); | |
356 #if defined (NEW_FRAME) | |
357 TIMERSTART( TDTMF_VALUE, ACI_TDTMF ); | |
358 #else | |
359 TIMERSTART( TDTMF_VALUE, t_dtmf_handle ); | |
360 #endif | |
361 return( TRUE ); | |
362 } | |
363 /* fallthrough for else */ | |
364 /*lint -fallthrough*/ | |
365 default: | |
366 TRACE_EVENT_P1("Invalid DTMF digit: %d", digit); | |
367 } | |
368 return( FALSE ); | |
369 } | |
370 | |
371 | |
372 #ifdef FAX_AND_DATA | |
373 /* | |
374 +-------------------------------------------------------------------+ | |
375 | PROJECT : GSM-PS (6147) MODULE : CMH_CC | | |
376 | ROUTINE : cmhCC_SelRate | | |
377 +-------------------------------------------------------------------+ | |
378 | |
379 PURPOSE : select the user rate out of the current speed setting | |
380 | |
381 */ | |
382 | |
383 GLOBAL UBYTE cmhCC_SelRate ( T_ACI_BS_SPEED speed ) | |
384 { | |
385 switch( speed ) | |
386 { | |
387 case( BS_SPEED_300_V21 ): | |
388 case( BS_SPEED_300_V110 ): return( MNCC_UR_0_3_KBIT ); | |
389 case( BS_SPEED_1200_V22 ): | |
390 case( BS_SPEED_1200_V120 ): | |
391 case( BS_SPEED_1200_V110 ): return( MNCC_UR_1_2_KBIT ); | |
392 case( BS_SPEED_1200_75_V23 ): return( MNCC_UR_1_2_KBIT_V23 ); | |
393 case( BS_SPEED_2400_V22bis ): | |
394 case( BS_SPEED_2400_V26ter ): | |
395 case( BS_SPEED_2400_V120 ): | |
396 case( BS_SPEED_2400_V110 ): return( MNCC_UR_2_4_KBIT ); | |
397 case( BS_SPEED_4800_V32 ): | |
398 case( BS_SPEED_4800_V120 ): | |
399 case( BS_SPEED_4800_V110 ): return( MNCC_UR_4_8_KBIT ); | |
400 case( BS_SPEED_AUTO ): | |
401 case( BS_SPEED_9600_V32 ): | |
402 case( BS_SPEED_9600_V34 ): | |
403 case( BS_SPEED_9600_V120 ): | |
404 case( BS_SPEED_9600_V110 ): return( MNCC_UR_9_6_KBIT ); | |
405 case( BS_SPEED_14400_V34 ): | |
406 case( BS_SPEED_14400_V120 ): | |
407 case( BS_SPEED_14400_V110 ): return( MNCC_UR_14_4_KBIT ); | |
408 default: return( MNCC_UR_NOT_PRES ); | |
409 } | |
410 } | |
411 | |
412 /* | |
413 +-------------------------------------------------------------------+ | |
414 | PROJECT : GSM-PS (6147) MODULE : CMH_CC | | |
415 | ROUTINE : cmhCC_SelMT | | |
416 +-------------------------------------------------------------------+ | |
417 | |
418 PURPOSE : select the modem type out of the current speed setting | |
419 | |
420 */ | |
421 | |
422 GLOBAL UBYTE cmhCC_SelMT ( T_ACI_BS_SPEED speed ) | |
423 { | |
424 switch( speed ) | |
425 { | |
426 case( BS_SPEED_300_V21 ): return( MNCC_MT_V21 ); | |
427 case( BS_SPEED_1200_V22 ): return( MNCC_MT_V22 ); | |
428 case( BS_SPEED_2400_V22bis ): return( MNCC_MT_V22_BIS ); | |
429 case( BS_SPEED_1200_75_V23 ): return( MNCC_MT_V23 ); | |
430 case( BS_SPEED_2400_V26ter ): return( MNCC_MT_V26_TER ); | |
431 case( BS_SPEED_9600_V32 ): | |
432 case( BS_SPEED_4800_V32 ): return( MNCC_MT_V32 ); | |
433 case( BS_SPEED_1200_V120 ): | |
434 case( BS_SPEED_2400_V120 ): | |
435 case( BS_SPEED_4800_V120 ): | |
436 case( BS_SPEED_9600_V120 ): | |
437 case( BS_SPEED_14400_V120 ): | |
438 case( BS_SPEED_2400_V110 ): | |
439 case( BS_SPEED_4800_V110 ): | |
440 case( BS_SPEED_9600_V110 ): | |
441 case( BS_SPEED_14400_V110 ): | |
442 case( BS_SPEED_300_V110 ): | |
443 case( BS_SPEED_1200_V110 ): return( MNCC_MT_NONE ); | |
444 case( BS_SPEED_9600_V34 ): | |
445 case( BS_SPEED_14400_V34 ): return( MNCC_MT_V34 ); | |
446 default: return( MNCC_MT_AUTOBAUD ); | |
447 } | |
448 } | |
449 | |
450 | |
451 /* | |
452 +-------------------------------------------------------------------+ | |
453 | PROJECT : GSM-PS (6147) MODULE : CMH_CC | | |
454 | ROUTINE : cmhCC_SelTransferCap | | |
455 +-------------------------------------------------------------------+ | |
456 | |
457 PURPOSE : select the transfer capabilty on basis of speed | |
458 | |
459 */ | |
460 | |
461 GLOBAL UBYTE cmhCC_SelTransferCap ( T_ACI_BS_SPEED speed ) | |
462 { | |
463 TRACE_FUNCTION("cmhCC_SelTransferCap()"); | |
464 | |
465 if (speed <= BS_SPEED_14400_V34) | |
466 { | |
467 return MNCC_ITC_NONE; | |
468 } | |
469 else | |
470 { | |
471 return MNCC_ITC_UDI; | |
472 } | |
473 } | |
474 | |
475 /* | |
476 +-------------------------------------------------------------------+ | |
477 | PROJECT : GSM-PS (6147) MODULE : CMH_CC | | |
478 | ROUTINE : cmhCC_SelRateAdaption | | |
479 +-------------------------------------------------------------------+ | |
480 | |
481 PURPOSE : select the rate adaption on basis of speed selection | |
482 | |
483 */ | |
484 | |
485 GLOBAL UBYTE cmhCC_SelRateAdaption ( T_ACI_BS_SPEED speed) | |
486 { | |
487 TRACE_FUNCTION("cmhCC_SelRateAdaption()"); | |
488 | |
489 if ((speed >= BS_SPEED_1200_V120) AND (speed <= BS_SPEED_14400_V120)) | |
490 { | |
491 return MNCC_RATE_ADAPT_V120; | |
492 } | |
493 else if ((speed >= BS_SPEED_300_V110) AND (speed <= BS_SPEED_14400_V110)) | |
494 { | |
495 return MNCC_RATE_ADAPT_V110; | |
496 } | |
497 else | |
498 { | |
499 return MNCC_RATE_ADAPT_NONE; | |
500 } | |
501 } | |
502 /* | |
503 +-------------------------------------------------------------------+ | |
504 | PROJECT : GSM-PS (6147) MODULE : CMH_CC | | |
505 | ROUTINE : cmhCC_SelServ | | |
506 +-------------------------------------------------------------------+ | |
507 | |
508 PURPOSE : select the bearer service out of the current name setting | |
509 | |
510 */ | |
511 | |
512 GLOBAL UBYTE cmhCC_SelServ ( T_ACI_CBST_NAM name ) | |
513 { | |
514 switch( name ) | |
515 { | |
516 case( CBST_NAM_Asynch ): return( MNCC_BEARER_SERV_ASYNC ); | |
517 case( CBST_NAM_Synch ): return( MNCC_BEARER_SERV_SYNC ); | |
518 default: return( MNCC_BEARER_SERV_NOT_PRES ); | |
519 } | |
520 | |
521 } | |
522 | |
523 /* | |
524 +-------------------------------------------------------------------+ | |
525 | PROJECT : GSM-PS (6147) MODULE : CMH_CC | | |
526 | ROUTINE : cmhCC_SelCE | | |
527 +-------------------------------------------------------------------+ | |
528 | |
529 PURPOSE : select the connection element out of the current ce setting | |
530 | |
531 */ | |
532 | |
533 GLOBAL UBYTE cmhCC_SelCE ( T_ACI_CBST_CE ce ) | |
534 { | |
535 switch( ce ) | |
536 { | |
537 case( CBST_CE_Transparent ): return( MNCC_CONN_ELEM_TRANS ); | |
538 case( CBST_CE_NonTransparent ): return( MNCC_CONN_ELEM_NON_TRANS ); | |
539 case( CBST_CE_BothTransPref ): return( MNCC_CONN_ELEM_TRANS_PREF ); | |
540 case( CBST_CE_BothNonTransPref ): return( MNCC_CONN_ELEM_NON_TRANS_PREF ); | |
541 default: return( MNCC_CONN_ELEM_NOT_PRES ); | |
542 } | |
543 } | |
544 | |
545 /* | |
546 +-------------------------------------------------------------------+ | |
547 | PROJECT : GSM-PS (6147) MODULE : CMH_CC | | |
548 | ROUTINE : cmhCC_SelStopBit | | |
549 +-------------------------------------------------------------------+ | |
550 | |
551 PURPOSE : select the stop bits out of the current character framing | |
552 setting | |
553 | |
554 */ | |
555 | |
556 GLOBAL UBYTE cmhCC_SelStopBit ( T_ACI_CMD_SRC srcId ) | |
557 { | |
558 #ifdef UART | |
559 if (UART_IO_SB_2 EQ cmhUART_GetStopBitOverSrcID( (UBYTE) srcId )) | |
560 { | |
561 return( MNCC_STOP_2_BIT ); | |
562 } | |
563 #endif /*UART*/ | |
564 #if defined (FF_PSI) AND defined (DTI) | |
565 if (UART_IO_SB_2 EQ cmhPSI_GetStopBitOverSrcID( (UBYTE) srcId )) | |
566 { | |
567 return( MNCC_STOP_2_BIT ); | |
568 } | |
569 #endif /*FF_PSI*/ | |
570 | |
571 return( MNCC_STOP_1_BIT ); | |
572 } | |
573 | |
574 | |
575 /* | |
576 +-------------------------------------------------------------------+ | |
577 | PROJECT : GSM-PS (6147) MODULE : CMH_CC | | |
578 | ROUTINE : cmhCC_SelDataBit | | |
579 +-------------------------------------------------------------------+ | |
580 | |
581 PURPOSE : select the data bits out of the current character framing | |
582 setting | |
583 | |
584 */ | |
585 | |
586 GLOBAL UBYTE cmhCC_SelDataBit ( T_ACI_CMD_SRC srcId ) | |
587 { | |
588 #ifdef UART | |
589 if ( UART_IO_BPC_7 EQ cmhUART_GetDataBitOverSrcID( (UBYTE) srcId )) | |
590 | |
591 { | |
592 return( MNCC_DATA_7_BIT ); | |
593 } | |
594 #endif /*UART*/ | |
595 | |
596 #if defined (FF_PSI) AND defined (DTI) | |
597 if ( UART_IO_BPC_7 EQ cmhPSI_GetDataBitOverSrcID( (UBYTE) srcId ) ) | |
598 { | |
599 return( MNCC_DATA_7_BIT ); | |
600 } | |
601 #endif /*FF_PSI*/ | |
602 | |
603 return( MNCC_DATA_8_BIT ); | |
604 } | |
605 | |
606 | |
607 /* | |
608 +-------------------------------------------------------------------+ | |
609 | PROJECT : GSM-PS (6147) MODULE : CMH_CC | | |
610 | ROUTINE : cmhCC_SelParity | | |
611 +-------------------------------------------------------------------+ | |
612 | |
613 PURPOSE : select the data bits out of the current character framing | |
614 setting | |
615 | |
616 */ | |
617 | |
618 GLOBAL UBYTE cmhCC_SelParity ( T_ACI_CMD_SRC srcId ) | |
619 { | |
620 UBYTE parity=0; | |
621 #if defined (FF_PSI) AND defined (DTI) | |
622 T_ACI_DTI_PRC_PSI *src_infos = find_element (psi_src_params, | |
623 (UBYTE)srcId, cmhPSItest_srcId); | |
624 | |
625 if (src_infos EQ NULL) | |
626 #endif /*FF_PSI*/ | |
627 | |
628 #ifdef UART | |
629 parity = cmhUART_GetParityOverSrcID( (UBYTE) srcId ); | |
630 #else /*UART*/ | |
631 parity=0; | |
632 #endif /*UART*/ | |
633 | |
634 #if defined (FF_PSI) AND defined (DTI) | |
635 else | |
636 parity = cmhPSI_GetParityOverSrcID( (UBYTE) srcId ); | |
637 #endif /*FF_PSI*/ | |
638 #ifdef UART | |
639 switch( parity ) | |
640 { | |
641 case UART_IO_PA_NONE: return( MNCC_PARITY_NONE ); | |
642 case UART_IO_PA_EVEN: return( MNCC_PARITY_EVEN ); | |
643 case UART_IO_PA_ODD: return( MNCC_PARITY_ODD ); | |
644 case UART_IO_PA_SPACE: return( MNCC_PARITY_FORCED_TO_0 ); | |
645 case NOT_SUPPORTED_UART_IO_PA_MARK: return( MNCC_PARITY_FORCED_TO_1 ); | |
646 default: TRACE_EVENT( "UNEXP PARITY IN ICF" ); | |
647 } | |
648 #endif /*UART*/ | |
649 return( MNCC_PARITY_NONE ); | |
650 | |
651 } | |
652 #endif /* FAX_AND_DATA */ | |
653 /* | |
654 +-------------------------------------------------------------------+ | |
655 | PROJECT : GSM-PS (6147) MODULE : CMH_CC | | |
656 | ROUTINE : cmhCC_GetCallType | | |
657 +-------------------------------------------------------------------+ | |
658 | |
659 PURPOSE : get call type out of bearer capabilities | |
660 | |
661 */ | |
662 | |
663 GLOBAL SHORT cmhCC_GetCallType_from_bearer ( void * bearCap ) | |
664 { | |
665 T_MNCC_bcpara * pBC = (T_MNCC_bcpara*) bearCap; | |
666 | |
667 switch( pBC->bearer_serv ) | |
668 { | |
669 case( MNCC_BEARER_SERV_SYNC ): | |
670 switch( pBC -> conn_elem ) | |
671 { | |
672 case( MNCC_CONN_ELEM_TRANS ): return( CRING_SERV_TYP_Sync ); | |
673 case( MNCC_CONN_ELEM_NON_TRANS ): return( CRING_SERV_TYP_RelSync ); | |
674 default: TRACE_EVENT( "UNEXP CONN ELEMENT IN CTB" ); | |
675 /*lint -fallthrough*/ | |
676 case( MNCC_CONN_ELEM_NOT_PRES ): return( CRING_SERV_TYP_NotPresent ); | |
677 } | |
678 | |
679 case( MNCC_BEARER_SERV_ASYNC ): | |
680 switch( pBC -> conn_elem ) | |
681 { | |
682 case( MNCC_CONN_ELEM_TRANS ): return( CRING_SERV_TYP_Async ); | |
683 case( MNCC_CONN_ELEM_NON_TRANS ): return( CRING_SERV_TYP_RelAsync ); | |
684 default: TRACE_EVENT( "UNEXP CONN ELEMENT IN CTB" ); | |
685 /*lint -fallthrough*/ | |
686 case( MNCC_CONN_ELEM_NOT_PRES ): return( CRING_SERV_TYP_NotPresent ); | |
687 } | |
688 | |
689 case( MNCC_BEARER_SERV_FAX ): return( CRING_SERV_TYP_Fax ); | |
690 | |
691 case( MNCC_BEARER_SERV_SPEECH_CTM ): | |
692 case( MNCC_BEARER_SERV_SPEECH ): return( CRING_SERV_TYP_Voice ); | |
693 | |
694 case( MNCC_BEARER_SERV_AUX_SPEECH_CTM): | |
695 case( MNCC_BEARER_SERV_AUX_SPEECH ): return( CRING_SERV_TYP_AuxVoice ); | |
696 | |
697 default: TRACE_EVENT( "UNEXP BEARER SERVICE IN CTB" ); | |
698 /*lint -fallthrough*/ | |
699 case( MNCC_BEARER_SERV_PAD_ACCESS ): | |
700 case( MNCC_BEARER_SERV_PACKET_ACCESS ): | |
701 case( MNCC_BEARER_SERV_NOT_PRES ): return( CRING_SERV_TYP_NotPresent ); | |
702 | |
703 } | |
704 } | |
705 | |
706 #ifdef FAX_AND_DATA | |
707 /* | |
708 +-------------------------------------------------------------------+ | |
709 | PROJECT : GSM-PS (6147) MODULE : CMH_CC | | |
710 | ROUTINE : cmhCC_GetSrvType | | |
711 +-------------------------------------------------------------------+ | |
712 | |
713 PURPOSE : get service type out of bearer capabilities | |
714 | |
715 */ | |
716 | |
717 GLOBAL SHORT cmhCC_GetSrvType ( void * bearCap ) | |
718 { | |
719 T_MNCC_bcpara * pBC = (T_MNCC_bcpara*) bearCap; | |
720 | |
721 switch( pBC->bearer_serv ) | |
722 { | |
723 case( MNCC_BEARER_SERV_SYNC ): | |
724 switch( pBC -> conn_elem ) | |
725 { | |
726 case( MNCC_CONN_ELEM_TRANS ): return( CRING_SERV_TYP_Sync ); | |
727 case( MNCC_CONN_ELEM_NON_TRANS ): return( CRING_SERV_TYP_RelSync ); | |
728 default: TRACE_EVENT( "UNEXP CONN ELEMENT IN CTB" ); | |
729 /*lint -fallthrough*/ | |
730 case( MNCC_CONN_ELEM_NOT_PRES ): return( CRING_SERV_TYP_NotPresent ); | |
731 } | |
732 | |
733 case( MNCC_BEARER_SERV_ASYNC ): | |
734 switch( pBC -> conn_elem ) | |
735 { | |
736 case( MNCC_CONN_ELEM_TRANS ): return( CRING_SERV_TYP_Async ); | |
737 case( MNCC_CONN_ELEM_NON_TRANS ): return( CRING_SERV_TYP_RelAsync ); | |
738 default: TRACE_EVENT( "UNEXP CONN ELEMENT IN CTB" ); | |
739 /*lint -fallthrough*/ | |
740 case( MNCC_CONN_ELEM_NOT_PRES ): return( CRING_SERV_TYP_NotPresent ); | |
741 } | |
742 | |
743 default: TRACE_EVENT( "UNEXP BEARER SERVICE IN CTB" ); | |
744 /*lint -fallthrough*/ | |
745 case( MNCC_BEARER_SERV_FAX ): | |
746 case( MNCC_BEARER_SERV_SPEECH_CTM ): | |
747 case( MNCC_BEARER_SERV_AUX_SPEECH_CTM): | |
748 case( MNCC_BEARER_SERV_SPEECH ): | |
749 case( MNCC_BEARER_SERV_AUX_SPEECH ): | |
750 case( MNCC_BEARER_SERV_PAD_ACCESS ): | |
751 case( MNCC_BEARER_SERV_PACKET_ACCESS ): | |
752 case( MNCC_BEARER_SERV_NOT_PRES ): return( CRING_SERV_TYP_NotPresent ); | |
753 | |
754 } | |
755 } | |
756 | |
757 /* | |
758 +-------------------------------------------------------------------+ | |
759 | PROJECT : GSM-PS (6147) MODULE : CMH_CC | | |
760 | ROUTINE : cmhCC_GetDataRate | | |
761 +-------------------------------------------------------------------+ | |
762 | |
763 PURPOSE : get user data rate out of bearer capabilities | |
764 | |
765 */ | |
766 | |
767 GLOBAL SHORT cmhCC_GetDataRate ( void * bearCap ) | |
768 { | |
769 T_MNCC_bcpara * pBC = (T_MNCC_bcpara*) bearCap; | |
770 | |
771 switch( pBC->rate ) | |
772 { | |
773 case( MNCC_UR_0_3_KBIT ): return( BS_SPEED_300_V110 ); | |
774 case( MNCC_UR_1_2_KBIT ): return( BS_SPEED_1200_V110 ); | |
775 case( MNCC_UR_2_4_KBIT ): return( BS_SPEED_2400_V110 ); | |
776 case( MNCC_UR_4_8_KBIT ): return( BS_SPEED_4800_V110 ); | |
777 case( MNCC_UR_9_6_KBIT ): return( BS_SPEED_9600_V110 ); | |
778 case( MNCC_UR_14_4_KBIT ): return( BS_SPEED_14400_V110 ); | |
779 default: return( BS_SPEED_NotPresent ); | |
780 } | |
781 | |
782 } | |
783 | |
784 /* | |
785 +-------------------------------------------------------------------+ | |
786 | PROJECT : GSM-PS (6147) MODULE : CMH_CC | | |
787 | ROUTINE : cmhCC_GetFormat | | |
788 +-------------------------------------------------------------------+ | |
789 | |
790 PURPOSE : get character format out of bearer capabilities | |
791 | |
792 */ | |
793 | |
794 GLOBAL SHORT cmhCC_GetFormat ( void * bearCap ) | |
795 { | |
796 T_MNCC_bcpara * pBC = (T_MNCC_bcpara*) bearCap; | |
797 | |
798 if( pBC->data_bits EQ MNCC_DATA_7_BIT) | |
799 { | |
800 if( pBC->stop_bits EQ MNCC_STOP_1_BIT ) | |
801 { | |
802 if( pBC->parity EQ MNCC_PARITY_NONE ) return( BS_FRM_Dat7_Par0_St1 ); | |
803 else return( BS_FRM_Dat7_Par1_St1 ); | |
804 } | |
805 else return( BS_FRM_Dat7_Par0_St2 ); | |
806 } | |
807 else | |
808 { | |
809 if( pBC->stop_bits EQ MNCC_STOP_1_BIT ) | |
810 { | |
811 if( pBC->parity EQ MNCC_PARITY_NONE ) return( BS_FRM_Dat8_Par0_St1 ); | |
812 else return( BS_FRM_Dat8_Par1_St1 ); | |
813 } | |
814 else return( BS_FRM_Dat8_Par0_St2 ); | |
815 } | |
816 } | |
817 | |
818 | |
819 /* | |
820 +-------------------------------------------------------------------+ | |
821 | PROJECT : GSM-PS (6147) MODULE : CMH_CC | | |
822 | ROUTINE : cmhCC_GetParity | | |
823 +-------------------------------------------------------------------+ | |
824 | |
825 PURPOSE : get parity out of bearer capabilities | |
826 | |
827 */ | |
828 | |
829 GLOBAL SHORT cmhCC_GetParity ( void * bearCap ) | |
830 { | |
831 T_MNCC_bcpara * pBC = (T_MNCC_bcpara*) bearCap; | |
832 | |
833 switch( pBC->parity ) | |
834 { | |
835 case( MNCC_PARITY_ODD ): return( BS_PAR_Odd ); | |
836 case( MNCC_PARITY_EVEN ): return( BS_PAR_Even ); | |
837 case( MNCC_PARITY_FORCED_TO_0 ): return( BS_PAR_Space ); | |
838 case( MNCC_PARITY_FORCED_TO_1 ): return( BS_PAR_Mark ); | |
839 case( MNCC_PARITY_NONE ): | |
840 default: return( BS_PAR_NotPresent ); | |
841 } | |
842 | |
843 } | |
844 #endif /* FAX_AND_DATA */ | |
845 /* | |
846 +-------------------------------------------------------------------+ | |
847 | PROJECT : GSM-PS (6147) MODULE : CMH_CC | | |
848 | ROUTINE : cmhCC_GetCallClass | | |
849 +-------------------------------------------------------------------+ | |
850 | |
851 PURPOSE : get call class out of bearer service | |
852 | |
853 */ | |
854 | |
855 GLOBAL T_ACI_CLASS cmhCC_GetCallClass ( SHORT cId ) | |
856 { | |
857 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
858 | |
859 switch( ctb->BC[ctb->curBC].bearer_serv ) | |
860 { | |
861 case( MNCC_BEARER_SERV_SPEECH_CTM ): | |
862 case( MNCC_BEARER_SERV_SPEECH ): return( CLASS_Vce ); | |
863 case( MNCC_BEARER_SERV_AUX_SPEECH_CTM ): | |
864 case( MNCC_BEARER_SERV_AUX_SPEECH ): return( CLASS_AuxVce ); | |
865 case( MNCC_BEARER_SERV_FAX ): return( CLASS_Fax ); | |
866 case( MNCC_BEARER_SERV_SYNC ): return( CLASS_Dat ); | |
867 case( MNCC_BEARER_SERV_ASYNC ): return( CLASS_Dat ); | |
868 default: return( CLASS_NotPresent ); | |
869 } | |
870 | |
871 } | |
872 | |
873 /* | |
874 +-------------------------------------------------------------------+ | |
875 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
876 | ROUTINE : cmhCC_ctbGetCldNumTyp | | |
877 +-------------------------------------------------------------------+ | |
878 | |
879 PURPOSE : this function builds the type of address information out | |
880 of the called party information. | |
881 */ | |
882 | |
883 GLOBAL T_ACI_TOA* cmhCC_ctbGetCldNumTyp ( SHORT cId, T_ACI_TOA* pToaBuf ) | |
884 { | |
885 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
886 /* | |
887 *------------------------------------------------------------------- | |
888 * build type of address information | |
889 *------------------------------------------------------------------- | |
890 */ | |
891 if (ctb->cldPty.ton EQ MNCC_TON_NOT_PRES ) | |
892 | |
893 return( NULL ); | |
894 | |
895 pToaBuf -> ton = (T_ACI_TOA_TON)ctb->cldPty.ton; | |
896 pToaBuf -> npi = (T_ACI_TOA_NPI)ctb->cldPty.npi; | |
897 | |
898 return( pToaBuf ); | |
899 } | |
900 | |
901 /* | |
902 +-------------------------------------------------------------------+ | |
903 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
904 | ROUTINE : cmhCC_ctbGetCldSubTyp | | |
905 +-------------------------------------------------------------------+ | |
906 | |
907 PURPOSE : this function builds the type of subaddress information | |
908 out of the called party information. | |
909 */ | |
910 | |
911 GLOBAL T_ACI_TOS* cmhCC_ctbGetCldSubTyp ( SHORT cId, T_ACI_TOS * pTosBuf ) | |
912 { | |
913 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
914 /* | |
915 *------------------------------------------------------------------- | |
916 * build type of subaddress information | |
917 *------------------------------------------------------------------- | |
918 */ | |
919 if( ctb->cldPtySub.tos EQ MNCC_TOS_NOT_PRES ) | |
920 | |
921 return( NULL ); | |
922 | |
923 pTosBuf -> tos = (T_ACI_TOS_TOS)ctb->cldPtySub.tos; | |
924 pTosBuf -> oe = (T_ACI_TOS_OE)ctb->cldPtySub.odd_even; | |
925 | |
926 return( pTosBuf ); | |
927 } | |
928 | |
929 /* | |
930 +-------------------------------------------------------------------+ | |
931 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
932 | ROUTINE : cmhCC_ctbGetClrNumTyp | | |
933 +-------------------------------------------------------------------+ | |
934 | |
935 PURPOSE : this function builds the type of address information out | |
936 of the calling party information. | |
937 */ | |
938 | |
939 GLOBAL T_ACI_TOA* cmhCC_ctbGetClrNumTyp ( SHORT cId, T_ACI_TOA* pToaBuf ) | |
940 { | |
941 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
942 /* | |
943 *------------------------------------------------------------------- | |
944 * build type of address information | |
945 *------------------------------------------------------------------- | |
946 */ | |
947 if (ctb->clgPty.ton EQ MNCC_TON_NOT_PRES ) | |
948 | |
949 return( NULL ); | |
950 | |
951 pToaBuf -> ton = (T_ACI_TOA_TON)ctb->clgPty.ton; | |
952 pToaBuf -> npi = (T_ACI_TOA_NPI)ctb->clgPty.npi; | |
953 | |
954 return( pToaBuf ); | |
955 } | |
956 | |
957 /* | |
958 +-------------------------------------------------------------------+ | |
959 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
960 | ROUTINE : cmhCC_ctbGetClrSubTyp | | |
961 +-------------------------------------------------------------------+ | |
962 | |
963 PURPOSE : this function builds the type of subaddress information | |
964 out of the calling party information. | |
965 */ | |
966 | |
967 GLOBAL T_ACI_TOS* cmhCC_ctbGetClrSubTyp ( SHORT cId, T_ACI_TOS * pTosBuf ) | |
968 { | |
969 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
970 /* | |
971 *------------------------------------------------------------------- | |
972 * build type of subaddress information | |
973 *------------------------------------------------------------------- | |
974 */ | |
975 if( ctb->clgPtySub.tos EQ MNCC_TOS_NOT_PRES ) | |
976 | |
977 return( NULL ); | |
978 | |
979 pTosBuf -> tos = (T_ACI_TOS_TOS)ctb->clgPtySub.tos; | |
980 pTosBuf -> oe = (T_ACI_TOS_OE)ctb->clgPtySub.odd_even; | |
981 | |
982 return( pTosBuf ); | |
983 } | |
984 | |
985 /* | |
986 +-------------------------------------------------------------------+ | |
987 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
988 | ROUTINE : cmhCC_ctbGetRdrNumTyp | | |
989 +-------------------------------------------------------------------+ | |
990 | |
991 PURPOSE : this function builds the type of address information out | |
992 of the redirecting party information. | |
993 */ | |
994 | |
995 GLOBAL T_ACI_TOA* cmhCC_ctbGetRdrNumTyp ( SHORT cId, T_ACI_TOA* pToaBuf ) | |
996 { | |
997 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
998 /* | |
999 *------------------------------------------------------------------- | |
1000 * build type of address information | |
1001 *------------------------------------------------------------------- | |
1002 */ | |
1003 if( ctb->rdrPty.ton EQ MNCC_TON_NOT_PRES ) | |
1004 | |
1005 return( NULL ); | |
1006 | |
1007 pToaBuf -> ton = (T_ACI_TOA_TON)ctb->rdrPty.ton; | |
1008 pToaBuf -> npi = (T_ACI_TOA_NPI)ctb->rdrPty.npi; | |
1009 | |
1010 return( pToaBuf ); | |
1011 } | |
1012 | |
1013 /* | |
1014 +-------------------------------------------------------------------+ | |
1015 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
1016 | ROUTINE : cmhCC_ctbGetRdrSubTyp | | |
1017 +-------------------------------------------------------------------+ | |
1018 | |
1019 PURPOSE : this function builds the type of subaddress information | |
1020 out of the redirecting party information. | |
1021 */ | |
1022 | |
1023 GLOBAL T_ACI_TOS* cmhCC_ctbGetRdrSubTyp ( SHORT cId, T_ACI_TOS * pTosBuf ) | |
1024 { | |
1025 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
1026 /* | |
1027 *------------------------------------------------------------------- | |
1028 * build type of subaddress information | |
1029 *------------------------------------------------------------------- | |
1030 */ | |
1031 if( ctb->rdrPtySub.tos EQ MNCC_TOS_NOT_PRES ) | |
1032 | |
1033 return( NULL ); | |
1034 | |
1035 pTosBuf -> tos = (T_ACI_TOS_TOS)ctb->rdrPtySub.tos; | |
1036 pTosBuf -> oe = (T_ACI_TOS_OE)ctb->rdrPtySub.odd_even; | |
1037 | |
1038 return( pTosBuf ); | |
1039 } | |
1040 | |
1041 /* | |
1042 +-------------------------------------------------------------------+ | |
1043 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR | | |
1044 | ROUTINE : cmhrat_no_carrier | | |
1045 +-------------------------------------------------------------------+ | |
1046 | |
1047 PURPOSE : Send NO CARRIER to user (saves memory in comparaison to R_AT). | |
1048 It also send a log to MFW, and sends NO CARRIER to the owner | |
1049 of the call if it is necessary (owner different from call killer). | |
1050 | |
1051 It also sends a DCD off to UART. | |
1052 | |
1053 */ | |
1054 | |
1055 GLOBAL void cmhrat_calldisc( RAT_ID response, UBYTE srcId, T_ACI_AT_CMD cmdId, SHORT cId ) | |
1056 { | |
1057 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
1058 | |
1059 TRACE_FUNCTION("cmhrat_calldisc"); | |
1060 | |
1061 /* CHECK response: THIS ONLY WORKS BECAUSE R_AT has the same parameters | |
1062 for RAT_NO_CARRIER, RAT_BUSY and RAT_NO_ANSWER */ | |
1063 switch( response ) | |
1064 { | |
1065 case( RAT_NO_CARRIER ): | |
1066 case( RAT_BUSY ): | |
1067 case( RAT_NO_ANSWER ): | |
1068 break; | |
1069 default: | |
1070 return; | |
1071 } | |
1072 | |
1073 if( srcId EQ (UBYTE)CMD_SRC_NONE OR | |
1074 srcId EQ ctb->calOwn ) | |
1075 { | |
1076 /* inform only call owner */ | |
1077 | |
1078 R_AT( response, (T_ACI_CMD_SRC)ctb->calOwn ) ( AT_CMD_NONE, cId+1 ); | |
1079 } | |
1080 else | |
1081 { | |
1082 /* inform both call owner and call killer */ | |
1083 R_AT( response, (T_ACI_CMD_SRC)ctb->calOwn ) ( AT_CMD_NONE, cId+1 ); | |
1084 R_AT( response, (T_ACI_CMD_SRC)srcId ) ( cmdId, cId+1 ); | |
1085 } | |
1086 | |
1087 #ifdef FF_ATI | |
1088 /* tlu:io_setDCD (ctb->calOwn, IO_DCD_OFF); */ /* V.24 DCD Line */ | |
1089 #endif | |
1090 | |
1091 cmh_logRslt ( (T_ACI_CMD_SRC)srcId, response, cmdId, (SHORT)(cId+1), | |
1092 BS_SPEED_NotPresent,CME_ERR_NotPresent); | |
1093 } | |
1094 | |
1095 /* | |
1096 +-------------------------------------------------------------------+ | |
1097 | PROJECT : GSM-PS (6147) MODULE : CMH_CC | | |
1098 | ROUTINE : cmhCC_SndDiscRsn | | |
1099 +-------------------------------------------------------------------+ | |
1100 | |
1101 PURPOSE : Find out the reason for disconnection and send it to the | |
1102 caller. | |
1103 | |
1104 */ | |
1105 | |
1106 GLOBAL void cmhCC_SndDiscRsn ( SHORT cId ) | |
1107 { | |
1108 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
1109 UBYTE cmdBuf; /* buffers current command */ | |
1110 UBYTE srcBuf; /* buffers current command source */ | |
1111 | |
1112 TRACE_FUNCTION ("cmhCC_SndDiscRsn()"); | |
1113 | |
1114 cmdBuf = ctb->curCmd; | |
1115 srcBuf = ctb->curSrc; | |
1116 | |
1117 if (rdlPrm.rdlcId EQ NO_ENTRY) | |
1118 { | |
1119 cmhCC_PrepareCmdEnd (cId, NULL, NULL); | |
1120 } | |
1121 | |
1122 if( cmdBuf EQ AT_CMD_NONE ) | |
1123 { | |
1124 srcBuf = ctb->calOwn; /* call owner is the only one that | |
1125 could possibly be informed */ | |
1126 } | |
1127 | |
1128 if( cmdBuf EQ AT_CMD_ABRT ) | |
1129 { | |
1130 R_AT( RAT_OK, (T_ACI_CMD_SRC)srcBuf )( cmdBuf ); | |
1131 /* log result */ | |
1132 cmh_logRslt ( (T_ACI_CMD_SRC)srcBuf, RAT_OK, | |
1133 (T_ACI_AT_CMD)cmdBuf, (SHORT)(cId+1), BS_SPEED_NotPresent,CME_ERR_NotPresent ); | |
1134 return; | |
1135 } | |
1136 | |
1137 /* | |
1138 *------------------------------------------------------------------- | |
1139 * check for reject cause | |
1140 *------------------------------------------------------------------- | |
1141 */ | |
1142 /* | |
1143 * Make use of ctb here or die. Problem with TI compiler 1.22e. | |
1144 * Seen. Exactly here. GET_CAUSE_VALUE() expression seems to become too | |
1145 * complicated without the help of this variable. You may get a wrong | |
1146 * ARM instruction otherwise in the generated code. | |
1147 */ | |
1148 if(GET_CAUSE_VALUE(ctb->rejCs) NEQ NOT_PRESENT_8BIT) | |
1149 { | |
1150 /* when there is no SIM error, send the NO CARRIER command, | |
1151 otherwise cmhSIM_GetSIMError send the error command (CME) */ | |
1152 if (GET_CAUSE_ORIGIN_ENTITY(ctb->rejCs) NEQ SIM_ORIGINATING_ENTITY OR | |
1153 cmhSIM_GetSIMError((T_ACI_CMD_SRC)srcBuf, (T_ACI_AT_CMD)cmdBuf) EQ AT_FAIL ) | |
1154 { | |
1155 cmhrat_calldisc(RAT_NO_CARRIER, srcBuf, (T_ACI_AT_CMD)cmdBuf, cId); | |
1156 return; | |
1157 } | |
1158 else | |
1159 { | |
1160 cmh_logRslt ( (T_ACI_CMD_SRC)srcBuf, RAT_CME, | |
1161 (T_ACI_AT_CMD)cmdBuf, (SHORT)(cId+1), BS_SPEED_NotPresent,CME_ERR_NotPresent ); | |
1162 } | |
1163 return; | |
1164 } | |
1165 | |
1166 /* | |
1167 *------------------------------------------------------------------- | |
1168 * otherwise check for normal cause | |
1169 *------------------------------------------------------------------- | |
1170 */ | |
1171 switch( ctb->nrmCs ) | |
1172 { | |
1173 case( MNCC_CAUSE_USER_BUSY ): | |
1174 cmhrat_calldisc(RAT_BUSY, srcBuf, (T_ACI_AT_CMD)cmdBuf, cId); | |
1175 break; | |
1176 | |
1177 case( MNCC_CAUSE_NO_RESPONSE ): | |
1178 case( MNCC_CAUSE_ALERT_NO_ANSWER ): | |
1179 cmhrat_calldisc(RAT_NO_ANSWER, srcBuf, (T_ACI_AT_CMD)cmdBuf, cId); | |
1180 break; | |
1181 | |
1182 default: | |
1183 cmhrat_calldisc(RAT_NO_CARRIER, srcBuf, (T_ACI_AT_CMD)cmdBuf, cId); | |
1184 } | |
1185 } | |
1186 | |
1187 /* | |
1188 +-------------------------------------------------------------------+ | |
1189 | PROJECT : GSM-PS (6147) MODULE : CMH_CC | | |
1190 | ROUTINE : cmhCC_ChckInCallMdfy | | |
1191 +-------------------------------------------------------------------+ | |
1192 | |
1193 PURPOSE : check the case of in-call modification. The function | |
1194 returns TRUE or FALSE, whether a modification is allowed | |
1195 or not. | |
1196 | |
1197 */ | |
1198 | |
1199 GLOBAL BOOL cmhCC_ChckInCallMdfy ( SHORT cId, UBYTE cmd ) | |
1200 { | |
1201 #ifdef FAX_AND_DATA | |
1202 T_CC_CALL_TYPE calltype = cmhCC_getcalltype(cId); | |
1203 | |
1204 TRACE_FUNCTION ("cmhCC_ChckInCallMdfy()"); | |
1205 | |
1206 #ifdef CO_UDP_IP | |
1207 if(calltype EQ UDPIP_CALL) | |
1208 { | |
1209 /* modifying a Wap Call should not be allowed */ | |
1210 return( FALSE); | |
1211 } | |
1212 #endif /* CO_UDP_IP */ | |
1213 | |
1214 /* check call mode */ | |
1215 switch( psaCC_ctb(cId)->rptInd ) | |
1216 { | |
1217 /* single call */ | |
1218 case( MNCC_RI_NOT_PRES ): | |
1219 return( FALSE ); | |
1220 | |
1221 /* voice followed by data */ | |
1222 case( MNCC_RI_SEQUENTIAL ): | |
1223 if(calltype EQ VOICE_CALL) | |
1224 { | |
1225 switch( cmd ) | |
1226 { | |
1227 case( AT_CMD_D ): /* modify commands */ | |
1228 case( AT_CMD_A ): | |
1229 | |
1230 TRACE_EVENT( "MODIFY FROM SPEECH" ); | |
1231 return( TRUE ); | |
1232 } | |
1233 } | |
1234 return( FALSE ); | |
1235 | |
1236 /* alternating call */ | |
1237 case( MNCC_RI_CIRCULAR ): | |
1238 switch(calltype) | |
1239 { | |
1240 case(VOICE_CALL): | |
1241 switch( cmd ) | |
1242 { | |
1243 case( AT_CMD_D ): /* modify commands */ | |
1244 case( AT_CMD_A ): | |
1245 | |
1246 TRACE_EVENT( "MODIFY FROM SPEECH" ); | |
1247 return( TRUE ); | |
1248 } | |
1249 return( FALSE ); | |
1250 | |
1251 case( TRANS_CALL ): | |
1252 case( NON_TRANS_CALL ): | |
1253 case( FAX_CALL ): | |
1254 if(cmd EQ AT_CMD_H ) /* modify commands */ | |
1255 { | |
1256 TRACE_EVENT( "MODIFY FROM DATA/FAX" ); | |
1257 return( TRUE ); | |
1258 } | |
1259 break; | |
1260 } | |
1261 return( FALSE ); | |
1262 } | |
1263 #endif /* FAX_AND_DATA */ | |
1264 return(FALSE); | |
1265 } | |
1266 | |
1267 /* | |
1268 +-------------------------------------------------------------------+ | |
1269 | PROJECT : GSM-PS (6147) MODULE : CMH_CC | | |
1270 | ROUTINE : cmhCC_atdsendok | | |
1271 +-------------------------------------------------------------------+ | |
1272 | |
1273 PURPOSE : returns TRUE if OK is to be sent directly: in case of ATD, | |
1274 if COLP is not set and source is neither LCL nor SAT nor CSSN ... | |
1275 */ | |
1276 | |
1277 GLOBAL BOOL cmhCC_atdsendok ( SHORT cId ) | |
1278 { | |
1279 T_CC_CALL_TYPE calltype = cmhCC_getcalltype(cId); | |
1280 T_ACI_AT_CMD cmd = (T_ACI_AT_CMD)psaCC_ctb(cId)->curCmd; | |
1281 SHORT srcId = psaCC_ctb(cId)->curSrc; | |
1282 | |
1283 #ifdef FF_ATI | |
1284 TRACE_EVENT_P6("cmhCC_atdsendok(): cmd: %d, calltype: %d, srcId: %d, COLP_stat: %d, SATinv: %d, CSSI_stat: %d", | |
1285 cmd, calltype, srcId, at.flags.COLP_stat, psaCC_ctb(cId)->SATinv, | |
1286 ati_user_output_cfg[srcId].CSSI_stat); | |
1287 #endif /* FF_ATI */ | |
1288 | |
1289 #ifdef FF_ATI | |
1290 if(cmd NEQ AT_CMD_D) /* can happen ONLY to ATD */ | |
1291 return(FALSE); | |
1292 | |
1293 if (calltype NEQ VOICE_CALL OR | |
1294 srcId EQ CMD_SRC_LCL OR | |
1295 at.flags.COLP_stat EQ 1 OR | |
1296 ati_user_output_cfg[srcId].CSSI_stat EQ 1 OR | |
1297 ati_is_src_type((UBYTE)srcId, ATI_SRC_TYPE_SAT) OR /* SAT run at cmd */ | |
1298 psaCC_ctb(cId)->SATinv ) /* call started by SAT */ | |
1299 { | |
1300 TRACE_EVENT("send OK normally: at the end"); | |
1301 return(FALSE); /* OK sent normally: after MNCC_SETUP_CNF has been received */ | |
1302 } | |
1303 else | |
1304 { | |
1305 TRACE_EVENT("send OK directly after ATD"); | |
1306 return(TRUE); /* OK sent as soon as MNCC_SETUP_REQ has been sent (see ITU. V25ter) */ | |
1307 } | |
1308 #else | |
1309 return(FALSE); | |
1310 #endif /* AT INTERPRETER */ | |
1311 | |
1312 } | |
1313 | |
1314 /* | |
1315 +-------------------------------------------------------------------+ | |
1316 | PROJECT : GSM-PS (6147) MODULE : CMH_CC | | |
1317 | ROUTINE : cmhCC_flagCall | | |
1318 +-------------------------------------------------------------------+ | |
1319 | |
1320 PURPOSE : flag a call for multy-call operation | |
1321 | |
1322 */ | |
1323 | |
1324 GLOBAL void cmhCC_flagCall ( SHORT cId, USHORT * flags ) | |
1325 { | |
1326 *flags |= (0x1 << cId); | |
1327 } | |
1328 | |
1329 /* | |
1330 +-------------------------------------------------------------------+ | |
1331 | PROJECT : GSM-PS (6147) MODULE : CMH_CC | | |
1332 | ROUTINE : cmhCC_tstAndUnflagCall | | |
1333 +-------------------------------------------------------------------+ | |
1334 | |
1335 PURPOSE : test and unflag a call for multy-call operation. Return | |
1336 the test result. | |
1337 | |
1338 */ | |
1339 | |
1340 GLOBAL BOOL cmhCC_tstAndUnflagCall ( SHORT cId, USHORT * flags ) | |
1341 { | |
1342 if( *flags & (1u << cId)) | |
1343 { | |
1344 *flags &= ~(1u << cId); | |
1345 return( TRUE ); | |
1346 } | |
1347 return( FALSE ); | |
1348 } | |
1349 | |
1350 | |
1351 /* | |
1352 +-------------------------------------------------------------------+ | |
1353 | PROJECT : GSM-PS (6147) MODULE : CMH_CC | | |
1354 | ROUTINE : cmhCC_getcalltype | | |
1355 +-------------------------------------------------------------------+ | |
1356 | |
1357 PURPOSE : returns the type of call of cId (voice, data, fax...). | |
1358 | |
1359 */ | |
1360 | |
1361 GLOBAL T_CC_CALL_TYPE cmhCC_getcalltype(SHORT cId) | |
1362 { | |
1363 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
1364 | |
1365 /* First the call table is checked before the checking for the valid CID */ | |
1366 if (ctb EQ NULL) | |
1367 return (T_CC_CALL_TYPE)ccShrdPrm.callType[cId]; /* Call already gone */ | |
1368 | |
1369 /* Check whether the cId is valid or not, if not return NO_VLD_CC_CALL_TYPE */ | |
1370 if (!psaCC_ctbIsValid (cId)) | |
1371 return(NO_VLD_CC_CALL_TYPE); | |
1372 | |
1373 /* determine type of call */ | |
1374 switch( ctb->BC[ctb->curBC].bearer_serv ) | |
1375 { | |
1376 default: | |
1377 return(NO_VLD_CC_CALL_TYPE); | |
1378 | |
1379 case( MNCC_BEARER_SERV_AUX_SPEECH ): | |
1380 case( MNCC_BEARER_SERV_SPEECH ): /* voice call */ | |
1381 case( MNCC_BEARER_SERV_AUX_SPEECH_CTM ): | |
1382 case( MNCC_BEARER_SERV_SPEECH_CTM ): /* voice call with CTM */ | |
1383 return(VOICE_CALL); | |
1384 | |
1385 #ifdef FAX_AND_DATA | |
1386 case( MNCC_BEARER_SERV_ASYNC ): /* asynchronous data call */ | |
1387 switch( ctb->BC[ctb->curBC].conn_elem ) | |
1388 { | |
1389 case( MNCC_CONN_ELEM_TRANS ): /* transparent data call */ | |
1390 case( MNCC_CONN_ELEM_NON_TRANS ): /* non transparent data call */ | |
1391 /* check if a WAP call is in process... If yes then end call */ | |
1392 #if defined(CO_UDP_IP) OR defined(FF_GPF_TCPIP) | |
1393 if (Wap_Call) | |
1394 { | |
1395 if (cId EQ wapId) | |
1396 { | |
1397 if(is_gpf_tcpip_call()) { | |
1398 GPF_TCPIP_STATEMENT(return(TCPIP_CALL)); | |
1399 } | |
1400 else { | |
1401 UDPIP_STATEMENT(return(UDPIP_CALL)); | |
1402 } | |
1403 } | |
1404 } | |
1405 #endif /* CO_UDP_IP || FF_GPF_TCPIP */ | |
1406 #ifdef FF_PPP | |
1407 if (pppShrdPrm.is_PPP_CALL EQ TRUE) | |
1408 { | |
1409 return (PPP_CALL); | |
1410 } | |
1411 #endif | |
1412 if( ctb->BC[ctb->curBC].conn_elem EQ MNCC_CONN_ELEM_TRANS ) | |
1413 { | |
1414 return(TRANS_CALL); | |
1415 } | |
1416 else | |
1417 return(NON_TRANS_CALL); | |
1418 } | |
1419 return(NO_VLD_CC_CALL_TYPE); | |
1420 | |
1421 case( MNCC_BEARER_SERV_FAX ): /* fax call */ | |
1422 return(FAX_CALL); | |
1423 | |
1424 case( MNCC_BEARER_SERV_SYNC ): | |
1425 case( MNCC_BEARER_SERV_PAD_ACCESS ): | |
1426 case( MNCC_BEARER_SERV_PACKET_ACCESS ): | |
1427 return(UNSUP_DATA_CALL); | |
1428 #endif /* of #ifdef FAX_AND_DATA */ | |
1429 } | |
1430 } | |
1431 | |
1432 /* | |
1433 +-------------------------------------------------------------------+ | |
1434 | PROJECT : GSM-PS (6147) MODULE : CMH_CCF | | |
1435 | ROUTINE : cmhCC_AcceptCall | | |
1436 +-------------------------------------------------------------------+ | |
1437 | |
1438 PURPOSE : accept a call. | |
1439 */ | |
1440 | |
1441 GLOBAL void cmhCC_AcceptCall(SHORT cId, T_ACI_CMD_SRC srcId, T_ACI_AT_CMD cmd) | |
1442 { | |
1443 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
1444 UBYTE idx; /* holds index value */ | |
1445 | |
1446 TRACE_FUNCTION("cmhCC_AcceptCall( )"); | |
1447 | |
1448 if (ctb EQ NULL OR ctb->calStat NEQ CS_ACT_REQ) | |
1449 { | |
1450 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_Unknown ); | |
1451 R_AT(RAT_CME, srcId)(cmd, CME_ERR_Unknown); | |
1452 return; | |
1453 } | |
1454 | |
1455 CHLDaddInfo = NO_CHLD_ADD_INFO; | |
1456 ctb->curCmd = cmd; | |
1457 ctb->calOwn = (T_OWN) srcId; | |
1458 ctb->curSrc = srcId; | |
1459 | |
1460 /* | |
1461 * ETSI 11.10 26.12.4 requires "that for speech calls, the mobile station | |
1462 * shall attach the user connection at latest when sending the connect | |
1463 * message, except if there is no compatible radio resource available at | |
1464 * this time." | |
1465 */ | |
1466 | |
1467 psaCC_phbAddNtry ( LRN, cId, CT_MTC, NULL ); /* add call to LRN PB */ | |
1468 | |
1469 #ifdef FF_ATI | |
1470 io_setRngInd ( IO_RING_OFF, CRING_SERV_TYP_NotPresent, CRING_SERV_TYP_NotPresent ); /* V.24 Ring Indicator Line */ | |
1471 #endif | |
1472 | |
1473 for( idx = 0; idx < CMD_SRC_MAX; idx++ ) | |
1474 { | |
1475 R_AT( RAT_CRING_OFF,(T_ACI_CMD_SRC) idx )( cId+1 ); | |
1476 } | |
1477 | |
1478 psaCC_AcceptCall(cId); | |
1479 } | |
1480 | |
1481 /* | |
1482 +-------------------------------------------------------------------+ | |
1483 | PROJECT : GSM-PS (6147) MODULE : CMH_CCF | | |
1484 | ROUTINE : cmhCC_RetrieveCall | | |
1485 +-------------------------------------------------------------------+ | |
1486 | |
1487 PURPOSE : Retrieve either a Multyparty or a Normal Call | |
1488 */ | |
1489 GLOBAL void cmhCC_RetrieveCall(SHORT cId, T_ACI_CMD_SRC srcId) | |
1490 { | |
1491 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
1492 | |
1493 TRACE_FUNCTION("cmhCC_RetrieveCall( )"); | |
1494 | |
1495 if (ctb EQ NULL OR ctb->calStat NEQ CS_HLD) | |
1496 { | |
1497 return; | |
1498 } | |
1499 | |
1500 CHLDaddInfo = NO_CHLD_ADD_INFO; | |
1501 ctb->curCmd = AT_CMD_CHLD; | |
1502 ctb->curSrc = srcId; | |
1503 | |
1504 if (ctb->mptyStat EQ CS_ACT ) | |
1505 { | |
1506 psaCC_Hold_RetrieveMPTY (cId, CS_HLD, CS_ACT_REQ, MNCC_MPTY_RETRIEVE_SENT, | |
1507 OPC_RETRIEVE_MPTY); | |
1508 } | |
1509 else | |
1510 { | |
1511 psaCC_RetrieveCall (cId); | |
1512 } | |
1513 } | |
1514 | |
1515 /* | |
1516 +-------------------------------------------------------------------+ | |
1517 | PROJECT : GSM-PS (6147) MODULE : CMH_CCF | | |
1518 | ROUTINE : cmhCC_NewCall | | |
1519 +-------------------------------------------------------------------+ | |
1520 | |
1521 PURPOSE : Initiate a new call. | |
1522 */ | |
1523 GLOBAL void cmhCC_NewCall(SHORT cId, T_ACI_CMD_SRC srcId, T_ACI_AT_CMD cmd) | |
1524 { | |
1525 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
1526 | |
1527 TRACE_FUNCTION("cmhCC_NewCall( )"); | |
1528 | |
1529 CHLDaddInfo = NO_CHLD_ADD_INFO; | |
1530 ctb->curCmd = cmd; | |
1531 ctb->calOwn = (T_OWN)srcId; | |
1532 ctb->curSrc = srcId; | |
1533 | |
1534 psaCC_NewCall(cId); | |
1535 } | |
1536 | |
1537 /* | |
1538 +-------------------------------------------------------------------+ | |
1539 | PROJECT : GSM-PS (6147) MODULE : CMH_CCF | | |
1540 | ROUTINE : cmhCC_HoldCall | | |
1541 +-------------------------------------------------------------------+ | |
1542 | |
1543 PURPOSE : Put a call on hold (multyparty or normal call) | |
1544 */ | |
1545 GLOBAL void cmhCC_HoldCall(SHORT cId, T_ACI_CMD_SRC srcId, T_ACI_AT_CMD cmd) | |
1546 { | |
1547 T_CC_CALL_TBL *ctb; /* points to CC call table */ | |
1548 T_CC_CMD_PRM *pCCCmdPrm; /* points to CC command parameters */ | |
1549 | |
1550 TRACE_FUNCTION("cmhCC_HoldCall( )"); | |
1551 | |
1552 ctb = ccShrdPrm.ctb[cId]; | |
1553 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm; | |
1554 | |
1555 cmhCC_flagCall( cId, &(pCCCmdPrm->mltyCncFlg)); | |
1556 ctb->curCmd = cmd; | |
1557 ctb->curSrc = srcId; | |
1558 | |
1559 if (ctb->mptyStat EQ CS_ACT) | |
1560 { | |
1561 psaCC_Hold_RetrieveMPTY (cId, CS_ACT, CS_HLD_REQ, MNCC_MPTY_HOLD_SENT, | |
1562 OPC_HOLD_MPTY); | |
1563 } | |
1564 else | |
1565 { | |
1566 psaCC_HoldCall(cId); | |
1567 } | |
1568 } | |
1569 /* | |
1570 +-------------------------------------------------------------------+ | |
1571 | PROJECT : GSM-PS (6147) MODULE : CMH_CCF | | |
1572 | ROUTINE : cmhCC_ClearCall | | |
1573 +-------------------------------------------------------------------+ | |
1574 | |
1575 PURPOSE : disconnect a call. | |
1576 */ | |
1577 | |
1578 GLOBAL void cmhCC_ClearCall ( SHORT cId, | |
1579 USHORT cs, | |
1580 T_ACI_CMD_SRC srcId, | |
1581 UBYTE cmd, | |
1582 SHORT *waitId ) | |
1583 { | |
1584 T_CC_CMD_PRM *pCCCmdPrm = NULL; /* points to CC command parameters */ | |
1585 T_CC_CALL_TYPE calltype = cmhCC_getcalltype(cId); | |
1586 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
1587 | |
1588 TRACE_FUNCTION( "cmhCC_ClearCall()" ); | |
1589 | |
1590 if(srcId > CMD_SRC_NONE AND | |
1591 srcId < CMD_SRC_MAX) | |
1592 { | |
1593 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm; | |
1594 } | |
1595 | |
1596 if (ccShrdPrm.ctb[cId] EQ NULL) | |
1597 { | |
1598 TRACE_EVENT("cmhCC_ClearCall(): Not a valid cId"); | |
1599 return; | |
1600 } | |
1601 | |
1602 TRACE_EVENT_P2("Clear Call ==> calStat: %d, calType: %d", ctb->calStat, ctb->calType NEQ CT_MOC); | |
1603 | |
1604 if(cmd NEQ AT_CMD_NONE) /* for instance +CHUP / H / Z */ | |
1605 { | |
1606 /* Check whether an incoming call is rejected by the user. */ | |
1607 if( ctb->calStat EQ CS_ACT_REQ AND | |
1608 ctb->calType EQ CT_MTC) | |
1609 { | |
1610 psaCC_phbAddNtry ( LRN, cId, CT_MTC, NULL ); /* Add call to Last Received Number (LRN) PB */ | |
1611 } | |
1612 | |
1613 /* Check whether call is a waiting call */ | |
1614 if(waitId NEQ NULL) | |
1615 { | |
1616 if( ctb->calStat EQ CS_ACT_REQ AND | |
1617 ctb->calType EQ CT_MTC AND | |
1618 ctb->calOwn EQ ((T_OWN)CMD_SRC_NONE) ) | |
1619 { | |
1620 /* tag a found waiting call */ | |
1621 TRACE_EVENT_P1("Waiting Call Found ! waitId=%d", cId); | |
1622 *waitId = cId; | |
1623 return; | |
1624 } | |
1625 } | |
1626 } | |
1627 | |
1628 ccShrdPrm.cIdFail = cId; | |
1629 if ( cmd NEQ AT_CMD_NONE ) /* this will decide whether a result is sent to the user or not */ | |
1630 { | |
1631 /* ATZ and ATH or AT+CHUP for instance */ | |
1632 if(pCCCmdPrm NEQ NULL) | |
1633 { | |
1634 cmhCC_flagCall( cId, &(pCCCmdPrm -> mltyDscFlg)); | |
1635 } | |
1636 ctb->curCmd = cmd; | |
1637 ctb->curSrc = srcId; | |
1638 } | |
1639 else | |
1640 { | |
1641 /* AOC for instance */ | |
1642 cmhCC_SndDiscRsn(cId); | |
1643 } | |
1644 ctb->nrmCs = cs; | |
1645 | |
1646 /* determine call status */ | |
1647 switch( ctb->calStat ) | |
1648 { | |
1649 /* active calls */ | |
1650 case( CS_ACT ): | |
1651 switch( calltype ) | |
1652 { | |
1653 case( VOICE_CALL ): | |
1654 psaCC_ClearCall (cId); | |
1655 break; | |
1656 | |
1657 #if defined FAX_AND_DATA AND defined (DTI) | |
1658 | |
1659 case( TRANS_CALL ): | |
1660 ccShrdPrm.datStat = DS_DSC_REQ; | |
1661 cmhTRA_Deactivate (); | |
1662 break; | |
1663 | |
1664 case( NON_TRANS_CALL ): | |
1665 ccShrdPrm.datStat = DS_DSC_REQ; | |
1666 cmhL2R_Deactivate (); | |
1667 break; | |
1668 | |
1669 #ifdef FF_FAX | |
1670 case( FAX_CALL ): | |
1671 ccShrdPrm.datStat = DS_DSC_REQ; | |
1672 cmhT30_Deactivate (); | |
1673 break; | |
1674 #endif /* FF_FAX */ | |
1675 | |
1676 #if defined(CO_UDP_IP) OR defined(FF_GPF_TCPIP) | |
1677 | |
1678 #ifdef CO_UDP_IP | |
1679 case( UDPIP_CALL ): | |
1680 #endif | |
1681 | |
1682 #ifdef FF_GPF_TCPIP | |
1683 case( TCPIP_CALL ): | |
1684 { | |
1685 T_DCM_STATUS_IND_MSG msg; | |
1686 msg.hdr.msg_id = DCM_ERROR_IND_MSG; | |
1687 msg.result = DCM_PS_CONN_BROKEN; | |
1688 dcm_send_message(msg, DCM_SUB_WAIT_SATDN_CNF); | |
1689 } | |
1690 #endif | |
1691 ccShrdPrm.datStat = DS_DSC_REQ; | |
1692 /* also test whether a SAT E connection has to be shut down */ | |
1693 if ( (cmd NEQ AT_CMD_NONE) | |
1694 #ifdef FF_SAT_E | |
1695 OR (satShrdPrm.opchAcptSrc EQ srcId) | |
1696 #endif | |
1697 ) | |
1698 { | |
1699 /* set the last possible state for the next "else if" statement */ | |
1700 T_ACI_WAP_STATES last_state = Wap_Not_Init; | |
1701 if(is_gpf_tcpip_call()) { | |
1702 GPF_TCPIP_STATEMENT(last_state = TCPIP_Deactivation); | |
1703 } | |
1704 else { | |
1705 last_state = UDPA_Deactivation; | |
1706 } | |
1707 | |
1708 /* Terminate PPP if established. UP indicate that entities under PPP are still activ. */ | |
1709 if((pppShrdPrm.state EQ PPP_ESTABLISHED) OR | |
1710 (pppShrdPrm.state EQ PPP_ESTABLISH)) | |
1711 { | |
1712 cmhPPP_Terminate(UP); | |
1713 } | |
1714 else if (wap_state > Wap_Not_Init AND | |
1715 wap_state <= last_state) | |
1716 { | |
1717 cmhPPP_Terminated(); /* Trigger termination of SCPIP if PPP did not yet start (ACI-FIX-9317) */ | |
1718 } | |
1719 } | |
1720 break; | |
1721 #endif /* defined(CO_UDP_IP) OR defined(FF_GPF_TCPIP) */ | |
1722 #if defined (FF_PPP) AND defined (DTI) | |
1723 case( PPP_CALL ): | |
1724 ccShrdPrm.datStat = DS_DSC_REQ; | |
1725 if (pppShrdPrm.is_PPP_CALL EQ TRUE) | |
1726 { | |
1727 dti_cntrl_close_dpath_from_src_id((UBYTE)srcId); | |
1728 } | |
1729 #endif /* DTI */ | |
1730 #endif /* of #ifdef FAX_AND_DATA */ | |
1731 default: | |
1732 TRACE_ERROR("Wrong call type"); | |
1733 } | |
1734 break; | |
1735 | |
1736 /* other present calls */ | |
1737 case( CS_HLD ): | |
1738 case( CS_HLD_REQ ): | |
1739 case( CS_MDF_REQ ): | |
1740 case( CS_DSC_REQ ): | |
1741 case( CS_ACT_REQ ): | |
1742 case( CS_CPL_REQ ): | |
1743 psaCC_ClearCall (cId); | |
1744 break; | |
1745 } | |
1746 } | |
1747 | |
1748 /* | |
1749 +--------------------------------------------------------------------+ | |
1750 | PROJECT : GSM-PS (6147) MODULE : CMH_CCF | | |
1751 | STATE : code ROUTINE : cmhCC_chkDTMFDig | | |
1752 +--------------------------------------------------------------------+ | |
1753 | |
1754 PURPOSE : This function is used extract DTMF digits from the dialled | |
1755 number. The DTMF digits, including separators, are stored | |
1756 in the DTMF parameters and will be send automatically after | |
1757 the connection is established. | |
1758 BOOL within_dial_string parameter to tell if DTMF tones are | |
1759 within a dial string or directly given. | |
1760 USHROT length: possibility to give the number of dtmf to be | |
1761 sent (relevant only if not within a dial string). | |
1762 */ | |
1763 | |
1764 /* next function fills up dtmf structure with extracted prms */ | |
1765 LOCAL void cmhCC_fillDTMFDig ( SHORT cId, CHAR *dtmf, USHORT dtmf_length ) | |
1766 { | |
1767 TRACE_FUNCTION("cmhCC_fillDTMFDig()"); | |
1768 | |
1769 if( dtmf NEQ NULL ) | |
1770 { | |
1771 ccShrdPrm.dtmf.cnt = MINIMUM( dtmf_length, MAX_DTMF_DIG ); | |
1772 | |
1773 strncpy( (char *)ccShrdPrm.dtmf.dig, dtmf, ccShrdPrm.dtmf.cnt ); | |
1774 ccShrdPrm.dtmf.dig[dtmf_length] = '\0'; | |
1775 | |
1776 ccShrdPrm.dtmf.cur = 0; | |
1777 ccShrdPrm.dtmf.cId = cId; | |
1778 TRACE_EVENT_P2("ccShrdPrm.dtmf.cnt: %d, ccShrdPrm.dtmf.cId: %d", ccShrdPrm.dtmf.cnt, ccShrdPrm.dtmf.cId); | |
1779 } | |
1780 else | |
1781 { | |
1782 ccShrdPrm.dtmf.cnt = 0; | |
1783 ccShrdPrm.dtmf.cur = 0; | |
1784 ccShrdPrm.dtmf.cId = NO_ENTRY; | |
1785 } | |
1786 } | |
1787 | |
1788 GLOBAL BOOL is_digit_dtmf_separator(CHAR digit) | |
1789 { | |
1790 switch(digit) | |
1791 { | |
1792 case('P'): /* PHB_DIAL_PAUSE, PHB_DTMF_SEP */ | |
1793 case('p'): | |
1794 case('W'): /* PHB_DIAL_WAIT */ | |
1795 case('w'): | |
1796 TRACE_EVENT("DTMF Separator Found"); | |
1797 return(TRUE); | |
1798 } | |
1799 return(FALSE); | |
1800 } | |
1801 | |
1802 LOCAL CHAR * find_dtmf_separator(CHAR *number_string, USHORT length) | |
1803 { | |
1804 int i; | |
1805 | |
1806 TRACE_FUNCTION("find_dtmf_separator()"); | |
1807 | |
1808 for(i=0; i<length; i++) | |
1809 { | |
1810 if(is_digit_dtmf_separator(*number_string)) | |
1811 { | |
1812 return(number_string); | |
1813 } | |
1814 number_string++; | |
1815 } | |
1816 return(NULL); | |
1817 } | |
1818 | |
1819 GLOBAL void cmhCC_chkDTMFDig ( CHAR* num, | |
1820 SHORT cId, | |
1821 USHORT length, | |
1822 BOOL within_dial_string ) | |
1823 { | |
1824 CHAR *dtmf = num; | |
1825 USHORT len = length; | |
1826 | |
1827 TRACE_FUNCTION("cmhCC_chkDTMFDig()"); | |
1828 | |
1829 if( within_dial_string ) | |
1830 { | |
1831 dtmf = find_dtmf_separator(num, (USHORT)strlen(num)); /*strchr( num, PHB_DTMF_SEP ); */ | |
1832 | |
1833 if(dtmf NEQ NULL) | |
1834 { | |
1835 len = strlen(dtmf); | |
1836 TRACE_EVENT_P1("Call number string contains %d DTMF tones", len); | |
1837 } | |
1838 } | |
1839 else | |
1840 { | |
1841 /* already inialized for the case "not within a phone call" (e.g SAT Send DTMF) */ | |
1842 } | |
1843 | |
1844 cmhCC_fillDTMFDig ( cId, dtmf, len ); | |
1845 | |
1846 if(dtmf NEQ NULL) | |
1847 { | |
1848 *dtmf = '\0'; /* split dial string from DTMF tones */ | |
1849 } | |
1850 | |
1851 } | |
1852 | |
1853 /* | |
1854 +--------------------------------------------------------------------+ | |
1855 | PROJECT : GSM-PS (6147) MODULE : CMH_CCF | | |
1856 | STATE : code ROUTINE : cmhCC_chkKeySeq | | |
1857 +--------------------------------------------------------------------+ | |
1858 | |
1859 PURPOSE : This function is used to decode a keystroke sequence and | |
1860 to initiate an appropriate action. | |
1861 */ | |
1862 GLOBAL T_ACI_RETURN cmhCC_chkKeySeq ( T_ACI_CMD_SRC srcId, | |
1863 T_CLPTY_PRM *cldPty, | |
1864 T_ACI_D_TOC *callType, | |
1865 T_ACI_D_CLIR_OVRD *CLIRovrd, | |
1866 T_CC_SIM_QLF ccSIMQlf ) | |
1867 { | |
1868 T_KSD_SEQGRP seqGrp = SEQGRP_UNKNOWN; | |
1869 T_KSD_SEQPARAM seqPrm; | |
1870 CHAR *restSeq = NULL; | |
1871 T_ACI_RETURN retVal; | |
1872 T_PHB_RECORD phbNtry; | |
1873 T_PHB_TYPE slctPHB; | |
1874 #ifdef SIM_TOOLKIT | |
1875 T_sat_ussd SATussd; /* to hold USSD string in case of SAT Control */ | |
1876 #endif /* of SIM_TOOLKIT */ | |
1877 | |
1878 TRACE_FUNCTION ("cmhCC_chkKeySeq ()"); | |
1879 | |
1880 if( cldPty EQ NULL OR | |
1881 strlen (cldPty->num) EQ 0 ) | |
1882 { | |
1883 return( AT_CMPL ); | |
1884 } | |
1885 | |
1886 restSeq = cldPty->num; | |
1887 seqGrp = SEQGRP_UNKNOWN; | |
1888 | |
1889 #ifdef SIM_TOOLKIT | |
1890 /* check for SAT SIM Call Control of SS strings */ | |
1891 if (ccSIMQlf EQ CC_SIM_YES) | |
1892 { | |
1893 if ( !ksd_isFDNCheckSeq ( cldPty-> num ) ) | |
1894 ; /* bypass *#06# from SSCntrlBySIM */ | |
1895 else | |
1896 { | |
1897 retVal = AT_CMPL; /* init */ | |
1898 if( ksd_isSATSscs (cldPty->num) ) | |
1899 { | |
1900 retVal = cmhSAT_SSCntrlBySIM( cldPty, (UBYTE)srcId ); | |
1901 } | |
1902 else if( ksd_isUSSD (cldPty->num) ) | |
1903 { | |
1904 if (psaSIM_ChkSIMSrvSup(SRV_USSDsupportInCC)) | |
1905 { | |
1906 SATussd.dcs = 0x0F; /* default alphabet see GSM 03.38 Cell Broadcast dcs */ | |
1907 SATussd.c_ussd_str = strlen(cldPty->num); | |
1908 SATussd.ussd_str = (UBYTE *)cldPty->num; | |
1909 | |
1910 retVal = cmhSAT_USSDCntrlBySIM( &SATussd, (UBYTE)srcId ); | |
1911 } | |
1912 else | |
1913 { | |
1914 retVal = cmhSAT_SSCntrlBySIM( cldPty, (UBYTE)srcId ); | |
1915 } | |
1916 } | |
1917 | |
1918 if( retVal NEQ AT_CMPL ) | |
1919 return( retVal ); | |
1920 } | |
1921 } | |
1922 #endif | |
1923 | |
1924 /* | |
1925 *------------------------------------------------------------- | |
1926 * decode SS string | |
1927 *------------------------------------------------------------- | |
1928 */ | |
1929 if (ksd_decode (cldPty->num, | |
1930 psaCC_ctbAnyCallInUse(), /* is there any call??? */ | |
1931 &seqGrp, | |
1932 &restSeq, | |
1933 &seqPrm) EQ TRUE) | |
1934 { | |
1935 retVal = AT_FAIL; | |
1936 | |
1937 /* | |
1938 *------------------------------------------------------------- | |
1939 * perform desired action | |
1940 *------------------------------------------------------------- | |
1941 */ | |
1942 switch (seqGrp) | |
1943 { | |
1944 /* | |
1945 *--------------------------------------------------------- | |
1946 * handling of sequence group SEQGRP_IMEI | |
1947 *--------------------------------------------------------- | |
1948 */ | |
1949 case ( SEQGRP_PRSNT_IMEI ): | |
1950 retVal = cmhSS_ksdIMEI( srcId ); | |
1951 break; | |
1952 | |
1953 /* | |
1954 *--------------------------------------------------------- | |
1955 * handling of sequence group SEQGRP_DIAL | |
1956 *--------------------------------------------------------- | |
1957 */ | |
1958 case (SEQGRP_DIAL): | |
1959 strncpy(cldPty->num, seqPrm.dial.number, sizeof (cldPty->num) - 1); | |
1960 cldPty->num[sizeof(cldPty->num) - 1] = '\0'; | |
1961 return ((T_ACI_RETURN) AT_CONT); | |
1962 | |
1963 /* | |
1964 *--------------------------------------------------------- | |
1965 * handling of sequence group SEQGRP_CHLD | |
1966 *--------------------------------------------------------- | |
1967 */ | |
1968 case (SEQGRP_CHLD): | |
1969 retVal = sAT_PlusCHLD( srcId, seqPrm.chld.mode, seqPrm.chld.call ); | |
1970 if (retVal NEQ AT_FAIL) | |
1971 break; /* successfull CHLD */ | |
1972 | |
1973 /* else handle as USSD if this CHLD was unexpected/illegal */ | |
1974 | |
1975 seqPrm.ussd.ussd = (UBYTE *)cldPty->num; | |
1976 seqGrp = SEQGRP_USSD; | |
1977 restSeq = cldPty->num + strlen (cldPty->num); | |
1978 /* fallthrough */ | |
1979 /*lint -fallthrough*/ | |
1980 /* | |
1981 *--------------------------------------------------------- | |
1982 * handling of sequence group SEQGRP_USSD | |
1983 *--------------------------------------------------------- | |
1984 */ | |
1985 case (SEQGRP_USSD): | |
1986 retVal = cmhSS_ksdUSSD( srcId, &seqPrm.ussd ); | |
1987 break; | |
1988 | |
1989 /* | |
1990 *--------------------------------------------------------- | |
1991 * handling of sequence group SEQGRP_DIAL_IDX | |
1992 *--------------------------------------------------------- | |
1993 */ | |
1994 case (SEQGRP_DIAL_IDX): | |
1995 | |
1996 if( !cmhPHB_cvtPhbType(cmhPrm[srcId].phbCmdPrm.cmhStor, | |
1997 &slctPHB )) | |
1998 return( AT_FAIL ); | |
1999 | |
2000 #ifdef TI_PS_FFS_PHB | |
2001 if (pb_read_record (slctPHB, | |
2002 seqPrm.dialIdx.index, | |
2003 &phbNtry) EQ PHB_OK) | |
2004 #else | |
2005 if( pb_read_phys_record( slctPHB, seqPrm.dialIdx.index, &phbNtry ) | |
2006 EQ PHB_OK ) | |
2007 #endif | |
2008 { | |
2009 cmhPHB_getAdrStr( cldPty->num, sizeof (cldPty->num) - 1, | |
2010 phbNtry.number, phbNtry.len ); | |
2011 | |
2012 cmh_demergeTOA ( phbNtry.ton_npi, &cldPty->ton, &cldPty->npi ); | |
2013 | |
2014 /* | |
2015 *--------------------------------------------------------- | |
2016 * as long as the bearer capabilities are not read from | |
2017 * the phonebook only voice calls are supported | |
2018 *--------------------------------------------------------- | |
2019 */ | |
2020 *callType = D_TOC_Voice; | |
2021 | |
2022 return((T_ACI_RETURN) AT_CONT); | |
2023 } | |
2024 | |
2025 return( AT_FAIL ); | |
2026 | |
2027 /* | |
2028 *--------------------------------------------------------- | |
2029 * handling of sequence groups which relates | |
2030 * to call forwarding parameter | |
2031 *--------------------------------------------------------- | |
2032 */ | |
2033 case (SEQGRP_CF): | |
2034 /* type of address has already been set, | |
2035 and a possible "+" already been removed... */ | |
2036 if(seqPrm.cf.num NEQ NULL AND | |
2037 seqPrm.cf.num[0] NEQ 0) /* only set if there is actually a number */ | |
2038 { | |
2039 seqPrm.cf.ton = cldPty->ton; | |
2040 seqPrm.cf.npi = cldPty->npi; | |
2041 } | |
2042 else | |
2043 { | |
2044 seqPrm.cf.ton = MNCC_TON_NOT_PRES; | |
2045 seqPrm.cf.npi = MNCC_NPI_NOT_PRES; | |
2046 } | |
2047 | |
2048 /* subaddress has also already been split up if existing */ | |
2049 if(cldPty->sub[0] NEQ 0) | |
2050 { | |
2051 seqPrm.cf.sub = (UBYTE *)cldPty->sub; | |
2052 seqPrm.cf.tos = cldPty->tos; | |
2053 seqPrm.cf.oe = cldPty->oe; | |
2054 } | |
2055 else | |
2056 seqPrm.cf.sub = NULL; | |
2057 | |
2058 retVal = cmhSS_ksdCF( srcId, &seqPrm.cf ); | |
2059 break; | |
2060 | |
2061 /* | |
2062 *--------------------------------------------------------- | |
2063 * handling of sequence groups which relates to | |
2064 * call barring parameter | |
2065 *--------------------------------------------------------- | |
2066 */ | |
2067 case (SEQGRP_CB): | |
2068 retVal = cmhSS_ksdCWCBStartTrans(srcId, KSD_CMD_CB, &seqPrm); | |
2069 break; | |
2070 | |
2071 /* | |
2072 *--------------------------------------------------------- | |
2073 * handling of sequence groups which results in a change | |
2074 * of CLIR parameter | |
2075 * in temporary mode a call is set up | |
2076 *--------------------------------------------------------- | |
2077 */ | |
2078 | |
2079 case (SEQGRP_SUP_COLR): | |
2080 case (SEQGRP_INV_COLR): | |
2081 case (SEQGRP_SUP_COLP): | |
2082 case (SEQGRP_INV_COLP): | |
2083 case (SEQGRP_SUP_CLIP): | |
2084 case (SEQGRP_INV_CLIP): | |
2085 if (strlen (restSeq) EQ 0) | |
2086 { | |
2087 T_ACI_KSD_USSD_PRM ksdString; | |
2088 | |
2089 ksdString.ussd = (UBYTE*)cldPty->num; | |
2090 retVal = cmhSS_ksdUSSD( srcId, &ksdString ); | |
2091 } | |
2092 else | |
2093 { | |
2094 /* | |
2095 *----------------------------------------------------- | |
2096 * temporary mode nonexistant on CLIR, COLR and COLP!! | |
2097 * So ignore USSD and continue calling: "Number not assigned" | |
2098 * will be indicated to the user by the network | |
2099 * This is the common behaviour as found on other phones | |
2100 *----------------------------------------------------- | |
2101 */ | |
2102 return((T_ACI_RETURN) AT_CONT); | |
2103 } | |
2104 break; | |
2105 | |
2106 case (SEQGRP_SUP_CLIR): | |
2107 case (SEQGRP_INV_CLIR): | |
2108 if (strlen (restSeq) EQ 0) | |
2109 { | |
2110 #if defined(MFW) OR defined(FF_MMI_RIV) | |
2111 if (srcId EQ CMD_SRC_LCL) /* VO: temp solution because MFW uses sAT_Dn to set CLIR */ | |
2112 retVal = sAT_PlusCLIR(srcId, seqPrm.Clir.mode); | |
2113 else | |
2114 #endif | |
2115 { | |
2116 T_ACI_KSD_USSD_PRM ksdString; | |
2117 | |
2118 ksdString.ussd = (UBYTE*)cldPty->num; | |
2119 retVal = cmhSS_ksdUSSD( srcId, &ksdString ); | |
2120 } | |
2121 } | |
2122 else | |
2123 { | |
2124 /* | |
2125 *----------------------------------------------------- | |
2126 * in temporary mode a call is set up | |
2127 *----------------------------------------------------- | |
2128 */ | |
2129 T_KSD_CLIR Clir; | |
2130 T_KSD_SEQGRP nextGrp = SEQGRP_UNKNOWN; | |
2131 CHAR* remSeq = NULL; | |
2132 | |
2133 Clir.mode = seqPrm.Clir.mode; | |
2134 | |
2135 if (ksd_decode (restSeq, FALSE, | |
2136 &nextGrp, &remSeq, | |
2137 &seqPrm) | |
2138 AND | |
2139 nextGrp EQ SEQGRP_DIAL) | |
2140 { | |
2141 *CLIRovrd = (Clir.mode EQ CLIR_MOD_Supp)? | |
2142 D_CLIR_OVRD_Supp: D_CLIR_OVRD_Invoc; | |
2143 strncpy(cldPty->num, seqPrm.dial.number, sizeof(cldPty->num) - 1); | |
2144 cldPty->num[sizeof(cldPty->num) - 1] = '\0'; | |
2145 return((T_ACI_RETURN) AT_CONT); | |
2146 } | |
2147 } | |
2148 break; | |
2149 | |
2150 /* | |
2151 *--------------------------------------------------------- | |
2152 * handling of sequence group for TTY service | |
2153 *--------------------------------------------------------- | |
2154 */ | |
2155 case (SEQGRP_TTY_SERV): | |
2156 if (strlen (restSeq) EQ 0) | |
2157 { | |
2158 #ifdef FF_TTY | |
2159 retVal = sAT_PercentCTTY (srcId, CTTY_MOD_NotPresent, | |
2160 seqPrm.ctty.req); | |
2161 #else | |
2162 retVal = AT_FAIL; | |
2163 #endif /* FF_TTY */ | |
2164 } | |
2165 else | |
2166 { | |
2167 T_KSD_SEQGRP nextGrp = SEQGRP_UNKNOWN; | |
2168 CHAR* remSeq = NULL; | |
2169 #ifdef FF_TTY | |
2170 if (seqPrm.ctty.req EQ CTTY_REQ_Off | |
2171 AND ccShrdPrm.ctmReq EQ MNCC_CTM_ENABLED) | |
2172 { | |
2173 ccShrdPrm.ctmOvwr = TRUE; | |
2174 } | |
2175 else if (seqPrm.ctty.req EQ CTTY_REQ_On | |
2176 AND ccShrdPrm.ctmReq EQ MNCC_CTM_DISABLED) | |
2177 { | |
2178 ccShrdPrm.ctmOvwr = TRUE; | |
2179 } | |
2180 else | |
2181 { | |
2182 ccShrdPrm.ctmOvwr = FALSE; | |
2183 } | |
2184 #endif /* FF_TTY */ | |
2185 if (ksd_decode (restSeq, FALSE, | |
2186 &nextGrp, &remSeq, | |
2187 &seqPrm) | |
2188 AND | |
2189 nextGrp EQ SEQGRP_DIAL) | |
2190 { | |
2191 strncpy(cldPty->num, seqPrm.dial.number, sizeof(cldPty->num) - 1); | |
2192 cldPty->num[sizeof(cldPty->num) - 1] = '\0'; | |
2193 return((T_ACI_RETURN) AT_CONT); | |
2194 } | |
2195 } | |
2196 break; | |
2197 | |
2198 /* | |
2199 *--------------------------------------------------------- | |
2200 * handling of sequence group which relates to | |
2201 * calling line supplementary services | |
2202 *--------------------------------------------------------- | |
2203 */ | |
2204 case (SEQGRP_CL): | |
2205 retVal = cmhSS_ksdCL( srcId, &seqPrm.cl ); | |
2206 break; | |
2207 | |
2208 /* | |
2209 *--------------------------------------------------------- | |
2210 * handling of sequence groups which results in a | |
2211 * registration of passwords | |
2212 *--------------------------------------------------------- | |
2213 */ | |
2214 case (SEQGRP_PWD): | |
2215 retVal = cmhSS_ksdPW( srcId, &seqPrm.pwd ); | |
2216 break; | |
2217 | |
2218 /* | |
2219 *--------------------------------------------------------- | |
2220 * handling of sequence groups which results in a | |
2221 * registration of passwords | |
2222 *--------------------------------------------------------- | |
2223 */ | |
2224 case (SEQGRP_UBLK): | |
2225 retVal = cmhSS_ksdUBLK( srcId, &seqPrm.ublk ); | |
2226 break; | |
2227 | |
2228 /* | |
2229 *--------------------------------------------------------- | |
2230 * handling of sequence groups which relates to | |
2231 * call waiting | |
2232 *--------------------------------------------------------- | |
2233 */ | |
2234 case (SEQGRP_CW): | |
2235 retVal = cmhSS_ksdCWCBStartTrans(srcId, KSD_CMD_CW, &seqPrm); | |
2236 break; | |
2237 | |
2238 /* | |
2239 *--------------------------------------------------------- | |
2240 * handling of sequence group SEQGRP_CCBS | |
2241 *--------------------------------------------------------- | |
2242 */ | |
2243 case (SEQGRP_CCBS): | |
2244 retVal = cmhSS_ksdCCBS( srcId, &seqPrm.ccbs ); | |
2245 break; | |
2246 | |
2247 /* | |
2248 *--------------------------------------------------------- | |
2249 * handling of sequence group SEQGRP_UNKNOWN | |
2250 *--------------------------------------------------------- | |
2251 */ | |
2252 case (SEQGRP_UNKNOWN): | |
2253 TRACE_EVENT ("sequence group unknown"); | |
2254 break; | |
2255 } | |
2256 } | |
2257 else | |
2258 { | |
2259 TRACE_EVENT ("ksd_decode failed"); | |
2260 return( AT_FAIL ); | |
2261 } | |
2262 | |
2263 return( retVal ); | |
2264 } | |
2265 | |
2266 /* | |
2267 +--------------------------------------------------------------------+ | |
2268 | PROJECT : GSM-PS (6147) MODULE : CMH_CCF | | |
2269 | STATE : code ROUTINE : cmhCC_fillSetupPrm | | |
2270 +--------------------------------------------------------------------+ | |
2271 | |
2272 PURPOSE : This function fills the call table entry with the | |
2273 necessary setup parameters. | |
2274 */ | |
2275 | |
2276 GLOBAL T_ACI_RETURN cmhCC_fillSetupPrm ( SHORT cId, | |
2277 T_ACI_CMD_SRC srcId, | |
2278 T_CLPTY_PRM *cldPty, | |
2279 T_MNCC_bcpara *bc, | |
2280 UBYTE prio, | |
2281 T_ACI_D_CLIR_OVRD clirOvrd, | |
2282 T_ACI_D_CUG_CTRL cugCtrl, | |
2283 T_ACI_D_TOC callType ) | |
2284 { | |
2285 T_CC_CALL_TBL *pfilled_ctb; | |
2286 T_CC_CMD_PRM *pCCCmdPrm; /* points to CC command parameters */ | |
2287 #ifdef FF_FAX | |
2288 T_T30_CMD_PRM *pT30CmdPrm; /* points to T30 command parameters */ | |
2289 #endif | |
2290 | |
2291 TRACE_FUNCTION ("cmhCC_fillSetupPrm()"); | |
2292 | |
2293 /* initializing local pointers: */ | |
2294 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm; | |
2295 | |
2296 #ifdef FF_FAX | |
2297 pT30CmdPrm = &fnd_cmhPrm[srcId].t30CmdPrm; | |
2298 #endif | |
2299 | |
2300 pfilled_ctb = ccShrdPrm.ctb[cId]; | |
2301 | |
2302 /* | |
2303 *----------------------------------------------------------------- | |
2304 * check data capabilities | |
2305 *----------------------------------------------------------------- | |
2306 */ | |
2307 #ifndef FAX_AND_DATA | |
2308 if( callType NEQ D_TOC_Voice ) | |
2309 { | |
2310 TRACE_EVENT("No data calls supported"); | |
2311 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_NoDataCallSup ); | |
2312 return( AT_FAIL ); /* no data calls allowed */ | |
2313 } | |
2314 #endif /* of #ifndef FAX_AND_DATA */ | |
2315 | |
2316 /* | |
2317 *----------------------------------------------------------------- | |
2318 * called address | |
2319 *----------------------------------------------------------------- | |
2320 */ | |
2321 if( cldPty EQ NULL ) | |
2322 { | |
2323 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
2324 return( AT_FAIL ); /* no number */ | |
2325 } | |
2326 | |
2327 /* priority */ | |
2328 pfilled_ctb->prio = prio; | |
2329 | |
2330 if ((prio EQ MNCC_PRIO_NORM_CALL) AND | |
2331 (aoc_check_moc() EQ FALSE)) | |
2332 /* | |
2333 * check ACM exceeds ACMmax | |
2334 * for non-emergency calls | |
2335 */ | |
2336 { | |
2337 ACI_ERR_DESC( ACI_ERR_CLASS_Ceer, CAUSE_MAKE(DEFBY_STD, | |
2338 ORIGSIDE_MS, MNCC_ACI_ORIGINATING_ENTITY, CEER_ACM_Max )); | |
2339 return( AT_FAIL ); | |
2340 } | |
2341 | |
2342 /* subaddress */ | |
2343 pfilled_ctb->cldPtySub.tos = cldPty->tos; | |
2344 pfilled_ctb->cldPtySub.odd_even = cldPty->oe; | |
2345 pfilled_ctb->cldPtySub.c_subaddr | |
2346 = (UBYTE)utl_dialStr2BCD (cldPty->sub, | |
2347 pfilled_ctb->cldPtySub.subaddr, | |
2348 MNCC_SUB_LENGTH); | |
2349 | |
2350 /* address */ | |
2351 if( pCCCmdPrm -> CSTAdef NEQ TRUE ) | |
2352 { | |
2353 pfilled_ctb->cldPty.npi = pCCCmdPrm -> CSTAtoa.npi; | |
2354 pfilled_ctb->cldPty.ton = pCCCmdPrm -> CSTAtoa.ton; | |
2355 } | |
2356 else | |
2357 { | |
2358 pfilled_ctb->cldPty.npi = cldPty->npi; | |
2359 pfilled_ctb->cldPty.ton = cldPty->ton; | |
2360 } | |
2361 | |
2362 if (pfilled_ctb->cldPty.called_num NEQ NULL) | |
2363 { | |
2364 ACI_MFREE (pfilled_ctb->cldPty.called_num); | |
2365 pfilled_ctb->cldPty.called_num = NULL; | |
2366 } | |
2367 pfilled_ctb->cldPty.c_called_num = | |
2368 (UBYTE)utl_dialStr2BCD (cldPty->num, NULL, MNCC_MAX_CC_CALLED_NUMBER); | |
2369 if (pfilled_ctb->cldPty.c_called_num NEQ 0) | |
2370 { | |
2371 ACI_MALLOC (pfilled_ctb->cldPty.called_num, | |
2372 pfilled_ctb->cldPty.c_called_num); | |
2373 (void)utl_dialStr2BCD (cldPty->num, | |
2374 pfilled_ctb->cldPty.called_num, | |
2375 pfilled_ctb->cldPty.c_called_num); | |
2376 } | |
2377 | |
2378 psaCC_phbSrchNum( cId, CT_MOC); /* get alpha identifier */ | |
2379 | |
2380 /* | |
2381 *----------------------------------------------------------------- | |
2382 * CLIR setting | |
2383 *----------------------------------------------------------------- | |
2384 */ | |
2385 switch( clirOvrd ) | |
2386 { | |
2387 case( D_CLIR_OVRD_Supp ): | |
2388 pfilled_ctb->CLIRsup = MNCC_CLR_SUP; | |
2389 break; | |
2390 | |
2391 case( D_CLIR_OVRD_Invoc ): | |
2392 pfilled_ctb->CLIRsup = MNCC_CLR_SUP_NOT; | |
2393 break; | |
2394 | |
2395 case( D_CLIR_OVRD_Default ): | |
2396 | |
2397 switch( pCCCmdPrm -> CLIRmode ) | |
2398 { | |
2399 case( CLIR_MOD_Subscript ): | |
2400 pfilled_ctb->CLIRsup = MNCC_CLR_NOT_PRES; | |
2401 break; | |
2402 case( CLIR_MOD_Invoc ): | |
2403 pfilled_ctb->CLIRsup = MNCC_CLR_SUP_NOT; | |
2404 break; | |
2405 case( CLIR_MOD_Supp ): | |
2406 pfilled_ctb->CLIRsup = MNCC_CLR_SUP; | |
2407 break; | |
2408 } | |
2409 break; | |
2410 | |
2411 default: | |
2412 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
2413 return( AT_FAIL ); | |
2414 } | |
2415 | |
2416 /* | |
2417 *----------------------------------------------------------------- | |
2418 * CUG setting | |
2419 *----------------------------------------------------------------- | |
2420 */ | |
2421 if ( cugCtrl EQ D_CUG_CTRL_Present OR | |
2422 pCCCmdPrm -> CCUGmode EQ CCUG_MOD_EnableTmp ) | |
2423 { | |
2424 pfilled_ctb->CUGidx = pCCCmdPrm -> CCUGidx; | |
2425 | |
2426 switch( pCCCmdPrm -> CCUGinfo ) | |
2427 { | |
2428 case( CCUG_INFO_No ): | |
2429 break; | |
2430 case( CCUG_INFO_SuppOa ): | |
2431 pfilled_ctb->OAsup = TRUE; | |
2432 break; | |
2433 case( CCUG_INFO_SuppPrefCug ): | |
2434 pfilled_ctb->CUGprf = TRUE; | |
2435 break; | |
2436 case( CCUG_INFO_SuppBoth ): | |
2437 pfilled_ctb->OAsup = TRUE; | |
2438 pfilled_ctb->CUGprf = TRUE; | |
2439 break; | |
2440 } | |
2441 } | |
2442 | |
2443 #ifdef SIM_TOOLKIT | |
2444 /* | |
2445 *----------------------------------------------------------------- | |
2446 * SAT settings | |
2447 *----------------------------------------------------------------- | |
2448 */ | |
2449 | |
2450 /* decides if a disconnect event for a call has already been sent to SAT */ | |
2451 pfilled_ctb->SatDiscEvent = FALSE; | |
2452 #endif | |
2453 | |
2454 /* | |
2455 *----------------------------------------------------------------- | |
2456 * bearer services | |
2457 *----------------------------------------------------------------- | |
2458 */ | |
2459 switch( callType ) | |
2460 { | |
2461 /* | |
2462 *----------------------------------------------------------------- | |
2463 * start with a voice call | |
2464 *----------------------------------------------------------------- | |
2465 */ | |
2466 case( D_TOC_Voice ): | |
2467 | |
2468 pfilled_ctb->BC[0].rate = MNCC_UR_NOT_PRES; | |
2469 pfilled_ctb->BC[0].bearer_serv = cmhCC_set_speech_serv (pCCCmdPrm); | |
2470 pfilled_ctb->BC[0].conn_elem = MNCC_CONN_ELEM_NOT_PRES; | |
2471 | |
2472 switch( ccShrdPrm.CMODmode ) | |
2473 { | |
2474 | |
2475 case( CMOD_MOD_Single ): /* single voice call */ | |
2476 pfilled_ctb->rptInd = MNCC_RI_NOT_PRES; | |
2477 | |
2478 pfilled_ctb->BC[1].rate = MNCC_UR_NOT_PRES; | |
2479 pfilled_ctb->BC[1].bearer_serv = MNCC_BEARER_SERV_NOT_PRES; | |
2480 pfilled_ctb->BC[1].conn_elem = MNCC_CONN_ELEM_NOT_PRES; | |
2481 break; | |
2482 #if defined (UART) AND defined (FAX_AND_DATA) | |
2483 case( CMOD_MOD_VoiceDat ): /* alternating voice/data call */ | |
2484 pfilled_ctb->rptInd = MNCC_RI_CIRCULAR; | |
2485 | |
2486 pfilled_ctb->BC[1].rate = cmhCC_SelRate( ccShrdPrm.CBSTspeed ); | |
2487 pfilled_ctb->BC[1].bearer_serv = cmhCC_SelServ( ccShrdPrm.CBSTname ); | |
2488 pfilled_ctb->BC[1].conn_elem = cmhCC_SelCE ( ccShrdPrm.CBSTce ); | |
2489 pfilled_ctb->BC[1].modem_type = cmhCC_SelMT ( ccShrdPrm.CBSTspeed ); | |
2490 | |
2491 pfilled_ctb->BC[1].stop_bits = cmhCC_SelStopBit( srcId ); | |
2492 pfilled_ctb->BC[1].data_bits = cmhCC_SelDataBit( srcId ); | |
2493 pfilled_ctb->BC[1].parity = cmhCC_SelParity ( srcId ); | |
2494 break; | |
2495 | |
2496 case( CMOD_MOD_VoiceFlwdDat ): /* voice followed by data */ | |
2497 pfilled_ctb->rptInd = MNCC_RI_CIRCULAR; | |
2498 | |
2499 pfilled_ctb->BC[1].rate = cmhCC_SelRate( ccShrdPrm.CBSTspeed ); | |
2500 pfilled_ctb->BC[1].bearer_serv = cmhCC_SelServ( ccShrdPrm.CBSTname ); | |
2501 pfilled_ctb->BC[1].conn_elem = cmhCC_SelCE( ccShrdPrm.CBSTce ); | |
2502 pfilled_ctb->BC[1].modem_type = cmhCC_SelMT ( ccShrdPrm.CBSTspeed ); | |
2503 | |
2504 pfilled_ctb->BC[1].stop_bits = cmhCC_SelStopBit( srcId ); | |
2505 pfilled_ctb->BC[1].data_bits = cmhCC_SelDataBit( srcId ); | |
2506 pfilled_ctb->BC[1].parity = cmhCC_SelParity ( srcId ); | |
2507 break; | |
2508 | |
2509 case( CMOD_MOD_VoiceFax ): /* alternating voice/fax call */ | |
2510 pfilled_ctb->rptInd = MNCC_RI_CIRCULAR; | |
2511 | |
2512 pfilled_ctb->BC[1].rate = cmhCC_SelRate( ccShrdPrm.CBSTspeed ); | |
2513 pfilled_ctb->BC[1].bearer_serv = MNCC_BEARER_SERV_FAX; | |
2514 pfilled_ctb->BC[1].conn_elem = MNCC_CONN_ELEM_TRANS; | |
2515 pfilled_ctb->BC[1].modem_type = MNCC_MT_NONE; | |
2516 break; | |
2517 #endif | |
2518 default: /* unexpected call mode */ | |
2519 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_DataCorrupt ); | |
2520 return( AT_FAIL ); | |
2521 } | |
2522 break; | |
2523 | |
2524 | |
2525 /* | |
2526 *----------------------------------------------------------------- | |
2527 * start with a data call | |
2528 *----------------------------------------------------------------- | |
2529 */ | |
2530 #ifdef FAX_AND_DATA | |
2531 | |
2532 case( D_TOC_Data ): | |
2533 | |
2534 switch( ccShrdPrm.CMODmode ) | |
2535 { | |
2536 case( CMOD_MOD_Single ): /* single data call */ | |
2537 pfilled_ctb->rptInd = MNCC_RI_NOT_PRES; | |
2538 | |
2539 pfilled_ctb->BC[0].rate = cmhCC_SelRate( ccShrdPrm.CBSTspeed ); | |
2540 | |
2541 #ifdef FF_FAX | |
2542 if( pT30CmdPrm -> FCLASSclass EQ FCLASS_CLASS_Fax20 ) | |
2543 { | |
2544 pfilled_ctb->BC[0].bearer_serv = MNCC_BEARER_SERV_FAX; | |
2545 pfilled_ctb->BC[0].conn_elem = MNCC_CONN_ELEM_TRANS; | |
2546 pfilled_ctb->BC[0].modem_type = MNCC_MT_NONE; | |
2547 } | |
2548 else | |
2549 #endif /* FF_FAX */ | |
2550 { | |
2551 pfilled_ctb->BC[0].bearer_serv = cmhCC_SelServ( ccShrdPrm.CBSTname ); | |
2552 pfilled_ctb->BC[0].conn_elem = cmhCC_SelCE( ccShrdPrm.CBSTce ); | |
2553 pfilled_ctb->BC[0].modem_type = cmhCC_SelMT ( ccShrdPrm.CBSTspeed ); | |
2554 | |
2555 pfilled_ctb->BC[0].rate_adaption = cmhCC_SelRateAdaption | |
2556 (ccShrdPrm.CBSTspeed); | |
2557 | |
2558 pfilled_ctb->BC[0].transfer_cap = cmhCC_SelTransferCap | |
2559 (ccShrdPrm.CBSTspeed); | |
2560 | |
2561 pfilled_ctb->BC[0].stop_bits = cmhCC_SelStopBit( srcId ); | |
2562 pfilled_ctb->BC[0].data_bits = cmhCC_SelDataBit( srcId ); | |
2563 pfilled_ctb->BC[0].parity = cmhCC_SelParity ( srcId ); | |
2564 } | |
2565 | |
2566 pfilled_ctb->BC[1].rate = MNCC_UR_NOT_PRES; | |
2567 pfilled_ctb->BC[1].bearer_serv = MNCC_BEARER_SERV_NOT_PRES; | |
2568 pfilled_ctb->BC[1].conn_elem = MNCC_CONN_ELEM_NOT_PRES; | |
2569 break; | |
2570 | |
2571 case( CMOD_MOD_VoiceDat ): /* alternating data/voice call */ | |
2572 pfilled_ctb->rptInd = MNCC_RI_CIRCULAR; | |
2573 | |
2574 pfilled_ctb->BC[0].rate = cmhCC_SelRate( ccShrdPrm.CBSTspeed ); | |
2575 pfilled_ctb->BC[0].bearer_serv = cmhCC_SelServ( ccShrdPrm.CBSTname ); | |
2576 pfilled_ctb->BC[0].conn_elem = cmhCC_SelCE( ccShrdPrm.CBSTce ); | |
2577 pfilled_ctb->BC[0].modem_type = cmhCC_SelMT ( ccShrdPrm.CBSTspeed ); | |
2578 | |
2579 pfilled_ctb->BC[0].stop_bits = cmhCC_SelStopBit( srcId ); | |
2580 pfilled_ctb->BC[0].data_bits = cmhCC_SelDataBit( srcId ); | |
2581 pfilled_ctb->BC[0].parity = cmhCC_SelParity ( srcId ); | |
2582 | |
2583 pfilled_ctb->BC[1].rate = MNCC_UR_NOT_PRES; | |
2584 pfilled_ctb->BC[1].bearer_serv = cmhCC_set_speech_serv (pCCCmdPrm); | |
2585 pfilled_ctb->BC[1].conn_elem = MNCC_CONN_ELEM_NOT_PRES; | |
2586 break; | |
2587 | |
2588 case( CMOD_MOD_VoiceFlwdDat ): /* voice followed by data call */ | |
2589 | |
2590 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
2591 return( AT_FAIL ); /* operation not allowed */ | |
2592 | |
2593 case( CMOD_MOD_VoiceFax ): /* alternating fax/voice call */ | |
2594 pfilled_ctb->rptInd = MNCC_RI_CIRCULAR; | |
2595 | |
2596 pfilled_ctb->BC[0].rate = cmhCC_SelRate( ccShrdPrm.CBSTspeed ); | |
2597 pfilled_ctb->BC[0].bearer_serv = MNCC_BEARER_SERV_FAX; | |
2598 pfilled_ctb->BC[0].conn_elem = MNCC_CONN_ELEM_TRANS; | |
2599 pfilled_ctb->BC[0].modem_type = MNCC_MT_NONE; | |
2600 | |
2601 pfilled_ctb->BC[1].rate = MNCC_UR_NOT_PRES; | |
2602 pfilled_ctb->BC[1].bearer_serv = cmhCC_set_speech_serv (pCCCmdPrm); | |
2603 pfilled_ctb->BC[1].conn_elem = MNCC_CONN_ELEM_NOT_PRES; | |
2604 break; | |
2605 | |
2606 default: /* unexpected call mode */ | |
2607 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_DataCorrupt ); | |
2608 return( AT_FAIL ); | |
2609 } | |
2610 break; | |
2611 #endif /* of #ifdef FAX_AND_DATA */ | |
2612 | |
2613 default: /* unexpected call type */ | |
2614 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_DataCorrupt ); | |
2615 return( AT_FAIL ); | |
2616 } | |
2617 | |
2618 return( AT_CMPL ); | |
2619 } | |
2620 | |
2621 #ifdef FF_TTY | |
2622 /* | |
2623 +--------------------------------------------------------------------+ | |
2624 | PROJECT : GSM-PS (6147) MODULE : CMH_CCF | | |
2625 | STATE : code ROUTINE : cmhCC_notifyTTY | | |
2626 +--------------------------------------------------------------------+ | |
2627 | |
2628 PURPOSE : This function converts the TTY activity to the trx state | |
2629 to be provided by '%CTYI: ...'. | |
2630 */ | |
2631 | |
2632 GLOBAL T_ACI_CTTY_TRX cmhCC_getTTYtrx_state (int ttyTrxState) | |
2633 { | |
2634 switch (ttyTrxState) | |
2635 { | |
2636 case TTY_OFF: | |
2637 return CTTY_TRX_Off; | |
2638 case TTY_HCO: | |
2639 return CTTY_TRX_SendOn; | |
2640 case TTY_VCO: | |
2641 return CTTY_TRX_RcvOn; | |
2642 case TTY_ALL: | |
2643 return CTTY_TRX_RcvSendOn; | |
2644 default: | |
2645 break; | |
2646 } | |
2647 return CTTY_TRX_Unknown; | |
2648 } | |
2649 | |
2650 /* | |
2651 +--------------------------------------------------------------------+ | |
2652 | PROJECT : GSM-PS (6147) MODULE : CMH_CCF | | |
2653 | STATE : code ROUTINE : cmhCC_notifyTTY | | |
2654 +--------------------------------------------------------------------+ | |
2655 | |
2656 PURPOSE : This function generates the unsolicited message '%CTYI: ...' | |
2657 for any logical channel having registered for. | |
2658 */ | |
2659 | |
2660 GLOBAL void cmhCC_notifyTTY (T_ACI_CTTY_NEG neg, | |
2661 T_ACI_CTTY_TRX trx) | |
2662 { | |
2663 int i; | |
2664 | |
2665 for (i = CMD_SRC_LCL; i < CMD_SRC_MAX; i++) | |
2666 { | |
2667 if (cmhPrm[i].ccCmdPrm.CTTYmode EQ CTTY_MOD_Enable) | |
2668 { | |
2669 R_AT (RAT_CTYI, (T_ACI_CMD_SRC)i) (neg, trx); | |
2670 } | |
2671 } | |
2672 } | |
2673 #endif /* FF_TTY */ | |
2674 | |
2675 /* | |
2676 +--------------------------------------------------------------------+ | |
2677 | PROJECT : GSM-PS (6147) MODULE : CMH_CCF | | |
2678 | STATE : code ROUTINE : cmhCC_checkALS_Support | | |
2679 +--------------------------------------------------------------------+ | |
2680 | |
2681 PURPOSE : These function checks for ALS support in two steps | |
2682 */ | |
2683 | |
2684 GLOBAL void cmhCC_checkALS_Support() | |
2685 { | |
2686 TRACE_FUNCTION ("cmhCC_checkALS_Support()"); | |
2687 | |
2688 /* Step #1: read CPHS info first */ | |
2689 cmhSIM_ReadTranspEF( CMD_SRC_NONE, | |
2690 AT_CMD_NONE, | |
2691 FALSE, | |
2692 NULL, | |
2693 SIM_CPHS_CINF, | |
2694 0, | |
2695 ACI_CPHS_INFO_SIZE, | |
2696 NULL, | |
2697 cmhCC_checkALS_Support_cb ); | |
2698 } | |
2699 | |
2700 GLOBAL void cmhCC_checkALS_Support_2() | |
2701 { | |
2702 TRACE_FUNCTION ("cmhCC_checkALS_Support_2()"); | |
2703 | |
2704 /* Step #2: then read the actual CSP */ | |
2705 cmhSIM_ReadTranspEF( CMD_SRC_NONE, | |
2706 AT_CMD_NONE, | |
2707 FALSE, | |
2708 NULL, | |
2709 SIM_CPHS_CSP, | |
2710 0, | |
2711 0, | |
2712 NULL, | |
2713 cmhCC_checkALS_Support_cb_2 ); | |
2714 } | |
2715 | |
2716 /* | |
2717 +--------------------------------------------------------------------+ | |
2718 | PROJECT : GSM-PS (6147) MODULE : CMH_CCF | | |
2719 | STATE : code ROUTINE : cmhCC_redialCheck | | |
2720 +--------------------------------------------------------------------+ | |
2721 | |
2722 PURPOSE : This function evaluates conditions for redialling | |
2723 */ | |
2724 | |
2725 GLOBAL void cmhCC_redialCheck(SHORT cId) | |
2726 { | |
2727 T_CC_CALL_TBL *ctbFail = ccShrdPrm.ctb[ccShrdPrm.cIdFail]; | |
2728 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
2729 SHORT error_indication; | |
2730 int i; | |
2731 | |
2732 TRACE_FUNCTION ("cmhCC_redialCheck()"); | |
2733 | |
2734 /* check conditions for error_indication check */ | |
2735 if((rdlPrm.rdlMod EQ AUTOM_REPEAT_ON) AND (rdlPrm.rdlcId EQ NO_ENTRY)) | |
2736 {/* if black list is full no further redial attempts; user has to delete the black list */ | |
2737 #ifdef TI_PS_FF_AT_P_CMD_RDLB | |
2738 if(cmhCC_redialChkBlackl(cId) EQ AT_CMPL) | |
2739 { | |
2740 if(cc_blacklist_ptr->blCount NEQ MAX_NUM_ENTR_BLACK_LIST) | |
2741 { | |
2742 #endif /* TI_PS_FF_AT_P_CMD_RDLB */ | |
2743 if( ccShrdPrm.cIdFail < 0 OR ccShrdPrm.cIdFail > MAX_CALL_NR ) | |
2744 { | |
2745 error_indication = GET_CAUSE_VALUE(CAUSE_MAKE(DEFBY_STD, | |
2746 ORIGSIDE_MS, | |
2747 MNCC_ACI_ORIGINATING_ENTITY, | |
2748 NOT_PRESENT_8BIT)); | |
2749 } | |
2750 else if( GET_CAUSE_VALUE(ctbFail->rejCs) NEQ NOT_PRESENT_8BIT ) | |
2751 { | |
2752 error_indication = GET_CAUSE_VALUE(ctbFail->rejCs); | |
2753 } | |
2754 else if( GET_CAUSE_VALUE(ctbFail->nrmCs) NEQ NOT_PRESENT_8BIT ) | |
2755 { | |
2756 error_indication = GET_CAUSE_VALUE(ctbFail->nrmCs); | |
2757 } | |
2758 else if( GET_CAUSE_VALUE(ctbFail->rslt) NEQ NOT_PRESENT_8BIT ) | |
2759 { | |
2760 error_indication = GET_CAUSE_VALUE(ctbFail->rslt); | |
2761 } | |
2762 else | |
2763 {/* in case network has sent no extended report */ | |
2764 error_indication = GET_CAUSE_VALUE(CAUSE_MAKE(DEFBY_STD, | |
2765 ORIGSIDE_MS, | |
2766 MNCC_ACI_ORIGINATING_ENTITY, | |
2767 NOT_PRESENT_8BIT)); | |
2768 } | |
2769 | |
2770 /* check error_indication (ETSI 2.07, Annex A) and redial counter */ | |
2771 switch (error_indication) | |
2772 { | |
2773 /*** indications of category 1 ***/ | |
2774 case 17: /* user busy */ | |
2775 /*** indications of category 2 ***/ | |
2776 case 18: /* no user responding */ | |
2777 case 19: /* user alterting, no answer */ | |
2778 case 27: /* destination out of order */ | |
2779 case 34: /* no circuit/channel available */ | |
2780 case 41: /* temporary failure */ | |
2781 case 42: /* switching equipment congestion */ | |
2782 case 44: /* requested circuit/channel available */ | |
2783 case 47: /*esources unavailable, unspecified */ | |
2784 | |
2785 /* Implements Measure 197, 198 and 199 */ | |
2786 if( (ctb->rdlCnt >= 4) AND (ctb->rdlCnt < MAX_NUM_REPEAT_ATT) ) | |
2787 { | |
2788 #ifndef _SIMULATION_ | |
2789 ctb->rdlTimIndex = 1; | |
2790 #endif | |
2791 } | |
2792 cmhCC_redialAttempt( cId, ctb->rdlCnt ); | |
2793 /* else : ctb->rdlCnt = MAX_NUM_REPEAT_ATT -> entry is black list */ | |
2794 break; | |
2795 /*** indications of category 3 -> only one redial attempt is allowed ***/ | |
2796 case 28: /* invalid number format */ | |
2797 ctb->rdlCnt = 0; | |
2798 break; /* for incorrect number we do not start redialling */ | |
2799 case 1: /* unassigned (unallocated) number */ | |
2800 case 3: /* no route to destination */ | |
2801 case 22: /* number changed */ | |
2802 case 38: /* network out of order */ | |
2803 if(!ctb->rdlCnt) | |
2804 {/* first redial attempt */ | |
2805 ctb->rdlCnt = MAX_NUM_REPEAT_ATT - 1; | |
2806 rdlPrm.rdlcId = cId; | |
2807 /* 5+5 sec for first (= only) call attempt */ | |
2808 TIMERSTART(ACI_REPEAT_1+ACI_DELAY_TIMER,ACI_REPEAT_HND); | |
2809 for(i = 0; i < CMD_SRC_MAX; i++) | |
2810 { | |
2811 R_AT(RAT_RDL, (T_ACI_CMD_SRC)i)(CALL_ATTEMPT_FAILED); | |
2812 R_AT(RAT_RDL, (T_ACI_CMD_SRC)i)(REDIAL_TIM_START); | |
2813 } | |
2814 } | |
2815 else | |
2816 {/* more than one attempt is not allowed --> entry in blacklist */ | |
2817 ctb->rdlCnt = MAX_NUM_REPEAT_ATT; | |
2818 for(i = 0; i < CMD_SRC_MAX; i++) | |
2819 { | |
2820 R_AT(RAT_RDL,(T_ACI_CMD_SRC) i)(CALL_ATTEMPT_FAILED); | |
2821 } | |
2822 } | |
2823 break; | |
2824 default: | |
2825 ctb->rdlCnt = 0; | |
2826 break; | |
2827 } | |
2828 #ifdef TI_PS_FF_AT_P_CMD_RDLB | |
2829 } | |
2830 #endif /* TI_PS_FF_AT_P_CMD_RDLB */ | |
2831 #ifdef TI_PS_FF_AT_P_CMD_RDLB | |
2832 /* check redial counter against black list: add entry if the list is not full yet */ | |
2833 if(ctb->rdlCnt EQ MAX_NUM_REPEAT_ATT) | |
2834 { | |
2835 if (cc_blacklist_ptr->blCount< MAX_NUM_ENTR_BLACK_LIST) | |
2836 { | |
2837 /* add entry in black list */ | |
2838 cc_blacklist_ptr->blCount++; | |
2839 cc_blacklist_ptr->blNum[cc_blacklist_ptr->blCount-1].numb_len = | |
2840 ctb->cldPty.c_called_num; | |
2841 memcpy(cc_blacklist_ptr->blNum[cc_blacklist_ptr->blCount-1].number, | |
2842 ctb->cldPty.called_num, | |
2843 ctb->cldPty.c_called_num); | |
2844 cc_blacklist_ptr->blNum[cc_blacklist_ptr->blCount-1].type.ton = | |
2845 (T_ACI_TOA_TON)ctb->cldPty.ton; | |
2846 cc_blacklist_ptr->blNum[cc_blacklist_ptr->blCount-1].type.npi = | |
2847 (T_ACI_TOA_NPI)ctb->cldPty.npi; | |
2848 | |
2849 ctb->rdlCnt = 0; /* reset redial counter in call table */ | |
2850 ctb->rdlTimIndex = RDL_TIM_INDEX_NOT_PRESENT; | |
2851 if(cc_blacklist_ptr->blCount EQ MAX_NUM_ENTR_BLACK_LIST) | |
2852 { | |
2853 for(i = 0; i < CMD_SRC_MAX; i++) | |
2854 { | |
2855 R_AT(RAT_RDLB, (T_ACI_CMD_SRC)i)(BLACKLIST_FULL); | |
2856 } | |
2857 } | |
2858 else | |
2859 { | |
2860 for(i = 0; i < CMD_SRC_MAX; i++) | |
2861 { | |
2862 R_AT(RAT_RDLB, (T_ACI_CMD_SRC)i)(ENTRY_BLACKLISTED); | |
2863 } | |
2864 } | |
2865 } | |
2866 } | |
2867 else | |
2868 { | |
2869 return; | |
2870 } | |
2871 } /* End of if (cc_blacklist_ptr->blCount< MAX_NUM_ENTR_BLACK_LIST) */ | |
2872 #ifdef SIM_TOOLKIT | |
2873 cmhSAT_NtwErr( (UBYTE)((GET_CAUSE_VALUE(ccShrdPrm.ctb[cId]->nrmCs) NEQ NOT_PRESENT_8BIT)? | |
2874 (ccShrdPrm.ctb[cId]->nrmCs|0x80) : ADD_NO_CAUSE)); | |
2875 /* | |
2876 * If cId is blacklisted, We need to stop the SAT Max duration timer | |
2877 * and reset the SAT max duration | |
2878 */ | |
2879 if(satShrdPrm.dur) | |
2880 { | |
2881 TIMERSTOP(ACI_SAT_MAX_DUR_HND); | |
2882 satShrdPrm.dur = -1; | |
2883 } | |
2884 #endif /* SIM_TOOKIT */ | |
2885 #endif /* TI_PS_FF_AT_P_CMD_RDLB */ | |
2886 } | |
2887 } | |
2888 | |
2889 #ifdef TI_PS_FF_AT_P_CMD_RDLB | |
2890 /* | |
2891 +--------------------------------------------------------------------+ | |
2892 | PROJECT : GSM-PS (6147) MODULE : CMH_CCF | | |
2893 | STATE : code ROUTINE : cmhCC_redialChkBlackl | | |
2894 +--------------------------------------------------------------------+ | |
2895 | |
2896 PURPOSE : This function checks the new cId against the black list | |
2897 */ | |
2898 | |
2899 GLOBAL T_ACI_RETURN cmhCC_redialChkBlackl(SHORT cId) | |
2900 { | |
2901 UBYTE bl_index = 0; | |
2902 int i; | |
2903 | |
2904 TRACE_FUNCTION ("cmhCC_redialChkBlackl()"); | |
2905 | |
2906 if(cc_blacklist_ptr NEQ NULL) | |
2907 { | |
2908 for(bl_index=0; bl_index<cc_blacklist_ptr->blCount;bl_index++) | |
2909 { | |
2910 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
2911 | |
2912 if (memcmp (cc_blacklist_ptr->blNum[bl_index].number, | |
2913 ctb->cldPty.called_num, | |
2914 ctb->cldPty.c_called_num) EQ 0) | |
2915 { | |
2916 for(i = 0; i < CMD_SRC_MAX; i++) | |
2917 { | |
2918 R_AT(RAT_RDLB, (T_ACI_CMD_SRC)i)(ENTRY_IN_BLACKLIST); | |
2919 } | |
2920 return( AT_FAIL ); | |
2921 } | |
2922 } | |
2923 } | |
2924 return( AT_CMPL ); | |
2925 } | |
2926 #endif /* TI_PS_FF_AT_P_CMD_RDLB */ | |
2927 #if defined(_TARGET_) | |
2928 /* | |
2929 +--------------------------------------------------------------------+ | |
2930 | PROJECT : GSM-PS (6147) MODULE : CMH_CCF | | |
2931 | STATE : code ROUTINE : cmhCC_rd_mode_FFS | | |
2932 +--------------------------------------------------------------------+ | |
2933 | |
2934 PURPOSE : This function writes redial_mode in FFS | |
2935 */ | |
2936 | |
2937 GLOBAL T_ACI_RETURN cmhCC_rd_mode_FFS(T_ACI_CC_REDIAL_MODE rdl_mode, | |
2938 T_ACI_CC_RDL_FFS ffs_mode) | |
2939 { | |
2940 T_ACI_CC_REDIAL_MODE redial_mode; | |
2941 | |
2942 TRACE_FUNCTION ("cmhCC_rd_mode_FFS()"); | |
2943 | |
2944 /* Implements Measure#32: Row 73 */ | |
2945 switch(FFS_mkdir(gsm_com_path)) | |
2946 {/* create/check ffs directory */ | |
2947 case EFFS_OK: | |
2948 case EFFS_EXISTS: | |
2949 break; | |
2950 default: | |
2951 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
2952 return ( AT_FAIL ); | |
2953 } | |
2954 | |
2955 if(ffs_mode EQ WRITE_RDLmode) | |
2956 { | |
2957 /* Implements Measure#32: Row 74 */ | |
2958 if(FFS_fwrite(gsm_com_redialmode_path,&rdl_mode, sizeof(T_ACI_CC_REDIAL_MODE)) NEQ EFFS_OK) | |
2959 { | |
2960 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
2961 return ( AT_FAIL ); | |
2962 } | |
2963 return AT_CMPL; | |
2964 } | |
2965 else if(ffs_mode EQ READ_RDLmode) | |
2966 { | |
2967 /* Implements Measure#32: Row 74 */ | |
2968 FFS_fread(gsm_com_redialmode_path,&redial_mode, sizeof(T_ACI_CC_REDIAL_MODE)); | |
2969 switch(redial_mode) | |
2970 { | |
2971 case AUTOM_REP_NOT_PRESENT: | |
2972 rdlPrm.rdlMod = AUTOM_REPEAT_OFF; | |
2973 return AT_CMPL; | |
2974 case AUTOM_REPEAT_OFF: | |
2975 case AUTOM_REPEAT_ON: | |
2976 rdlPrm.rdlMod = redial_mode; | |
2977 return AT_CMPL; | |
2978 default: | |
2979 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
2980 return ( AT_FAIL ); | |
2981 } | |
2982 } | |
2983 else | |
2984 { | |
2985 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
2986 return ( AT_FAIL ); | |
2987 } | |
2988 } | |
2989 #endif /* _TARGET_ */ | |
2990 | |
2991 /* Implements Measure 197, 198 and 199 */ | |
2992 /* | |
2993 +------------------------------------------------------------------------------ | |
2994 | Function : cmhCC_redialAttempt | |
2995 +------------------------------------------------------------------------------ | |
2996 | Purpose : This Function will Attempt for Redialling. | |
2997 | | |
2998 | Parameters : srcId - AT command source identifier. | |
2999 | rdlCnt - Redial Counter | |
3000 | | |
3001 | Return : void | |
3002 +------------------------------------------------------------------------------ | |
3003 */ | |
3004 | |
3005 LOCAL void cmhCC_redialAttempt( SHORT cId, UBYTE rdlCnt ) | |
3006 { | |
3007 int i; | |
3008 | |
3009 TRACE_FUNCTION ("cmhCC_redialAttempt()"); | |
3010 | |
3011 if(!rdlCnt) | |
3012 { | |
3013 rdlPrm.rdlcId = cId; | |
3014 #ifdef SIM_TOOLKIT | |
3015 if (satShrdPrm.dur NEQ -1) | |
3016 { | |
3017 /* Start the SAT max duration timer before the first redial attempt*/ | |
3018 TIMERSTART(satShrdPrm.dur,ACI_SAT_MAX_DUR_HND); | |
3019 } | |
3020 #endif /* SIM_TOOLKIT */ | |
3021 | |
3022 /* first redial attempt */ | |
3023 TIMERSTART( ACI_REPEAT_1 + ACI_DELAY_TIMER, ACI_REPEAT_HND ); | |
3024 } | |
3025 else if ( rdlCnt < MAX_NUM_REPEAT_ATT ) | |
3026 { | |
3027 rdlPrm.rdlcId = cId; | |
3028 /* from 2nd to 4th redial attempt and from 5th to 10th redial attempt */ | |
3029 #ifdef _SIMULATION_ | |
3030 TIMERSTART( ACI_REPEAT_1, ACI_REPEAT_HND ); | |
3031 #else | |
3032 TIMERSTART( ACI_REPEAT_2_4 + ACI_DELAY_TIMER, ACI_REPEAT_HND ); | |
3033 #endif | |
3034 } | |
3035 else | |
3036 { | |
3037 return; | |
3038 } | |
3039 | |
3040 for(i = 0; i < CMD_SRC_MAX; i++) | |
3041 { | |
3042 R_AT(RAT_RDL, (T_ACI_CMD_SRC)i)(CALL_ATTEMPT_FAILED); | |
3043 R_AT(RAT_RDL, (T_ACI_CMD_SRC)i)(REDIAL_TIM_START); | |
3044 } | |
3045 } | |
3046 | |
3047 | |
3048 | |
3049 /*==== EOF ========================================================*/ | |
3050 |