comparison src/aci2/aci/cmh_ccr.c @ 3:93999a60b835

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