comparison g23m/condat/ms/src/aci/cmh_ccf.c @ 0:509db1a7b7b8

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