comparison src/g23m-aci/aci/cmh_ccr.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_CCR
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 which are responsible
18 | for the responses of the protocol stack adapter for
19 | call control.
20 +-----------------------------------------------------------------------------
21 */
22
23 #ifndef CMH_CCR_C
24 #define CMH_CCR_C
25 #endif
26
27 /*==== INCLUDES ===================================================*/
28
29 #include "aci_all.h"
30 #include "aci_cmh.h"
31 #include "ati_cmd.h"
32 #include "aci_cmd.h"
33 #include "aci_mem.h"
34 #include "phb.h"
35 #include "l4_tim.h"
36 #include "aci_lst.h"
37
38
39 #ifdef FAX_AND_DATA
40 #include "aci_fd.h"
41 #endif /* of #ifdef FAX_AND_DATA */
42
43 #include "aci.h"
44 #include "psa.h"
45 #include "ksd.h"
46 #include "psa_cc.h"
47 #include "psa_ss.h"
48 #include "psa_util.h"
49 #include "cmh.h"
50 #include "cmh_cc.h"
51 #include "cmh_ss.h"
52
53 #ifdef FF_ATI
54 #include "aci_io.h"
55 #endif /* of #ifdef FF_ATI */
56
57 #ifdef UART
58 #include "dti.h" /* functionality of the dti library */
59 #include "dti_conn_mng.h"
60 #include "dti_cntrl_mng.h"
61 #endif
62
63 #ifdef FAX_AND_DATA
64
65 #include "psa_ra.h"
66 #include "cmh_ra.h"
67 #include "psa_l2r.h"
68 #include "cmh_l2r.h"
69 #include "psa_tra.h"
70
71 #ifdef FF_FAX
72 #include "psa_t30.h"
73 #include "cmh_t30.h"
74 #endif /* FF_FAX */
75
76 #endif /* FAX_AND_DATA */
77
78 #ifdef SIM_TOOLKIT
79 #include "psa_sat.h"
80 #include "cmh_sat.h"
81 #include "psa_sim.h"
82 #endif /* of #ifdef SIM_TOOLKIT */
83
84 #include "aoc.h"
85 #include "audio.h"
86
87 #if defined (FF_WAP) || defined (FF_PPP) || defined (FF_GPF_TCPIP) || defined (FF_SAT_E)
88 #include "wap_aci.h"
89 #include "psa_ppp_w.h"
90 #include "cmh_ppp.h"
91 #endif /* of FF_WAP or FF_PPP || FF_GPF_TCPIP FF_SAT_E */
92
93 #if defined (CO_UDP_IP) || defined (FF_GPF_TCPIP)
94 #include "psa_tcpip.h"
95 #include "cmh_ipa.h"
96 #endif /* CO_UDP_IP || FF_GPF_TCPIP */
97
98 #ifdef FF_GPF_TCPIP
99 #include "dcm_utils.h"
100 #include "dcm_state.h"
101 #include "dcm_env.h"
102 #endif
103 #include "dcm_f.h"
104 #ifdef UART
105 #include "psa_uart.h"
106 #include "cmh_uart.h"
107 #endif /*UART*/
108
109 #ifdef FF_PSI
110 #include "psa_psi.h"
111 #include "cmh_psi.h"
112 #endif /*FF_PSI*/
113
114 #include "cmh_phb.h"
115
116 #include "psa_sim.h"
117 #include "cmh_sim.h"
118
119 /*==== CONSTANTS ==================================================*/
120
121 /*==== TYPES ======================================================*/
122
123 /* Implements Measure 90,91 */
124
125 /*
126 * Conversion Array that convert CSSX codes to CSSI codes.
127 * CSSX_CODE is being used as the index of the array and
128 * CSSI_CODE is being used as the contents of the array.
129 */
130
131 const T_ACI_CSSI_CODE cssx2I_Code_Convert[]=
132 {
133 CSSI_CODE_ForwardedCall,
134 CSSI_CODE_CUGCall,
135 CSSI_CODE_NotPresent,
136 CSSI_CODE_NotPresent,
137 CSSI_CODE_NotPresent,
138 CSSI_CODE_NotPresent,
139 CSSI_CODE_NotPresent,
140 CSSI_CODE_NotPresent,
141 CSSI_CODE_NotPresent,
142 CSSI_CODE_CFUActive,
143 CSSI_CODE_SomeCCFActive,
144 CSSI_CODE_CallWaiting,
145 CSSI_CODE_OutCallsBarred,
146 CSSI_CODE_IncCallsBarred,
147 CSSI_CODE_CLIRSupRej,
148 CSSI_CODE_DeflectedCall
149 };
150
151 /*==== EXPORT =====================================================*/
152
153 /*==== VARIABLES ==================================================*/
154
155 #if defined (FF_WAP) || defined (FF_PPP) || defined (FF_GPF_TCPIP) || defined (FF_SAT_E)
156 ULONG ipAddress;
157
158 GLOBAL SHORT cmhCC_PPP_Established (ULONG ip_address,USHORT max_receive_unit,
159 ULONG dns1, ULONG dns2);
160 GLOBAL SHORT cmhCC_PPP_Terminated (void);
161 #endif
162
163 #ifdef CO_UDP_IP
164 GLOBAL SHORT cmhCC_IPA_Configurated (void);
165 GLOBAL SHORT cmhCC_UDPA_Configurated (void);
166 GLOBAL SHORT cmhCC_UDPA_Deconfigurated (void);
167 #endif /* CO_UDP_IP */
168
169 LOCAL void cmhCC_tstAndUnflag_MPTYCall( SHORT cId,
170 UBYTE srcBuf,
171 UBYTE cmdBuf,
172 T_CC_CMD_PRM *pCCCmdPrm );
173 LOCAL BOOL cmhCC_check_isCallServiced( SHORT cId );
174 LOCAL void cmhCC_Call_Progress_Information( SHORT cId, T_ACI_CPI_MSG msgType, USHORT cause );
175
176 /*==== FUNCTIONS ==================================================*/
177
178 /*
179 +-------------------------------------------------------------------+
180 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
181 | ROUTINE : cmhCC_CallAlerted |
182 +-------------------------------------------------------------------+
183
184 PURPOSE : called party is alerted
185
186 */
187
188 GLOBAL void cmhCC_CallAlerted ( SHORT cId )
189 {
190 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId];
191
192 TRACE_FUNCTION ("cmhCC_CallAlerted()");
193
194 /*
195 *-------------------------------------------------------------------
196 * process event
197 *-------------------------------------------------------------------
198 */
199 if (ctb->prgDesc EQ MNCC_PROG_NOT_PRES)
200 {
201 /* Implements Measure 207 */
202 cmhCC_Call_Progress_Information( cId, CPI_MSG_Alert, ctb->curCs );
203 }
204 return;
205 }
206
207 /*
208 +-------------------------------------------------------------------+
209 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
210 | ROUTINE : cmhCC_CallProceeding |
211 +-------------------------------------------------------------------+
212
213 PURPOSE : call proceed indication
214
215 */
216
217 GLOBAL void cmhCC_CallProceeding ( SHORT cId )
218 {
219 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId];
220 T_ACI_CPI_MSG msgType;
221
222 TRACE_FUNCTION ("cmhCC_CallProceeding()");
223
224 /*
225 *-------------------------------------------------------------------
226 * process event
227 *-------------------------------------------------------------------
228 */
229 switch( ccShrdPrm.msgType )
230 {
231 case( MT_SETUP ): msgType = CPI_MSG_Setup; break;
232 case( MT_DISC ):
233 switch (ctb->calStat)
234 {
235 case NO_VLD_CS:
236 case CS_ACT_REQ:
237 case CS_CPL_REQ:
238 case CS_DSC_REQ:
239 break;
240 default:
241 return;
242 }
243 msgType = CPI_MSG_Disc;
244 break;
245 case( MT_ALRT ): msgType = CPI_MSG_Alert; break;
246 case( MT_PROC ): msgType = CPI_MSG_Proc; break;
247 case( MT_PROGR ): msgType = CPI_MSG_Progr; break;
248 /* case( MT_CONN ): msgType = CPI_MSG_Conn; break; */
249 case( MT_CONN ): return; /* CPI is generated in cmhCC_CallConnected */
250 default: TRACE_EVENT("UNEXP MSG TYPE IN CC SHRD PARM");
251 return;
252 }
253
254 /* ctb->curCs = MNCC_CAUSE_NO_MS_CAUSE; */
255 /* Implements Measure 207 */
256 cmhCC_Call_Progress_Information( cId, msgType, ctb->curCs );
257
258 return;
259 }
260
261 /*
262 +-------------------------------------------------------------------+
263 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
264 | ROUTINE : cmhCC_CallConnected |
265 +-------------------------------------------------------------------+
266
267 PURPOSE : call is connected
268
269 */
270
271 GLOBAL void cmhCC_CallConnected ( SHORT cId )
272 {
273 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId];
274 T_CC_CMD_PRM * pCCCmdPrm; /* points to CC command parameters */
275 CHAR numBuf[MNCC_MAX_CC_CALLING_NUMBER+1]; /* buffers calling number + '\0' */
276 CHAR subBuf[MNCC_SUB_LENGTH+1]; /* buffers subaddress 'subaddress\0' */
277 T_ACI_TOA toaBuf; /* buffers type of address */
278 T_ACI_TOS tosBuf; /* buffers type of subaddress */
279 UBYTE cmdBuf; /* buffers current command */
280 UBYTE srcBuf; /* buffers current command source */
281 T_CC_CALL_TYPE calltype = cmhCC_getcalltype(cId);
282
283 TRACE_FUNCTION ("cmhCC_CallConnected()");
284
285 /* check for command context */
286 switch(ctb->curCmd)
287 {
288 case(AT_CMD_D):
289 case(AT_CMD_A):
290 case(AT_CMD_CHLD):
291 break;
292
293 default:
294 TRACE_EVENT_P1("cmhCC_CallConnected(): wrong command context %d", ctb->curCmd);
295 return;
296 }
297
298 /* call progress information */
299 /* Implements Measure 207 */
300 cmhCC_Call_Progress_Information( cId, CPI_MSG_Conn, ctb->curCs );
301
302 /* process event for D, A and +CHLD command */
303 pCCCmdPrm = &cmhPrm[ctb->curSrc].ccCmdPrm;
304
305 if (ctb->curCmd EQ AT_CMD_D)
306 {
307 /* Check if user allows Connected Line Presentation: FTA 31.1.3.1 */
308 switch (ctb->clgPty.present)
309 {
310 case (MNCC_PRES_PRES_ALLOW): /* presentation allowed FTA 31.1.3.1 */
311 TRACE_EVENT ("cmhCC_CallConnected(): presentation allowed !");
312 break;
313
314 case (MNCC_PRES_NOT_PRES):
315 TRACE_EVENT ("cmhCC_CallConnected(): presentation not present !");
316 break;
317
318 case (MNCC_PRES_PRES_REST): /* presentation restricted FTA 31.1.4.2 procedure 1 */
319 TRACE_EVENT ("cmhCC_CallConnected(): presentation restricted !");
320 /*
321 * R_AT( RAT_COLR, ccShrdPrm.???.???.??? )
322 * ( COLR_STAT_??? );
323 */
324 break;
325
326 case (MNCC_PRES_NUMB_NOT_AVAIL): /* number not available due to interworking FTA 31.1.4.2 procedure 2 */
327 TRACE_EVENT ("cmhCC_CallConnected(): number not available due to interworking !");
328 /*
329 * R_AT( RAT_COLR, ccShrdPrm.???.???.??? )
330 * ( COLR_STAT_??? );
331 */
332 break;
333
334 default:
335 TRACE_EVENT ("[ERR] cmhCC_CallConnected(): pCtbNtry->clgPty.present = UNKNOWN");
336 return;
337
338 }
339
340 if ((ctb->clgPty.present NEQ MNCC_PRES_NOT_PRES) /* any .present indicator received from MSC? */
341 AND (ctb->clgPty.c_num EQ 0) ) /* but no number available? */
342 {
343 ; /* do nothig */
344 }
345 else
346 {
347 /*
348 * This function call (rAT_PlusCOLP) informs MWF/BMI about
349 * presentation of the called number on display.
350 * If MFW did not receive this function call, then it should
351 * not display the number after querying the call state with
352 * qAT_PercentCAL() where it gets the typed in called number, unfortunately
353 */
354 R_AT( RAT_COLP, (T_ACI_CMD_SRC)ctb->curSrc )
355 ( COLP_STAT_NotPresent,
356 psaCC_ctbClrAdr2Num( cId, numBuf, sizeof (numBuf) ),
357 cmhCC_ctbGetClrNumTyp( cId, &toaBuf ),
358 psaCC_ctbClrAdr2Sub( cId, subBuf ),
359 cmhCC_ctbGetClrSubTyp( cId, &tosBuf ),
360 psaCC_ctbGetAlpha( cId) );
361 }
362 }
363
364
365 /* reset CMOD to single mode */
366 ccShrdPrm.CMODmode = CMOD_MOD_Single;
367
368 switch(calltype)
369 {
370 /* Speech Call */
371 case( VOICE_CALL ):
372 cmdBuf = ctb->curCmd;
373 srcBuf = ctb->curSrc;
374
375 /* reset CMOD to single mode */
376 if( ctb->BC[1].bearer_serv NEQ MNCC_BEARER_SERV_NOT_PRES )
377 {
378 ccShrdPrm.CMODmode = CMOD_MOD_Single;
379 }
380
381 /*
382 * check if connect is expected
383 */
384 if( cmhCC_tstAndUnflagCall( cId, &(pCCCmdPrm -> mltyCncFlg)))
385 {
386 if( pCCCmdPrm -> mltyCncFlg EQ 0 ) /* if last call */
387 {
388
389 #ifdef SIM_TOOLKIT
390 if( ctb->SATinv )
391 {
392 cmhSAT_CallCncted();
393 ctb->SATinv = FALSE; /* unsent */
394 }
395 #endif /* SIM_TOOLKIT */
396 if(!cmhCC_atdsendok(cId)) /* if OK hasn't been sent right after MNCC_SETUP_REQ, then send it now */
397 {
398 /* needed for RAT_OK in MFW... Temp until tasks are separated */
399 cmhCC_PrepareCmdEnd (cId, NULL, NULL);
400
401 R_AT( RAT_OK, (T_ACI_CMD_SRC)srcBuf ) ( cmdBuf );
402 }
403
404 /* log result */
405 cmh_logRslt ( (T_ACI_CMD_SRC)srcBuf, RAT_OK,(T_ACI_AT_CMD)cmdBuf, (SHORT)(cId+1),
406 BS_SPEED_NotPresent, CME_ERR_NotPresent );
407 }
408 }
409 cmhCC_PrepareCmdEnd (cId, NULL, NULL);
410 break;
411
412 #if defined (FAX_AND_DATA) AND defined (DTI)
413
414 /* in case of a supported data call */
415 case(TRANS_CALL):
416 case(NON_TRANS_CALL):
417 case(FAX_CALL):
418 #ifdef FF_PPP
419 /* PPP call initialisation (AAA - PPP - L2R) */
420 case(PPP_CALL):
421 #endif /* FF_PPP */
422 /* wait for TCH if not assigned */
423 if( ccShrdPrm.TCHasg )
424 {
425 /* activate RA connection: in case of failure clear call ! */
426 ccShrdPrm.datStat = DS_ACT_REQ;
427
428 if (cmhRA_Activate( (T_ACI_CMD_SRC)ctb->curSrc, (T_ACI_AT_CMD)ctb->curCmd, cId ) NEQ AT_EXCT)
429 {
430 TRACE_EVENT("RA ACTIVATION FAILURE -> DISC CALL");
431 ccShrdPrm.datStat = DS_IDL;
432 ctb->nrmCs = MNCC_CAUSE_CALL_CLEAR;
433 psaCC_ClearCall (cId);
434 #if defined (SIM_TOOLKIT) AND defined (FF_SAT_E)
435 /* check impact for SAT commands */
436 cmhSAT_OpChnCSDDown( cId, TPL_NONE );
437 #endif /* SIM TOOLKIT AND FF_SAT_E */
438 }
439 }
440 break;
441
442 #if defined(CO_UDP_IP) OR defined(FF_GPF_TCPIP)
443 #ifdef CO_UDP_IP
444 case(UDPIP_CALL):
445 #endif
446 #ifdef FF_GPF_TCPIP
447 case(TCPIP_CALL):
448 #endif
449 /* wait for TCH if not assigned */
450 if( ccShrdPrm.TCHasg )
451 {
452 if (wap_state NEQ Wap_Not_Init) /* release call */
453 {
454 TRACE_EVENT("FATAL ERROR in cmhCC_CallConnected: WAP Call already in process");
455 ctb->nrmCs = MNCC_CAUSE_CALL_CLEAR;
456 psaCC_ClearCall (cId);
457 #if defined (SIM_TOOLKIT) AND defined (FF_SAT_E)
458 cmhSAT_OpChnCSDDown( cId, UDP );
459 #endif /* SIM TOOLKIT AND FF_SAT_E */
460 break;
461 }
462 else
463 {
464 TRACE_EVENT("WAP call initialisation");
465 #if defined (SIM_TOOLKIT) AND defined (FF_SAT_E)
466 if( cmhSAT_OpChnChckCSD(UDP) )
467 {
468 psaTCPIP_Activate(ctb->curSrc, 0,
469 cId,
470 TCPIP_ACT_OPTION_V4 | TCPIP_ACT_OPTION_UDP,
471 TCPIP_CONNECTION_TYPE_CSD_WAP,
472 cmhSAT_OpChnUDPActiveCsd) ;
473 }
474 else
475 #endif /* SIM TOOLKIT AND FF_SAT_E */
476 {
477 if(is_gpf_tcpip_call())
478 {
479 psaTCPIP_Activate(ctb->curSrc, 0 /* Change this! */,
480 cId,
481 TCPIP_ACT_OPTION_V4 | TCPIP_ACT_OPTION_TCPIP,
482 TCPIP_CONNECTION_TYPE_CSD_WAP,
483 psaTCPIP_act_csd_callback) ;
484 }
485 else
486 {
487 psaTCPIP_Activate(ctb->curSrc, 0 /* Change this! */,
488 cId,
489 TCPIP_ACT_OPTION_V4 | TCPIP_ACT_OPTION_UDP,
490 TCPIP_CONNECTION_TYPE_CSD_WAP,
491 psaTCPIP_act_csd_callback) ;
492 }
493 }
494 }
495 }
496 break;
497 #endif /* defined(WAP) OR defined(FF_GPF_TCPIP) */
498
499 /* in case of an unsupported data call */
500 case(UNSUP_DATA_CALL):
501 TRACE_EVENT("UNSUPPORTED DATA CALL -> DISC CALL");
502 ctb->nrmCs = MNCC_CAUSE_CALL_CLEAR;
503 psaCC_ClearCall (cId);
504 #if defined (SIM_TOOLKIT) AND defined (FF_SAT_E)
505 /* check impact for SAT commands */
506 cmhSAT_OpChnCSDDown( cId, TPL_NONE );
507 #endif /* SIM TOOLKIT AND SAT_SAT_E */
508 break;
509
510 #endif /* of #ifdef FAX_AND_DATA */
511
512 default:
513 TRACE_ERROR("Wrong call type");
514 }
515 }
516
517 /*
518 +-------------------------------------------------------------------+
519 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
520 | ROUTINE : process_CHLDaddInfo |
521 +-------------------------------------------------------------------+
522
523 PURPOSE : Local function: processes parameter CHLDaddInfo (continue action that
524 had to wait for a call to be connected first).
525 */
526 /* Held call is being disconnected */
527 #define DISCONNECT_HELD (0)
528 /* Call is being put on hold */
529 #define CALL_HELD (1)
530 /* Multyparty call is being put on hold */
531 #define MTPTY_HELD (2)
532
533 LOCAL void process_CHLDaddInfo( UBYTE srcId, UBYTE context )
534 {
535 /* param context allows to differentiate some special case */
536 SHORT addId;
537 T_CC_CMD_PRM *pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm;
538
539 TRACE_FUNCTION("process_CHLDaddInfo( )");
540
541 for( addId = 0; !((pCCCmdPrm -> mltyCncFlg >> addId) & 0x01); addId++ )
542 ;
543
544 switch( CHLDaddInfo )
545 {
546 case( CHLD_ADD_INFO_ACC_CAL ):
547 cmhCC_AcceptCall(addId, (T_ACI_CMD_SRC)srcId, AT_CMD_CHLD);
548 return;
549
550 case (CHLD_ADD_INFO_DIAL_CAL):
551 cmhCC_NewCall(addId, (T_ACI_CMD_SRC)srcId, AT_CMD_D);
552 return;
553
554 case( CHLD_ADD_INFO_RTV_CAL ):
555 if(context NEQ CALL_HELD)
556 {
557 cmhCC_RetrieveCall(addId, (T_ACI_CMD_SRC)srcId);
558 return;
559 }
560 break;
561
562 case (NO_CHLD_ADD_INFO):
563 if(context EQ DISCONNECT_HELD)
564 {
565 return; /* May happen for CCBS recall, disconnecting the active call */
566 }
567 break;
568 }
569
570 TRACE_EVENT("UNEXP ADD CHLD INFO");
571 }
572
573 /*
574 +-------------------------------------------------------------------+
575 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
576 | ROUTINE : cmhCC_CallDisconnected |
577 +-------------------------------------------------------------------+
578
579 PURPOSE : call is disconnected: process event for D and A command, abort command or no command
580 */
581
582 #ifdef SIM_TOOLKIT
583 LOCAL void cmhCC_CallDisc_whiledialling_sat(SHORT cId, BOOL *send_atresult)
584 {
585 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId];
586 UBYTE network_cause;
587
588 if( !ctb->SATinv )
589 {
590 return;
591 }
592
593 TRACE_FUNCTION("cmhCC_CallDisc_whiledialling_sat");
594
595 switch(ctb->curCmd)
596 {
597 case( AT_CMD_A ):
598 /* if connect is expected */
599 if( cmhPrm[ctb->curSrc].ccCmdPrm.mltyCncFlg NEQ 0 )
600 {
601 if( ctb->SATinv & SAT_REDIAL )
602 {
603 ctb->calStat = CS_SAT_REQ;
604 return;
605 }
606
607 /* return network error cause GSM 11.14 / 12.12.3 */
608 if(GET_CAUSE_VALUE(ctb->nrmCs) EQ NOT_PRESENT_8BIT)
609 {
610 network_cause = ADD_NO_CAUSE;
611 }
612 else
613 network_cause = GET_CAUSE_VALUE(ctb->nrmCs)|0x80;
614
615 *send_atresult = cmhSAT_NtwErr(network_cause);
616 }
617 break;
618
619 case( AT_CMD_ABRT ):
620 /* if disconnect is expected */
621 if( cmhPrm[ctb->curSrc].ccCmdPrm.mltyDscFlg NEQ 0 )
622 {
623 cmhSAT_UserClear();
624 }
625 break;
626 #ifdef FF_SAT_E
627 default:
628 cmhSAT_OpChnCSDDown( cId, TPL_DONT_CARE );
629 break;
630 #endif /* FF_SAT_E */
631 }
632 }
633 #endif /*#ifdef SIM_TOOLKIT*/
634 /*
635 +------------------------------------------------------------------------------
636 | Function : cmhCC_CallDisc_connectingphase
637 +------------------------------------------------------------------------------
638 | Description : This function checks on call type and disconnects the
639 | different calltypes.
640 |
641 | Parameters : call id
642 |
643 | Return :
644 |
645 +------------------------------------------------------------------------------
646 */
647
648 LOCAL void cmhCC_CallDisc_connectingphase ( SHORT cId )
649 {
650 T_CC_CMD_PRM * pCCCmdPrm; /* points to CC command parameters */
651 T_CC_CALL_TYPE calltype = cmhCC_getcalltype(cId);
652 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId];
653 BOOL atRslt = TRUE; /* flags to send a AT result code */
654
655 TRACE_FUNCTION("cmhCC_CallDisc_connectingphase");
656
657 pCCCmdPrm = &cmhPrm[ctb->curSrc].ccCmdPrm;
658
659 /* reset CMOD to single mode */
660 ccShrdPrm.CMODmode = CMOD_MOD_Single;
661
662 #ifdef SIM_TOOLKIT
663 /* handling of SAT invoked call */
664 cmhCC_CallDisc_whiledialling_sat(cId, &atRslt);
665 #endif /* SIM_TOOLKIT */
666
667 /* Unflag Multiconnect/disconnect Flags */
668 if( ctb->curSrc NEQ CMD_SRC_NONE )
669 {
670 cmhCC_tstAndUnflagCall( cId,
671 &pCCCmdPrm->mltyCncFlg );
672 cmhCC_tstAndUnflagCall( cId,
673 &pCCCmdPrm->mltyDscFlg );
674 }
675
676 /* CCBS handling */
677 if( ctb->curCmd EQ AT_CMD_D AND
678 ctb->CCBSstat EQ CCBSS_PSSBL )
679 {
680 cmhrat_ccbs( CMD_SRC_MAX, CCBS_IND_Possible,
681 CCBS_STAT_NotPresent, NULL );
682 }
683
684 switch( calltype )
685 {
686 case( VOICE_CALL ): /* voice call */
687 /* CSSU indications handling */
688 if( ctb->calStat EQ CS_HLD )
689 {
690 if( ctb->curCmd NEQ AT_CMD_NONE )
691 {
692 send_CSSX_notification(cId,
693 CSSX_CODE_HeldCallRel,
694 ACI_NumParmNotPresent,
695 NULL, NULL, NULL, NULL);
696 }
697 }
698 /* Check for CHLDmode and if all calls are disconnected send
699 OK to the terminal and reset CHLDmode */
700 if (pCCCmdPrm->CHLDmode EQ CHLD_MOD_Ect AND
701 (pCCCmdPrm->mltyCncFlg EQ 0) AND
702 (pCCCmdPrm->mltyDscFlg EQ 0))
703 {
704 pCCCmdPrm->CHLDmode = CHLD_MOD_NotPresent;
705 R_AT( RAT_OK, (T_ACI_CMD_SRC)ctb->curSrc ) ( AT_CMD_CHLD );
706
707 /* log result */
708 cmh_logRslt ( (T_ACI_CMD_SRC)ctb->curSrc, RAT_OK,
709 AT_CMD_CHLD, (SHORT)(cId+1),BS_SPEED_NotPresent, CME_ERR_NotPresent );
710 }
711 break;
712
713 #if defined (FAX_AND_DATA) AND defined (DTI)
714 case(TRANS_CALL):
715 if( ccShrdPrm.datStat NEQ DS_IDL )
716 {
717 ccShrdPrm.datStat = DS_STOP_REQ;
718 cmhTRA_Deactivate ();
719 return;
720 }
721 break;
722
723 case(NON_TRANS_CALL):
724 if( ccShrdPrm.datStat NEQ DS_IDL )
725 {
726 ccShrdPrm.datStat = DS_STOP_REQ;
727 cmhL2R_Deactivate ();
728 return;
729 }
730 break;
731
732 #ifdef FF_FAX
733 case( FAX_CALL ):
734 if( ccShrdPrm.datStat NEQ DS_IDL )
735 {
736 ccShrdPrm.datStat = DS_STOP_REQ;
737 cmhT30_Deactivate ();
738 return;
739 }
740 break;
741 #endif /* FF_FAX */
742
743 #ifdef CO_UDP_IP
744 case(UDPIP_CALL):
745 /* check if a UDP/IP call is in process... If yes then end call */
746 if (ccShrdPrm.datStat NEQ DS_IDL)
747 {
748 ccShrdPrm.datStat = DS_STOP_REQ;
749
750 /* Check command context to know if lower layers of PPP already are down or not */
751 if(ctb->curCmd EQ AT_CMD_NONE OR
752 ctb->curCmd EQ AT_CMD_D )
753 {
754 /* If PPP connected - send terminate request to PPP */
755 if(pppShrdPrm.state EQ PPP_ESTABLISHED)
756 {
757 cmhPPP_Terminate(DWN);
758 }
759 return;
760 }
761 }
762 break;
763 #endif /* CO_UDP_IP */
764
765 #endif /* of #ifdef FAX_AND_DATA */
766 }
767
768 /* Command is done: send response to user if not suppressed */
769 /* if(atRslt) cmhCC_SndDiscRsn( cId ); */ /* to pass 26.8.1.2.8.1 */
770 }
771
772 LOCAL void call_disconnected_data_call(T_CC_CALL_TYPE calltype, SHORT cId)
773 {
774 TRACE_FUNCTION("call_disconnected_data_call");
775
776 /* Local disconnection for PPP if peer shuts down the line
777 instead of normal PPP shutdown */
778 switch( calltype )
779 {
780 #if defined (FAX_AND_DATA) AND defined (DTI)
781 /* check if a WAP call is in process... If yes then end call */
782 #if defined(CO_UDP_IP) || defined(FF_PPP)
783
784 #ifdef CO_UDP_IP
785 case(UDPIP_CALL):
786 #endif /* CO_UDP_IP */
787
788 #if defined(FF_GPF_TCPIP)
789 case (TCPIP_CALL):
790 #endif /* FF_GPF_TCPIP */
791 #ifdef FF_PPP
792 case PPP_CALL:
793 pppShrdPrm.is_PPP_CALL = FALSE;
794 TRACE_EVENT ("is_PPP_CALL resetted");
795 #endif /* FF_PPP */
796 if (ccShrdPrm.datStat NEQ DS_IDL)
797 {
798 ccShrdPrm.datStat = DS_STOP_REQ;
799
800 /* Only local disconnection is possible in this case, the call is already disconnected !
801 if(pppShrdPrm.state EQ PPP_ESTABLISHED)
802 cmhPPP_Terminate(UP); */
803
804 if((pppShrdPrm.state EQ PPP_ESTABLISHED) OR
805 (pppShrdPrm.state EQ PPP_ESTABLISH) OR
806 (pppShrdPrm.state EQ PPP_TERMINATE))
807 {
808 cmhPPP_Terminate(DWN);
809 }
810 else if (wap_state > Wap_Not_Init AND
811 wap_state <= UDPA_Deactivation)
812 {
813 cmhPPP_Terminated(); /* Trigger termination of TCPIP if PPP did not yet start (ACI-FIX-9317)*/
814 }
815 }
816 break;
817 #endif /* of WAP || FF_PPP || SAT E */
818
819 case(TRANS_CALL):
820 case(NON_TRANS_CALL):
821 if( ccShrdPrm.datStat NEQ DS_IDL )
822 {
823 ccShrdPrm.datStat = DS_STOP_REQ;
824 if(calltype EQ TRANS_CALL)
825 {
826 cmhTRA_Deactivate ();
827 }
828 else
829 {
830 cmhL2R_Deactivate ();
831 }
832 }
833 break;
834 #endif /* FAX_AND_DATA */
835
836 default:
837 break;
838 } /* end switch */
839 } /* end switch */
840
841 LOCAL void cmhCC_CallDisc_userinitiated ( SHORT cId )
842 {
843 T_CC_CMD_PRM * pCCCmdPrm; /* points to CC command parameters */
844 T_CC_CALL_TYPE calltype = cmhCC_getcalltype(cId);
845 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId];
846 #ifdef FF_PSI
847 T_ACI_DTI_PRC_PSI *src_infos = NULL;
848 #endif /*FF_PSI*/
849 UBYTE cmdBuf; /* buffers current command */
850 UBYTE srcBuf; /* buffers current command source */
851 BOOL dtr_clearcall = FALSE;
852
853 TRACE_FUNCTION("cmhCC_CallDisc_userinitiated");
854
855 /* process event for H and +CHUP command */
856 pCCCmdPrm = &cmhPrm[ctb->curSrc].ccCmdPrm;
857
858 /* reset CMOD to single mode */
859 ccShrdPrm.CMODmode = CMOD_MOD_Single;
860
861 call_disconnected_data_call(calltype, cId);
862
863 cmhCC_PrepareCmdEnd (cId, &cmdBuf, &srcBuf);
864
865 /* if ATH before the call is connected, the flag must be cleared */
866 cmhCC_tstAndUnflagCall (cId, &(pCCCmdPrm -> mltyCncFlg));
867
868 /* check if disconnect is expected */
869 if( cmhCC_tstAndUnflagCall( cId, &(pCCCmdPrm -> mltyDscFlg)))
870 {
871 #if defined (FF_WAP) || defined (FF_SAT_E)
872 /* Check if the WAP stack is down */
873 if((pCCCmdPrm -> mltyDscFlg EQ 0) AND
874 (ccShrdPrm.wapStat EQ CC_WAP_STACK_DOWN))
875 #else
876 if( pCCCmdPrm -> mltyDscFlg EQ 0 )
877 #endif /* WAP || SAT E */
878 /****************/
879 /* if last call */
880 /****************/
881 {
882 #ifdef SIM_TOOLKIT
883 if( ctb->SATinv )
884 {
885 cmhSAT_StartPendingCall( );
886 }
887 else
888 #endif /* SIM_TOOLKIT */
889 {
890 if (cmdBuf EQ AT_CMD_Z)
891 {
892 cmh_Reset ( (T_ACI_CMD_SRC)srcBuf, TRUE );
893 R_AT(RAT_Z, (T_ACI_CMD_SRC)srcBuf)();
894 }
895 #if defined (FF_PSI) AND defined (DTI)
896 src_infos = find_element (psi_src_params, srcBuf, cmhPSItest_srcId);
897 if (src_infos EQ NULL)
898 #endif /*FF_PSI*/
899 #ifdef UART
900 {
901 if (uartShrdPrm.dtr_clearcall EQ TRUE)
902 {
903 uartShrdPrm.dtr_clearcall = FALSE;
904 dtr_clearcall = TRUE;
905 }
906 }
907 #endif /*UART*/
908 #if defined (FF_PSI) AND defined (DTI)
909 else if (psiShrdPrm.dtr_clearcall EQ TRUE)
910 {
911 psiShrdPrm.dtr_clearcall = FALSE;
912 dtr_clearcall = TRUE;
913 }
914 #endif /*FF_PSI*/
915 /* To avoid the redudancy of the code */
916 /* If UART and PSI is disabled, still OK has to be sent to MMI */
917 if (dtr_clearcall)
918 {
919 R_AT( RAT_NO_CARRIER,(T_ACI_CMD_SRC)srcBuf ) ( cmdBuf, cId+1 );
920 cmh_logRslt ( (T_ACI_CMD_SRC)srcBuf,
921 RAT_NO_CARRIER, (T_ACI_AT_CMD)cmdBuf, (SHORT)(cId+1), BS_SPEED_NotPresent, CME_ERR_NotPresent );
922 }
923 else
924 {
925 R_AT( RAT_OK, (T_ACI_CMD_SRC)srcBuf ) ( cmdBuf );
926 /* log result */
927 cmh_logRslt ( (T_ACI_CMD_SRC)srcBuf,
928 RAT_OK, (T_ACI_AT_CMD)cmdBuf, (SHORT)(cId+1), BS_SPEED_NotPresent,CME_ERR_NotPresent );
929 }
930 }
931 }
932 }
933
934 /* inform call owner about disconnect */
935 if( srcBuf EQ ctb->calOwn
936 #ifdef SIM_TOOLKIT
937 AND
938 !ctb->SATinv )
939 #else
940 )
941 #endif
942 {
943 /* do nothing: owner knows already... */
944 /* EXCEPT if !ctb->SATinv: a SAT call setup has been started, and all previous
945 calls had to be disconnected (because of SAT command qualifer) */
946 }
947 else
948 {
949 R_AT( RAT_NO_CARRIER, (T_ACI_CMD_SRC)ctb->calOwn ) ( AT_CMD_NONE, cId+1 );
950 cmh_logRslt ( (T_ACI_CMD_SRC)srcBuf, RAT_NO_CARRIER, (T_ACI_AT_CMD)cmdBuf,
951 (SHORT)(cId+1), BS_SPEED_NotPresent, CME_ERR_NotPresent);
952 }
953 }
954
955 /* process disconnection of an held call: +CHLD command context */
956 LOCAL void cmhCC_CallDisc_heldcall ( SHORT cId )
957 {
958 T_CC_CMD_PRM * pCCCmdPrm; /* points to CC command parameters */
959 T_CC_CALL_TYPE calltype = cmhCC_getcalltype(cId);
960 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId];
961 UBYTE cmdBuf; /* buffers current command */
962 UBYTE srcBuf; /* buffers current command source */
963 UBYTE cmd_id = 0; /* Command scr id */
964
965 TRACE_FUNCTION("cmhCC_CallDisc_heldcall");
966
967 pCCCmdPrm = &cmhPrm[ctb->curSrc].ccCmdPrm;
968
969 cmhCC_PrepareCmdEnd (cId, &cmdBuf, &srcBuf);
970
971 if( pCCCmdPrm -> mltyDscFlg EQ 0 AND
972 pCCCmdPrm -> mltyCncFlg EQ 0 ) /* if last call */
973 {
974 R_AT( RAT_OK, (T_ACI_CMD_SRC)srcBuf ) ( cmdBuf );
975
976 /* log result */
977 cmh_logRslt ( (T_ACI_CMD_SRC)srcBuf, RAT_OK,
978 (T_ACI_AT_CMD)cmdBuf, (SHORT)(cId+1), BS_SPEED_NotPresent, CME_ERR_NotPresent );
979 }
980 /* check if disconnect is expected */
981 else if( cmhCC_tstAndUnflagCall( cId, &(pCCCmdPrm -> mltyDscFlg)))
982 {
983 if( pCCCmdPrm -> CHLDmode EQ CHLD_MOD_RelActAndAcpt AND
984 pCCCmdPrm -> mltyCncFlg AND pCCCmdPrm -> mltyDscFlg EQ 0 )
985 {
986 process_CHLDaddInfo( srcBuf, DISCONNECT_HELD );
987 }
988 else if( pCCCmdPrm -> CHLDmode EQ CHLD_MOD_Ect )
989 {
990 cmhCC_tstAndUnflagCall( cId, &(pCCCmdPrm -> mltyCncFlg)); /* now disconnected */
991 }
992
993 if( pCCCmdPrm -> mltyDscFlg EQ 0 AND
994 pCCCmdPrm -> mltyCncFlg EQ 0 ) /* if last call */
995 {
996 /* Reset the CHLDmode to default value */
997 if( pCCCmdPrm -> CHLDmode EQ CHLD_MOD_Ect )
998 {
999 pCCCmdPrm -> CHLDmode = CHLD_MOD_NotPresent;
1000 }
1001 R_AT( RAT_OK, (T_ACI_CMD_SRC)srcBuf ) ( cmdBuf );
1002
1003 /* log result */
1004 cmh_logRslt ( (T_ACI_CMD_SRC)srcBuf, RAT_OK,
1005 (T_ACI_AT_CMD)cmdBuf, (SHORT)(cId+1),BS_SPEED_NotPresent, CME_ERR_NotPresent );
1006 }
1007 }
1008 /* check if disconnect is unexpected */
1009 else if( cmhCC_tstAndUnflagCall( cId, &(pCCCmdPrm -> mltyCncFlg)))
1010 {
1011 if( pCCCmdPrm -> CHLDmode EQ CHLD_MOD_HldActAndAcpt AND
1012 pCCCmdPrm -> mltyCncFlg AND pCCCmdPrm -> mltyDscFlg EQ 0 )
1013 {
1014 process_CHLDaddInfo( srcBuf, DISCONNECT_HELD );
1015 }
1016 else
1017 {
1018 pCCCmdPrm -> mltyCncFlg = 0; /* unflag calls */
1019
1020 R_AT( RAT_CME, (T_ACI_CMD_SRC)srcBuf ) ( cmdBuf, CME_ERR_NotPresent );
1021
1022 /* log result */
1023 cmh_logRslt ( (T_ACI_CMD_SRC)srcBuf, RAT_CME, (T_ACI_AT_CMD)cmdBuf,
1024 -1, BS_SPEED_NotPresent, CME_ERR_NotPresent );
1025 }
1026 }
1027
1028 /* inform all the sources about call disconnect */
1029 for( cmd_id = 0; cmd_id < CMD_SRC_MAX; cmd_id++ )
1030 {
1031 R_AT( RAT_NO_CARRIER, cmd_id )( AT_CMD_NONE, cId+1 );
1032 }
1033 }
1034
1035 /* process event for the +CTFR command.*/
1036 LOCAL void cmhCC_CallDisc_transferedcall ( SHORT cId )
1037 {
1038 T_CC_CMD_PRM *pCCCmdPrm; /* points to CC command parameters */
1039 T_CC_CALL_TYPE calltype = cmhCC_getcalltype(cId);
1040 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId];
1041 UBYTE cmdBuf; /* buffers current command */
1042 UBYTE srcBuf; /* buffers current command source */
1043 RAT_ID rat_id;
1044 T_ACI_CME_ERR cme_err;
1045
1046 TRACE_FUNCTION("cmhCC_CallDisc_transferedcall");
1047
1048 /* Get a pointer to the appropriate CC call table entry */
1049 pCCCmdPrm = &cmhPrm[ctb->curSrc].ccCmdPrm;
1050
1051 /* End of command execution here */
1052 cmhCC_PrepareCmdEnd (cId, &cmdBuf, &srcBuf);
1053
1054 (void)cmhCC_tstAndUnflagCall( cId, &(pCCCmdPrm -> mltyDscFlg));
1055
1056 switch (ctb->CDStat)
1057 {
1058 case CD_Succeeded:
1059 rat_id = RAT_OK;
1060 cme_err = CME_ERR_NotPresent;
1061 break;
1062
1063 case CD_Requested: /* No answer from the network */
1064 rat_id = RAT_CME;
1065 cme_err = CME_ERR_Timeout;
1066 break;
1067
1068 case CD_Failed: /* SS transaction failed */
1069 rat_id = RAT_CME;
1070 cme_err = CME_ERR_OpNotSupp;
1071 break;
1072
1073 default: /* Unexpected here */
1074 rat_id = RAT_CME;
1075 cme_err = CME_ERR_Unknown;
1076 break;
1077 }
1078
1079 if(rat_id EQ RAT_OK)
1080 {
1081 R_AT( RAT_OK, (T_ACI_CMD_SRC)srcBuf ) ( cmdBuf );
1082 }
1083 else if(rat_id EQ RAT_CME)
1084 {
1085 R_AT( RAT_CME, (T_ACI_CMD_SRC)srcBuf ) ( cmdBuf, cme_err );
1086 }
1087 cmh_logRslt( (T_ACI_CMD_SRC)srcBuf, rat_id, (T_ACI_AT_CMD)cmdBuf,
1088 (SHORT)(cId+1), BS_SPEED_NotPresent,cme_err );
1089
1090 ctb->CDStat = NO_VLD_CD;
1091 }
1092
1093 GLOBAL void cmhCC_CallDisconnected ( SHORT cId )
1094 {
1095 #if defined(FF_GPF_TCPIP)
1096 T_CC_CALL_TYPE calltype = cmhCC_getcalltype(cId);
1097 #endif /* FF_GPF_TCPIP */
1098 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId];
1099
1100 TRACE_FUNCTION ("cmhCC_CallDisconnected()");
1101
1102 /* inform advice of charge module */
1103 aoc_info (cId, AOC_STOP_TIME);
1104
1105 #if defined(FF_GPF_TCPIP)
1106 /* Needed if user stops call setup before app got connection conf */
1107 if (calltype EQ TCPIP_CALL)
1108 {
1109 T_DCM_STATUS_IND_MSG msg;
1110 msg.hdr.msg_id = DCM_NEXT_CMD_STOP_MSG;
1111 msg.result = DCM_PS_CONN_BROKEN;
1112 dcm_send_message(msg, DCM_SUB_WAIT_SATDN_CNF);
1113 }
1114 #endif /* FF_GPF_TCPIP */
1115
1116 /*
1117 *----------------------------------------------------------------
1118 * call progress information
1119 *----------------------------------------------------------------
1120 */
1121 /* Implements Measure 207 */
1122 cmhCC_Call_Progress_Information( cId, CPI_MSG_Disc, ctb->curCs );
1123
1124 /*************************
1125 call was not serviced yet
1126 ***************************/
1127 /* Implements Measure 32 */
1128 if (cmhCC_check_isCallServiced( cId ) EQ TRUE )
1129 {
1130 return;
1131 }
1132
1133 /*************************
1134 check for command context
1135 ***************************/
1136 switch( ctb->curCmd )
1137 {
1138 case( AT_CMD_NONE ):
1139 case( AT_CMD_A ):
1140 case( AT_CMD_D ):
1141 case( AT_CMD_ABRT ):
1142 cmhCC_CallDisc_connectingphase(cId);
1143 break;
1144
1145 case( AT_CMD_H ):
1146 case( AT_CMD_Z ):
1147 case( AT_CMD_CHUP ):
1148
1149 #ifdef FF_FAX
1150 case( AT_CMD_FKS ):
1151 case( AT_CMD_FDT ):
1152 case( AT_CMD_FDR ):
1153 #endif /* FF_FAX */
1154
1155 cmhCC_CallDisc_userinitiated(cId);
1156 break;
1157
1158 case( AT_CMD_CHLD ):
1159 cmhCC_CallDisc_heldcall(cId);
1160 break;
1161
1162 case( AT_CMD_CTFR ):
1163 cmhCC_CallDisc_transferedcall(cId);
1164 break;
1165 } /* switch */
1166
1167 /* PATCH BE 03.07.00
1168 * DO NOT declare the call table entry as unused:
1169 do not free call table at this time then every second MTC will fail if early
1170 assignment is used. */
1171
1172 return;
1173 }
1174
1175 /*
1176 +-------------------------------------------------------------------+
1177 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
1178 | ROUTINE : cmhCC_CallReleased |
1179 +-------------------------------------------------------------------+
1180
1181 PURPOSE : call is released
1182
1183 */
1184
1185 GLOBAL void cmhCC_CallReleased ( SHORT cId )
1186 {
1187 UBYTE cmdBuf; /* buffers current command */
1188 UBYTE srcBuf; /* buffers current command source */
1189 T_CC_CMD_PRM *pCCCmdPrm; /* points to CC command parameters */
1190 T_CC_CALL_TYPE calltype = cmhCC_getcalltype(cId);
1191 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId];
1192
1193 TRACE_FUNCTION ("cmhCC_CallReleased()");
1194
1195 /* inform advice of charge module */
1196 aoc_info (cId, AOC_STOP_TIME);
1197
1198 #if defined(FF_GPF_TCPIP)
1199 /* This will happen if network got lost during a CSD call */
1200 if (calltype EQ TCPIP_CALL)
1201 {
1202 T_DCM_STATUS_IND_MSG msg;
1203 msg.hdr.msg_id = DCM_ERROR_IND_MSG;
1204 msg.result = DCM_PS_CONN_BROKEN;
1205 dcm_send_message(msg, DCM_SUB_WAIT_SATDN_CNF);
1206 }
1207 #endif /* FF_GPF_TCPIP */
1208
1209 /* check for command context */
1210 switch( ctb->curCmd )
1211 {
1212 case( AT_CMD_A ):
1213 case( AT_CMD_D ):
1214 case( AT_CMD_NONE ):
1215 /* process event for A, D or no command */
1216
1217 /* handling for CCBS prolonged session */
1218
1219 if( ctb->curSrc NEQ CMD_SRC_NONE )
1220 {
1221 cmhCC_tstAndUnflagCall( cId, &cmhPrm[ctb->curSrc].ccCmdPrm.mltyCncFlg );
1222 cmhCC_tstAndUnflagCall( cId, &cmhPrm[ctb->curSrc].ccCmdPrm.mltyDscFlg );
1223 }
1224
1225 if (ctb->CCBSstat EQ CCBSS_PSSBL )
1226 {
1227 cmhrat_ccbs (CMD_SRC_MAX, CCBS_IND_PossibilityTimedOut,
1228 CCBS_STAT_NotPresent, NULL );
1229 break; /* skip the rest */
1230 }
1231 if (ctb->CCBSstat EQ CCBSS_REQ)
1232 {
1233 break; /* skip the rest */
1234 }
1235 if (ctb->calType EQ CT_NI_MOC)
1236 {
1237 cmhrat_ccbs( CMD_SRC_MAX, CCBS_IND_RecallTimedOut,
1238 CCBS_STAT_NotPresent, NULL );
1239 break; /* skip the rest */
1240 }
1241
1242 /* call clean up */
1243 switch( calltype )
1244 {
1245 case( VOICE_CALL ):
1246 ;
1247 break;
1248
1249 #ifdef FF_GPF_TCPIP
1250 case( TCPIP_CALL ):
1251 if( ccShrdPrm.datStat NEQ DS_IDL )
1252 {
1253 ccShrdPrm.datStat = DS_STOP_REQ;
1254 pppShrdPrm.state = PPP_UNDEFINED; /* Otherwise PPP and TCPIP doesn't go down well */
1255 cmhPPP_Terminate(DWN);
1256 ctb->curCmd = AT_CMD_NONE;
1257 }
1258 break;
1259 #endif /* FF_GPF_TCPIP */
1260
1261 #if defined (FAX_AND_DATA) AND defined (DTI)
1262 case( TRANS_CALL ):
1263 if( ccShrdPrm.datStat NEQ DS_IDL )
1264 {
1265 ccShrdPrm.datStat = DS_STOP_REQ;
1266 cmhTRA_Deactivate ();
1267 }
1268 break;
1269
1270 case( NON_TRANS_CALL ):
1271 if( ccShrdPrm.datStat NEQ DS_IDL )
1272 {
1273 ccShrdPrm.datStat = DS_STOP_REQ;
1274 cmhL2R_Deactivate ();
1275 }
1276 break;
1277
1278 #ifdef CO_UDP_IP
1279 case( UDPIP_CALL ):
1280 if( ccShrdPrm.datStat NEQ DS_IDL )
1281 {
1282 ccShrdPrm.datStat = DS_STOP_REQ;
1283 cmhPPP_Terminate(DWN);
1284 ctb->curCmd = AT_CMD_NONE;
1285 }
1286 break;
1287 #endif /* CO_UDP_IP */
1288
1289 #ifdef FF_FAX
1290 case( FAX_CALL ):
1291 if( ccShrdPrm.datStat NEQ DS_IDL )
1292 {
1293 ccShrdPrm.datStat = DS_STOP_REQ;
1294 cmhT30_Deactivate ();
1295 }
1296 #endif /* FF_FAX */
1297 #endif /* FAX_AND_DATA */
1298
1299 }
1300 cmhCC_SndDiscRsn( cId );
1301 break;
1302
1303 case( AT_CMD_H ):
1304 case( AT_CMD_Z ):
1305 case( AT_CMD_CHUP ):
1306 case( AT_CMD_ABRT ):
1307 case( AT_CMD_CHLD ):
1308
1309 #ifdef FF_FAX
1310 case( AT_CMD_FKS ):
1311 case( AT_CMD_FDT ):
1312 case( AT_CMD_FDR ):
1313 #endif
1314 /*
1315 *----------------------------------------------------------------
1316 * process event for H, Z and +CHUP command
1317 *----------------------------------------------------------------
1318 */
1319 /*
1320 * Bugfix for DISCONNECT_IND in CC U3 with PROGRESS_IND #8
1321 */
1322 cmdBuf = ctb->curCmd;
1323 srcBuf = ctb->curSrc;
1324 pCCCmdPrm = &cmhPrm[srcBuf].ccCmdPrm;
1325
1326 cmhCC_tstAndUnflagCall( cId, &(pCCCmdPrm->mltyCncFlg) );
1327 cmhCC_tstAndUnflagCall( cId, &(pCCCmdPrm->mltyDscFlg) );
1328
1329 if ( cmdBuf EQ AT_CMD_Z AND
1330 pCCCmdPrm -> mltyDscFlg EQ 0 )
1331 {
1332 cmh_Reset ( (T_ACI_CMD_SRC)srcBuf, TRUE );
1333 R_AT( RAT_Z, (T_ACI_CMD_SRC)srcBuf)();
1334 }
1335
1336 cmhCC_PrepareCmdEnd (cId, NULL, NULL);
1337
1338 if (ctb->curCmd NEQ AT_CMD_CHLD) /* Do not emmit OK for CHLD since this would
1339 occour in multiple OKs for a multi-party call */
1340 {
1341 R_AT( RAT_OK, (T_ACI_CMD_SRC)srcBuf ) ( cmdBuf );
1342 }
1343
1344 /* log result */
1345 cmh_logRslt ( (T_ACI_CMD_SRC)srcBuf, RAT_OK, (T_ACI_AT_CMD)cmdBuf, (SHORT)(cId+1),
1346 BS_SPEED_NotPresent,CME_ERR_NotPresent );
1347 break;
1348 }
1349
1350 /* call progress information */
1351 /* Implements Measure 207 */
1352 cmhCC_Call_Progress_Information( cId, CPI_MSG_Rls, ctb->curCs );
1353
1354 if (rdlPrm.rdlcId NEQ cId)
1355 { /* if redialling is active no clean cId entry */
1356 /* declare the call table entry as unused */
1357 psaCC_FreeCtbNtry (cId);
1358 }
1359 return;
1360 }
1361
1362 /*
1363 +-------------------------------------------------------------------+
1364 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
1365 | ROUTINE : cmhCC_CallReleaseIndication |
1366 +-------------------------------------------------------------------+
1367
1368 PURPOSE : call release indication to give out correct call process information
1369 interface so that psa function can report a release ind
1370 */
1371
1372 GLOBAL void cmhCC_CPIReleaseMsg ( SHORT cId )
1373 {
1374 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId];
1375 TRACE_FUNCTION ("cmhCC_CPIReleaseMsg()");
1376
1377 /* call progress information */
1378 /* Implements Measure 207 */
1379 cmhCC_Call_Progress_Information( cId, CPI_MSG_Rls, ctb->curCs );
1380
1381 return;
1382 }
1383
1384 /*
1385 +-------------------------------------------------------------------+
1386 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
1387 | ROUTINE : cmhCC_CPIrejectMsg |
1388 +-------------------------------------------------------------------+
1389
1390 PURPOSE : interface so that psa function can report a reject ind.
1391
1392 */
1393 GLOBAL void cmhCC_CPIrejectMsg ( SHORT cId )
1394 {
1395 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId];
1396
1397 TRACE_FUNCTION ("cmhCC_CPIrejectMsg()");
1398
1399 /* Implements Measure 207 */
1400 cmhCC_Call_Progress_Information( cId, CPI_MSG_Rjct, ctb->curCs );
1401 /*************************
1402 call was not serviced yet
1403 ***************************/
1404 /* Implements Measure 32 */
1405 if (cmhCC_check_isCallServiced( cId ) EQ TRUE)
1406 {
1407 return;
1408 }
1409
1410 return;
1411 }
1412
1413 /*
1414 +-------------------------------------------------------------------+
1415 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
1416 | ROUTINE : cmhCC_CallModified |
1417 +-------------------------------------------------------------------+
1418
1419 PURPOSE : call was modified
1420
1421 */
1422
1423 GLOBAL void cmhCC_CallModified ( SHORT cId )
1424 {
1425 #if defined (FAX_AND_DATA)
1426 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId];
1427 T_CC_CALL_TYPE calltype = cmhCC_getcalltype(cId);
1428 UBYTE cmdBuf; /* buffers current command */
1429 UBYTE srcBuf; /* buffers current command source */
1430
1431 TRACE_FUNCTION ("cmhCC_CallModified()");
1432
1433 /* check for command context */
1434 switch (ctb->curCmd )
1435 {
1436 case( AT_CMD_D ):
1437 case( AT_CMD_A ):
1438 case( AT_CMD_H ):
1439 /* process event for D, A and H command */
1440 cmdBuf = ctb->curCmd;
1441 srcBuf = ctb->curSrc;
1442 break;
1443
1444 default:
1445 cmdBuf = AT_CMD_NONE;
1446 srcBuf = ctb->calOwn;
1447 break;
1448 }
1449
1450 /* determine modifaction status */
1451 switch (ctb->rslt)
1452 {
1453 /* successful modification */
1454 case( MNCC_CAUSE_MODIFY_SUCCESS ):
1455
1456 switch( calltype )
1457 {
1458 /* modified to speech call */
1459 case( VOICE_CALL ):
1460 cmhCC_PrepareCmdEnd (cId, NULL, NULL);
1461
1462 R_AT( RAT_OK, (T_ACI_CMD_SRC)srcBuf ) ( cmdBuf );
1463
1464 /* log result */
1465 cmh_logRslt ( (T_ACI_CMD_SRC)srcBuf, RAT_OK,
1466 (T_ACI_AT_CMD)cmdBuf, (SHORT)(cId+1), BS_SPEED_NotPresent,CME_ERR_NotPresent );
1467 break;
1468
1469 /* modified to transparent or non-transparent or fax data call */
1470 case( TRANS_CALL ):
1471 case( NON_TRANS_CALL ):
1472 case( FAX_CALL ):
1473 ccShrdPrm.datStat = DS_ACT_REQ;
1474
1475 if( cmhRA_Activate ( (T_ACI_CMD_SRC)srcBuf, (T_ACI_AT_CMD)cmdBuf, cId ) NEQ AT_EXCT )
1476 {
1477 ctb->nrmCs = MNCC_CAUSE_CALL_CLEAR;
1478 psaCC_ClearCall (cId);
1479 }
1480 break;
1481 }
1482 break;
1483
1484 /* unsuccessful modification */
1485 case( MNCC_CAUSE_MS_TIMER ):
1486 default: /* network can send any cause */
1487
1488 TRACE_EVENT_P1 ("MODIFICATION FAILURE: cause=%d",ctb->rslt);
1489
1490
1491 R_AT( RAT_CME, (T_ACI_CMD_SRC)srcBuf ) ( cmdBuf, CME_ERR_NotPresent );
1492
1493 /* log result */
1494 cmh_logRslt ( (T_ACI_CMD_SRC)srcBuf, RAT_CME, (T_ACI_AT_CMD)cmdBuf, -1,
1495 BS_SPEED_NotPresent,CME_ERR_NotPresent );
1496
1497 if( calltype EQ TRANS_CALL OR
1498 calltype EQ NON_TRANS_CALL OR
1499 calltype EQ FAX_CALL )
1500 {
1501 /* back to transparent or non-transparent or fax data call */
1502 ccShrdPrm.datStat = DS_REST_REQ;
1503
1504 if( cmhRA_Activate ( (T_ACI_CMD_SRC)srcBuf, (T_ACI_AT_CMD)cmdBuf, cId ) NEQ AT_EXCT )
1505 {
1506 ctb->nrmCs = MNCC_CAUSE_CALL_CLEAR;
1507 psaCC_ClearCall (cId);
1508 }
1509 }
1510 break;
1511 }
1512 #endif /* FAX_AND_DATA */
1513 }
1514
1515 /*
1516 +-------------------------------------------------------------------+
1517 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
1518 | ROUTINE : cmhCC_DTMFsent |
1519 +-------------------------------------------------------------------+
1520
1521 PURPOSE : confirmation for sent DTMF
1522
1523 */
1524
1525 LOCAL void dtmf_sent_after_vts ( SHORT cId )
1526 {
1527 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId];
1528 UBYTE current_cmd_source = ctb->dtmfSrc; /* buffers current command source */
1529
1530 TRACE_FUNCTION ("dtmf_sent_after_vts()");
1531
1532 ctb->dtmfCmd = AT_CMD_NONE;
1533 ctb->dtmfSrc = (T_OWN)CMD_SRC_NONE;
1534
1535 ccShrdPrm.dtmf.cId = NO_ENTRY;
1536 ccShrdPrm.dtmf.cnt = 0;
1537
1538 if ((GET_CAUSE_VALUE(ctb->nrmCs) NEQ NOT_PRESENT_8BIT) AND
1539 (ctb->nrmCs NEQ MNCC_CAUSE_DTMF_START_SUCCESS) AND
1540 (ctb->nrmCs NEQ MNCC_CAUSE_DTMF_STOP_SUCCESS))
1541 {
1542 TRACE_EVENT_P1("DTMF response cause value: %d", ctb->nrmCs);
1543 R_AT( RAT_CME, (T_ACI_CMD_SRC)current_cmd_source ) ( AT_CMD_VTS, CME_ERR_NotPresent );
1544 return;
1545 }
1546
1547 R_AT( RAT_OK, (T_ACI_CMD_SRC)current_cmd_source ) ( AT_CMD_VTS );
1548 }
1549
1550 LOCAL void dtmf_sent_within_number ( SHORT cId )
1551 {
1552 BOOL dtmf_sent; /* result of sending of next DTMF char */
1553
1554 TRACE_FUNCTION ("dtmf_sent_within_number()");
1555
1556 if ((ccShrdPrm.dtmf.cId NEQ cId) OR
1557 !is_call_ok_for_dtmf(cId))
1558 {
1559 TRACE_EVENT_P2("Wrong cId for send DTMF. ccShrdPrm.dtmf.cId: %d, cId: %d", ccShrdPrm.dtmf.cId, cId);
1560 return;
1561 }
1562
1563 while( ccShrdPrm.dtmf.cnt AND
1564 ccShrdPrm.dtmf.cur < ccShrdPrm.dtmf.cnt )
1565 {
1566 dtmf_sent = cmhCC_SendDTMFdig ( AT_CMD_NONE,
1567 cId,
1568 ccShrdPrm.dtmf.dig[ccShrdPrm.dtmf.cur],
1569 MNCC_DTMF_MOD_AUTO );
1570 ccShrdPrm.dtmf.cur++;
1571 if( dtmf_sent )
1572 {
1573 return;
1574 }
1575 }
1576
1577 TRACE_EVENT_P1("End of sending DTMF tones: %d", ccShrdPrm.dtmf.dig[ccShrdPrm.dtmf.cur]);
1578 ccShrdPrm.dtmf.cnt = ccShrdPrm.dtmf.cur = 0;
1579 ccShrdPrm.dtmf.cId = NO_ENTRY;
1580 }
1581
1582 GLOBAL void cmhCC_DTMFsent ( SHORT cId )
1583 {
1584 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId];
1585
1586 TRACE_FUNCTION ("cmhCC_DTMFsent()");
1587
1588 switch( ctb->dtmfCmd )
1589 {
1590 case( AT_CMD_VTS ):
1591 dtmf_sent_after_vts(cId);
1592 return;
1593
1594 case( AT_CMD_NONE ):
1595 dtmf_sent_within_number(cId);
1596 return;
1597
1598 default:
1599 TRACE_EVENT_P1("Unexpected DTMF command value: %d", ctb->dtmfCmd);
1600 break;
1601 }
1602 }
1603
1604
1605 /*
1606 This will be called when the call was disconnected while sending DTMF tones
1607
1608 */
1609 GLOBAL void cmhCC_DTMFstopped ( SHORT cId )
1610 {
1611 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId];
1612
1613 TRACE_FUNCTION ("cmhCC_DTMFstopped()");
1614
1615 switch( ctb->dtmfCmd )
1616 {
1617 case( AT_CMD_VTS ):
1618 TRACE_EVENT ("DTMF stopped within VTS");
1619 R_AT( RAT_CME,(T_ACI_CMD_SRC)ctb->dtmfSrc )
1620 ( AT_CMD_VTS, CME_ERR_Unknown );
1621 return;
1622
1623 case( AT_CMD_NONE ):
1624 TRACE_EVENT ("DTMF stopped within NONE");
1625
1626 return;
1627
1628 default:
1629 TRACE_EVENT_P1("Unexpected DTMF command value: %d", ctb->dtmfCmd);
1630 break;
1631 }
1632 }
1633
1634
1635 #if 0 // HM 11-May-2005: Dead code
1636 /*
1637 +-------------------------------------------------------------------+
1638 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
1639 | ROUTINE : cmhCC_DisconnectCall |
1640 +-------------------------------------------------------------------+
1641
1642 PURPOSE : request to disconnect the call (in-band tones available)
1643
1644 */
1645
1646 GLOBAL void cmhCC_DisconnectCall ( SHORT cId )
1647 {
1648 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId];
1649 T_CC_CMD_PRM *pCCCmdPrm; /* points to CC command parameters */
1650 UBYTE cmdBuf; /* buffers current command */
1651 UBYTE srcBuf; /* buffers current command source */
1652
1653 TRACE_FUNCTION ("cmhCC_DisconnectCall()");
1654
1655 /* check for command context */
1656 switch (ctb->curCmd)
1657 {
1658 case( AT_CMD_NONE ):
1659 case( AT_CMD_D ):
1660 case( AT_CMD_A ):
1661 /*
1662 *----------------------------------------------------------------
1663 * process event for D, A and no command
1664 *----------------------------------------------------------------
1665 */
1666 /* for data calls proceed with call completion */
1667 if( cmhCC_getcalltype(cId) NEQ VOICE_CALL )
1668 {
1669 psaCC_ClearCall (cId);
1670 }
1671 break;
1672
1673 case( AT_CMD_H ):
1674 case( AT_CMD_Z ):
1675 case( AT_CMD_CHUP ):
1676
1677 /*
1678 *----------------------------------------------------------------
1679 * process event for H, Z and +CHUP command
1680 *----------------------------------------------------------------
1681 */
1682 cmdBuf = ctb->curCmd;
1683 srcBuf = ctb->curSrc;
1684
1685 psaCC_ClearCall (cId);
1686
1687 cmhCC_PrepareCmdEnd (cId, NULL, NULL);
1688
1689 pCCCmdPrm = &cmhPrm[srcBuf].ccCmdPrm;
1690
1691 if(cmdBuf EQ AT_CMD_Z AND
1692 pCCCmdPrm -> mltyDscFlg EQ 0 )
1693 {
1694 cmh_Reset ( srcBuf, TRUE );
1695 R_AT( RAT_Z, srcBuf)();
1696 }
1697
1698 R_AT( RAT_OK, (T_ACI_CMD_SRC)srcBuf ) ( (T_ACI_AT_CMD)cmdBuf );
1699
1700 /* log result */
1701 cmh_logRslt ( (T_ACI_CMD_SRC)srcBuf, RAT_OK,
1702 (T_ACI_AT_CMD)cmdBuf, (SHORT)(cId+1), BS_SPEED_NotPresent, CME_ERR_NotPresent );
1703 break;
1704 }
1705
1706 return;
1707 }
1708 #endif /* #if 0 */
1709
1710 /*
1711 +-------------------------------------------------------------------+
1712 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
1713 | ROUTINE : cmhCC_IncomingCall |
1714 +-------------------------------------------------------------------+
1715
1716 PURPOSE : indication of a mobile terminated call
1717
1718 */
1719
1720 GLOBAL void cmhCC_IncomingCall ( SHORT cId )
1721 {
1722 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId];
1723 SHORT idx; /* holds index counter */
1724 T_ACI_CRING_MOD mode; /* holds mode of call */
1725 T_ACI_CRING_SERV_TYP type1, type2; /* holds types of bearer services */
1726 CHAR numBuf[MAXIMUM(MNCC_MAX_CC_CALLING_NUMBER, MNCC_MAX_CC_REDIR_NUMBER)+1];
1727 /* buffers calling number + '\0' */
1728 CHAR subBuf[MNCC_SUB_LENGTH+1]; /* buffers subaddress 'subaddress\0' */
1729 T_ACI_TOA toaBuf; /* buffers type of address */
1730 T_ACI_TOS tosBuf; /* buffers type of subaddress */
1731 USHORT listcounter;
1732 T_ACI_LIST *msg2send;
1733
1734 TRACE_FUNCTION ("cmhCC_IncomingCall()");
1735
1736 /*
1737 *-------------------------------------------------------------------
1738 * ring for call, if no call is in use
1739 *-------------------------------------------------------------------
1740 */
1741 if( ! psaCC_ctbCallInUse() )
1742 {
1743
1744 switch (ctb->rptInd) /* determine call mode */
1745 {
1746 case( MNCC_RI_NOT_PRES ):
1747 case( MNCC_RI_SEQUENTIAL ):
1748 mode = CRING_MOD_Direct;
1749 break;
1750 case( MNCC_RI_CIRCULAR ):
1751 mode = CRING_MOD_Alternate;
1752 break;
1753
1754 default:
1755 TRACE_EVENT("UNEXP REPEAT INDICATOR IN CTB");
1756 mode = CRING_MOD_NotPresent;
1757 break;
1758 }
1759
1760 /* determine 1st service */
1761 type1 = (T_ACI_CRING_SERV_TYP)cmhCC_GetCallType_from_bearer( &ctb->BC[0] );
1762
1763 /* determine 2nd service */
1764 type2 = (T_ACI_CRING_SERV_TYP)cmhCC_GetCallType_from_bearer( &ctb->BC[1] );
1765
1766 #ifdef FF_ATI
1767 io_setRngInd (IO_RING_ON, type1, type2); /* V.24 Ring Indicator Line */
1768 #endif
1769
1770 for( idx = 0; idx < CMD_SRC_MAX; idx++ )
1771 {
1772 if (ctb->prgDesc EQ MNCC_PROG_NOT_PRES)
1773 {
1774 R_AT( RAT_CPI, (T_ACI_CMD_SRC)idx )
1775 ( cId+1,
1776 CPI_MSG_Setup,
1777 (ctb->inBndTns)? CPI_IBT_True: CPI_IBT_False,
1778 (ccShrdPrm.TCHasg)? CPI_TCH_True: CPI_TCH_False,
1779 ctb->curCs );
1780 }
1781 R_AT( RAT_CRING, (T_ACI_CMD_SRC)idx )( mode, type1, type2 );
1782
1783 /* calling line presentation, if no call is in use */
1784
1785 /* check of presentation indicator removed, due to the fact that
1786 * other mobiles show the same behaviour.
1787 if( ctb->clgPty.present NEQ PRES_NUMB_NOT_AVAIL ){} */
1788
1789 R_AT( RAT_CLIP, (T_ACI_CMD_SRC)idx )
1790 ( CLIP_STAT_NotPresent,
1791 psaCC_ctbClrAdr2Num( cId, numBuf, sizeof (numBuf) ),
1792 cmhCC_ctbGetClrNumTyp( cId, &toaBuf ),
1793 ctb->clgPty.present,
1794 psaCC_ctbClrAdr2Sub( cId, subBuf ),
1795 cmhCC_ctbGetClrSubTyp( cId, &tosBuf ),
1796 psaCC_ctbGetAlpha( cId ) );
1797
1798 R_AT ( RAT_CDIP, (T_ACI_CMD_SRC)idx )
1799 (psaCC_ctbCldAdr2Num( cId, numBuf, sizeof (numBuf) ),
1800 cmhCC_ctbGetCldNumTyp( cId, &toaBuf ),
1801 psaCC_ctbCldAdr2Sub( cId, subBuf ),
1802 cmhCC_ctbGetCldSubTyp( cId, &tosBuf ));
1803
1804 } /* for */
1805
1806 if (ctb->CDStat EQ CD_Notified)
1807 {
1808 send_CSSX_notification(cId,
1809 CSSX_CODE_DeflectedCall,
1810 ACI_NumParmNotPresent,
1811 psaCC_ctbRdrAdr2Num( cId, numBuf, sizeof (numBuf) ),
1812 cmhCC_ctbGetRdrNumTyp( cId, &toaBuf ),
1813 psaCC_ctbRdrAdr2Sub( cId, subBuf ),
1814 cmhCC_ctbGetRdrSubTyp( cId, &tosBuf));
1815 }
1816
1817 if (ctb->CDStat EQ CD_Notified)
1818 {
1819 psaCC_FreeRdrPty (cId);
1820 ctb->CDStat = NO_VLD_CD;
1821 }
1822 /* check for TTY service */
1823 cmhCC_TTY_Control ( cId, TTY_START );
1824
1825 /* Find out if there is any MNCC_FACILITY_IND stored */
1826 listcounter = 0;
1827 if ((listcounter = get_list_count(ccShrdPrm.facility_list)) > 0)
1828 {
1829 for (;listcounter > 0 ; listcounter --)
1830 {
1831 msg2send = remove_first_element(ccShrdPrm.facility_list);
1832
1833 /* Send MNCC_FACILITY_IND */
1834 psa_mncc_facility_ind((T_MNCC_FACILITY_IND *)msg2send);
1835 }
1836 }
1837
1838 } /* endif */
1839
1840
1841 /*
1842 *-------------------------------------------------------------------
1843 * call waiting indication, if a call is in use
1844 *-------------------------------------------------------------------
1845 */
1846 else
1847 {
1848 /* check of presentation indicator removed, due to the fact that
1849 other mobiles show the same behaviour.
1850 if( ctb->clgPty.present NEQ PRES_NUMB_NOT_AVAIL ) {} */
1851
1852 if (ctb->CDStat EQ CD_Notified)
1853 {
1854 send_CSSX_notification( cId,
1855 CSSX_CODE_DeflectedCall,
1856 ACI_NumParmNotPresent,
1857 psaCC_ctbRdrAdr2Num( cId, numBuf, sizeof (numBuf) ),
1858 cmhCC_ctbGetRdrNumTyp( cId, &toaBuf ),
1859 psaCC_ctbRdrAdr2Sub( cId, subBuf ),
1860 cmhCC_ctbGetRdrSubTyp( cId, &tosBuf ));
1861 }
1862
1863 for( idx = 0; idx < CMD_SRC_MAX; idx++ )
1864 {
1865 if (ctb->prgDesc EQ MNCC_PROG_NOT_PRES)
1866 {
1867 R_AT( RAT_CPI, (T_ACI_CMD_SRC)idx )
1868 ( cId+1,
1869 CPI_MSG_Setup,
1870 (ctb->inBndTns)? CPI_IBT_True: CPI_IBT_False,
1871 (ccShrdPrm.TCHasg)? CPI_TCH_True: CPI_TCH_False,
1872 ctb->curCs );
1873 }
1874
1875 R_AT( RAT_CCWA, (T_ACI_CMD_SRC)idx )
1876 ( NULL,
1877 psaCC_ctbClrAdr2Num( cId, numBuf, sizeof (numBuf) ),
1878 cmhCC_ctbGetClrNumTyp( cId, &toaBuf ),
1879 ctb->clgPty.present,
1880 cmhCC_GetCallClass( cId ),
1881 psaCC_ctbGetAlpha( cId ) );
1882 }
1883 if (ctb->CDStat EQ CD_Notified)
1884 {
1885 psaCC_FreeRdrPty (cId);
1886 ctb->CDStat = NO_VLD_CD;
1887 }
1888 }
1889 }
1890
1891 /*
1892 +-------------------------------------------------------------------+
1893 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
1894 | ROUTINE : psaCC_Synchronized |
1895 +-------------------------------------------------------------------+
1896
1897 PURPOSE : channel mode has changed or
1898 call reestablishment event received.
1899 If a channel mode change is indicated cId needs not
1900 to be valid.
1901
1902 */
1903
1904 GLOBAL void cmhCC_Synchronized ( SHORT cId )
1905 {
1906 SHORT act_cId; /* holds call identifier */
1907 #if defined (FAX_AND_DATA) AND defined (DTI)
1908 T_CC_CALL_TYPE calltype;
1909 #endif /* of #ifdef FAX_AND_DATA */
1910
1911 TRACE_FUNCTION ("cmhCC_Synchronized()");
1912
1913 /* process event */
1914 switch( ccShrdPrm.syncCs )
1915 {
1916 case( MNCC_CAUSE_CHANNEL_SYNC ): /* change of TCH state */
1917
1918 if( ccShrdPrm.TCHasg EQ TRUE )
1919 {
1920 /* search for an active call */
1921 if((act_cId = psaCC_ctbFindCall( OWN_SRC_INV, CS_ACT, NO_VLD_CT ))
1922 NEQ NO_ENTRY )
1923 {
1924 #if defined (FAX_AND_DATA) AND defined (DTI)
1925 calltype = cmhCC_getcalltype(act_cId);
1926
1927 switch( calltype )
1928 {
1929 #ifdef FF_FAX
1930 case( FAX_CALL ):
1931 switch( ccShrdPrm.datStat )
1932 {
1933 case( DS_ACT ):
1934 case( DS_TCH_MDF ):
1935 ccShrdPrm.datStat = DS_TCH_MDF;
1936 /*
1937 * use entity owner instead of current source, because
1938 * command is out of scope for CC
1939 */
1940 if( cmhRA_Modify ( raEntStat.entOwn, act_cId ) NEQ AT_EXCT )
1941 {
1942 ccShrdPrm.datStat = DS_IDL;
1943 cmhT30_Deactivate();
1944 psaCC_ctb(act_cId)->nrmCs = MNCC_CAUSE_CALL_CLEAR;
1945 psaCC_ClearCall (act_cId);
1946 }
1947 break;
1948
1949 case( DS_IDL ):
1950 ccShrdPrm.datStat = DS_ACT_REQ;
1951 if( cmhRA_Activate ( (T_ACI_CMD_SRC)psaCC_ctb(act_cId)->curSrc,
1952 (T_ACI_AT_CMD)psaCC_ctb(act_cId)->curCmd,
1953 act_cId )
1954 NEQ AT_EXCT )
1955 {
1956 ccShrdPrm.datStat = DS_IDL;
1957 psaCC_ctb(act_cId)->nrmCs = MNCC_CAUSE_CALL_CLEAR;
1958 psaCC_ClearCall (act_cId);
1959 }
1960 }
1961 break;
1962 #endif /* FF_FAX */
1963
1964 case( TRANS_CALL ): /* activate RA */
1965 case( NON_TRANS_CALL ): /* activate RA */
1966 switch( ccShrdPrm.datStat )
1967 {
1968 case( DS_IDL ):
1969 ccShrdPrm.datStat = DS_ACT_REQ;
1970 if( cmhRA_Activate ( (T_ACI_CMD_SRC)psaCC_ctb(act_cId)->curSrc,
1971 (T_ACI_AT_CMD)psaCC_ctb(act_cId)->curCmd,
1972 act_cId )
1973 NEQ AT_EXCT )
1974 {
1975 ccShrdPrm.datStat = DS_IDL;
1976 psaCC_ctb(act_cId)->nrmCs = MNCC_CAUSE_CALL_CLEAR;
1977 psaCC_ClearCall (act_cId);
1978 }
1979 break;
1980
1981 default:
1982 TRACE_EVENT("modify data call ignored");
1983 break;
1984 }
1985 break;
1986
1987 case( UNSUP_DATA_CALL ):
1988 TRACE_EVENT("UNSUPPORTED DATA CALL -> DISC CALL");
1989 psaCC_ctb(act_cId)->nrmCs = MNCC_CAUSE_CALL_CLEAR;
1990 psaCC_ClearCall (act_cId);
1991 break;
1992 }
1993 #endif /* FAX_AND_DATA */
1994 }
1995 }
1996
1997 /* Information about Traffic Channel Assignment should be sent
1998 for all existing act_cIds */
1999 for( act_cId = 0; act_cId < MAX_CALL_NR; act_cId++ )
2000 {
2001 if (ccShrdPrm.ctb[act_cId] NEQ NULL)
2002 {
2003 /* Implements Measure 207 */
2004 cmhCC_Call_Progress_Information( act_cId, CPI_MSG_Sync, psaCC_ctb(act_cId)->curCs );
2005 }
2006 }
2007 break;
2008
2009 case( MNCC_CAUSE_REEST_STARTED ): /* call reestablishment */
2010 case( MNCC_CAUSE_REEST_FINISHED ):
2011 /* Implements Measure#32: Row 81, 82 */
2012 if(ccShrdPrm.syncCs EQ MNCC_CAUSE_REEST_STARTED)
2013 {
2014 TRACE_EVENT("SYNC -> CALL REESTABLISHMENT STARTED");
2015 }
2016 else
2017 {
2018 TRACE_EVENT("SYNC -> CALL REESTABLISHMENT FINISHED");
2019 }
2020 if (psaCC_ctbIsValid (cId))
2021 {
2022 /* Send %CPI notification for call reestablishment */
2023 /* Implements Measure 207 */
2024 cmhCC_Call_Progress_Information( cId, CPI_MSG_Sync, psaCC_ctb(cId)->curCs );
2025 }
2026 else
2027 {
2028 TRACE_ERROR ("No call table entry");
2029 }
2030 break;
2031 }
2032 }
2033
2034 /*
2035 +-------------------------------------------------------------------+
2036 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
2037 | ROUTINE : psaCC_CallHeld |
2038 +-------------------------------------------------------------------+
2039
2040 PURPOSE : call hold result
2041
2042 */
2043
2044 GLOBAL void cmhCC_CallHeld ( SHORT cId )
2045 {
2046 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId];
2047 T_CC_CMD_PRM * pCCCmdPrm; /* points to CC command parameters */
2048 UBYTE cmdBuf; /* buffers current command */
2049 UBYTE srcBuf; /* buffers current command source */
2050 SHORT addId; /* holds additional call id */
2051 TRACE_FUNCTION ("cmhCC_CallHeld()");
2052
2053 /* check for command context */
2054 switch (ctb->curCmd )
2055 {
2056 case( AT_CMD_D ):
2057 case( AT_CMD_A ):
2058 case( AT_CMD_CHLD ):
2059 break;
2060
2061 default:
2062 TRACE_EVENT_P1("Error: wrong command context: %d", ctb->curCmd);
2063 return; /* wrong command context */
2064 }
2065
2066 cmhCC_PrepareCmdEnd (cId, &cmdBuf, &srcBuf);
2067 pCCCmdPrm = &cmhPrm[srcBuf].ccCmdPrm;
2068
2069 /* check result of hold request */
2070 TRACE_EVENT_P1("Hold CNF cause value: %04X", ctb->rslt);
2071 switch( ctb->rslt )
2072 {
2073 case( MNCC_CAUSE_HOLD_SUCCESS ):
2074 case( MNCC_CAUSE_SUCCESS ):
2075 case( MNCC_CAUSE_NO_MS_CAUSE ):
2076
2077 /* Held information displayed if call is on hold */
2078 /* Implements Measure 207 */
2079 cmhCC_Call_Progress_Information( cId, CPI_MSG_Hld, ctb->rslt );
2080
2081 if( cmhCC_tstAndUnflagCall( cId, &(pCCCmdPrm -> mltyCncFlg)))
2082 {
2083 if((pCCCmdPrm -> CHLDmode EQ CHLD_MOD_HldActExc OR
2084 pCCCmdPrm -> CHLDmode EQ CHLD_MOD_HldActAndAcpt OR
2085 pCCCmdPrm -> CHLDmode EQ CHLD_MOD_HldActDial) AND
2086 pCCCmdPrm -> mltyCncFlg )
2087 {
2088 process_CHLDaddInfo( srcBuf, CALL_HELD );
2089 }
2090
2091 if( pCCCmdPrm -> mltyCncFlg EQ 0 AND
2092 pCCCmdPrm -> mltyDscFlg EQ 0 ) /* if last call */
2093 {
2094 #ifdef SIM_TOOLKIT
2095 if (ctb->SATinv )
2096 {
2097 cmh_logRslt ( (T_ACI_CMD_SRC)srcBuf, RAT_OK,
2098 (T_ACI_AT_CMD)cmdBuf, (SHORT)(cId+1), BS_SPEED_NotPresent,CME_ERR_NotPresent );
2099
2100 cmhSAT_StartPendingCall( );
2101 }
2102 else
2103 #endif /* SIM_TOOLKIT */
2104 {
2105 R_AT( RAT_OK, (T_ACI_CMD_SRC)srcBuf ) ( cmdBuf );
2106
2107 /* log result */
2108 cmh_logRslt ( (T_ACI_CMD_SRC)srcBuf, RAT_OK,
2109 (T_ACI_AT_CMD)cmdBuf, (SHORT)(cId+1), BS_SPEED_NotPresent,CME_ERR_NotPresent);
2110 }
2111 }
2112 }
2113 break;
2114
2115 default: /* no positive result, i.e. negative result of Hold operation */
2116
2117 if( cmhCC_tstAndUnflagCall( cId, &(pCCCmdPrm -> mltyCncFlg)))
2118 {
2119
2120 #ifdef SIM_TOOLKIT
2121 if (ctb->SATinv)
2122 {
2123 psaCC_ctb(ccShrdPrm.cIdMPTY)->SATinv = FALSE;
2124 /* return network error cause GSM 11.14 / 12.12.3 */
2125 cmhSAT_NtwErr( ADD_NO_CAUSE );
2126 }
2127 #endif
2128 if( pCCCmdPrm -> CHLDmode EQ CHLD_MOD_HldActDial AND
2129 pCCCmdPrm -> mltyCncFlg )
2130 {
2131 for( addId = 0; !((pCCCmdPrm -> mltyCncFlg >> addId) & 0x01); addId++ )
2132 ;
2133
2134 if( CHLDaddInfo EQ CHLD_ADD_INFO_DIAL_CAL )
2135 {
2136 CHLDaddInfo = NO_CHLD_ADD_INFO;
2137 psaCC_FreeCtbNtry (addId);
2138 }
2139 }
2140
2141 pCCCmdPrm -> mltyCncFlg = 0; /* unflag calls */
2142 CHLDaddInfo = NO_CHLD_ADD_INFO;
2143
2144 R_AT( RAT_CME, (T_ACI_CMD_SRC)srcBuf ) ( cmdBuf, CME_ERR_OpNotAllow );
2145
2146 /* log result */
2147 cmh_logRslt ( (T_ACI_CMD_SRC)srcBuf, RAT_CME,
2148 (T_ACI_AT_CMD)cmdBuf, -1, BS_SPEED_NotPresent, CME_ERR_OpNotAllow );
2149 }
2150 break;
2151 }
2152 }
2153
2154 /*
2155 +-------------------------------------------------------------------+
2156 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
2157 | ROUTINE : psaCC_CallRetrieved |
2158 +-------------------------------------------------------------------+
2159
2160 PURPOSE : call retrieve result
2161
2162 */
2163
2164 GLOBAL void cmhCC_CallRetrieved ( SHORT cId )
2165 {
2166 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId];
2167 T_CC_CMD_PRM * pCCCmdPrm; /* points to CC command parameters */
2168 UBYTE cmdBuf; /* buffers current command */
2169 UBYTE srcBuf; /* buffers current command source */
2170
2171 TRACE_FUNCTION ("cmhCC_CallRetrieved()");
2172
2173 /* check for command context */
2174 if (ctb->curCmd NEQ AT_CMD_CHLD)
2175 {
2176 return;
2177 }
2178
2179 pCCCmdPrm = &cmhPrm[ctb->curSrc].ccCmdPrm;
2180 cmhCC_PrepareCmdEnd (cId, &cmdBuf, &srcBuf);
2181
2182 /*
2183 * check result of retrieve request
2184 */
2185 switch (ctb->rslt)
2186 {
2187 case( MNCC_CAUSE_RETRIEVE_SUCCESS ):
2188 /* Implements Measure 184, 185 and 187 */
2189 cmhCC_tstAndUnflag_MPTYCall( cId, srcBuf, cmdBuf, pCCCmdPrm );
2190 break;
2191
2192 default: /* no positive result of retrieve operation */
2193
2194 if( cmhCC_tstAndUnflagCall( cId, &(pCCCmdPrm -> mltyCncFlg)))
2195 {
2196 pCCCmdPrm -> mltyCncFlg = 0; /* unflag calls */
2197
2198 R_AT( RAT_CME, (T_ACI_CMD_SRC)srcBuf ) ( cmdBuf, CME_ERR_OpNotAllow );
2199
2200 /* log result */
2201 cmh_logRslt ( (T_ACI_CMD_SRC)srcBuf, RAT_CME,
2202 (T_ACI_AT_CMD)cmdBuf, -1, BS_SPEED_NotPresent, CME_ERR_OpNotAllow );
2203 }
2204 break;
2205 }
2206 }
2207
2208 /*
2209 +-------------------------------------------------------------------+
2210 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
2211 | ROUTINE : cmhCC_RA_Activated |
2212 +-------------------------------------------------------------------+
2213
2214 PURPOSE : RA entity activated, data path established
2215
2216 */
2217 #ifdef DTI
2218 GLOBAL void cmhCC_RA_Activated ( SHORT cId )
2219 {
2220 #ifdef FAX_AND_DATA
2221
2222 UBYTE cmdBuf; /* buffers current command */
2223 UBYTE srcBuf; /* buffers current command source */
2224 T_CC_CALL_TYPE calltype = cmhCC_getcalltype(cId);
2225
2226 TRACE_FUNCTION ("cmhCC_RA_Activated()");
2227
2228 srcBuf = psaCC_ctb(cId)->curSrc;
2229 cmdBuf = psaCC_ctb(cId)->curCmd;
2230
2231 switch( ccShrdPrm.datStat )
2232 {
2233 case( DS_ACT_REQ ):
2234 case( DS_REST_REQ ):
2235 switch( calltype )
2236 {
2237 /* transparent data call */
2238 case( TRANS_CALL ):
2239 psaTRA_Activate( );
2240 break;
2241
2242 /* non-transparent data call */
2243 case( NON_TRANS_CALL ):
2244 /* a WAP call is a non-transparent data call */
2245 #ifdef CO_UDP_IP
2246 case( UDPIP_CALL ):
2247 #endif /* CO_UDP_IP */
2248 #ifdef FF_PPP
2249 case( PPP_CALL ):
2250 #endif /* FF_PPP */
2251 #if defined(FF_GPF_TCPIP)
2252 case (TCPIP_CALL):
2253 #endif /* FF_GPF_TCPIP */
2254
2255 if( cmhL2R_Activate((T_ACI_CMD_SRC)srcBuf, (T_ACI_AT_CMD)cmdBuf, cId) NEQ AT_EXCT )
2256 {
2257 ccShrdPrm.datStat = DS_DSC_REQ;
2258 cmhRA_Deactivate ();
2259 }
2260 break;
2261
2262 #ifdef FF_FAX
2263 case( FAX_CALL ):
2264 if( cmhT30_Activate((T_ACI_CMD_SRC)srcBuf, (T_ACI_AT_CMD)cmdBuf, cId) NEQ AT_EXCT )
2265 {
2266 ccShrdPrm.datStat = DS_DSC_REQ;
2267 cmhRA_Deactivate ();
2268 }
2269 break;
2270 #endif /* FF_FAX */
2271
2272 /* in case of other types of call */
2273 default:
2274 ccShrdPrm.datStat = DS_DSC_REQ;
2275 cmhRA_Deactivate ();
2276 break;
2277 }
2278 break;
2279 }
2280 #endif /* of #ifdef FAX_AND_DATA */
2281 }
2282 #endif /* DTI */
2283 /*
2284 +-------------------------------------------------------------------+
2285 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
2286 | ROUTINE : cmhCC_RA_Deactivated |
2287 +-------------------------------------------------------------------+
2288
2289 PURPOSE : RA entity deactivated, data path disconnected
2290
2291 */
2292 #ifdef DTI
2293 GLOBAL void cmhCC_RA_Deactivated ( SHORT cId )
2294 {
2295 #ifdef FAX_AND_DATA
2296 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId];
2297 T_CC_CALL_TYPE calltype = cmhCC_getcalltype(cId);
2298 UBYTE cmdBuf; /* buffers current command */
2299
2300 TRACE_FUNCTION ("cmhCC_RA_Deactivated()");
2301
2302 cmdBuf = ctb->curCmd;
2303
2304 switch( calltype )
2305 {
2306 case( TRANS_CALL ):
2307 /* transparent data call */
2308 switch( ccShrdPrm.datStat )
2309 {
2310 case( DS_ACT ):
2311 case( DS_ACT_REQ ):
2312 case( DS_DSC_REQ ):
2313 case( DS_TCH_MDF ):
2314
2315 ccShrdPrm.datStat = DS_IDL;
2316 ctb->nrmCs = MNCC_CAUSE_CALL_CLEAR;
2317 psaCC_ClearCall (cId);
2318 #if defined (SIM_TOOLKIT) AND defined (FF_SAT_E)
2319 /* check impact for SAT commands */
2320 cmhSAT_OpChnCSDDown( cId, TPL_NONE );
2321 #endif /* SIM TOOLKIT AND FF_SAT_E */
2322 break;
2323
2324 case( DS_MDF_REQ ):
2325
2326 ccShrdPrm.datStat = DS_IDL;
2327 psaCC_ModifyCall(cId);
2328 break;
2329
2330 case( DS_STOP_REQ ):
2331
2332 ccShrdPrm.datStat = DS_IDL;
2333 cmhCC_CallDisconnected(cId);
2334 break;
2335 }
2336 break;
2337
2338 /* non-transparent data call */
2339 case( NON_TRANS_CALL ):
2340 #ifdef CO_UDP_IP
2341 case( UDPIP_CALL ):
2342 #endif /* CO_UDP_IP */
2343 #ifdef FF_PPP
2344 case( PPP_CALL ):
2345 #endif /* FF_PPP */
2346 #ifdef FF_GPF_TCPIP
2347 case (TCPIP_CALL):
2348 #endif /* FF_GPF_TCPIP */
2349
2350 switch( ccShrdPrm.datStat )
2351 {
2352 case( DS_ACT ):
2353 case( DS_ACT_REQ ):
2354 case( DS_DSC_REQ ):
2355 case( DS_REST_REQ ):
2356 case( DS_TCH_MDF ):
2357
2358 ccShrdPrm.datStat = DS_IDL;
2359 ctb->nrmCs = MNCC_CAUSE_CALL_CLEAR;
2360
2361 #if defined(CO_UDP_IP) OR defined(FF_GPF_TCPIP)
2362 /* WAP STACK is down */
2363
2364 /* The following statements check which configuration is active,
2365 because there are three possibilities:
2366 1. UDP/IP only - WAP1.x and SAT_E
2367 2. TCP/IP only - WAP2.x and higher and App's
2368 3. UDP/IP and TCP/IP - WAP2.x and higher and App's and SAT_E
2369 */
2370 #if defined(FF_GPF_TCPIP) AND !defined(CO_UDP_IP)
2371 if(calltype EQ TCPIP_CALL)
2372 #elif !defined(FF_GPF_TCPIP) AND defined(CO_UDP_IP)
2373 if(calltype EQ UDPIP_CALL)
2374 #elif defined(FF_GPF_TCPIP) AND defined(CO_UDP_IP)
2375 if(calltype EQ UDPIP_CALL OR calltype EQ TCPIP_CALL)
2376 #endif
2377 {
2378 #if defined (SIM_TOOLKIT) AND defined (FF_SAT_E)
2379 /* check impact for SAT commands */
2380 cmhSAT_OpChnCSDDown( cId, UDP );
2381 #endif /* SIM TOOLKIT AND FF_SAT_E */
2382 /* Have CC disconnected before ? */
2383 if (ctb->calStat EQ CS_ACT)
2384 {
2385 psaCC_ClearCall (cId);
2386 }
2387 else
2388 {
2389 /* Message to MMI */
2390 R_AT( RAT_OK, (T_ACI_CMD_SRC)ctb->calOwn ) ( AT_CMD_NONE, cId+1 );
2391
2392 #ifdef FF_ATI
2393 io_setDCD ((T_ACI_CMD_SRC)ctb->calOwn, IO_DCD_OFF); /* V.24 DCD Line */
2394 #endif
2395 /* log result */
2396 cmh_logRslt ((T_ACI_CMD_SRC)ctb->calOwn, RAT_OK,
2397 (T_ACI_AT_CMD)cmdBuf, (SHORT)(cId+1), BS_SPEED_NotPresent,CME_ERR_NotPresent );
2398 }
2399 break;
2400 }
2401 #endif /* CO_UDP_IP || FF_GPF_TCPIP */
2402
2403 psaCC_ClearCall (cId);
2404 #if defined (SIM_TOOLKIT) AND defined (FF_SAT_E)
2405 /* check impact for SAT commands */
2406 cmhSAT_OpChnCSDDown( cId, TPL_NONE );
2407 #endif /* SIM TOOLKIT AND FF_SAT_E */
2408 break;
2409
2410 case( DS_STOP_REQ ):
2411
2412 ccShrdPrm.datStat = DS_IDL;
2413 cmhCC_CallDisconnected(cId);
2414 #if defined (FF_WAP) || defined (FF_SAT_E)
2415 /* WAP STACK is down */
2416 ccShrdPrm.wapStat = CC_WAP_STACK_DOWN;
2417 #endif /* FF_WAP || SAT E */
2418 break;
2419
2420 case( DS_ABO_REQ ): /* during modification */
2421 switch( ctb->rptInd )
2422 {
2423 case( MNCC_RI_SEQUENTIAL ): /* no way back */
2424
2425 ccShrdPrm.datStat = DS_IDL;
2426 ctb->nrmCs = MNCC_CAUSE_CALL_CLEAR;
2427 psaCC_ClearCall (cId);
2428 break;
2429
2430 case( MNCC_RI_CIRCULAR ):
2431
2432 ccShrdPrm.datStat = DS_IDL;
2433 psaCC_ModifyCall(cId); /* back to former service */
2434 break;
2435 }
2436 break;
2437
2438 case( DS_MDF_REQ ):
2439 ccShrdPrm.datStat = DS_IDL;
2440 psaCC_ModifyCall(cId);
2441 break;
2442 }
2443 break;
2444
2445 /* in case of a fax call */
2446 case( FAX_CALL ):
2447 switch( ccShrdPrm.datStat )
2448 {
2449 case( DS_ACT ):
2450 case( DS_ACT_REQ ):
2451 case( DS_DSC_REQ ):
2452 case( DS_REST_REQ ):
2453 case( DS_TCH_MDF ):
2454 ccShrdPrm.datStat = DS_IDL;
2455 ctb->nrmCs = MNCC_CAUSE_CALL_CLEAR;
2456 psaCC_ClearCall (cId);
2457 break;
2458
2459 case( DS_STOP_REQ ):
2460 ccShrdPrm.datStat = DS_IDL;
2461 cmhCC_CallDisconnected(cId);
2462 break;
2463
2464 case( DS_ABO_REQ ): /* abort during modification */
2465 switch (ctb->rptInd)
2466 {
2467 case( MNCC_RI_SEQUENTIAL ): /* no way back */
2468
2469 ccShrdPrm.datStat = DS_IDL;
2470 ctb->nrmCs = MNCC_CAUSE_CALL_CLEAR;
2471 psaCC_ClearCall (cId);
2472 break;
2473
2474 case( MNCC_RI_CIRCULAR ):
2475
2476 ccShrdPrm.datStat = DS_IDL;
2477 psaCC_ModifyCall(cId); /* back to former service */
2478 break;
2479 }
2480 break;
2481
2482 case( DS_MDF_REQ ):
2483 ccShrdPrm.datStat = DS_IDL;
2484 psaCC_ModifyCall(cId);
2485 break;
2486 }
2487 break;
2488 }
2489 #endif /* of #ifdef FAX_AND_DATA */
2490 }
2491 #endif /* DTI */
2492
2493 #ifdef FF_FAX
2494 /*
2495 +-------------------------------------------------------------------+
2496 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
2497 | ROUTINE : cmhCC_RA_Modified |
2498 +-------------------------------------------------------------------+
2499
2500 PURPOSE : RA entity modified after CMM
2501
2502 */
2503 #ifdef DTI
2504 GLOBAL void cmhCC_RA_Modified ( SHORT cId )
2505 {
2506 #ifdef FAX_AND_DATA
2507
2508 T_CC_CALL_TYPE calltype = cmhCC_getcalltype(cId);
2509
2510 TRACE_FUNCTION ("cmhCC_RA_Modified()");
2511
2512 if( calltype EQ FAX_CALL )
2513 {
2514 /* only in case of a fax call */
2515 if( ccShrdPrm.datStat EQ DS_TCH_MDF )
2516 {
2517 ccShrdPrm.datStat = DS_ACT;
2518
2519 if( cmhT30_Modify() NEQ AT_EXCT )
2520 {
2521 ccShrdPrm.datStat = DS_DSC_REQ;
2522 cmhRA_Deactivate ();
2523 }
2524 }
2525 }
2526 #endif /* of #ifdef FAX_AND_DATA */
2527 }
2528 #endif /* DTI */
2529 #endif /* FF_FAX */
2530
2531 /*
2532 +-------------------------------------------------------------------+
2533 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
2534 | ROUTINE : cmhCC_L2R_or_TRA_Activated |
2535 +-------------------------------------------------------------------+
2536
2537 PURPOSE : L2R entity activated, data path established
2538
2539 */
2540 #ifdef DTI
2541 GLOBAL void cmhCC_L2R_or_TRA_Activated ( T_DTI_ENTITY_ID activated_module, SHORT cId )
2542 {
2543 #ifdef FAX_AND_DATA
2544 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId];
2545 T_CC_CMD_PRM * pCCCmdPrm; /* points to CC command parameters */
2546 UBYTE cmdBuf; /* buffers current command */
2547 UBYTE srcBuf; /* buffers current command source */
2548 T_CC_CALL_TYPE calltype = cmhCC_getcalltype(cId);
2549
2550 TRACE_FUNCTION ("cmhCC_L2R_or_TRA_Activated()");
2551
2552 if (!psaCC_ctbIsValid (cId))
2553 {
2554 /*
2555 * If for some no good reason we got a L2R_CONNECT_CNF, L2R_CONNECT_IND
2556 * or TRA_ACTIVATE_CNF without having a valid entry in the call table,
2557 * we do here the same as for the FAX case where those events are also
2558 * unexpected. We send the respective deativation request.
2559 */
2560 TRACE_ERROR ("Call table entry disappeared");
2561 ccShrdPrm.datStat = DS_DSC_REQ;
2562 switch( activated_module )
2563 {
2564 case( DTI_ENTITY_TRA ):
2565 psaTRA_Deactivate();
2566 break;
2567 case( DTI_ENTITY_L2R ):
2568 cmhL2R_Deactivate();
2569 break;
2570 default: /* Unexpected to happen */
2571 break;
2572 }
2573 return;
2574 }
2575
2576 cmdBuf = ctb->curCmd;
2577 srcBuf = ctb->curSrc;
2578 pCCCmdPrm = &cmhPrm[srcBuf].ccCmdPrm;
2579
2580 switch( calltype )
2581 {
2582 case( TRANS_CALL ):
2583 case( NON_TRANS_CALL ):
2584
2585 #ifdef CO_UDP_IP
2586 case( UDPIP_CALL ):
2587 #endif /* CO_UDP_IP */
2588 #ifdef FF_PPP
2589 case( PPP_CALL ):
2590 #endif /* FF_PPP */
2591 #if defined(FF_GPF_TCPIP)
2592 case (TCPIP_CALL):
2593 #endif /* FF_GPF_TCPIP */
2594
2595 switch( ccShrdPrm.datStat )
2596 {
2597 case( DS_ACT_REQ ):
2598
2599 ccShrdPrm.datStat = DS_ACT;
2600 cmhCC_PrepareCmdEnd (cId, NULL, NULL);
2601
2602 /* reset CMOD to single mode */
2603 ccShrdPrm.CMODmode = CMOD_MOD_Single;
2604
2605 /* check if connect is expected */
2606 if( cmhCC_tstAndUnflagCall( cId, &(pCCCmdPrm -> mltyCncFlg)))
2607 {
2608 if( pCCCmdPrm -> mltyCncFlg EQ 0 ) /* if last call */
2609 {
2610 R_AT( RAT_CR, (T_ACI_CMD_SRC)srcBuf )
2611 (cmhCC_GetSrvType (&ctb->BC[ctb->curBC]));
2612
2613 R_AT( RAT_ILRR, (T_ACI_CMD_SRC)srcBuf )
2614 (cmhCC_GetDataRate (&ctb->BC[ctb->curBC]),
2615 cmhCC_GetFormat (&ctb->BC[ctb->curBC]),
2616 cmhCC_GetParity (&ctb->BC[ctb->curBC]));
2617 #if defined (CO_UDP_IP) AND defined (FF_GPF_TCPIP)
2618 if ( (calltype NEQ UDPIP_CALL) AND (calltype NEQ TCPIP_CALL) )
2619 #endif
2620 #if defined (CO_UDP_IP) AND !defined(FF_GPF_TCPIP)
2621 if (calltype NEQ UDPIP_CALL)
2622 #endif
2623 #if defined (FF_GPF_TCPIP) AND !defined(CO_UDP_IP)
2624 if (calltype NEQ TCPIP_CALL)
2625 #endif
2626 #ifdef FF_PPP
2627 if (calltype NEQ PPP_CALL)
2628 #endif /* FF_PPP */
2629 {
2630 #if defined (SIM_TOOLKIT) AND defined (FF_SAT_E)
2631 if (!cmhSAT_OpChnChckCSD( TPL_NONE))
2632 #endif /* of SIM_TOOLKIT AND FF_SAT_E*/
2633 {
2634 R_AT( RAT_CONNECT, (T_ACI_CMD_SRC)srcBuf )
2635 (cmdBuf, cmhCC_GetDataRate(&ctb->BC[ctb->curBC]), cId+1, FALSE);
2636 }
2637 }
2638
2639 /* log result */
2640 cmh_logRslt ( (T_ACI_CMD_SRC)srcBuf, RAT_CONNECT,
2641 (T_ACI_AT_CMD)cmdBuf, (SHORT)(cId+1),
2642 (T_ACI_BS_SPEED)cmhCC_GetDataRate(&ctb->BC[ctb->curBC]), CME_ERR_NotPresent );
2643
2644 switch( activated_module )
2645 {
2646 case( DTI_ENTITY_TRA ):
2647 if (IS_SRC_BT(srcBuf))
2648 {
2649 T_DTI_ENTITY_ID entity_list[] = {DTI_ENTITY_BLUETOOTH, DTI_ENTITY_TRA};
2650 UBYTE dti_id = dti_cntrl_new_dti(DTI_DTI_ID_NOTPRESENT);
2651 dti_cntrl_est_dpath ( dti_id,
2652 entity_list,
2653 2,
2654 SPLIT,
2655 TRA_connect_dti_cb);
2656 }
2657 #if defined (SIM_TOOLKIT) AND defined (FF_SAT_E)
2658 if (cmhSAT_OpChnChckCSD( TPL_NONE))
2659 {
2660 cmhSAT_OpChnSIMCnctReq( DTI_ENTITY_TRA );
2661 }
2662 #endif /* of SIM_TOOLKIT AND FF_SAT_E */
2663 else
2664 {
2665 T_DTI_ENTITY_ID entity_list[] = {DTI_ENTITY_TRA};
2666
2667 dti_cntrl_est_dpath_indirect ( srcBuf,
2668 entity_list,
2669 1,
2670 SPLIT,
2671 TRA_connect_dti_cb,
2672 DTI_CPBLTY_SER,
2673 DTI_CID_NOTPRESENT);
2674 }
2675 break;
2676
2677 case( DTI_ENTITY_L2R ):
2678 #ifdef CO_UDP_IP
2679 if ( calltype EQ UDPIP_CALL )
2680 {
2681 UBYTE dti_id;
2682 T_DTI_ENTITY_ID entity_list[] = {DTI_ENTITY_IP, DTI_ENTITY_PPPC, DTI_ENTITY_L2R};
2683 #if defined (SIM_TOOLKIT) AND defined (FF_SAT_E)
2684 if ( satShrdPrm.opchStat EQ OPCH_EST_REQ )
2685 dti_id = simShrdPrm.sat_class_e_dti_id;
2686 else
2687 #endif /* SIM_TOOLKIT AND FF_SAT_E */
2688 dti_id = wap_dti_id;
2689
2690 dti_cntrl_est_dpath ( dti_id,
2691 entity_list,
2692 3,
2693 APPEND,
2694 IP_UDP_connect_dti_cb);
2695 break;
2696 }
2697 #endif /* CO_UDP_IP */
2698
2699 #if defined (FF_PPP) AND defined (DTI)
2700 if ( calltype EQ PPP_CALL )
2701 {
2702 T_DTI_ENTITY_ID entity_list[] = {DTI_ENTITY_PPPC, DTI_ENTITY_L2R};
2703 dti_cntrl_est_dpath_indirect ( srcBuf,
2704 entity_list,
2705 2,
2706 SPLIT,
2707 L2R_connect_dti_cb,
2708 DTI_CPBLTY_PKT,
2709 DTI_CID_NOTPRESENT);
2710 break;
2711 }
2712 #endif /* FF_PPP */
2713
2714 #ifdef FF_GPF_TCPIP
2715 if ( calltype EQ TCPIP_CALL )
2716 {
2717 UBYTE dti_id;
2718 T_DTI_ENTITY_ID entity_list[] = {DTI_ENTITY_TCPIP, DTI_ENTITY_PPPC, DTI_ENTITY_L2R};
2719 /* create a WAP DTI if not present */
2720 if (wap_dti_id EQ DTI_DTI_ID_NOTPRESENT)
2721 {
2722 wap_dti_id = dti_cntrl_new_dti (DTI_DTI_ID_NOTPRESENT);
2723 TRACE_EVENT_P1("tcpip_wap_dti_id = %d", wap_dti_id);
2724 }
2725 dti_id = wap_dti_id;
2726 dti_cntrl_est_dpath ( dti_id,
2727 entity_list,
2728 3,
2729 SPLIT,
2730 TCPIP_connect_dti_cb);
2731 break;
2732 }
2733 #endif /* FF_GPF_TCPIP */
2734
2735 #if defined (SIM_TOOLKIT) AND defined (FF_SAT_E)
2736 if (cmhSAT_OpChnChckCSD( TPL_NONE))
2737 {
2738 cmhSAT_OpChnSIMCnctReq( DTI_ENTITY_L2R );
2739 }
2740 #endif /* of SIM_TOOLKIT AND FF_SAT_E */
2741
2742 #ifdef DTI
2743 if (IS_SRC_BT(srcBuf))
2744 {
2745 T_DTI_ENTITY_ID entity_list[] = {DTI_ENTITY_BLUETOOTH, DTI_ENTITY_L2R};
2746 UBYTE dti_id = dti_cntrl_new_dti(DTI_DTI_ID_NOTPRESENT);
2747 dti_cntrl_est_dpath ( dti_id,
2748 entity_list,
2749 2,
2750 SPLIT,
2751 L2R_connect_dti_cb);
2752 }
2753 else
2754 {
2755 T_DTI_ENTITY_ID entity_list[] = {DTI_ENTITY_L2R};
2756 dti_cntrl_est_dpath_indirect ( srcBuf,
2757 entity_list,
2758 1,
2759 SPLIT,
2760 L2R_connect_dti_cb,
2761 DTI_CPBLTY_SER,
2762 DTI_CID_NOTPRESENT);
2763 }
2764 #endif /* DTI */
2765 break;
2766 } /* switch( activated_module ) */
2767 } /* if( pCCCmdPrm -> mltyCncFlg EQ 0 ) */
2768 } /* if( cmhCC_tstAndUnflagCall( cId, &(pCCCmdPrm -> mltyCncFlg))) */
2769 break;
2770
2771 case( DS_REST_REQ ):
2772 ccShrdPrm.datStat = DS_ACT;
2773 break;
2774 }
2775 break;
2776 /* in case of a fax call */
2777 case( FAX_CALL ):
2778
2779 TRACE_EVENT( "UNEXP BEARER SERV FAX" );
2780 ccShrdPrm.datStat = DS_DSC_REQ;
2781 switch( activated_module )
2782 {
2783 case( DTI_ENTITY_TRA ):
2784 psaTRA_Deactivate();
2785 break;
2786 case( DTI_ENTITY_L2R ):
2787 cmhL2R_Deactivate();
2788 break;
2789 }
2790 break;
2791 }
2792 #endif /* of #ifdef FAX_AND_DATA */
2793 }
2794 #endif /* UART */
2795
2796 /*
2797 +-------------------------------------------------------------------+
2798 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
2799 | ROUTINE : cmhCC_L2R_or_TRA_Deactivated |
2800 +-------------------------------------------------------------------+
2801
2802 PURPOSE : L2R entity deactivated, data path disconnected
2803
2804 */
2805 #ifdef UART
2806 GLOBAL void cmhCC_L2R_or_TRA_Deactivated ( SHORT cId )
2807 {
2808 #ifdef FAX_AND_DATA
2809
2810 UBYTE srcBuf;
2811 #ifdef DTI
2812 T_DTI_CNTRL dti_cntrl_info;
2813 #endif /* DTI */
2814 T_CC_CALL_TYPE calltype = cmhCC_getcalltype(cId);
2815
2816 /* if there is a redirection get proper source */
2817 #ifdef DTI
2818 if (dti_cntrl_get_info_from_dti_id(raShrdPrm.dti_id, &dti_cntrl_info))
2819 {
2820 srcBuf = dti_cntrl_info.src_id;
2821 }
2822 else /* if it is not a valid dti_id - take stored src_id */
2823 {
2824 TRACE_EVENT_P2("No valid dti_id:%d taking owner:%d",
2825 raShrdPrm.dti_id,
2826 raShrdPrm.owner);
2827 #endif /* DTI */
2828 srcBuf = raShrdPrm.owner;
2829 #ifdef DTI
2830 }
2831 /* reset ra dti_id storage */
2832 raShrdPrm.dti_id = NOT_PRESENT_8BIT;
2833 #endif /* DTI */
2834
2835 TRACE_FUNCTION ("cmhCC_L2R_or_TRA_Deactivated()");
2836
2837 io_setDCD ((T_ACI_CMD_SRC)srcBuf, IO_DCD_OFF);
2838
2839 switch( calltype )
2840 {
2841 case( TRANS_CALL ):
2842 case( NON_TRANS_CALL ):
2843
2844 #ifdef CO_UDP_IP
2845 case( UDPIP_CALL ):
2846 #endif /* CO_UDP_IP */
2847 #ifdef FF_PPP
2848 case( PPP_CALL ):
2849 #endif /* FF_PPP */
2850 #if defined(FF_GPF_TCPIP)
2851 case (TCPIP_CALL):
2852 #endif /* FF_GPF_TCPIP */
2853
2854 switch( ccShrdPrm.datStat )
2855 {
2856 case( DS_ACT ):
2857 case( DS_ACT_REQ ):
2858 case( DS_DSC_REQ ):
2859 case( DS_MDF_REQ ):
2860 case( DS_STOP_REQ ):
2861
2862 cmhRA_Deactivate ();
2863 break;
2864 }
2865 break;
2866
2867 case( FAX_CALL ):
2868 TRACE_EVENT( "UNEXP BEARER SERV FAX" );
2869 ccShrdPrm.datStat = DS_DSC_REQ;
2870 cmhRA_Deactivate();
2871 break;
2872 }
2873 #endif /* of #ifdef FAX_AND_DATA */
2874 }
2875 #endif /* UART */
2876
2877 /*
2878 +-------------------------------------------------------------------+
2879 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
2880 | ROUTINE : cmhCC_L2R_Failed |
2881 +-------------------------------------------------------------------+
2882
2883 PURPOSE : L2R entity failure
2884
2885 */
2886
2887 GLOBAL void cmhCC_L2R_Failed ( void )
2888 {
2889 #ifdef FAX_AND_DATA
2890 SHORT cId = raShrdPrm.cId; /* holds call identifier */
2891 T_CC_CALL_TYPE calltype;
2892
2893 TRACE_FUNCTION ("cmhCC_L2R_Failed()");
2894
2895 calltype = cmhCC_getcalltype(cId);
2896
2897 switch( calltype )
2898 {
2899 case( NON_TRANS_CALL ):
2900 switch( ccShrdPrm.datStat )
2901 {
2902 case( DS_ACT_REQ ):
2903 if( psaCC_ctbIsValid (cId) AND
2904 psaCC_ctb(cId)->calStat EQ CS_MDF_REQ )
2905 {
2906 ccShrdPrm.datStat = DS_ABO_REQ;
2907 }
2908 /*lint -fallthrough*/
2909 case( DS_ACT ):
2910 case( DS_REST_REQ ):
2911 cmhL2R_Deactivate ();
2912 break;
2913 }
2914 break;
2915
2916
2917 case( FAX_CALL ):
2918
2919 TRACE_EVENT( "UNEXP BEARER SERV FAX" );
2920 ccShrdPrm.datStat = DS_DSC_REQ;
2921 cmhL2R_Deactivate();
2922 break;
2923 }
2924
2925 #endif /* of #ifdef FAX_AND_DATA */
2926 }
2927
2928 #ifdef FF_FAX
2929 /*
2930 +-------------------------------------------------------------------+
2931 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
2932 | ROUTINE : cmhCC_T30_Activated |
2933 +-------------------------------------------------------------------+
2934
2935 PURPOSE : T30 entity activated, data path established
2936
2937 */
2938
2939 GLOBAL void cmhCC_T30_Activated ( void )
2940 {
2941 #if defined (FAX_AND_DATA) AND defined (DTI)
2942
2943 SHORT cId = t30ShrdPrm.cId; /* holds call identifier */
2944 T_CC_CALL_TYPE calltype = cmhCC_getcalltype(cId);
2945
2946 TRACE_FUNCTION ("cmhCC_T30_Activated()");
2947
2948 (void)&cmhPrm[psaCC_ctb(cId)->calOwn].ccCmdPrm;
2949 (void)psaCC_ctb(cId)->curCmd;
2950
2951 switch( calltype )
2952 {
2953 case( FAX_CALL ):
2954 switch( ccShrdPrm.datStat )
2955 {
2956 case( DS_ACT_REQ ):
2957
2958 ccShrdPrm.datStat = DS_ACT;
2959
2960 /* reset CMOD to single mode */
2961 ccShrdPrm.CMODmode = CMOD_MOD_Single;
2962
2963 if( psaCC_ctb(cId)->calType EQ CT_MTC )
2964 {
2965 cmhT30_SendCaps( (T_ACI_CMD_SRC)psaCC_ctb(cId)->curSrc, FRT_DIS );
2966 }
2967 break;
2968 }
2969 break;
2970
2971 /* in case of a asynchronous call */
2972 case( TRANS_CALL ):
2973 case( NON_TRANS_CALL ):
2974 TRACE_EVENT( "UNEXP BEARER SERV ASYNC" );
2975 ccShrdPrm.datStat = DS_DSC_REQ;
2976 cmhT30_Deactivate();
2977 break;
2978 }
2979
2980 #endif /* of #ifdef FAX_AND_DATA */
2981 }
2982
2983 /*
2984 +-------------------------------------------------------------------+
2985 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
2986 | ROUTINE : cmhCC_T30_Deactivated |
2987 +-------------------------------------------------------------------+
2988
2989 PURPOSE : T30 entity deactivated, data path disconnected
2990
2991 */
2992
2993 GLOBAL void cmhCC_T30_Deactivated ( void )
2994 {
2995 #ifdef FAX_AND_DATA
2996
2997 SHORT cId = t30ShrdPrm.cId; /* holds call identifier */
2998 T_CC_CALL_TYPE calltype = cmhCC_getcalltype(cId);
2999
3000 TRACE_FUNCTION ("cmhCC_T30_Deactivated()");
3001
3002 switch( calltype )
3003 {
3004 case( FAX_CALL ):
3005 switch( ccShrdPrm.datStat )
3006 {
3007 case( DS_ACT ):
3008 case( DS_ACT_REQ ):
3009 case( DS_DSC_REQ ):
3010 case( DS_MDF_REQ ):
3011 case( DS_STOP_REQ ):
3012 case( DS_TCH_MDF ):
3013
3014 cmhRA_Deactivate ();
3015 break;
3016 }
3017 break;
3018
3019 /* in case of a asynchronous data call */
3020 case( TRANS_CALL ):
3021 case( NON_TRANS_CALL ):
3022
3023 TRACE_EVENT( "UNEXP BEARER SERV ASYNC" );
3024 ccShrdPrm.datStat = DS_DSC_REQ;
3025 cmhRA_Deactivate();
3026 break;
3027 }
3028
3029 #endif /* of #ifdef FAX_AND_DATA */
3030 }
3031
3032 /*
3033 +-------------------------------------------------------------------+
3034 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
3035 | ROUTINE : cmhCC_T30_Failed |
3036 +-------------------------------------------------------------------+
3037
3038 PURPOSE : T30 entity failure
3039
3040 */
3041
3042 GLOBAL void cmhCC_T30_Failed ( void )
3043 {
3044 #if defined FAX_AND_DATA AND defined (DTI)
3045
3046 SHORT cId = t30ShrdPrm.cId; /* holds call identifier */
3047 T_CC_CALL_TYPE calltype = cmhCC_getcalltype(cId);
3048
3049 TRACE_FUNCTION ("cmhCC_T30_Failed()");
3050
3051 switch( calltype )
3052 {
3053 case( FAX_CALL ):
3054
3055 switch( ccShrdPrm.datStat )
3056 {
3057 case( DS_ACT_REQ ):
3058
3059 if( psaCC_ctb(cId)->calStat EQ CS_MDF_REQ )
3060 {
3061 ccShrdPrm.datStat = DS_ABO_REQ;
3062 }
3063 /*lint -fallthrough*/
3064 case( DS_ACT ):
3065 case( DS_REST_REQ ):
3066 case( DS_TCH_MDF ):
3067
3068 cmhT30_Deactivate ();
3069 break;
3070 }
3071 break;
3072
3073 /* in case of a asynchronous data call */
3074 case( TRANS_CALL ):
3075 case( NON_TRANS_CALL ):
3076
3077 TRACE_EVENT( "UNEXP BEARER SERV ASYNC" );
3078 ccShrdPrm.datStat = DS_DSC_REQ;
3079 cmhT30_Deactivate();
3080 break;
3081 }
3082
3083 #endif /* of #ifdef FAX_AND_DATA */
3084 }
3085
3086 /*
3087 +-------------------------------------------------------------------+
3088 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
3089 | ROUTINE : cmhCC_T30_RmtCaps |
3090 +-------------------------------------------------------------------+
3091
3092 PURPOSE : T30 remote capability indication
3093
3094 */
3095
3096 GLOBAL void cmhCC_T30_RmtCaps ( void )
3097 {
3098 #ifdef FAX_AND_DATA
3099
3100 T_CC_CMD_PRM * pCCCmdPrm; /* points to CC command parameters */
3101 UBYTE cmdBuf; /* buffers current command */
3102 UBYTE srcBuf; /* buffers current command source */
3103 SHORT cId = t30ShrdPrm.cId; /* holds call identifier */
3104
3105 TRACE_FUNCTION ("cmhCC_T30_RmtCaps()");
3106
3107 /*
3108 *-------------------------------------------------------------------
3109 * check if connect is expected
3110 *-------------------------------------------------------------------
3111 */
3112 pCCCmdPrm = &cmhPrm[psaCC_ctb(cId)->curSrc].ccCmdPrm;
3113 cmhCC_PrepareCmdEnd (cId, &cmdBuf, &srcBuf);
3114
3115 if( cmhCC_tstAndUnflagCall( cId, &(pCCCmdPrm -> mltyCncFlg)))
3116 {
3117 if( pCCCmdPrm -> mltyCncFlg EQ 0 ) /* if last call */
3118 {
3119 R_AT( RAT_OK, (T_ACI_CMD_SRC)srcBuf ) ( cmdBuf );
3120
3121 /* log result */
3122 cmh_logRslt ( (T_ACI_CMD_SRC)srcBuf, RAT_OK,
3123 (T_ACI_AT_CMD)cmdBuf, (SHORT)(cId+1), BS_SPEED_NotPresent,CME_ERR_NotPresent);
3124 }
3125 }
3126
3127 #endif /* of #ifdef FAX_AND_DATA */
3128 }
3129
3130 #endif /* FF_FAX */
3131 /*
3132 +-------------------------------------------------------------------+
3133 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
3134 | ROUTINE : cmhCC_MPTYBuild |
3135 +-------------------------------------------------------------------+
3136
3137 PURPOSE : Multiparty successful build.
3138
3139 */
3140
3141 GLOBAL void cmhCC_MPTYBuild( SHORT cId,
3142 T_BUILD_MPTY_RES *bldMPTY )
3143 {
3144 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId];
3145 T_CC_CMD_PRM * pCCCmdPrm; /* points to CC command parameters */
3146 UBYTE ctbIdx; /* holds call table index */
3147 UBYTE cmdBuf; /* buffers command */
3148 UBYTE srcBuf; /* buffers command source */
3149
3150 TRACE_FUNCTION ("cmhCC_MPTYBuild()");
3151
3152 TIMERSTOP( ACI_TMPTY );
3153
3154 if( ctb->curCmd NEQ AT_CMD_CHLD )
3155 return; /* wrong command context */
3156
3157 /* set multiparty status for involved calls */
3158 for( ctbIdx = 0; ctbIdx < MAX_CALL_NR; ctbIdx++ )
3159 {
3160 if (ccShrdPrm.ctb[ctbIdx] NEQ NULL AND
3161 (psaCC_ctb(ctbIdx)->mptyStat EQ CS_ACT_REQ OR
3162 psaCC_ctb(ctbIdx)->mptyStat EQ CS_ACT ))
3163 {
3164 psaCC_ctb(ctbIdx)->mptyStat = CS_ACT;
3165 psaCC_ctb(ctbIdx)->calStat = CS_ACT;
3166 }
3167 }
3168
3169 pCCCmdPrm = &cmhPrm[ctb->curSrc].ccCmdPrm;
3170 cmhCC_PrepareCmdEnd (cId, &cmdBuf, &srcBuf);
3171
3172 psaCC_MPTY (cId, MNCC_MPTY_BUILD_SUCCESS);
3173 /* Implements Measure 184, 185 and 187 */
3174 cmhCC_tstAndUnflag_MPTYCall( cId, srcBuf, cmdBuf, pCCCmdPrm );
3175 }
3176
3177 /*
3178 +-------------------------------------------------------------------+
3179 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
3180 | ROUTINE : cmhCC_MPTYSplit |
3181 +-------------------------------------------------------------------+
3182
3183 PURPOSE : Multiparty successful split.
3184
3185 */
3186
3187 GLOBAL void cmhCC_MPTYSplit( SHORT cId,
3188 T_SPLIT_MPTY_RES *splMPTY )
3189 {
3190 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId];
3191 T_CC_CMD_PRM * pCCCmdPrm; /* points to CC command parameters */
3192 UBYTE ctbIdx; /* holds call table index */
3193 UBYTE cmdBuf; /* buffers command */
3194 UBYTE srcBuf; /* buffers command source */
3195 UBYTE fndCal; /* holds number of found calls */
3196
3197 TRACE_FUNCTION ("cmhCC_MPTYSplit()");
3198
3199 TIMERSTOP( ACI_TMPTY );
3200
3201 if( ctb->curCmd NEQ AT_CMD_CHLD )
3202 return; /* wrong command context */
3203
3204 /* set status for involved calls */
3205 for( fndCal = 0, ctbIdx = 0; ctbIdx < MAX_CALL_NR; ctbIdx++ )
3206 {
3207 if( ccShrdPrm.ctb[ctbIdx] NEQ NULL AND
3208 psaCC_ctb(ctbIdx)->mptyStat EQ CS_ACT AND
3209 ctbIdx NEQ cId )
3210 {
3211 psaCC_ctb(ctbIdx)->calStat = CS_HLD;
3212 fndCal++;
3213 }
3214 }
3215
3216 /* if only one other call is left, reset multiparty status */
3217 /* if only one other call is left, do not reset multiparty status - VO patch
3218 if( fndCal EQ 1 )
3219 {
3220 psaCC_ctb(fndCId)->mptyStat = CS_IDL;
3221 }
3222 */
3223
3224 pCCCmdPrm = &cmhPrm[ctb->curSrc].ccCmdPrm;
3225 cmhCC_PrepareCmdEnd (cId, &cmdBuf, &srcBuf);
3226 ctb->calStat = CS_ACT;
3227 ctb->mptyStat = CS_IDL;
3228
3229 psaCC_MPTY (cId, MNCC_MPTY_SPLIT_SUCCESS);
3230
3231 psaCC_setSpeechMode (); /* In case we split from a held mpty */
3232 /* Implements Measure 184, 185 and 187 */
3233 cmhCC_tstAndUnflag_MPTYCall( cId, srcBuf, cmdBuf, pCCCmdPrm );
3234 }
3235
3236 /*
3237 +-------------------------------------------------------------------+
3238 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
3239 | ROUTINE : cmhCC_MPTYHeld |
3240 +-------------------------------------------------------------------+
3241
3242 PURPOSE : Multiparty successful held.
3243
3244 */
3245
3246 GLOBAL void cmhCC_MPTYHeld( SHORT cId,
3247 T_HOLD_MPTY_RES *hldMPTY )
3248 {
3249 T_CC_CMD_PRM * pCCCmdPrm; /* points to CC command parameters */
3250 UBYTE ctbIdx; /* holds call table index */
3251 UBYTE cmdBuf; /* buffers command */
3252 UBYTE srcBuf; /* buffers command source */
3253
3254 TRACE_FUNCTION ("cmhCC_MPTYHeld()");
3255
3256 TIMERSTOP( ACI_TMPTY );
3257
3258 /* check for command context */
3259 switch( psaCC_ctb(cId)->curCmd )
3260 {
3261 case( AT_CMD_CHLD ):
3262 case( AT_CMD_D ):
3263 break;
3264
3265 default:
3266 return; /* wrong command context */
3267 }
3268
3269 /* set call status for multiparty call member */
3270 for( ctbIdx = 0; ctbIdx < MAX_CALL_NR; ctbIdx++ )
3271 {
3272 if( ccShrdPrm.ctb[ctbIdx] NEQ NULL AND
3273 psaCC_ctb(ctbIdx)->calStat EQ CS_HLD_REQ AND
3274 psaCC_ctb(ctbIdx)->mptyStat EQ CS_ACT )
3275 {
3276 psaCC_ctb(ctbIdx)->calStat = CS_HLD;
3277 }
3278 }
3279
3280 psaCC_MPTY (cId, MNCC_MPTY_HOLD_SUCCESS);
3281
3282 psaCC_setSpeechMode ();
3283
3284 pCCCmdPrm = &cmhPrm[psaCC_ctb(cId)->curSrc].ccCmdPrm;
3285 cmhCC_PrepareCmdEnd (cId, &cmdBuf, &srcBuf);
3286
3287 if( cmhCC_tstAndUnflagCall( cId, &(pCCCmdPrm -> mltyCncFlg)))
3288 {
3289 if((pCCCmdPrm -> CHLDmode EQ CHLD_MOD_HldActExc OR
3290 pCCCmdPrm -> CHLDmode EQ CHLD_MOD_HldActAndAcpt OR
3291 pCCCmdPrm -> CHLDmode EQ CHLD_MOD_HldActDial) AND
3292 pCCCmdPrm -> mltyCncFlg )
3293 {
3294 process_CHLDaddInfo( srcBuf, MTPTY_HELD );
3295 }
3296
3297 if( pCCCmdPrm -> mltyCncFlg EQ 0 AND
3298 pCCCmdPrm -> mltyDscFlg EQ 0 ) /* if last call */
3299 {
3300 R_AT( RAT_OK, (T_ACI_CMD_SRC)srcBuf ) ( cmdBuf );
3301
3302 /* log result */
3303 cmh_logRslt ((T_ACI_CMD_SRC)srcBuf, RAT_OK,
3304 (T_ACI_AT_CMD)cmdBuf, (SHORT)(cId+1),BS_SPEED_NotPresent,CME_ERR_NotPresent);
3305 }
3306 }
3307 }
3308
3309 /*
3310 +-------------------------------------------------------------------+
3311 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
3312 | ROUTINE : cmhCC_MPTYRetrieved |
3313 +-------------------------------------------------------------------+
3314
3315 PURPOSE : Multiparty successful retrieved.
3316
3317 */
3318
3319 GLOBAL void cmhCC_MPTYRetrieved( SHORT cId,
3320 T_RETRIEVE_MPTY_RES *rtvMPTY )
3321 {
3322 T_CC_CMD_PRM * pCCCmdPrm; /* points to CC command parameters */
3323 UBYTE ctbIdx; /* holds call table index */
3324 UBYTE cmdBuf; /* buffers command */
3325 UBYTE srcBuf; /* buffers command source */
3326
3327 TRACE_FUNCTION ("cmhCC_MPTYRetrieved()");
3328
3329 TIMERSTOP( ACI_TMPTY );
3330
3331 if( psaCC_ctb(cId)->curCmd NEQ AT_CMD_CHLD )
3332 return; /* wrong command context */
3333
3334 /* set call status for multiparty call member */
3335 for( ctbIdx = 0; ctbIdx < MAX_CALL_NR; ctbIdx++ )
3336 {
3337 if( ccShrdPrm.ctb[ctbIdx] NEQ NULL AND
3338 psaCC_ctb(ctbIdx)->calStat EQ CS_ACT_REQ AND
3339 psaCC_ctb(ctbIdx)->mptyStat EQ CS_ACT )
3340 {
3341 psaCC_ctb(ctbIdx)->calStat = CS_ACT;
3342 }
3343 }
3344
3345 pCCCmdPrm = &cmhPrm[psaCC_ctb(cId)->curSrc].ccCmdPrm;
3346 cmhCC_PrepareCmdEnd (cId, &cmdBuf, &srcBuf);
3347
3348 psaCC_MPTY (cId, MNCC_MPTY_RETRIEVE_SUCCESS);
3349
3350 psaCC_setSpeechMode ();
3351 /* Implements Measure 184, 185 and 187 */
3352 cmhCC_tstAndUnflag_MPTYCall( cId, srcBuf, cmdBuf, pCCCmdPrm );
3353
3354 }
3355
3356 /*
3357 +-------------------------------------------------------------------+
3358 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
3359 | ROUTINE : cmhCC_NotifySS |
3360 +-------------------------------------------------------------------+
3361
3362 PURPOSE : SS notification received: in preamble, some
3363 local functions, otherwise, the function would be huge...
3364
3365 */
3366
3367 /*
3368 +------------------------------------------------------------------------------
3369 | Function : send_CSSX_notification
3370 +------------------------------------------------------------------------------
3371 | Description : This function sends CSSU and CSSI.
3372 |
3373 | Parameters : ctbIdx - call table index
3374 | cssx_code - CSS(X) code
3375 | index - Index
3376 | *number - buffer for number
3377 | *toa - buffers type of address
3378 | *subaddr - buffer for subaddress
3379 | *tos - holds type of subaddress
3380 |
3381 | Return :
3382 +------------------------------------------------------------------------------
3383 */
3384
3385 GLOBAL void send_CSSX_notification(SHORT ctbIdx,
3386 T_ACI_CSSX_CODE cssx_code,
3387 SHORT index,
3388 CHAR *number,
3389 T_ACI_TOA *toa,
3390 CHAR *subaddr,
3391 T_ACI_TOS *tos)
3392
3393 {
3394 UBYTE idx; /* holds index counter */
3395
3396 /* Check if CC State is CS ACT REQ */
3397 //TISH, OMAPS00130688
3398 //start
3399 #if 0
3400 if (ctbIdx > NO_ENTRY AND
3401 psaCC_ctb(ctbIdx)->calStat EQ CS_ACT_REQ AND
3402 psaCC_ctb(ctbIdx)->calType EQ CT_MOC)
3403 #else
3404 if (ctbIdx > NO_ENTRY AND
3405 ((psaCC_ctb(ctbIdx)->calStat EQ CS_ACT_REQ) OR
3406 (psaCC_ctb(ctbIdx)->calStat EQ CS_ACT AND cssx_code EQ CSSX_CODE_CFUActive) OR
3407 (psaCC_ctb(ctbIdx)->calStat EQ CS_DSC_REQ)) AND
3408 psaCC_ctb(ctbIdx)->calType EQ CT_MOC)
3409 #endif
3410 //end
3411 {
3412 T_ACI_CSSI_CODE cssi_code;
3413 /* Implements Measure 90,91 */
3414 if( (cssx_code <= CSSX_CODE_DeflectedCall ) AND
3415 (cssx_code >= CSSX_CODE_ForwardedCall))
3416 {
3417 cssi_code = ( T_ACI_CSSI_CODE ) cssx2I_Code_Convert[cssx_code];
3418 }
3419 else
3420 {
3421 cssi_code = CSSI_CODE_NotPresent;
3422 }
3423 if (cssi_code NEQ CSSI_CODE_NotPresent
3424 /* Added as we want comparison to 255 */
3425 AND (cssi_code NEQ CSSI_CODE_Biggest )
3426 )
3427 {
3428 //TISH patch for OMAPS00130689
3429 //start
3430 #if 0
3431 S8 source = psaCC_ctb(ctbIdx)->curSrc;
3432 R_AT( RAT_CSSI, (T_ACI_CMD_SRC)source)( cssi_code, index );
3433 #else
3434 for( idx = 0; idx < CMD_SRC_MAX; idx++ )
3435 {
3436 R_AT( RAT_CSSI, idx )(cssi_code, index);
3437 }
3438 #endif
3439 //end
3440 }
3441 }
3442 else /* (calldirection EQ CT_MTC) */
3443 {
3444 /* Sent CSSU TO ALL */
3445 T_ACI_CSSU_CODE cssu_code;
3446 /* Implements Measure 90,91 */
3447 /******************
3448 * Since there is a one-to-one mapping between CSSU and CSSX,
3449 * Hence we have not implemented any table for converting
3450 * CSSX codes to CSSU codes.
3451 ******************/
3452 cssu_code = CSSU_CODE_NotPresent;
3453
3454 if ( cssx_code EQ CSSX_CODE_DeflectedCall )
3455 {
3456 cssu_code = CSSU_CODE_DeflectedCall;
3457 }
3458 else if ( cssx_code EQ CSSX_CODE_IncCallForwarded)
3459 {
3460 cssu_code = CSSU_CODE_IncCallForwarded;
3461 }
3462 else if ( cssx_code <= CSSX_CODE_ECTConnect AND
3463 cssx_code >= CSSX_CODE_ForwardedCall )
3464 {
3465 cssu_code = ( T_ACI_CSSU_CODE ) cssx_code;
3466 }
3467 if (cssu_code != CSSU_CODE_NotPresent )
3468 {
3469 for( idx = 0; idx < CMD_SRC_MAX; idx++ )
3470 {
3471 R_AT( RAT_CSSU, (T_ACI_CMD_SRC)idx )(cssu_code, index, number, toa, subaddr, tos);
3472 }
3473 }
3474 }
3475 }
3476
3477
3478
3479 LOCAL void cmhCC_NotifySS_v_ssCode( SHORT cId, T_NOTIFY_SS_INV *ntfySS )
3480 {
3481 CHAR numBuf[MAX_B_SUBSCR_NUM_LEN]; /* buffer for number */
3482 T_ACI_TOA toa; /* holds type of address */
3483 CHAR subBuf[MAX_SUBADDR_LEN]; /* buffer for subaddress */
3484 T_ACI_TOS tos; /* holds type of subaddress */
3485
3486 TRACE_FUNCTION ("cmhCC_NotifySS_v_ssCode()");
3487
3488 switch( ntfySS -> notifySSArg.ssCode )
3489 {
3490 case( SS_CD_ALL_FWSS ):
3491 case( SS_CD_CFU ):
3492 if( ntfySS -> notifySSArg.v_ssStatus AND
3493 ntfySS -> notifySSArg.ssStatus & SSS_A )
3494 {
3495 send_CSSX_notification(cId,
3496 CSSX_CODE_CFUActive,
3497 ACI_NumParmNotPresent,
3498 NULL, NULL, NULL, NULL);
3499 }
3500 break;
3501
3502 case( SS_CD_CFB ):
3503 case( SS_CD_CFNRY ):
3504 case( SS_CD_CFNRC ):
3505 case( SS_CD_ALL_CFWSS ):
3506
3507 if( ntfySS -> notifySSArg.v_ssStatus AND
3508 ntfySS -> notifySSArg.ssStatus & SSS_A )
3509 {
3510
3511 send_CSSX_notification(cId,
3512 CSSX_CODE_SomeCCFActive,
3513 ACI_NumParmNotPresent,
3514 NULL, NULL, NULL, NULL);
3515 }
3516 break;
3517
3518 case( SS_CD_ALL_CBSS ):
3519
3520 if( ntfySS -> notifySSArg.v_ssStatus AND
3521 ntfySS -> notifySSArg.ssStatus & SSS_A )
3522 {
3523 /* RAT_CSSI ... outgoing calls are barred */
3524 /* RAT_CSSI ... incoming calls are barred */
3525 send_CSSX_notification(cId,
3526 CSSX_CODE_OutCallsBarred,
3527 ACI_NumParmNotPresent,
3528 NULL, NULL, NULL, NULL);
3529
3530 send_CSSX_notification(cId,
3531 CSSX_CODE_IncCallsBarred,
3532 ACI_NumParmNotPresent,
3533 NULL, NULL, NULL, NULL);
3534
3535 }
3536 break;
3537
3538 case( SS_CD_BOC ):
3539 case( SS_CD_BAOC ):
3540 case( SS_CD_BOIC ):
3541 case( SS_CD_BOICXH ):
3542
3543 if( ntfySS -> notifySSArg.v_ssStatus AND
3544 ntfySS -> notifySSArg.ssStatus & SSS_A )
3545 {
3546 /* RAT_CSSI ... outgoing calls are barred */
3547 send_CSSX_notification(cId,
3548 CSSX_CODE_OutCallsBarred,
3549 ACI_NumParmNotPresent,
3550 NULL, NULL, NULL, NULL);
3551
3552 }
3553 break;
3554
3555 case( SS_CD_BIC ):
3556 case( SS_CD_BAIC ):
3557 case( SS_CD_BICRM ):
3558
3559 if( ntfySS -> notifySSArg.v_ssStatus AND
3560 ntfySS -> notifySSArg.ssStatus & SSS_A )
3561 {
3562 /* RAT_CSSI ... incoming calls are barred */
3563 send_CSSX_notification(cId,
3564 CSSX_CODE_IncCallsBarred,
3565 ACI_NumParmNotPresent,
3566 NULL, NULL, NULL, NULL);
3567
3568 }
3569 break;
3570
3571 case( SS_CD_CD ):
3572 if (ntfySS->notifySSArg.v_ssNotification AND
3573 ntfySS->notifySSArg.ssNotification.fwdSubscriber EQ
3574 FWD_C_INC_CALL_FWD)
3575 {
3576 /*
3577 * If alerting is allowed now, send the CSSU indication.
3578 * Otherwise just remember that we got this notification.
3579 */
3580 if ((ccShrdPrm.TCHasg EQ TRUE) OR
3581 (psaCC_ctb(cId)->sigInf NEQ MNCC_SIG_NOT_PRES))
3582
3583 {
3584 /*
3585 * The conditions for user alerting are fulfilled.
3586 * Send the +CSSU: unsolicited result code now.
3587 */
3588 send_CSSX_notification(cId,
3589 CSSX_CODE_DeflectedCall,
3590 ACI_NumParmNotPresent,
3591 psaCC_ctbRdrAdr2Num (cId, numBuf, sizeof (numBuf)),
3592 cmhCC_ctbGetRdrNumTyp (cId, &toa),
3593 psaCC_ctbRdrAdr2Sub (cId, subBuf),
3594 cmhCC_ctbGetRdrSubTyp (cId, &tos));
3595
3596 psaCC_FreeRdrPty (cId);
3597 psaCC_ctb(cId)->CDStat = NO_VLD_CD;
3598 }
3599 else
3600 {
3601 /*
3602 * Indication of the MT call towards the MMI is deferred until
3603 * the alerting conditions are fulfilled (TCH assignment).
3604 */
3605 psaCC_ctb(cId)->CDStat = CD_Notified;
3606 }
3607 return;
3608 }
3609
3610 if (ntfySS->notifySSArg.v_ssNotification AND
3611 ntfySS->notifySSArg.ssNotification.clgSubscriber EQ
3612 CLG_A_OUTG_CALL_FWD_C)
3613 {
3614 /* RAT_CSSI ... outgoing call has been deflected */
3615 send_CSSX_notification(cId,
3616 CSSX_CODE_DeflectedCall,
3617 ACI_NumParmNotPresent,
3618 NULL, NULL, NULL, NULL);
3619
3620 }
3621 break;
3622
3623 default:
3624 TRACE_EVENT( "UNHANDLED SS-CODE IN NOTIFY" );
3625 break;
3626 }
3627 }
3628
3629 LOCAL void cmhCC_NotifySS_v_ssNotification( SHORT cId, T_NOTIFY_SS_INV *ntfySS )
3630 {
3631
3632 TRACE_FUNCTION ("cmhCC_NotifySS_v_ssNotification()");
3633
3634 if( ntfySS -> notifySSArg.ssNotification.clgSubscriber EQ
3635 CLG_A_OUTG_CALL_FWD_C )
3636 {
3637 /* RAT_CSSI ... outgoing call has been forwarded */
3638 send_CSSX_notification(cId,
3639 CSSX_CODE_ForwardedCall,
3640 ACI_NumParmNotPresent,
3641 NULL, NULL, NULL, NULL);
3642 }
3643
3644 if( ntfySS -> notifySSArg.ssNotification.fwgSubscriber EQ
3645 FWG_B_INC_CALL_FWD_C )
3646 {
3647 /* RAT_CSSU ... this call is forwarded to C-Subsciber */
3648 send_CSSX_notification(cId,
3649 CSSX_CODE_IncCallForwarded,
3650 ACI_NumParmNotPresent ,
3651 NULL, NULL, NULL, NULL);
3652
3653 }
3654
3655 if( ntfySS -> notifySSArg.ssNotification.fwdSubscriber EQ
3656 FWD_C_INC_CALL_FWD )
3657 {
3658 /* RAT_CSSU ... this is a forwarded call */
3659 send_CSSX_notification(cId,
3660 CSSX_CODE_ForwardedCall,
3661 ACI_NumParmNotPresent ,
3662 NULL, NULL, NULL, NULL);
3663
3664 }
3665 }
3666
3667
3668
3669
3670 LOCAL void cmhCC_NotifySS_v_ectIndicator( SHORT cId, T_NOTIFY_SS_INV *ntfySS )
3671 {
3672 CHAR numBuf[MAX_B_SUBSCR_NUM_LEN]; /* buffer for number */
3673 T_ACI_TOA toa; /* holds type of address */
3674 CHAR subBuf[MAX_SUBADDR_LEN]; /* buffer for subaddress */
3675 T_ACI_TOS tos; /* holds type of subaddress */
3676 BOOL numFlg = FALSE; /* flags a present number */
3677 BOOL subFlg = FALSE; /* flags a present subaddress */
3678
3679 TRACE_FUNCTION ("cmhCC_NotifySS_v_ectIndicator()");
3680
3681 /* note that according to GSM 04.91, indications without RDN are
3682 possible but not without ectCallState */
3683 if( ntfySS -> notifySSArg.ectIndicator.v_ectCallState )
3684 {
3685 /* (G)ACI-FIX-1415 */
3686 if(ntfySS -> notifySSArg.ectIndicator.v_rdn )
3687 {
3688 if( ntfySS -> notifySSArg.ectIndicator.
3689 rdn.v_presentationAllowedAddress )
3690 {
3691 if( ntfySS -> notifySSArg.ectIndicator.
3692 rdn.presentationAllowedAddress.v_partyNumber AND
3693 ntfySS -> notifySSArg.ectIndicator.
3694 rdn.presentationAllowedAddress.partyNumber.c_bcdDigit )
3695 {
3696 utl_BCD2DialStr
3697 (ntfySS -> notifySSArg.ectIndicator.
3698 rdn.presentationAllowedAddress.partyNumber.bcdDigit,
3699 numBuf,
3700 ntfySS -> notifySSArg.ectIndicator.
3701 rdn.presentationAllowedAddress.partyNumber.c_bcdDigit);
3702
3703 toa.npi = (T_ACI_TOA_NPI)ntfySS -> notifySSArg.ectIndicator.
3704 rdn.presentationAllowedAddress.partyNumber.npi;
3705 toa.ton = (T_ACI_TOA_TON)ntfySS -> notifySSArg.ectIndicator.
3706 rdn.presentationAllowedAddress.partyNumber.noa;
3707
3708 numFlg = TRUE;
3709 }
3710
3711 if( ntfySS -> notifySSArg.ectIndicator.
3712 rdn.presentationAllowedAddress.v_partySubaddress AND
3713 ntfySS -> notifySSArg.ectIndicator.
3714 rdn.presentationAllowedAddress.partySubaddress.c_subadr_str )
3715 {
3716 utl_BCD2DialStr
3717 (ntfySS -> notifySSArg.ectIndicator.
3718 rdn.presentationAllowedAddress.partySubaddress.subadr_str,
3719 subBuf,
3720 ntfySS -> notifySSArg.ectIndicator.
3721 rdn.presentationAllowedAddress.partySubaddress.c_subadr_str);
3722
3723 tos.tos = (T_ACI_TOS_TOS)ntfySS -> notifySSArg.ectIndicator.
3724 rdn.presentationAllowedAddress.partySubaddress.tos;
3725 tos.oe = (T_ACI_TOS_OE)ntfySS -> notifySSArg.ectIndicator.
3726 rdn.presentationAllowedAddress.partySubaddress.oei;
3727
3728 subFlg = TRUE;
3729 }
3730 }
3731 /* check if the override case occured, do present RDN, (G)ACI-FIX-1434 */
3732 /* if presentationAllowedAddress is present then it is obsolete to look
3733 at presentationRestrictedAddress */
3734 else if( ntfySS -> notifySSArg.ectIndicator.
3735 rdn.v_presentationRestrictedAddress )
3736 {
3737 if( ntfySS -> notifySSArg.ectIndicator.
3738 rdn.presentationRestrictedAddress.v_partyNumber AND
3739 ntfySS -> notifySSArg.ectIndicator.
3740 rdn.presentationRestrictedAddress.partyNumber.c_bcdDigit )
3741 {
3742 utl_BCD2DialStr
3743 (ntfySS -> notifySSArg.ectIndicator.
3744 rdn.presentationRestrictedAddress.partyNumber.bcdDigit,
3745 numBuf,
3746 ntfySS -> notifySSArg.ectIndicator.
3747 rdn.presentationRestrictedAddress.partyNumber.c_bcdDigit);
3748
3749 toa.npi = (T_ACI_TOA_NPI)ntfySS -> notifySSArg.ectIndicator.
3750 rdn.presentationRestrictedAddress.partyNumber.npi;
3751 toa.ton = (T_ACI_TOA_TON)ntfySS -> notifySSArg.ectIndicator.
3752 rdn.presentationRestrictedAddress.partyNumber.noa;
3753
3754 numFlg = TRUE;
3755 }
3756
3757 if( ntfySS -> notifySSArg.ectIndicator.
3758 rdn.presentationRestrictedAddress.v_partySubaddress AND
3759 ntfySS -> notifySSArg.ectIndicator.
3760 rdn.presentationRestrictedAddress.partySubaddress.c_subadr_str )
3761 {
3762 utl_BCD2DialStr
3763 (ntfySS -> notifySSArg.ectIndicator.
3764 rdn.presentationRestrictedAddress.partySubaddress.subadr_str,
3765 subBuf,
3766 ntfySS -> notifySSArg.ectIndicator.
3767 rdn.presentationRestrictedAddress.partySubaddress.c_subadr_str);
3768
3769 tos.tos = (T_ACI_TOS_TOS)ntfySS -> notifySSArg.ectIndicator.
3770 rdn.presentationRestrictedAddress.partySubaddress.tos;
3771 tos.oe = (T_ACI_TOS_OE)ntfySS -> notifySSArg.ectIndicator.
3772 rdn.presentationRestrictedAddress.partySubaddress.oei;
3773
3774 subFlg = TRUE;
3775 }
3776 }
3777 }
3778
3779 switch( ntfySS -> notifySSArg.ectIndicator.ectCallState )
3780 {
3781 case( ECT_CS_ALERTING ):
3782 /* RAT_CSSU ... ECT alerting */
3783 send_CSSX_notification(cId,
3784 CSSX_CODE_ECTAlert,
3785 ACI_NumParmNotPresent,
3786 (numFlg)?numBuf:NULL,
3787 (numFlg)?&toa:NULL,
3788 (subFlg)?subBuf:NULL,
3789 (subFlg)?&tos:NULL);
3790 break;
3791
3792 case( ECT_CS_ACTIVE ):
3793 /* RAT_CSSU ... ECT active */
3794 send_CSSX_notification(cId,
3795 CSSX_CODE_ECTConnect,
3796 ACI_NumParmNotPresent,
3797 (numFlg)?numBuf:NULL,
3798 (numFlg)?&toa:NULL,
3799 (subFlg)?subBuf:NULL,
3800 (subFlg)?&tos:NULL);
3801
3802 break;
3803 }
3804 }
3805 }
3806
3807 LOCAL void cmhCC_NotifySS_v_ccbsf( T_NOTIFY_SS_INV *ntfySS )
3808 {
3809 T_ACI_CCBS_SET ccbsSet; /* holds ccbs setting */
3810
3811 TRACE_FUNCTION ("cmhCC_NotifySS_v_ccbsf()");
3812
3813 if( ntfySS -> notifySSArg.ccbsf.v_ccbsIndex )
3814 {
3815 ccbsSet.idx = ntfySS -> notifySSArg.ccbsf.ccbsIndex;
3816 }
3817 else
3818 ccbsSet.idx = ACI_NumParmNotPresent;
3819
3820 if( ntfySS -> notifySSArg.ccbsf.v_b_subscriberNumber AND
3821 ntfySS -> notifySSArg.ccbsf.b_subscriberNumber.c_bcdDigit)
3822 {
3823 utl_BCD2DialStr
3824 (ntfySS -> notifySSArg.ccbsf.b_subscriberNumber.bcdDigit,
3825 ccbsSet.number,
3826 ntfySS -> notifySSArg.ccbsf.b_subscriberNumber.c_bcdDigit);
3827
3828 ccbsSet.type.npi = (T_ACI_TOA_NPI)ntfySS -> notifySSArg.ccbsf.b_subscriberNumber.npi;
3829 ccbsSet.type.ton = (T_ACI_TOA_TON)ntfySS -> notifySSArg.ccbsf.b_subscriberNumber.noa;
3830 }
3831 else
3832 {
3833 ccbsSet.number[0] = 0x0;
3834 ccbsSet.type.npi = NPI_NotPresent;
3835 ccbsSet.type.ton = TON_NotPresent;
3836 }
3837
3838 if( ntfySS -> notifySSArg.ccbsf.v_b_subscriberSubaddress AND
3839 ntfySS -> notifySSArg.ccbsf.b_subscriberSubaddress.c_subadr_str)
3840 {
3841 utl_BCD2DialStr
3842 (ntfySS -> notifySSArg.ccbsf.b_subscriberSubaddress.subadr_str,
3843 ccbsSet.subaddr,
3844 ntfySS -> notifySSArg.ccbsf.b_subscriberSubaddress.c_subadr_str);
3845
3846 ccbsSet.satype.tos = (T_ACI_TOS_TOS)ntfySS -> notifySSArg.ccbsf.b_subscriberSubaddress.tos;
3847 ccbsSet.satype.oe = (T_ACI_TOS_OE)ntfySS -> notifySSArg.ccbsf.b_subscriberSubaddress.oei;
3848 }
3849 else
3850 {
3851 ccbsSet.subaddr[0] = 0x0;
3852 ccbsSet.satype.tos = TOS_NotPresent;
3853 ccbsSet.satype.oe = OE_NotPresent;
3854 }
3855
3856 if( ntfySS -> notifySSArg.ccbsf.v_basicServiceGroup )
3857 ccbsSet.class_type = cmhSS_GetClass( (T_basicService*)&ntfySS -> notifySSArg.ccbsf.
3858 basicServiceGroup );
3859 else
3860 ccbsSet.class_type = CLASS_NotPresent;
3861
3862 if( ntfySS -> notifySSArg.v_alertingPattern )
3863 {
3864 ccbsSet.alrtPtn = (T_ACI_ALRT_PTRN)ntfySS -> notifySSArg.alertingPattern;
3865 }
3866 else
3867 {
3868 ccbsSet.alrtPtn = ALPT_NotPresent;
3869 }
3870
3871 cmhrat_ccbs( CMD_SRC_MAX, CCBS_IND_Recall,
3872 CCBS_STAT_NotPresent, &ccbsSet );
3873 }
3874
3875
3876 GLOBAL void cmhCC_NotifySS( SHORT cId, T_NOTIFY_SS_INV *ntfySS )
3877 {
3878 UBYTE idx; /* holds index counter */
3879 T_callingName *NameId; /* holds Name Identifier for CNAP */
3880
3881 TRACE_FUNCTION ("cmhCC_NotifySS()");
3882
3883 /* check SS code */
3884 if( ntfySS -> notifySSArg.v_ssCode )
3885 {
3886 cmhCC_NotifySS_v_ssCode( cId, ntfySS );
3887 }
3888
3889 /* check SS notification */
3890 if( ntfySS -> notifySSArg.v_ssNotification )
3891 {
3892 cmhCC_NotifySS_v_ssNotification( cId, ntfySS );
3893 }
3894
3895 /* check call is waiting indicator */
3896 if( ntfySS -> notifySSArg.v_callIsWaitingIndicator )
3897 {
3898 /* RAT_CSSI ... call is waiting */
3899 send_CSSX_notification(cId,
3900 CSSX_CODE_CallWaiting,
3901 ACI_NumParmNotPresent,
3902 NULL, NULL, NULL, NULL);
3903
3904 }
3905
3906 /* check call on hold indicator */
3907 if( ntfySS -> notifySSArg.v_callOnHoldIndicator )
3908 {
3909 switch( ntfySS -> notifySSArg.callOnHoldIndicator )
3910 {
3911 case( CHLD_CALL_RETRIEVED ):
3912 send_CSSX_notification(cId,
3913 CSSX_CODE_Retrieved,
3914 ACI_NumParmNotPresent ,
3915 NULL, NULL, NULL, NULL);
3916
3917 break;
3918
3919 case( CHLD_CALL_ON_HOLD ):
3920 /* RAT_CSSU ... call has been put on hold */
3921 send_CSSX_notification(cId,
3922 CSSX_CODE_OnHold,
3923 ACI_NumParmNotPresent ,
3924 NULL, NULL, NULL, NULL);
3925
3926 break;
3927 }
3928 }
3929
3930 /* check multparty indicator */
3931 if( ntfySS -> notifySSArg.v_mptyIndicator )
3932 {
3933 /* mptyStat equal to CS_ACT_REQ set it to CS_ACT
3934 required to place multiparty call on hold */
3935 if(psaCC_ctb(cId)->mptyStat EQ CS_ACT_REQ)
3936 {
3937 psaCC_ctb(cId)->mptyStat = CS_ACT;
3938 }
3939
3940 /* RAT_CSSU ... multiparty call entered */
3941 send_CSSX_notification(cId,
3942 CSSX_CODE_Multiparty,
3943 ACI_NumParmNotPresent ,
3944 NULL, NULL, NULL, NULL);
3945
3946 }
3947
3948 /* check CUG index */
3949 if( ntfySS -> notifySSArg.v_cugIndex )
3950 {
3951 send_CSSX_notification(cId,
3952 CSSX_CODE_CUGCall,
3953 ntfySS -> notifySSArg.cugIndex,
3954 NULL, NULL, NULL, NULL);
3955 }
3956
3957 /* check CLIR suppression */
3958 if( ntfySS -> notifySSArg.v_clirSuppressionRejected )
3959 {
3960 /* RAT_CSSI ... CLIR suppression rejected */
3961 send_CSSX_notification(cId,
3962 CSSX_CODE_CLIRSupRej,
3963 ACI_NumParmNotPresent,
3964 NULL, NULL, NULL, NULL);
3965
3966 }
3967
3968 /* check ECT indicator */
3969 if( ntfySS -> notifySSArg.v_ectIndicator )
3970 {
3971 cmhCC_NotifySS_v_ectIndicator( cId, ntfySS );
3972 }
3973
3974 /* check CNAP indicator */
3975 if( ntfySS -> notifySSArg.v_nameIndicator )
3976 {
3977 if ( ntfySS -> notifySSArg.nameIndicator.v_callingName )
3978 {
3979 NameId = &(ntfySS -> notifySSArg.nameIndicator.callingName);
3980 for( idx = 0; idx < CMD_SRC_MAX; idx++ )
3981 {
3982 R_AT( RAT_CNAP, (T_ACI_CMD_SRC)idx )
3983 ( NameId, CNAP_SERVICE_STATUS_NOT_PRESENT);
3984 }
3985 }
3986 }
3987
3988 /* check CCBS feature */
3989 if( ntfySS -> notifySSArg.v_ccbsf )
3990 {
3991 cmhCC_NotifySS_v_ccbsf( ntfySS );
3992 }
3993 }
3994
3995
3996
3997 /*
3998 +------------------------------------------------------------------------------
3999 | Function : cmhCC_CheckSS
4000 +------------------------------------------------------------------------------
4001 | Description : check SS indication received.
4002 |
4003 | Parameters : cId -
4004 |
4005 | Return :
4006 +------------------------------------------------------------------------------
4007 */
4008 GLOBAL void cmhCC_CheckSS( SHORT cId )
4009 {
4010 UBYTE idx; /* holds index counter */
4011
4012 TRACE_FUNCTION ("cmhCC_CheckSS()");
4013
4014 /*
4015 *-------------------------------------------------------------------
4016 * indicate check SS
4017 *-------------------------------------------------------------------
4018 */
4019 /* RAT_CSSU ... forward check SS indication */
4020 for( idx = 0; idx < CMD_SRC_MAX; idx++ )
4021 {
4022 send_CSSX_notification( cId,
4023 CSSX_CODE_FwrdCheckSS,
4024 ACI_NumParmNotPresent,
4025 NULL, NULL, NULL, NULL);
4026
4027 }
4028 }
4029
4030 /*
4031 +-------------------------------------------------------------------+
4032 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
4033 | ROUTINE : cmhCC_CCBSRegistered |
4034 +-------------------------------------------------------------------+
4035
4036 PURPOSE : call completion to busy subscriber successfully registered.
4037
4038 */
4039
4040 GLOBAL void cmhCC_CCBSRegistered( SHORT cId,
4041 T_ACC_REGISTER_CC_ENTRY_RES *CCBSreg )
4042 {
4043 UBYTE cmdBuf; /* buffers command */
4044 UBYTE srcBuf; /* buffers command source */
4045 T_ACI_CCBS_SET ccbsSet; /* holds ccbs setting */
4046
4047 TRACE_FUNCTION ("cmhCC_CCBSRegistered()");
4048
4049 /* check for command context */
4050 if( psaCC_ctb(cId)->curCmd NEQ AT_CMD_CHLD )
4051 {
4052 TRACE_EVENT("cmhCC_CCBSRegistered: wrong command context !");
4053 return;
4054 }
4055
4056 if( CCBSreg->accRegisterCCEntryRes.v_ccbsf )
4057 {
4058 if( CCBSreg->accRegisterCCEntryRes.ccbsf.v_ccbsIndex )
4059
4060 ccbsSet.idx = CCBSreg->accRegisterCCEntryRes.ccbsf.ccbsIndex;
4061 else
4062 ccbsSet.idx = ACI_NumParmNotPresent;
4063
4064
4065 if( CCBSreg->accRegisterCCEntryRes.ccbsf.
4066 v_b_subscriberNumber AND
4067 CCBSreg->accRegisterCCEntryRes.ccbsf.
4068 b_subscriberNumber.c_bcdDigit)
4069 {
4070 utl_BCD2DialStr
4071 (CCBSreg->accRegisterCCEntryRes.ccbsf.b_subscriberNumber.
4072 bcdDigit,
4073 ccbsSet.number,
4074 CCBSreg->accRegisterCCEntryRes.ccbsf.b_subscriberNumber.
4075 c_bcdDigit);
4076
4077 ccbsSet.type.npi = (T_ACI_TOA_NPI)CCBSreg->accRegisterCCEntryRes.ccbsf.
4078 b_subscriberNumber.npi;
4079 ccbsSet.type.ton = (T_ACI_TOA_TON)CCBSreg->accRegisterCCEntryRes.ccbsf.
4080 b_subscriberNumber.noa;
4081 }
4082 else
4083 {
4084 ccbsSet.number[0] = 0x0;
4085 ccbsSet.type.npi = NPI_NotPresent;
4086 ccbsSet.type.ton = TON_NotPresent;
4087 }
4088
4089 if( CCBSreg->accRegisterCCEntryRes.ccbsf.
4090 v_b_subscriberSubaddress AND
4091 CCBSreg->accRegisterCCEntryRes.ccbsf.
4092 b_subscriberSubaddress.c_subadr_str)
4093 {
4094 utl_BCD2DialStr
4095 (CCBSreg->accRegisterCCEntryRes.ccbsf.b_subscriberSubaddress.
4096 subadr_str,
4097 ccbsSet.subaddr,
4098 CCBSreg->accRegisterCCEntryRes.ccbsf.b_subscriberSubaddress.
4099 c_subadr_str);
4100
4101 ccbsSet.satype.tos = (T_ACI_TOS_TOS)CCBSreg->accRegisterCCEntryRes.ccbsf.
4102 b_subscriberSubaddress.tos;
4103 ccbsSet.satype.oe = (T_ACI_TOS_OE)CCBSreg->accRegisterCCEntryRes.ccbsf.
4104 b_subscriberSubaddress.oei;
4105 }
4106 else
4107 {
4108 ccbsSet.subaddr[0] = 0x0;
4109 ccbsSet.satype.tos = TOS_NotPresent;
4110 ccbsSet.satype.oe = OE_NotPresent;
4111 }
4112
4113 if( CCBSreg->accRegisterCCEntryRes.ccbsf.v_basicServiceGroup )
4114 ccbsSet.class_type = cmhSS_GetClass( (T_basicService*)&CCBSreg->accRegisterCCEntryRes.
4115 ccbsf.basicServiceGroup );
4116 else
4117 ccbsSet.class_type = CLASS_NotPresent;
4118
4119 ccbsSet.alrtPtn = ALPT_NotPresent;
4120 }
4121
4122 cmhCC_PrepareCmdEnd (cId, &cmdBuf, &srcBuf);
4123 cmhCC_tstAndUnflagCall( cId, &(cmhPrm[srcBuf].ccCmdPrm.mltyDscFlg));
4124 psaCC_FreeCtbNtry (cId);
4125
4126 cmhrat_ccbs( srcBuf, CCBS_IND_Registered,
4127 CCBS_STAT_NotPresent, &ccbsSet );
4128
4129 R_AT( RAT_OK, (T_ACI_CMD_SRC)srcBuf ) ( cmdBuf );
4130
4131 /* log result */
4132 cmh_logRslt ( (T_ACI_CMD_SRC)srcBuf, RAT_OK,
4133 (T_ACI_AT_CMD)cmdBuf, (SHORT)(cId+1), BS_SPEED_NotPresent,CME_ERR_NotPresent);
4134 }
4135
4136 /* sends RAT_CCBS: sometimes it is an intermediate result, and sometimes it is an
4137 indication.
4138 When srcId = CMD_SRC_MAX, it is an indication and shall go to all sources...
4139 Otherwise, only to the source specified... */
4140 GLOBAL void cmhrat_ccbs( UBYTE srcId,
4141 T_ACI_CCBS_IND ccbs_ind,
4142 T_ACI_CCBS_STAT status,
4143 T_ACI_CCBS_SET *setting )
4144 {
4145 #ifdef FF_ATI
4146 UBYTE idx;
4147 #endif
4148
4149 if( srcId EQ CMD_SRC_MAX )
4150 {
4151 #if defined MFW || defined SMI OR defined FF_MMI_RIV
4152 rAT_PercentCCBS(ccbs_ind, status, setting);
4153 #endif
4154
4155 #ifdef FF_ATI
4156 for( idx = CMD_SRC_ATI_1; idx < CMD_SRC_MAX; idx++ )
4157 {
4158 srcId_cb = idx;
4159 rCI_PercentCCBS(ccbs_ind, status, setting, FALSE);
4160 }
4161 #endif /* FF_ATI */
4162
4163 return;
4164 }
4165 #if defined MFW || defined SMI OR defined FF_MMI_RIV
4166 if( srcId EQ CMD_SRC_LCL )
4167 {
4168 rAT_PercentCCBS( ccbs_ind, status, setting );
4169 return;
4170 }
4171 #endif
4172
4173 /* else it is an ATI source */
4174 srcId_cb = srcId;
4175
4176 #ifdef FF_ATI
4177 rCI_PercentCCBS(ccbs_ind, status, setting, TRUE);
4178 #endif /* FF_ATI */
4179 }
4180
4181
4182 /*
4183 +-------------------------------------------------------------------+
4184 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
4185 | ROUTINE : cmhCC_CDRegistered |
4186 +-------------------------------------------------------------------+
4187
4188 PURPOSE : Call Deflection (CD) successfully registered.
4189
4190 */
4191
4192 GLOBAL void cmhCC_CDRegistered( SHORT cId )
4193 {
4194 TRACE_FUNCTION ("cmhCC_CDRegistered()");
4195
4196 switch( psaCC_ctb(cId)->curCmd )
4197 {
4198 case AT_CMD_CTFR:
4199 psaCC_ctb(cId)->CDStat = CD_Succeeded;
4200 break;
4201
4202 default: /* This is unexpected or network failure, ignore the event */
4203 break;
4204 }
4205 }
4206
4207
4208 /*
4209 +-------------------------------------------------------------------+
4210 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
4211 | ROUTINE : cmhCC_SSTransFail |
4212 +-------------------------------------------------------------------+
4213
4214 PURPOSE : SS transaction failed.
4215
4216 */
4217
4218 GLOBAL void cmhCC_SSTransFail ( SHORT cId )
4219 {
4220 T_CC_CMD_PRM * pCCCmdPrm; /* points to CC command parameters */
4221 SHORT ctbIdx; /* holds call table index */
4222 SHORT addId; /* holds additional call id */
4223 UBYTE cmdBuf; /* buffers command */
4224 UBYTE srcBuf; /* buffers command source */
4225
4226 TRACE_FUNCTION ("cmhCC_SSTransFail()");
4227
4228 /*
4229 *-------------------------------------------------------------------
4230 * check for command context
4231 *-------------------------------------------------------------------
4232 */
4233 switch( psaCC_ctb(cId)->curCmd )
4234 {
4235 /*
4236 *----------------------------------------------------------------
4237 * process result for D and A command
4238 *----------------------------------------------------------------
4239 */
4240 case( AT_CMD_D ):
4241 case( AT_CMD_A ):
4242
4243 /* restore call status for hold request*/
4244 if( psaCC_ctb(cId)->calStat EQ CS_HLD_REQ )
4245 for( ctbIdx = 0; ctbIdx < MAX_CALL_NR; ctbIdx++ )
4246 {
4247 if( ccShrdPrm.ctb[ctbIdx] NEQ NULL AND
4248 psaCC_ctb(ctbIdx)->calStat EQ CS_HLD_REQ AND
4249 psaCC_ctb(ctbIdx)->mptyStat EQ CS_ACT )
4250 {
4251 psaCC_ctb(ctbIdx)->calStat = CS_ACT;
4252 }
4253 }
4254
4255 pCCCmdPrm = &cmhPrm[psaCC_ctb(cId)->curSrc].ccCmdPrm;
4256
4257 cmhCC_PrepareCmdEnd (cId, &cmdBuf, &srcBuf);
4258
4259 if( cmhCC_tstAndUnflagCall( cId, &(pCCCmdPrm -> mltyCncFlg)))
4260 {
4261 if( pCCCmdPrm -> CHLDmode EQ CHLD_MOD_HldActDial AND
4262 pCCCmdPrm -> mltyCncFlg )
4263 {
4264 for( addId = 0; !((pCCCmdPrm -> mltyCncFlg >> addId) & 0x01); addId++ )
4265 ;
4266
4267 if( CHLDaddInfo EQ CHLD_ADD_INFO_DIAL_CAL )
4268 {
4269 CHLDaddInfo = NO_CHLD_ADD_INFO;
4270 psaCC_FreeCtbNtry (addId); /* remove pending call */
4271 }
4272 }
4273
4274 pCCCmdPrm -> mltyCncFlg = 0; /* unflag calls */
4275 //TISH, patch for OMAPS00129157
4276 //start
4277 if (psaCC_ctb(cId)->failType == SSF_ERR_PRB && psaCC_ctb(cId)->errCd == 0x0a)
4278 R_AT( RAT_CME, srcBuf ) ( cmdBuf, CME_ERR_OpNotAllow);
4279 else
4280 //end
4281 R_AT( RAT_CME, (T_ACI_CMD_SRC)srcBuf ) ( cmdBuf, CME_ERR_NotPresent );
4282
4283 cmh_logRslt ( (T_ACI_CMD_SRC)srcBuf, RAT_CME,
4284 (T_ACI_AT_CMD)cmdBuf, -1, BS_SPEED_NotPresent, CME_ERR_NotPresent );
4285 }
4286 break;
4287
4288 /*
4289 *----------------------------------------------------------------
4290 * process result for +CTFR command
4291 *----------------------------------------------------------------
4292 */
4293 case( AT_CMD_CTFR ):
4294 psaCC_ctb(cId)->CDStat = CD_Failed;
4295 break;
4296
4297 /*
4298 *----------------------------------------------------------------
4299 * process result for +CHLD command
4300 *----------------------------------------------------------------
4301 */
4302 case( AT_CMD_CHLD ):
4303
4304 /* determine CHLD mode */
4305 switch( cmhPrm[psaCC_ctb(cId)->curSrc].ccCmdPrm.CHLDmode )
4306 {
4307 /*
4308 *------------------------------------------------------------
4309 * no multiparty relation
4310 *------------------------------------------------------------
4311 */
4312 case( CHLD_MOD_NotPresent ):
4313 case( CHLD_MOD_RelHldOrUdub ):
4314 case( CHLD_MOD_RelActSpec ):
4315
4316 TRACE_EVENT( "UNEXP CHLD MODE FOR SS ERROR COMP" );
4317 return;
4318
4319 /*
4320 *------------------------------------------------------------
4321 * multiparty hold or retrieve
4322 *------------------------------------------------------------
4323 */
4324 case( CHLD_MOD_RelActAndAcpt ):
4325 case( CHLD_MOD_HldActAndAcpt ):
4326
4327 /* restore call status for retrieve request */
4328 if( psaCC_ctb(cId)->calStat EQ CS_ACT_REQ )
4329 {
4330 for( ctbIdx = 0; ctbIdx < MAX_CALL_NR; ctbIdx++ )
4331 {
4332 if( ccShrdPrm.ctb[ctbIdx] NEQ NULL AND
4333 psaCC_ctb(ctbIdx)->calStat EQ CS_ACT_REQ AND
4334 psaCC_ctb(ctbIdx)->mptyStat EQ CS_ACT )
4335 {
4336 psaCC_ctb(ctbIdx)->calStat = CS_HLD;
4337 }
4338 }
4339 psaCC_MPTY (cId, MNCC_MPTY_RETRIEVE_FAIL);
4340 }
4341
4342 /* restore call status for hold request*/
4343 if( psaCC_ctb(cId)->calStat EQ CS_HLD_REQ )
4344 {
4345 for( ctbIdx = 0; ctbIdx < MAX_CALL_NR; ctbIdx++ )
4346 {
4347 if( ccShrdPrm.ctb[ctbIdx] NEQ NULL AND
4348 psaCC_ctb(ctbIdx)->calStat EQ CS_HLD_REQ AND
4349 psaCC_ctb(ctbIdx)->mptyStat EQ CS_ACT )
4350 {
4351 psaCC_ctb(ctbIdx)->calStat = CS_ACT;
4352 }
4353 }
4354 psaCC_MPTY (cId, MNCC_MPTY_HOLD_FAIL);
4355 }
4356
4357 break;
4358
4359 /*
4360 *------------------------------------------------------------
4361 * multiparty split
4362 *------------------------------------------------------------
4363 */
4364 case( CHLD_MOD_HldActExc ):
4365
4366 psaCC_ctb(cId)->mptyStat = CS_ACT;
4367 psaCC_MPTY (cId, MNCC_MPTY_SPLIT_FAIL);
4368 break;
4369
4370 /*
4371 *------------------------------------------------------------
4372 * multiparty build
4373 *------------------------------------------------------------
4374 */
4375 case( CHLD_MOD_AddHld ):
4376
4377 /* restore call status for build request */
4378 for( ctbIdx = 0; ctbIdx < MAX_CALL_NR; ctbIdx++ )
4379 {
4380 if( ccShrdPrm.ctb[ctbIdx] NEQ NULL AND
4381 psaCC_ctb(ctbIdx)->mptyStat EQ CS_ACT_REQ AND
4382 psaCC_ctb(ctbIdx)->calStat EQ CS_HLD )
4383 {
4384 psaCC_ctb(ctbIdx)->mptyStat = CS_IDL;
4385 }
4386 }
4387
4388 if( psaCC_ctb(cId)->mptyStat EQ CS_ACT_REQ )
4389 psaCC_ctb(cId)->mptyStat = CS_IDL;
4390 psaCC_MPTY (cId, MNCC_MPTY_BUILD_FAIL);
4391 break;
4392
4393 /*
4394 *------------------------------------------------------------
4395 * explicit call transfer
4396 *------------------------------------------------------------
4397 */
4398 case( CHLD_MOD_Ect ):
4399 pCCCmdPrm = &cmhPrm[psaCC_ctb(cId)->curSrc].ccCmdPrm;
4400 TRACE_EVENT("ECT failed...");
4401
4402 TIMERSTOP( ACI_TECT );
4403
4404 pCCCmdPrm->CHLDmode = CHLD_MOD_NotPresent;
4405
4406 /* restore call status for other call that was to be transfered */
4407 for( ctbIdx = 0; ctbIdx < MAX_CALL_NR; ctbIdx++ )
4408 {
4409 if( ctbIdx EQ cId )
4410 {
4411 continue;
4412 }
4413 else if (ccShrdPrm.ctb[ctbIdx] NEQ NULL AND
4414 cmhCC_tstAndUnflagCall( ctbIdx, &(pCCCmdPrm -> mltyDscFlg)) AND
4415 psaCC_ctb(ctbIdx)->curCmd EQ AT_CMD_CHLD )
4416 {
4417 /* then it is the second call id */
4418 cmhCC_PrepareCmdEnd (ctbIdx, NULL, NULL);
4419 }
4420 }
4421
4422 /* restore first call id parameters */
4423 cmhCC_PrepareCmdEnd (cId, NULL, &srcBuf);
4424
4425 if( cmhCC_tstAndUnflagCall( cId, &(pCCCmdPrm -> mltyDscFlg)) )
4426 {
4427 R_AT( RAT_CME, (T_ACI_CMD_SRC)srcBuf )
4428 ( AT_CMD_CHLD, CME_ERR_Unknown );
4429
4430 cmh_logRslt ( (T_ACI_CMD_SRC)srcBuf, RAT_CME,
4431 AT_CMD_CHLD, -1, BS_SPEED_NotPresent, CME_ERR_Unknown );
4432 }
4433 return;
4434
4435 /*
4436 *------------------------------------------------------------
4437 * call completion to busy subscriber
4438 *------------------------------------------------------------
4439 */
4440 case( CHLD_MOD_Ccbs ):
4441 pCCCmdPrm = &cmhPrm[psaCC_ctb(cId)->curSrc].ccCmdPrm;
4442 TRACE_EVENT("CCBS failed...");
4443
4444 /* restore first call id parameters */
4445 cmhCC_PrepareCmdEnd (cId, NULL, &srcBuf);
4446
4447 if( psaCC_ctb(cId)->opCode EQ OPC_ACC_REGISTER_CC_ENTRY )
4448 psaCC_FreeCtbNtry (cId); /* remove call table entry */
4449
4450 if( cmhCC_tstAndUnflagCall( cId, &(pCCCmdPrm -> mltyDscFlg)) )
4451 {
4452 pCCCmdPrm -> mltyDscFlg = 0; /* unflag calls */
4453
4454 R_AT( RAT_CME, (T_ACI_CMD_SRC)srcBuf )
4455 ( AT_CMD_CHLD, CME_ERR_Unknown );
4456
4457 cmh_logRslt ( (T_ACI_CMD_SRC)srcBuf, RAT_CME,
4458 AT_CMD_CHLD, -1, BS_SPEED_NotPresent, CME_ERR_Unknown );
4459 }
4460 return;
4461 }
4462
4463 pCCCmdPrm = &cmhPrm[psaCC_ctb(cId)->curSrc].ccCmdPrm;
4464 cmhCC_PrepareCmdEnd (cId, NULL, &srcBuf);
4465
4466 if( cmhCC_tstAndUnflagCall( cId, &(pCCCmdPrm -> mltyCncFlg)))
4467 {
4468 pCCCmdPrm -> mltyCncFlg = 0; /* unflag calls */
4469
4470 R_AT( RAT_CME, (T_ACI_CMD_SRC)srcBuf ) ( AT_CMD_CHLD, CME_ERR_Unknown );
4471
4472 cmh_logRslt ( (T_ACI_CMD_SRC)srcBuf, RAT_CME,
4473 AT_CMD_CHLD, -1, BS_SPEED_NotPresent, CME_ERR_Unknown );
4474 }
4475
4476 break;
4477 }
4478
4479 return;
4480 }
4481
4482 /*
4483 +-------------------------------------------------------------------+
4484 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
4485 | ROUTINE : cmhCC_MPTYTimeout |
4486 +-------------------------------------------------------------------+
4487
4488 PURPOSE : handle multiparty timeout
4489
4490 */
4491
4492 GLOBAL void cmhCC_MPTYTimeout ( void )
4493 {
4494 TRACE_FUNCTION( "cmhCC_MPTYTimeout()" );
4495
4496 if (!psaCC_ctbIsValid (ccShrdPrm.cIdMPTY))
4497 {
4498 TRACE_ERROR ("ccShrdPrm.cIdMPTY invalid");
4499 return;
4500 }
4501
4502 /*
4503 *-------------------------------------------------------------------
4504 * SS failure
4505 *-------------------------------------------------------------------
4506 */
4507 #ifdef SIM_TOOLKIT
4508 if (psaCC_ctb(ccShrdPrm.cIdMPTY)->SATinv )
4509 {
4510 psaCC_ctb(ccShrdPrm.cIdMPTY)->SATinv = FALSE;
4511 /* return network error cause GSM 11.14 / 12.12.3 */
4512 cmhSAT_NtwErr( ADD_NO_CAUSE );
4513 }
4514 #endif
4515 cmhCC_SSTransFail(ccShrdPrm.cIdMPTY);
4516
4517 }
4518
4519 /*
4520 +-------------------------------------------------------------------+
4521 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
4522 | ROUTINE : cmhCC_ECTTimeout |
4523 +-------------------------------------------------------------------+
4524
4525 PURPOSE : handle explicit call transfer timeout
4526
4527 */
4528
4529 LOCAL SHORT search_ect_call(void)
4530 {
4531 SHORT idx;
4532 UBYTE chld_src;
4533
4534 for(idx = 0; idx < MAX_CALL_NR; idx++)
4535 {
4536 if (ccShrdPrm.ctb[idx] NEQ NULL AND
4537 psaCC_ctb(idx)->curCmd EQ AT_CMD_CHLD)
4538 {
4539 chld_src = psaCC_ctb(idx)->curSrc;
4540
4541 if( cmhPrm[chld_src].ccCmdPrm.CHLDmode EQ CHLD_MOD_Ect )
4542 {
4543 return(idx);
4544 }
4545 }
4546 }
4547 return(NO_ENTRY);
4548 }
4549
4550 GLOBAL void cmhCC_ECTTimeout ( void )
4551 {
4552 SHORT ectId;
4553
4554 TRACE_FUNCTION( "cmhCC_ECTTimeout()" );
4555
4556 ectId = search_ect_call( );
4557
4558 if (ectId NEQ NO_ENTRY)
4559 cmhCC_SSTransFail(ectId);
4560 }
4561
4562 #ifdef FF_TTY
4563 /*
4564 +-------------------------------------------------------------------+
4565 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
4566 | ROUTINE : cmhCC_TTY_Control |
4567 +-------------------------------------------------------------------+
4568
4569 PURPOSE : Enabling/disabling TTY for the active call
4570
4571 */
4572
4573 LOCAL BOOL cmhCC_TTY_Proceed (SHORT cId)
4574 {
4575 T_TTY_CMD ttyAction = TTY_OFF;
4576 T_MNCC_bcpara *bc;
4577
4578 if (ccShrdPrm.ctb[cId] NEQ NULL)
4579 {
4580 /* Call table entry exists */
4581 bc = &psaCC_ctb(cId)->BC[psaCC_ctb(cId)->curBC];
4582
4583 if ((bc->bearer_serv EQ MNCC_BEARER_SERV_SPEECH_CTM OR
4584 bc->bearer_serv EQ MNCC_BEARER_SERV_AUX_SPEECH_CTM) AND
4585 psaCC_ctb(cId)->calStat NEQ CS_DSC_REQ)
4586 {
4587 if ((ccShrdPrm.chMod EQ MNCC_CHM_SPEECH) OR
4588 (ccShrdPrm.chMod EQ MNCC_CHM_SPEECH_V2) OR
4589 (ccShrdPrm.chMod EQ MNCC_CHM_SPEECH_V3))
4590 {
4591 audio_set_tty (ttyAction = (T_TTY_CMD)ccShrdPrm.ttyCmd);
4592 }
4593 else
4594 {
4595 TRACE_EVENT_P1 ("TTY no speech mode: %d", (int)ccShrdPrm.chMod);
4596 }
4597 }
4598 else
4599 {
4600 TRACE_EVENT_P1 ("TTY wrong BCAP: %d", (int)bc->bearer_serv);
4601 }
4602
4603 if (ttyAction NEQ (UBYTE)TTY_OFF)
4604 {
4605 cmhCC_notifyTTY (CTTY_NEG_Grant, cmhCC_getTTYtrx_state (ttyAction));
4606 return TRUE;
4607 }
4608 else
4609 {
4610 cmhCC_notifyTTY (((ccShrdPrm.ctmReq EQ MNCC_CTM_ENABLED)?
4611 CTTY_NEG_Reject: CTTY_NEG_None),
4612 CTTY_TRX_Unknown);
4613 }
4614 }
4615 else
4616 {
4617 TRACE_EVENT ("TTY no call table entry");
4618 }
4619
4620 return FALSE;
4621 }
4622
4623 GLOBAL void cmhCC_TTY_Control (SHORT cId, UBYTE action)
4624 {
4625 TRACE_EVENT_P3 ("TTY event %d, old state %d, callId %d",
4626 action, ccShrdPrm.ctmState, cId);
4627
4628 if (!ccShrdPrm.TCHasg)
4629 {
4630 TRACE_EVENT ("TTY: no TCH");
4631 }
4632 switch (action)
4633 {
4634 case TTY_TCH:
4635 if (ccShrdPrm.ctmState EQ TTY_STATE_IDLE)
4636 {
4637 ccShrdPrm.ctmState = TTY_STATE_SYNC;
4638 }
4639 else if (ccShrdPrm.ctmState EQ TTY_STATE_BCAP)
4640 {
4641 if (cmhCC_TTY_Proceed (cId))
4642 ccShrdPrm.ctmState = TTY_STATE_ACTIVE;
4643 else
4644 ccShrdPrm.ctmState = TTY_STATE_WAIT;
4645 }
4646 break;
4647
4648 case TTY_START:
4649 if (ccShrdPrm.ctmState EQ TTY_STATE_IDLE)
4650 {
4651 ccShrdPrm.ctmState = TTY_STATE_BCAP;
4652 }
4653 else if (ccShrdPrm.ctmState EQ TTY_STATE_SYNC)
4654 {
4655 if (cmhCC_TTY_Proceed (cId))
4656 ccShrdPrm.ctmState = TTY_STATE_ACTIVE;
4657 else
4658 ccShrdPrm.ctmState = TTY_STATE_WAIT;
4659 }
4660 break;
4661
4662 case TTY_PAUSE:
4663 if (ccShrdPrm.ctmState EQ TTY_STATE_WAIT)
4664 {
4665 ccShrdPrm.ctmState = TTY_STATE_SYNC;
4666 }
4667 else if (ccShrdPrm.ctmState EQ TTY_STATE_ACTIVE)
4668 {
4669 audio_set_tty (TTY_OFF);
4670 ccShrdPrm.ctmState = TTY_STATE_SYNC;
4671 }
4672 break;
4673
4674 case TTY_STOP:
4675 if (ccShrdPrm.ctmState EQ TTY_STATE_ACTIVE)
4676 {
4677 audio_set_tty (TTY_OFF);
4678 cmhCC_notifyTTY (CTTY_NEG_None, CTTY_TRX_Off);
4679 }
4680 ccShrdPrm.ctmState = (ccShrdPrm.ctmReq EQ MNCC_CTM_ENABLED)?
4681 TTY_STATE_IDLE: TTY_STATE_NONE;
4682 break;
4683
4684 default:
4685 break;
4686 }
4687 TRACE_EVENT_P1 ("TTY new state %d", ccShrdPrm.ctmState);
4688 }
4689 #endif /* FF_TTY */
4690
4691 #if defined (FF_WAP) || defined (FF_PPP) || defined (FF_GPF_TCPIP) || defined (FF_SAT_E)
4692 /* Only for WAP or RNET */
4693
4694 /*
4695 +-------------------------------------------------------------------+
4696 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
4697 | ROUTINE : cmhCC_PPP_Established |
4698 +-------------------------------------------------------------------+
4699
4700 PURPOSE : PPP entity activated, data path established
4701
4702 */
4703
4704 GLOBAL SHORT cmhCC_PPP_Established (ULONG ip_address, USHORT max_receive_unit,
4705 ULONG dns1, ULONG dns2)
4706 {
4707
4708 char c_ip_address[16],c_dns1[16],c_dns2[16];
4709
4710 #ifdef FF_PPP
4711 SHORT cId = raShrdPrm.cId;
4712 #endif /* FF_PPP */
4713
4714 TRACE_FUNCTION ("cmhCC_PPP_Established()");
4715
4716 ipAddress = ip_address;
4717 sprintf (c_ip_address, "%03u.%03u.%03u.%03u", (ip_address & 0xff000000) >> 24,
4718 (ip_address & 0x00ff0000) >> 16,
4719 (ip_address & 0x0000ff00) >> 8 ,
4720 (ip_address & 0x000000ff) );
4721
4722 sprintf(c_dns1, "%03u.%03u.%03u.%03u", (dns1 & 0xff000000) >> 24,
4723 (dns1 & 0x00ff0000) >> 16,
4724 (dns1 & 0x0000ff00) >> 8 ,
4725 (dns1 & 0x000000ff) );
4726
4727 sprintf(c_dns2, "%03u.%03u.%03u.%03u", (dns2 & 0xff000000) >> 24,
4728 (dns2 & 0x00ff0000) >> 16,
4729 (dns2 & 0x0000ff00) >> 8 ,
4730 (dns2 & 0x000000ff) );
4731
4732 TRACE_EVENT_P3("addr : %s ,dns1 : %s ,dns2: %s",c_ip_address,c_dns1,c_dns2);
4733
4734 if(is_gpf_tcpip_call()) {
4735 pppShrdPrm.ipaddr = ip_address ;
4736 pppShrdPrm.dns1 = dns1 ;
4737 pppShrdPrm.dns2 = dns2 ;
4738 }
4739 #if defined FF_PPP AND defined FAX_AND_DATA
4740 if (psaCC_ctbIsValid (cId) AND /* Ensure not to dereferentiate NULL */
4741 pppShrdPrm.is_PPP_CALL EQ TRUE)
4742 {
4743 pppShrdPrm.ipaddr = ip_address ;
4744 pppShrdPrm.dns1 = dns1 ;
4745 pppShrdPrm.dns2 = dns2 ;
4746 R_AT( RAT_CONNECT, raShrdPrm.owner )
4747 (psaCC_ctb(cId)->curCmd,
4748 cmhCC_GetDataRate(&psaCC_ctb(cId)->BC[psaCC_ctb(cId)->curBC]),
4749 cId+1,
4750 FALSE);
4751 return 0;
4752 }
4753 #endif /*FF_PPP*/
4754 #if defined (FF_SAT_E)
4755 if(cmhSAT_OpChnChckCSD(UDP))
4756 {
4757 psaTCPIP_Configure((UBYTE*)c_ip_address, NULL, NULL,
4758 (UBYTE*)c_dns1, (UBYTE*)c_dns2,max_receive_unit,
4759 cmhSAT_OpChnUDPConfCsd) ;
4760 }
4761 else
4762 #endif /* FF_SAT_E */
4763 #if defined (FF_WAP) || defined (FF_GPF_TCPIP)
4764 {
4765 psaTCPIP_Configure((UBYTE*)c_ip_address, NULL, NULL,
4766 (UBYTE*)c_dns1, (UBYTE*)c_dns1,max_receive_unit,
4767 psaTCPIP_conf_csd_callback) ;
4768 }
4769 #endif /* FF_WAP OR FF_GPF_TCPIP */
4770 return 0;
4771 }
4772
4773 #ifdef CO_UDP_IP
4774 /*
4775 +-------------------------------------------------------------------+
4776 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
4777 | ROUTINE : cmhCC_IPA_Configurated |
4778 +-------------------------------------------------------------------+
4779
4780 PURPOSE : IPA entity activated, data path established
4781 */
4782
4783 GLOBAL SHORT cmhCC_IPA_Configurated (void)
4784 {
4785 TRACE_FUNCTION ("cmhCC_IPA_Configurated()");
4786
4787 psaUDPA_Config(UDPA_CONFIG_UP);
4788
4789 return 0;
4790 }
4791
4792 /*
4793 +-------------------------------------------------------------------+
4794 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
4795 | ROUTINE : cmhCC_UDPA_Configurated |
4796 +-------------------------------------------------------------------+
4797
4798 PURPOSE : IPA entity activated, data path established
4799
4800 */
4801
4802 GLOBAL SHORT cmhCC_UDPA_Configurated (void)
4803 {
4804 TRACE_FUNCTION ("cmhCC_UDPA_Configurated()");
4805 #ifdef FF_WAP
4806 if (Wap_Call)
4807 {
4808 if ( tcpipShrdPrm.connection_type EQ TCPIP_CONNECTION_TYPE_CSD_WAP )
4809 {
4810 rAT_WAP_PPP_connected(wapId,ipAddress);
4811 }
4812 else
4813 {
4814 TRACE_EVENT_P1 ("IP: %s", tcpipShrdPrm.ipaddr);
4815 rAT_WAP_PPP_connected(wapId, psaTCPIP_bytes2ipv4addr(tcpipShrdPrm.ipaddr));
4816 }
4817 }
4818 #endif
4819 psaUDPIP_config_dispatch() ;
4820 return 0;
4821 }
4822
4823
4824 /*
4825 +-------------------------------------------------------------------+
4826 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
4827 | ROUTINE : cmhCC_UDPA_Deconfigurated |
4828 +-------------------------------------------------------------------+
4829
4830 PURPOSE :
4831
4832 */
4833
4834 GLOBAL SHORT cmhCC_UDPA_Deconfigurated (void)
4835 {
4836 TRACE_FUNCTION ("cmhCC_UDPA_Deconfigurated ()");
4837
4838 cmhUDPA_Deactivate(tcpipShrdPrm.src_id);
4839
4840 return 0;
4841 }
4842
4843 /*
4844 +-------------------------------------------------------------------+
4845 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
4846 | ROUTINE : cmhCC_IPA_Deconfigurated |
4847 +-------------------------------------------------------------------+
4848
4849 PURPOSE :
4850
4851 */
4852
4853 GLOBAL SHORT cmhCC_IPA_Deconfigurated (void)
4854 {
4855 TRACE_FUNCTION ("cmhCC_IPA_Deconfigurated()");
4856
4857 psaUDPA_Config(UDPA_CONFIG_DOWN);
4858
4859 return 0;
4860 }
4861
4862 #endif /* of WAP || SAT E */
4863
4864 /*
4865 +-------------------------------------------------------------------+
4866 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
4867 | ROUTINE : cmhCC_PPP_Terminated |
4868 +-------------------------------------------------------------------+
4869
4870 PURPOSE : PPP entity terminated, close connection / update CC parameters
4871
4872 */
4873
4874 GLOBAL SHORT cmhCC_PPP_Terminated ( void )
4875 {
4876 TRACE_FUNCTION ("cmhCC_PPP_Terminated()");
4877
4878 #ifdef DTI
4879 #if defined (FF_WAP) || defined (FF_GPF_TCPIP) || defined (FF_SAT_E)
4880 if (Wap_Call EQ TRUE)
4881 {
4882 if(is_gpf_tcpip_call()) {
4883 GPF_TCPIP_STATEMENT(dti_cntrl_entity_disconnected(peer_link_id,
4884 DTI_ENTITY_TCPIP ));
4885 }
4886 else {
4887 dti_cntrl_entity_disconnected( peer_link_id, DTI_ENTITY_IP );
4888 }
4889 dti_cntrl_entity_disconnected( prot_link_id, DTI_ENTITY_L2R );
4890 }
4891 #endif /* WAP || defined (FF_GPF_TCPIP) || SAT E */
4892
4893 dti_cntrl_entity_disconnected( peer_link_id, DTI_ENTITY_PPPC );
4894 dti_cntrl_entity_disconnected( prot_link_id, DTI_ENTITY_PPPC );
4895
4896
4897 #if defined (FF_SAT_E)
4898 if( cmhSAT_OpChnChckCSD(UDP))
4899 {
4900 psaTCPIP_Deactivate(cmhSAT_OpChnUDPDeactCsd) ;
4901 }
4902 else
4903 #endif /* FF_SAT_E */
4904 #if defined (FF_WAP) OR defined (FF_GPF_TCPIP)
4905 {
4906 psaTCPIP_Deactivate(psaTCPIP_deact_csd_callback) ;
4907 }
4908 #endif /* defined (WAP) OR defined (FF_GPF_TCPIP) */
4909 #endif /* DTI */
4910 return 0;
4911 }
4912
4913
4914 #endif /* of WAP or FF_PPP || defined (FF_GPF_TCPIP) or SAT E */
4915
4916 /*
4917 +--------------------------------------------------------------------+
4918 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
4919 | STATE : code ROUTINE : cmhCC_checkALS_Support_cb|
4920 +--------------------------------------------------------------------+
4921
4922 PURPOSE : Call-backs for ALS support check.
4923 */
4924
4925 GLOBAL void cmhCC_checkALS_Support_cb ( SHORT aId )
4926 {
4927 TRACE_FUNCTION ("cmhCC_checkALS_Support_cb()");
4928
4929 simShrdPrm.atb[aId].ntryUsdFlg = FALSE;
4930
4931 /* Step #1: Reading of CPHS Info */
4932 if (simShrdPrm.atb[aId].errCode NEQ SIM_NO_ERROR OR
4933 simShrdPrm.atb[aId].exchData EQ NULL OR
4934 simShrdPrm.atb[aId].dataLen < 2)
4935 {
4936 ; /* CPHS info not supported or invalid */
4937 }
4938 else if ((simShrdPrm.atb[aId].exchData[1] & 0x03) EQ ALLOCATED_AND_ACTIVATED)
4939 {
4940 /* continue with step 2 */
4941 cmhCC_checkALS_Support_2();
4942 return;
4943 }
4944
4945 cmhCC_checkALS_Support_exec( 0 );
4946 }
4947
4948 GLOBAL void cmhCC_checkALS_Support_cb_2 ( SHORT aId )
4949 {
4950 int i;
4951
4952 TRACE_FUNCTION ("cmhCC_checkALS_Support_cb_2()");
4953
4954 simShrdPrm.atb[aId].ntryUsdFlg = FALSE;
4955
4956 if (simShrdPrm.atb[aId].errCode NEQ SIM_NO_ERROR OR
4957 simShrdPrm.atb[aId].exchData EQ NULL OR
4958 simShrdPrm.atb[aId].dataLen < ACI_CPHS_CSP_SIZE )
4959 {
4960 ; /* CSP not supported or invalid */
4961 }
4962 else
4963 {
4964 for (i = 0; i < simShrdPrm.atb[aId].dataLen; i += 2)
4965 {
4966 if (simShrdPrm.atb[aId].exchData[i] EQ ALS_SERVICE_GROUP_CODE)
4967 {
4968 if (BITFIELD_CHECK(simShrdPrm.atb[aId].exchData[i+1],ALS_BIT_ON))
4969 {
4970 cmhCC_checkALS_Support_exec( 1 );
4971 return;
4972 }
4973 break;
4974 }
4975 }
4976 }
4977
4978 cmhCC_checkALS_Support_exec( 0 );
4979 }
4980
4981
4982 GLOBAL void cmhCC_checkALS_Support_exec ( UBYTE flag )
4983 {
4984 T_ACI_CMD_SRC ownBuf; /* buffers current owner */
4985 T_ACI_ALS_MOD ALSmode;
4986
4987 TRACE_FUNCTION ("cmhCC_checkALS_Support_exec()");
4988
4989 ownBuf = simEntStat.entOwn;
4990
4991 simEntStat.curCmd = AT_CMD_NONE;
4992 simShrdPrm.owner = (T_OWN)CMD_SRC_NONE;
4993 simEntStat.entOwn = CMD_SRC_NONE;
4994
4995 switch (ccShrdPrm.als_cmd)
4996 {
4997 case ALS_CMD_SET:
4998 if (flag)
4999 {
5000 cmhPrm[ownBuf].ccCmdPrm.ALSmode = ALS_MOD_AUX_SPEECH;
5001 R_AT( RAT_OK, ownBuf ) ( AT_CMD_ALS );
5002 }
5003 else
5004 {
5005 R_AT( RAT_CME, ownBuf ) ( AT_CMD_ALS, CME_ERR_OpNotSupp );
5006 }
5007 break;
5008 case ALS_CMD_TEST:
5009 if (flag)
5010 {
5011 ALSmode = (T_ACI_ALS_MOD)(ALS_MOD_SPEECH | ALS_MOD_AUX_SPEECH);
5012 }
5013 else
5014 {
5015 ALSmode = ALS_MOD_SPEECH;
5016 }
5017 R_AT( RAT_ALS, ownBuf ) ( ALSmode );
5018 R_AT( RAT_OK, ownBuf ) ( AT_CMD_ALS );
5019 break;
5020 default:
5021 TRACE_EVENT("wrong value in als_cmd");
5022 R_AT( RAT_CME, ownBuf ) ( AT_CMD_ALS, CME_ERR_OpNotSupp );
5023 }
5024 ccShrdPrm.als_cmd = ALS_CMD_NONE;
5025 }
5026
5027 /*
5028 +-------------------------------------------------------------------+
5029 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
5030 | ROUTINE : cmhCC_satTimeout |
5031 +-------------------------------------------------------------------+
5032
5033 PURPOSE : handle redial timeout of SAT max duration
5034
5035 */
5036
5037 GLOBAL void cmhCC_satTimeout( void )
5038 {
5039 TRACE_FUNCTION( "cmhCC_satTimeout()" );
5040 /* Stop the redial timer if still running */
5041 TIMERSTOP (ACI_REPEAT_HND);
5042 /* Send Terminal response to SIM with Network unable to handle error */
5043 cmhSAT_NtwErr( (UBYTE)((GET_CAUSE_VALUE(ccShrdPrm.ctb[rdlPrm.rdlcId]->nrmCs) NEQ NOT_PRESENT_8BIT)?
5044 (ccShrdPrm.ctb[rdlPrm.rdlcId]->nrmCs|0x80) : ADD_NO_CAUSE));
5045 /* Reset the call table */
5046 psaCC_FreeCtbNtry (rdlPrm.rdlcId);
5047 /* Reset the SA maximum duration timer */
5048 satShrdPrm.dur = -1;
5049 } /* End of cmhCC_satTimeout() */
5050
5051
5052 /*
5053 +-------------------------------------------------------------------+
5054 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
5055 | ROUTINE : cmhCC_redialTimeout |
5056 +-------------------------------------------------------------------+
5057
5058 PURPOSE : handle redial timeout
5059
5060 */
5061
5062 GLOBAL void cmhCC_redialTimeout ( void )
5063 {
5064 int i;
5065 T_CC_CMD_PRM * pCCCmdPrm; /* points to CC command parameters */
5066 T_SIM_SET_PRM * pSSetPrm; /* points to SIM set parameters */
5067
5068 #ifdef SIM_TOOLKIT
5069 T_ACI_RETURN aciRet;
5070 T_ACI_SAT_TERM_RESP resp_data;
5071 psaSAT_InitTrmResp( &resp_data );
5072 #endif /* SIM_TOOLKIT */
5073
5074 TRACE_FUNCTION( "cmhCC_redialTimeout()" );
5075
5076 #ifdef SIM_TOOLKIT
5077 pSSetPrm = &simShrdPrm.setPrm[ccShrdPrm.ctb[rdlPrm.rdlcId]->curSrc];
5078 /* Check For --Envelope Call Control Always Sent To SIM Bit-- */
5079 if ((ccShrdPrm.ctb[rdlPrm.rdlcId]->SATinv & SAT_REDIAL) AND
5080 (pSSetPrm->STKprof[0] & SAT_TP1_CC_ON_REDIAL))
5081 {
5082 /* Enable Call Control By SIM During AutoRedial */
5083 ccShrdPrm.ctb[rdlPrm.rdlcId]->SATinv |= SAT_REDIAL_ECCBE;
5084 aciRet = cmhSAT_CalCntrlBySIM (rdlPrm.rdlcId);
5085
5086 switch (aciRet)
5087 {
5088 case AT_CMPL:
5089 case AT_FAIL:
5090 /* respond with "Interaction with call control by SIM, permanent" */
5091 resp_data.add_content = ADD_NO_CAUSE;
5092 case AT_BUSY:
5093 /* respond with "Interaction with call control by SIM, temporary" */
5094 psaSAT_SendTrmResp( RSLT_CC_SIM_TMP, &resp_data );
5095 psaCC_FreeCtbNtry (rdlPrm.rdlcId);
5096 return;
5097 /*lint -fallthrough*/
5098 default:
5099 break;
5100 }
5101 }
5102 #endif /* SIM_TOOLKIT */
5103
5104
5105 if (psaCC_ctbIsValid (rdlPrm.rdlcId))
5106 {
5107 pCCCmdPrm = &cmhPrm[psaCC_ctb(rdlPrm.rdlcId)->curSrc].ccCmdPrm;
5108
5109 if (rdlPrm.rdlMod EQ AUTOM_REPEAT_ON)
5110 {
5111 if((psaCC_ctb(rdlPrm.rdlcId)->rdlTimIndex >= 1) AND
5112 (psaCC_ctb(rdlPrm.rdlcId)->rdlTimIndex < 3))
5113 {
5114 #ifdef _SIMULATION_
5115 TIMERSTART(ACI_REPEAT_1,ACI_REPEAT_HND);
5116 #else
5117 psaCC_ctb(rdlPrm.rdlcId)->rdlTimIndex++;
5118 TIMERSTART(ACI_REPEAT_2_4,ACI_REPEAT_HND);
5119 #endif
5120 }
5121 else
5122 {
5123 psaCC_ctb(rdlPrm.rdlcId)->rdlTimIndex = RDL_TIM_INDEX_NOT_PRESENT;
5124 psaCC_ctb(rdlPrm.rdlcId)->rdlCnt++;
5125 for(i = 0; i < CMD_SRC_MAX; i++)
5126 {
5127 R_AT(RAT_RDL,(T_ACI_CMD_SRC)i)(REDIAL_ATT_START);
5128 }
5129 psaCC_ctb(rdlPrm.rdlcId)->calType = CT_MOC_RDL;
5130 cmhCC_flagCall( rdlPrm.rdlcId, &(pCCCmdPrm->mltyCncFlg));
5131 /* start a new call */
5132 psaCC_NewCall(rdlPrm.rdlcId);
5133 rdlPrm.rdlcId = NO_ENTRY;
5134 }
5135 }
5136 else
5137 {
5138 TRACE_EVENT("cmhCC_redialTimeout: wrong cId");
5139 }
5140 }
5141 }
5142
5143
5144 /*
5145 +-------------------------------------------------------------------+
5146 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
5147 | ROUTINE : cmhCC_sendFie |
5148 +-------------------------------------------------------------------+
5149
5150 PURPOSE : forward unsolicited facility responses from CC to terminal
5151
5152 */
5153 GLOBAL T_ACI_RETURN cmhCC_sendFie( T_ACI_FAC_DIR tDirection,
5154 SHORT cId,
5155 T_MNCC_fac_inf *fie )
5156 {
5157 T_ACI_CMD_SRC tSrc;
5158
5159 TRACE_EVENT( "cmhCC_sendFie()" );
5160
5161 for( tSrc=CMD_SRC_LCL; tSrc<CMD_SRC_MAX; tSrc++ ) /* try over all sources */
5162 {
5163 if( cmhPrm[tSrc].ccCmdPrm.CSCNcc_mode.CcCSCNModeState EQ CC_CSCN_MOD_STATE_ON )
5164 {
5165 switch (cmhPrm[tSrc].ccCmdPrm.CSCNcc_mode.CcCSCNModeDirection)
5166 {
5167 case CC_CSCN_MOD_DIR_BOTH:
5168 break; /* printout regardless of direction */
5169
5170 case CC_CSCN_MOD_DIR_IN:
5171 if( tDirection NEQ CSCN_FACILITY_DIRECTION_IN)
5172 continue; /* settings for source don't match, advance to next source */
5173 break;
5174
5175 case CC_CSCN_MOD_DIR_OUT:
5176 if( tDirection NEQ CSCN_FACILITY_DIRECTION_OUT )
5177 continue; /* settings for source don't match, advance to next source */
5178 break;
5179
5180 default:
5181 continue; /* illegal setting, advance to next source */
5182 }
5183 R_AT( RAT_CCCN, tSrc )( tDirection, cId, fie );
5184 }
5185 }
5186 return( AT_CMPL );
5187 }
5188
5189 /*
5190 +-------------------------------------------------------------------+
5191 | PROJECT : GSM-PS (6147) MODULE : CMH_CCR |
5192 | ROUTINE : cmhCC_ChngWaitingToIncoming |
5193 +-------------------------------------------------------------------+
5194
5195 PURPOSE : Change waiting call to incomimg call.
5196
5197 */
5198
5199 GLOBAL void cmhCC_ChngWaitingToIncoming( void )
5200 {
5201 SHORT cId;
5202 /* If there is a call in CS_ACT_REQ state then send ring ind to the src's */
5203 cId = psaCC_ctbFindCall( (T_OWN)CMD_SRC_NONE, CS_ACT_REQ, CT_MTC );
5204 if (cId NEQ NO_ENTRY)
5205 {
5206 if((psaCC_ctb(cId)->calStat EQ CS_ACT_REQ) AND (CHLDaddInfo EQ NO_CHLD_ADD_INFO))
5207 {
5208 cmhCC_IncomingCall(cId); /* There is a call in CS_ACT_REQ state */
5209 }
5210 }
5211 }
5212
5213
5214 /* Implements Measure 184, 185 and 187 */
5215 /*
5216 +------------------------------------------------------------------------------
5217 | Function : cmhCC_tstAndUnflag_MPTYCall
5218 +------------------------------------------------------------------------------
5219 | Purpose : This Function will test and unflag a call for multy-call operation.
5220 |
5221 | Parameters : cId - Call Id.
5222 | srcBuf - Buffers Current Command Source
5223 | cmdBuf - Buffers Current Command
5224 |
5225 | Return : void
5226 +------------------------------------------------------------------------------
5227 */
5228
5229 LOCAL void cmhCC_tstAndUnflag_MPTYCall( SHORT cId, UBYTE srcBuf, UBYTE cmdBuf,
5230 T_CC_CMD_PRM *pCCCmdPrm )
5231 {
5232 TRACE_FUNCTION ("cmhCC_tstAndUnflag_MPTYCall()");
5233
5234 if( cmhCC_tstAndUnflagCall( cId, &(pCCCmdPrm -> mltyCncFlg)))
5235 {
5236 if( pCCCmdPrm -> mltyCncFlg EQ 0 AND
5237 pCCCmdPrm -> mltyDscFlg EQ 0 )
5238 {
5239 R_AT( RAT_OK, (T_ACI_CMD_SRC)srcBuf ) ( cmdBuf );
5240
5241 /* log result */
5242 cmh_logRslt ( (T_ACI_CMD_SRC)srcBuf, RAT_OK,
5243 (T_ACI_AT_CMD)cmdBuf, (SHORT)(cId+1), BS_SPEED_NotPresent,CME_ERR_NotPresent);
5244 }
5245 }
5246 }
5247
5248 /* Implements Measure 32 */
5249 /*
5250 +------------------------------------------------------------------------------
5251 | Function : cmhCC_check_isCallServiced
5252 +------------------------------------------------------------------------------
5253 | Purpose : This Function will check whether the Call was serviced or not.
5254 | If the call was found to be not serviced then add call
5255 | to LMN Phone Book.
5256 |
5257 | Parameters : cId - Call Id.
5258 |
5259 | Return : Returns TRUE if the Call is added to LMN Phone Book.
5260 | Returns FALSE if the Call is not added to LMN Phone Book.
5261 +------------------------------------------------------------------------------
5262 */
5263
5264 LOCAL BOOL cmhCC_check_isCallServiced( SHORT cId )
5265 {
5266 UBYTE idx;
5267 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId];
5268
5269 TRACE_FUNCTION ("cmhCC_check_isCallServiced()");
5270
5271 if( ctb->calOwn EQ (T_OWN)CMD_SRC_NONE AND
5272 ctb->curCmd EQ AT_CMD_NONE )
5273 {
5274 psaCC_phbAddNtry ( LMN, cId, CT_MTC, NULL ); /* add call to LMN PB */
5275
5276 #ifdef AT_INTERPRETER
5277 /* V.24 Ring Indicator Line */
5278 io_setRngInd (IO_RING_OFF, CRING_SERV_TYP_NotPresent, CRING_SERV_TYP_NotPresent ); /* V.24 Ring Indicator Line */
5279 #endif
5280
5281 for( idx = 0; idx < CMD_SRC_MAX; idx++ )
5282 {
5283 R_AT( RAT_CRING_OFF, (T_ACI_CMD_SRC)idx )( cId+1 );
5284 }
5285 return TRUE;
5286 }
5287 return FALSE;
5288 }
5289
5290 /* Implements Measure 207 */
5291 /*
5292 +------------------------------------------------------------------------------
5293 | Function : cmhCC_Call_Progress_Information
5294 +------------------------------------------------------------------------------
5295 | Purpose : This Function will provide the Information regarding the
5296 | Progress of the call to the User.
5297 |
5298 | Parameters : cId - Call Id.
5299 | msgType - Call Control Message Type
5300 |
5301 | Return : void
5302 |+------------------------------------------------------------------------------
5303 */
5304
5305 LOCAL void cmhCC_Call_Progress_Information( SHORT cId, T_ACI_CPI_MSG msgType, USHORT cause )
5306 {
5307 UBYTE idx;
5308 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId];
5309
5310 TRACE_FUNCTION ("cmhCC_Call_Progress_Information()");
5311
5312 for( idx = 0; idx < CMD_SRC_MAX; idx++ )
5313 {
5314 R_AT( RAT_CPI, (T_ACI_CMD_SRC)idx )
5315 ( cId+1,
5316 msgType,
5317 (ctb->inBndTns)? CPI_IBT_True: CPI_IBT_False,
5318 (ccShrdPrm.TCHasg)? CPI_TCH_True: CPI_TCH_False,
5319 cause);
5320 }
5321 }
5322
5323 /*==== EOF ========================================================*/
5324