comparison src/g23m-aci/aci/cmh_ccs.c @ 162:53929b40109c

src/g23m-aci: initial import from TCS3.2/LoCosto
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 11 Oct 2016 02:02:43 +0000
parents
children 772c754cb3c9
comparison
equal deleted inserted replaced
161:4557e2a9c18e 162:53929b40109c
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-PS (6147)
4 | Modul : CMH_CCS
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 provides the set functions related to the
18 | protocol stack adapter for call control.
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef CMH_CCS_C
23 #define CMH_CCS_C
24 #endif
25
26 #include "aci_all.h"
27
28 #include "aci_cmh.h"
29 #include "ksd.h"
30
31 /*==== INCLUDES ===================================================*/
32
33 /* for CCD */
34 #include "ccdapi.h"
35 #include "aci.h" /* for CCD_END... */
36
37 /***********/
38
39 #include "ati_cmd.h"
40 #include "aci_cmd.h"
41
42 #ifdef DTI
43 #include "dti.h" /* functionality of the dti library */
44 #include "dti_conn_mng.h"
45 #include "dti_cntrl_mng.h"
46 #endif
47
48 #ifdef FAX_AND_DATA
49 #include "aci_fd.h"
50 #endif /* of #ifdef FAX_AND_DATA */
51
52 #ifdef FF_TTY
53 #include "audio.h"
54 #endif
55
56 #include "aci_mem.h"
57 #include "l4_tim.h"
58
59 #include "phb.h"
60 #include "psa.h"
61 #include "psa_cc.h"
62 #include "psa_sim.h"
63 #include "psa_mm.h"
64 #include "psa_ss.h"
65 #include "psa_util.h"
66 #include "cmh.h"
67 #include "cmh_cc.h"
68 #include "cmh_mm.h"
69 #include "cmh_sim.h"
70 #include "cmh_phb.h"
71
72 #ifdef FF_ATI
73 #include "aci_io.h"
74 #endif /* of #ifdef FF_ATI */
75
76 #ifdef FAX_AND_DATA
77
78 #include "psa_ra.h"
79 #include "cmh_ra.h"
80 #include "psa_l2r.h"
81 #include "cmh_l2r.h"
82 #include "psa_tra.h"
83
84 #ifdef FF_FAX
85 #include "psa_t30.h"
86 #include "cmh_t30.h"
87 #endif /* FF_FAX */
88
89 #endif /* FAX_AND_DATA */
90
91 #ifdef SIM_TOOLKIT
92 #include "psa_sat.h"
93 #include "cmh_sat.h"
94 #endif
95
96 #ifdef DTI
97 #if defined (FF_WAP) || defined (FF_GPF_TCPIP) || defined (FF_SAT_E)
98 #include "wap_aci.h"
99 #include "psa_ppp_w.h"
100 #include "cmh_ppp.h"
101 #endif /* FF_WAP || FF_GPF_TCPIP || FF_SAT_E */
102 #endif /* DTI */
103
104 #ifdef GPRS
105 #include "gaci.h"
106 #include "gaci_cmh.h"
107 #include "psa_sm.h"
108 #include "cmh_sm.h"
109 #endif /* GPRS */
110
111 #include "aoc.h"
112 #include "ksd.h"
113
114 #ifdef ACI
115 #include "cmh_mmi.h"
116 #endif
117
118 #ifdef FF_PSI
119 #include "psa_psi.h"
120 #include "cmh_psi.h"
121 #include "cmh_uart.h"
122 #include "ati_src_psi.h"
123 #endif /* FF_PSI */
124
125 /*==== CONSTANTS ==================================================*/
126 #ifdef TI_PS_FF_AT_CMD_P_ECC
127 //LOCAL char additional_ecc_numbers[ADDITIONAL_ECC_NUMBER_MAX][ADDITIONAL_ECC_NUMBER_LENGTH];
128 LOCAL char additional_ecc_numbers[ADDITIONAL_ECC_NUMBER_MAX][ADDITIONAL_ECC_NUMBER_LENGTH+1]; //OMAPS00117704/OMAPS00117705
129 #endif /* TI_PS_FF_AT_CMD_P_ECC */
130 #ifdef TI_PS_FF_AT_P_CMD_RDLB
131 GLOBAL T_ACI_CC_REDIAL_BLACKL * cc_blacklist_ptr = NULL;
132 #endif /* TI_PS_FF_AT_P_CMD_RDLB */
133 /*==== EXPORT =====================================================*/
134
135
136 #if defined (GPRS) AND defined (DTI)
137 EXTERN T_ATI_RSLT atGD (char *cl, UBYTE srcId, BOOL *gprs_command);
138 #endif /* GPRS */
139
140 /*==== VARIABLES ==================================================*/
141
142 /* Implements Measure#32: Row 89, 90, 116, 117, 1241 & 1242 */
143 const char * const ksd_supp_clir_str = "*31#";
144 const char * const ksd_inv_clir_str = "#31#";
145
146 EXTERN T_PCEER causeMod;
147 EXTERN SHORT causeCeer;
148 /* parameter block for delayed cmhCC_Dial call */
149 LOCAL struct cmhCC_Dial_buffer {
150 T_ACI_CMD_SRC srcId;
151 } cmhCC_Dial_buffer;
152
153 #ifdef TI_PS_FF_AT_P_CMD_CUSCFG
154 EXTERN T_ACI_CUSCFG_PARAMS cuscfgParams;
155 #endif /* TI_PS_FF_AT_P_CMD_CUSCFG */
156 /*==== PROTOTYPES =================================================*/
157
158 LOCAL UCHAR cmhCC_Dial_delayed (void *arg);
159 LOCAL T_ACI_RETURN chld_RelHldOrUdub(T_ACI_CMD_SRC srcId);
160 LOCAL T_ACI_RETURN chld_RelActAndAcpt(T_ACI_CMD_SRC srcId);
161 LOCAL T_ACI_RETURN chld_RelActSpec(T_ACI_CMD_SRC srcId, CHAR *call);
162 LOCAL T_ACI_RETURN chld_HldActAndAcpt(T_ACI_CMD_SRC srcId);
163 LOCAL T_ACI_RETURN chld_HldActExc(T_ACI_CMD_SRC srcId, CHAR *call);
164 LOCAL T_ACI_RETURN chld_AddHld(T_ACI_CMD_SRC srcId);
165 LOCAL T_ACI_RETURN chld_Ect(T_ACI_CMD_SRC srcId);
166 LOCAL T_ACI_RETURN chld_Ccbs(T_ACI_CMD_SRC srcId);
167 LOCAL T_ACI_RETURN chld_OnlyHold(T_ACI_CMD_SRC srcId);
168 LOCAL T_ACI_RETURN chld_RelDialCall(T_ACI_CMD_SRC srcId);
169 LOCAL T_ACI_RETURN chld_RetrieveHoldCall(T_ACI_CMD_SRC srcId);
170 LOCAL T_ACI_RETURN chld_RetrieveHoldCallSpec(T_ACI_CMD_SRC srcId, CHAR *call);
171 LOCAL T_ACI_RETURN chld_RelAnySpec(T_ACI_CMD_SRC srcId, CHAR *call);
172 LOCAL BOOL cmhCC_check_RedialCall ( T_ACI_AT_CMD at_cmd_id );
173 LOCAL BOOL cmhCC_check_pending_satCall();
174 LOCAL BOOL chld_HoldActiveCalls ( T_ACI_CMD_SRC srcId,
175 BOOL *mptyHldFlg,
176 BOOL *hldCalFlg,
177 SHORT *cId );
178 LOCAL T_ACI_RETURN chld_Rel_MultipartySpec( T_ACI_CMD_SRC srcId,
179 SHORT *spcId,
180 T_ACI_CHLD_MOD chld_mode,
181 CHAR *call );
182 LOCAL void cmhCC_disconnect_waiting_call ( T_ACI_CMD_SRC srcId,
183 SHORT waitId,
184 T_ACI_AT_CMD at_cmd_id,
185 USHORT *mltyDscFlg );
186
187 /*==== FUNCTIONS ==================================================*/
188
189 /*
190 +--------------------------------------------------------------------+
191 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
192 | STATE : code ROUTINE : sAT_Dm |
193 +--------------------------------------------------------------------+
194
195 PURPOSE : This is the functional counterpart to the D> AT command
196 which is responsible to originate a call using the phone-
197 book. The searched number can be declared either by the
198 name or by giving the index of a specified phonebook. If
199 an entry could be found, the ordinary AT D command is
200 called.
201
202 <str> : name string to search.
203 <mem> : type of phonebook.
204 <index> : phonebook index.
205 <clirOvrd>: CLIR override
206 <cugCtrl> : CUG control
207 <callType>: call type
208 */
209
210 #define RETURN(x) { retVal = x; goto cleanup_exit; }
211 /*lint -e{801} Use of goto*/
212 #ifdef NO_ASCIIZ
213 GLOBAL T_ACI_RETURN sAT_Dm ( T_ACI_CMD_SRC srcId,
214 T_ACI_PB_TEXT *str,
215 T_ACI_PB_STOR mem,
216 SHORT index,
217 T_ACI_D_CLIR_OVRD clirOvrd,
218 T_ACI_D_CUG_CTRL cugCtrl,
219 T_ACI_D_TOC callType )
220 #else /* ifdef NO_ASCIIZ */
221 GLOBAL T_ACI_RETURN sAT_Dm ( T_ACI_CMD_SRC srcId,
222 CHAR *str,
223 T_ACI_PB_STOR mem,
224 SHORT index,
225 T_ACI_D_CLIR_OVRD clirOvrd,
226 T_ACI_D_CUG_CTRL cugCtrl,
227 T_ACI_D_TOC callType )
228 #endif /* ifdef NO_ASCIIZ */
229 {
230 T_CLPTY_PRM *cldPty; /* holds calling party parameter */
231 T_ACI_RETURN retVal; /* holds function return value */
232 T_PHB_RECORD phbNtry; /* holds phonebook entry */
233 T_PHB_TYPE slctPHB; /* holds selected phonebook */
234 T_ACI_PB_TEXT *dial_name;
235 #ifndef NO_ASCIIZ
236 T_ACI_PB_TEXT dialname;
237 #endif /* #ifndef NO_ASCIIZ */
238
239 ACI_MALLOC (cldPty, sizeof (T_CLPTY_PRM));
240
241 TRACE_FUNCTION ("sAT_Dm()");
242 /*
243 *-------------------------------------------------------------------
244 * check command source
245 *-------------------------------------------------------------------
246 */
247 if(!cmh_IsVldCmdSrc (srcId))
248 {
249 RETURN( AT_FAIL )
250 }
251
252 /* init cldPty */
253 cmhCC_init_cldPty( cldPty );
254
255 #ifdef NO_ASCIIZ
256 dial_name = str;
257 #else /* #ifdef NO_ASCIIZ */
258 dial_name = &dialname;
259
260 if ( str NEQ NULL )
261 {
262 USHORT len = (USHORT)strlen( str );
263
264 cmh_cvtToDefGsm ( str, (CHAR*)dial_name->data, &len );
265 dial_name->cs = CS_Sim;
266 dial_name->len = (UBYTE)len;
267 }
268 else
269 {
270 dial_name->cs = CS_NotPresent;
271 dial_name->len = 0;
272 }
273 #endif /* #ifdef NO_ASCIIZ */
274
275 /*
276 *-------------------------------------------------------------------
277 * check for name search
278 *-------------------------------------------------------------------
279 */
280 if( dial_name->len NEQ 0 )
281 {
282 if( psaCC_phbSrchName( srcId, dial_name, cldPty ) )
283 RETURN( cmhCC_Dial( srcId, cldPty, clirOvrd, cugCtrl, callType ))
284
285 else
286 {
287 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_NotFound );
288 RETURN( AT_FAIL )
289 }
290 }
291
292 /*
293 *-------------------------------------------------------------------
294 * check for index read
295 *-------------------------------------------------------------------
296 */
297 #ifdef NO_ASCIIZ
298 if( ( !str OR !str->len ) AND index NEQ ACI_NumParmNotPresent )
299 #else /* #ifdef NO_ASCIIZ */
300 if( !str AND index NEQ ACI_NumParmNotPresent )
301 #endif /* #ifdef NO_ASCIIZ */
302 {
303 if( !cmhPHB_cvtPhbType ((( mem EQ PB_STOR_NotPresent )?
304 cmhPrm[srcId].phbCmdPrm.cmhStor : mem), &slctPHB ))
305 {
306 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
307 RETURN( AT_FAIL )
308 }
309
310 #ifdef TI_PS_FFS_PHB
311 if (pb_read_record (slctPHB, index, &phbNtry) EQ PHB_OK)
312 #else
313 if( pb_read_phys_record( slctPHB, index, &phbNtry ) EQ PHB_OK )
314 #endif
315 {
316 cmhPHB_getAdrStr( cldPty->num, sizeof (cldPty->num) - 1,
317 phbNtry.number, phbNtry.len );
318
319 cmh_demergeTOA ( phbNtry.ton_npi, &cldPty->ton, &cldPty->npi );
320 RETURN( cmhCC_Dial( srcId, cldPty, clirOvrd, cugCtrl, callType ))
321 }
322 else
323 {
324 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_InvIdx );
325 RETURN( AT_FAIL )
326 }
327 }
328 RETURN( AT_FAIL )
329
330 /* The one and only exit out of this function to avoid memory leaks */
331 cleanup_exit:
332 ACI_MFREE (cldPty);
333 return retVal;
334 }
335
336 /*
337 +--------------------------------------------------------------------+
338 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
339 | STATE : code ROUTINE : sAT_Dn |
340 +--------------------------------------------------------------------+
341
342 PURPOSE : This is the functional counterpart to the D AT command
343 which is responsible to originate a call to a given phone
344 number. The D command starts to establish a new call if no
345 call is currently active. Otherwise if a call is in active
346 state the D command starts to modify the active call. If the
347 call mode set by the +CMOD command indicates a single call
348 no modification takes place and the D command returns with
349 a fail.
350
351 <number> : phone number.
352 <clirOvrd>: CLIR override
353 <cugCtrl> : CUG control
354 <callType>: call type
355 */
356
357 GLOBAL T_ACI_RETURN sAT_Dn ( T_ACI_CMD_SRC srcId,
358 CHAR * number,
359 T_ACI_D_CLIR_OVRD clirOvrd,
360 T_ACI_D_CUG_CTRL cugCtrl,
361 T_ACI_D_TOC callType )
362 {
363 /* Implements Measure#32: Row 88 */
364 CHAR trace_number_buffer[59];
365 T_CLPTY_PRM *cldPty = NULL; /* holds calling party parameter */
366 T_ACI_RETURN retVal; /* holds function return value */
367 #if defined (GPRS) AND defined (DTI)
368 BOOL gprs_command;
369 T_ATI_RSLT r_value;
370 #endif /* GPRS */
371
372 TRACE_FUNCTION ("sAT_Dn()");
373 if (number NEQ NULL)
374 {
375 /* char trcBuf[80]; */
376 /* Implements Measure#32: Row 88 */
377 strncpy (&trace_number_buffer[0], number, 58);
378 trace_number_buffer[58] = '\0';
379
380 if (trace_number_buffer[55])
381 {
382 trace_number_buffer[55] = trace_number_buffer[56] = trace_number_buffer[57] = '.'; /* add trailing "..." if string is >=76 */
383 }
384 TRACE_EVENT_P1 ("sAT_Dn(): dialled nb=%s",trace_number_buffer);
385 }
386 /*
387 *-------------------------------------------------------------------
388 * check command source
389 *-------------------------------------------------------------------
390 */
391 if(!cmh_IsVldCmdSrc (srcId))
392 {
393 return( AT_FAIL );
394 }
395
396 #if defined (GPRS) AND defined (DTI)
397 r_value = atGD( number, (UBYTE) srcId, &gprs_command );
398 if ( gprs_command EQ TRUE)
399 {
400 /* SPR#1983 - SH */
401 switch (r_value)
402 {
403 case ATI_CMPL:
404 return AT_CMPL;
405
406 case ATI_EXCT:
407 return AT_EXCT;
408
409 default:
410 return AT_FAIL;
411 }
412 /* end SPR#1983 */
413 }
414 #endif /* GPRS */
415
416 ACI_MALLOC (cldPty, sizeof (T_CLPTY_PRM));
417
418 /* initialize called party parameter */
419 if(number NEQ NULL)
420 {
421 cmhCC_init_cldPty( cldPty );
422
423 cmh_bldCalPrms ( number, cldPty );
424 }
425
426 /*
427 *-------------------------------------------------------------------
428 * start dialling
429 *-------------------------------------------------------------------
430 */
431 retVal = cmhCC_Dial( srcId,
432 (number NEQ NULL) ? cldPty : NULL,
433 clirOvrd,
434 cugCtrl,
435 callType );
436 ACI_MFREE (cldPty);
437 return retVal;
438 }
439
440
441 /* initialize cldPty structure */
442 GLOBAL void cmhCC_init_cldPty( /*lint -e(578) */T_CLPTY_PRM *cldPty )
443 {
444 cldPty->num[0] = 0;
445 cldPty->ton = MNCC_TON_NOT_PRES;
446 cldPty->npi = MNCC_NPI_NOT_PRES;
447 cldPty->sub[0] = 0;
448 cldPty->tos = MNCC_TOS_NOT_PRES;
449 cldPty->oe = MNCC_OE_EVEN;
450 }
451
452
453 /*
454 +--------------------------------------------------------------------+
455 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
456 | STATE : code ROUTINE : cmhCC_CHLD_Serv |
457 +--------------------------------------------------------------------+
458
459 PURPOSE : This is the functional counterpart to the %CHLD AT command
460 which is responsible to handle the supplementary services
461 witin a call. This function is resonsible for the +CHLD
462 and %CHLD command both.
463 */
464 LOCAL T_ACI_RETURN cmhCC_CHLD_Serv(T_ACI_CMD_SRC srcId,
465 T_ACI_CHLD_MOD mode,
466 CHAR *call)
467 {
468 /* check command source */
469 if(!cmh_IsVldCmdSrc (srcId))
470 {
471 return( AT_FAIL );
472 }
473
474 switch( mode )
475 {
476 /* release all held calls, or UDUB for CWA */
477 case( CHLD_MOD_RelHldOrUdub ):
478 return(chld_RelHldOrUdub(srcId));
479
480 /* release all active calls, and accept held or waiting call */
481 case( CHLD_MOD_RelActAndAcpt ):
482 return(chld_RelActAndAcpt(srcId));
483
484 /* release a specific active call */
485 case( CHLD_MOD_RelActSpec ):
486 return(chld_RelActSpec(srcId, call));
487
488 /* place all active calls on hold, and accept held or waiting call */
489 case( CHLD_MOD_HldActAndAcpt ):
490 return(chld_HldActAndAcpt(srcId));
491
492 /* place all active calls on hold except the specified call */
493 case( CHLD_MOD_HldActExc ):
494 return(chld_HldActExc(srcId, call));
495
496 /* add a held call to the conversation */
497 case( CHLD_MOD_AddHld ):
498 return(chld_AddHld(srcId));
499
500 /* explicit call transfer */
501 case( CHLD_MOD_Ect ):
502 return(chld_Ect(srcId));
503
504 /* activate call completion to busy subscriber */
505 case( CHLD_MOD_Ccbs ):
506 return(chld_Ccbs(srcId));
507
508 /* place a call on hold */
509 case(CHLD_MOD_OnlyHold):
510 return(chld_OnlyHold(srcId));
511
512 /* release currently dialling call only */
513 case(CHLD_MOD_RelDialCall):
514 return(chld_RelDialCall(srcId));
515
516 /* retrive first held call on the list */
517 case(CHLD_MOD_RetrieveHoldCall):
518 return(chld_RetrieveHoldCall(srcId));
519
520 /* retrieve specific held call */
521 case(CHLD_MOD_RetrieveHoldCallSpec):
522 return(chld_RetrieveHoldCallSpec(srcId, call));
523
524 /* releases specific call */
525 case(CHLD_MOD_RelAnySpec):
526 return(chld_RelAnySpec(srcId, call));
527
528 }
529 /* for unexpected conditions */
530 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow );
531 return( AT_FAIL );
532 }
533
534 /*
535 +--------------------------------------------------------------------+
536 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
537 | STATE : code ROUTINE : cmhCC_Dial |
538 +--------------------------------------------------------------------+
539
540 PURPOSE : Start dialling.
541
542 */
543
544 /* helper function for delivering delayed rAT_PlusCPMS callback */
545 LOCAL UCHAR cmhCC_Dial_delayed (void* arg)
546 {
547 struct cmhCC_Dial_buffer* p = (struct cmhCC_Dial_buffer*) arg;
548 TRACE_EVENT("delayed delivery of RAT_NO_CARRIER after cmhCC_Dial");
549 R_AT( RAT_NO_CARRIER, p->srcId ) ( AT_CMD_D, 0 );
550 return FALSE; /* single-shot */
551 }
552
553 GLOBAL T_ACI_RETURN cmhCC_Dial ( T_ACI_CMD_SRC srcId,
554 /*lint -e(578) */ T_CLPTY_PRM *cldPty,
555 T_ACI_D_CLIR_OVRD clirOvrd,
556 T_ACI_D_CUG_CTRL cugCtrl,
557 T_ACI_D_TOC callType )
558 {
559 SHORT cId, newId; /* holds call id */
560 T_CC_CMD_PRM * pCCCmdPrm; /* points to CC command parameters */
561 T_ACI_RETURN retVal; /* holds return value */
562 UBYTE prio; /* holds priority of the call */
563 USHORT dummy=0;
564 UBYTE idx;
565
566 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
567 T_ACI_CLOG cmdLog; /* holds logging info */
568 #endif
569
570 TRACE_FUNCTION ("cmhCC_Dial()");
571
572 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm;
573
574 causeMod = P_CEER_mod; /* Clear module which was set for ceer */
575 causeCeer = CEER_NotPresent; /* Clear proprietary cause when at point of dialling. */
576 /*
577 *-------------------------------------------------------------------
578 * check for an active call
579 *-------------------------------------------------------------------
580 */
581
582 cId = psaCC_ctbFindCall( OWN_SRC_INV, CS_ACT, NO_VLD_CT );
583
584 #ifdef FAX_AND_DATA
585
586 if( cId NEQ NO_ENTRY )
587 {
588
589 /*
590 *-----------------------------------------------------------------
591 * check call mode to modify the call
592 *-----------------------------------------------------------------
593 */
594 if( cmhCC_ChckInCallMdfy( cId, AT_CMD_D ) )
595 {
596 cmhCC_flagCall( cId, &(pCCCmdPrm->mltyCncFlg));
597 psaCC_ctb(cId)->curCmd = AT_CMD_D;
598 psaCC_ctb(cId)->curSrc = srcId;
599 psaCC_ModifyCall(cId);
600
601 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
602 /* log command */
603 cmdLog.atCmd = AT_CMD_D;
604 cmdLog.cmdType = CLOG_TYPE_Set;
605 cmdLog.retCode = AT_EXCT;
606 cmdLog.cId = cId+1;
607 cmdLog.sId = ACI_NumParmNotPresent;
608 cmdLog.cmdPrm.sD.srcId = srcId;
609 cmdLog.cmdPrm.sD.number = NULL;
610 cmdLog.cmdPrm.sD.clirOvrd = clirOvrd;
611 cmdLog.cmdPrm.sD.cugCtrl = cugCtrl;
612 cmdLog.cmdPrm.sD.callType = callType;
613 #ifdef SIM_TOOLKIT
614 cmdLog.cmdPrm.sD.simCallCtrl= D_SIMCC_NOT_ACTIVE;
615 #endif /* SIM_TOOLKIT */
616
617 rAT_PercentCLOG( &cmdLog );
618 #endif
619
620 return( AT_EXCT );
621 }
622 }
623
624 #endif /* of #ifdef FAX AND_DATA */
625
626 if( cldPty EQ NULL )
627 {
628 TRACE_EVENT("ERROR: cldPty is NULL");
629
630 if (callType EQ D_TOC_Voice)
631 return(AT_CMPL);
632 else
633 {
634 if (!cmh_set_delayed_call (cmhCC_Dial_delayed, &cmhCC_Dial_buffer))
635 return AT_BUSY;
636
637 cmhCC_Dial_buffer.srcId = srcId;
638
639 TRACE_EVENT("delayed return requested: 100 ms");
640 cmh_start_delayed_call (100);
641
642 return(AT_EXCT);
643 }
644 }
645
646 /*
647 *-------------------------------------------------------------------
648 * determine call priority
649 *-------------------------------------------------------------------
650 */
651 if (cmhMM_ChkIgnoreECC(cldPty->num))
652 {
653 prio = MNCC_PRIO_NORM_CALL;
654 TRACE_EVENT("cmhCC_Dial(): ECC check is ignored");
655 }
656 else
657 {
658 TRACE_EVENT("cmhCC_Dial(): ECC check is coninued");
659 prio = psaCC_phbSrchECC ( cldPty->num, TRUE );
660 }
661
662 /*
663 *-------------------------------------------------------------------
664 * check fixed dialing phonebook if enabled
665 *-------------------------------------------------------------------
666 */
667 if( prio EQ MNCC_PRIO_NORM_CALL AND
668 (simShrdPrm.crdFun EQ SIM_FDN_ENABLED OR
669 simShrdPrm.crdFun EQ SIM_FDN_BDN_ENABLED) )
670 {
671 if( ksd_isFDNCheckSeq ( cldPty->num ) )
672 {
673 if(!psaCC_phbNtryFnd( FDN, cldPty ))
674 {
675 TRACE_EVENT ( "FDN check failed" );
676 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_FdnCheck );
677 return( AT_FAIL );
678 }
679 }
680 }
681
682 /*
683 *-------------------------------------------------------------------
684 * Add Number or Sequence to LDN phonebook
685 * This has to be done prior keystrokes to allow adding some special
686 * sequences for dialing purpose with prepaid SIMs when roaming (USSD callback)
687 *-------------------------------------------------------------------
688 */
689 if (prio NEQ MNCC_PRIO_EMERG_CALL) /* only normal calls are added to the LDN PB */
690 {
691 if(ksd_isLDNWriteCheckSeq(cldPty->num)) /* check whether the string needs to be written to LDN?*/
692 {
693 /* A call table entry does not exist here yet */
694 psaCC_phbAddNtry( LDN, NO_ENTRY, CT_MOC, cldPty ); /* add call to LDN PB */
695 }
696 }
697
698 /*
699 *-------------------------------------------------------------------
700 * check for a keystroke sequence
701 *-------------------------------------------------------------------
702 */
703
704 if(prio NEQ MNCC_PRIO_EMERG_CALL)
705 {
706 retVal = cmhCC_chkKeySeq ( srcId,
707 cldPty,
708 &callType,
709 &clirOvrd,
710 CC_SIM_YES );
711
712 if( retVal NEQ AT_CONT )
713 return( retVal );
714 }
715 else if (strlen(cldPty->num) > 4)
716 {
717 /* decode clirOvrd in case of ECC
718 since cmhCC_chkKeySeq is not aware of ECC */
719
720 /* Implements Measure#32: Row 89 & 90 */
721 if ( !strncmp(cldPty->num,(char*)ksd_supp_clir_str,4) OR /* KSD_SUPPRESS_CLIR */
722 !strncmp(cldPty->num,(char*)ksd_inv_clir_str,4) ) /* KSD_INVOKE_CLIR */
723 {
724 CHAR *p1, *p2;
725
726 if (*cldPty->num EQ '*')
727 clirOvrd = D_CLIR_OVRD_Supp;
728 else
729 clirOvrd = D_CLIR_OVRD_Invoc;
730 /* and remove clirOvrd from dial num */
731 for (p1=cldPty->num, p2=cldPty->num+4; /*lint -e720 */ *p1++ = *p2++; )
732 ;
733 }
734 }
735
736
737 /*
738 *-------------------------------------------------------------------
739 * check for a short string sequence: should also be USSD (see 02.30 chptr 4.5.3.2)
740 *-------------------------------------------------------------------
741 */
742 if( ( prio EQ MNCC_PRIO_NORM_CALL ) AND ( !ksd_isBCDForUSBand(cldPty->num) ) )
743 {
744 retVal = cmhCC_chkShortString (srcId, cId, cldPty);
745 if (retVal NEQ AT_EXCT)
746 {
747 return (retVal);
748 }
749 }
750
751 /*
752 *-------------------------------------------------------------------
753 * check redialing
754 *-------------------------------------------------------------------
755 */
756 /* Implements Measure 64 */
757 cmhCC_CheckRedialTimer( FALSE );
758 /*
759 *-------------------------------------------------------------------
760 * continue dialing
761 *-------------------------------------------------------------------
762 */
763 newId = psaCC_ctbNewEntry();
764
765 if( newId EQ NO_ENTRY )
766 {
767 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_CallTabFull );
768 return( AT_FAIL ); /* call table full */
769 }
770
771 if( cId NEQ NO_ENTRY )
772 {
773
774 /*
775 *-----------------------------------------------------------------
776 * check if there is already a call on hold
777 *-----------------------------------------------------------------
778 */
779 if( psaCC_ctbFindCall( OWN_SRC_INV, CS_HLD, NO_VLD_CT ) NEQ NO_ENTRY )
780 {
781 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_OneCallOnHold );
782 psaCC_FreeCtbNtry (newId);
783 return( AT_FAIL );
784 }
785
786 /*
787 *-----------------------------------------------------------------
788 * check to put active call on hold, if it is no data call and not
789 * an emergency call
790 *-----------------------------------------------------------------
791 */
792 if( psaCC_ctb(cId)->prio EQ MNCC_PRIO_NORM_CALL AND
793 cmhCC_getcalltype(cId) EQ VOICE_CALL )
794 {
795 if( pCCCmdPrm->mltyCncFlg NEQ 0 )
796 {
797 psaCC_FreeCtbNtry (newId);
798 return( AT_BUSY );
799 }
800 }
801 else
802 {
803 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_CallTypeNoHold );
804 psaCC_FreeCtbNtry (newId);
805 return( AT_FAIL );
806 }
807 }
808
809 /*
810 *-------------------------------------------------------------------
811 * setup call parameters
812 *-------------------------------------------------------------------
813 */
814 cmhCC_chkDTMFDig ( cldPty->num, newId, dummy, TRUE );
815
816
817 retVal = cmhCC_fillSetupPrm ( newId, srcId, cldPty, NULL, prio,
818 clirOvrd, cugCtrl, callType );
819 if( retVal NEQ AT_CMPL )
820 {
821 psaCC_FreeCtbNtry (newId);
822 return( retVal );
823 }
824
825 #ifdef TI_PS_FF_AT_P_CMD_RDLB
826 /*
827 *-------------------------------------------------------------------
828 * check number against black list entries
829 *-------------------------------------------------------------------
830 */
831 if(rdlPrm.rdlMod EQ AUTOM_REPEAT_ON)
832 {
833 if(cmhCC_redialChkBlackl(newId) NEQ AT_CMPL)
834 {
835 psaCC_FreeCtbNtry (newId);
836 return( AT_FAIL);
837 }
838 }
839 #endif /* TI_PS_FF_AT_P_CMD_RDLB */
840 /*
841 *-----------------------------------------------------------------
842 * declare call table entry as used and the owner of the call
843 *-----------------------------------------------------------------
844 */
845 psaCC_ctb(newId)->calType = CT_MOC;
846 psaCC_ctb(newId)->calOwn = (T_OWN)srcId;
847 psaCC_ctb(newId)->curCmd = AT_CMD_D;
848 psaCC_ctb(newId)->curSrc = srcId;
849
850 /*
851 *-------------------------------------------------------------------
852 * check for call control by SIM toolkit
853 *-------------------------------------------------------------------
854 */
855 #ifdef SIM_TOOLKIT
856
857 if ( prio NEQ MNCC_PRIO_EMERG_CALL ) /* don't send emergency calls to */
858 { /* SIM toolkit */
859 if ( !ksd_isFDNCheckSeq ( cldPty-> num ) )
860 ; /* bypass *#06# from CntrlBySIM */
861 else
862 {
863 if( psaSIM_ChkSIMSrvSup( SRV_CalCntrl ) AND satShrdPrm.SIMCCParm.busy NEQ TRUE )
864 {
865 /* get bearer capability parameter */
866 ccShrdPrm.BC0_send_flag = ccShrdPrm.ctb[newId]->BC[0].bearer_serv NEQ MNCC_BEARER_SERV_NOT_PRES AND
867 ccShrdPrm.ctb[newId]->BC[0].bearer_serv NEQ MNCC_BEARER_SERV_SPEECH AND
868 ccShrdPrm.ctb[newId]->BC[0].bearer_serv NEQ MNCC_BEARER_SERV_AUX_SPEECH;
869
870 ccShrdPrm.BC1_send_flag = ccShrdPrm.ctb[newId]->BC[1].bearer_serv NEQ MNCC_BEARER_SERV_NOT_PRES AND
871 ccShrdPrm.ctb[newId]->BC[1].bearer_serv NEQ MNCC_BEARER_SERV_SPEECH AND
872 ccShrdPrm.ctb[newId]->BC[1].bearer_serv NEQ MNCC_BEARER_SERV_AUX_SPEECH;
873 if ( (callType EQ D_TOC_Data) AND ( ccShrdPrm.BC0_send_flag OR ccShrdPrm.BC1_send_flag) )
874 {
875 satShrdPrm.capParm.cId = newId;
876 psaCC_BCapCode( BCRI_SAT, newId );
877 return (AT_EXCT);
878 }
879 else
880 {
881 retVal = cmhSAT_CalCntrlBySIM( newId );
882 }
883
884 if( retVal NEQ AT_CMPL )
885 {
886 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
887 cmdLog.atCmd = AT_CMD_D;
888 cmdLog.cmdType = CLOG_TYPE_Set;
889 cmdLog.retCode = AT_EXCT;
890 cmdLog.cId = newId+1;
891 cmdLog.sId = ACI_NumParmNotPresent;
892 cmdLog.cmdPrm.sD.srcId = srcId;
893 cmdLog.cmdPrm.sD.number = cldPty->num;
894 cmdLog.cmdPrm.sD.clirOvrd = clirOvrd;
895 cmdLog.cmdPrm.sD.cugCtrl = cugCtrl;
896 cmdLog.cmdPrm.sD.callType = callType;
897 cmdLog.cmdPrm.sD.simCallCtrl= D_SIMCC_ACTIVE_CHECK;
898
899 rAT_PercentCLOG( &cmdLog );
900 #endif
901 return( retVal );
902 }
903 }
904 }
905 }
906
907 #endif
908
909
910 if( cId NEQ NO_ENTRY )
911 {
912 /* put an active call on hold prior to set up the new call */
913 CHLDaddInfo = CHLD_ADD_INFO_DIAL_CAL;
914 pCCCmdPrm -> CHLDmode = CHLD_MOD_HldActDial;
915
916 cmhCC_HoldCall(cId, srcId, AT_CMD_D);
917
918 /* flag newId to start the call once active call has been held */
919 cmhCC_flagCall( newId, &(pCCCmdPrm->mltyCncFlg));
920 }
921 else
922 {
923 /* start a new call */
924 cmhCC_flagCall( newId, &(pCCCmdPrm->mltyCncFlg));
925
926 psaCC_NewCall(newId);
927 /* call progress information */
928 for(idx = 0; idx < CMD_SRC_MAX; idx++ )
929 {
930 R_AT(RAT_CPI, (T_ACI_CMD_SRC)idx)( newId+1,
931 CPI_MSG_MO_Setup,
932 (psaCC_ctb(newId)->inBndTns)? CPI_IBT_True: CPI_IBT_False,
933 (ccShrdPrm.TCHasg)? CPI_TCH_True: CPI_TCH_False,
934 psaCC_ctb(newId)->curCs);
935 }
936 }
937
938 /* log command */
939 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
940 cmdLog.atCmd = AT_CMD_D;
941 cmdLog.cmdType = CLOG_TYPE_Set;
942 cmdLog.retCode = AT_EXCT;
943 cmdLog.cId = newId+1;
944 cmdLog.sId = ACI_NumParmNotPresent;
945 cmdLog.cmdPrm.sD.srcId = srcId;
946 cmdLog.cmdPrm.sD.number = cldPty->num;
947 cmdLog.cmdPrm.sD.clirOvrd = clirOvrd;
948 cmdLog.cmdPrm.sD.cugCtrl = cugCtrl;
949 cmdLog.cmdPrm.sD.callType = callType;
950 #ifdef SIM_TOOLKIT
951 cmdLog.cmdPrm.sD.simCallCtrl= D_SIMCC_NOT_ACTIVE;
952 #endif /* SIM_TOOLKIT */
953
954 rAT_PercentCLOG( &cmdLog );
955
956 #endif
957
958 return( AT_EXCT );
959 }
960
961 /*
962 +--------------------------------------------------------------------+
963 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
964 | STATE : code ROUTINE : sAT_H |
965 +--------------------------------------------------------------------+
966
967 PURPOSE : This is the functional counterpart to the H AT command
968 which is responsible to terminate or modify a call.
969
970 1. The function searches for an active call. If this
971 call is modifiable, it will be modified and the function
972 returns.
973 2. Then the function searches for a call that is in the
974 disconnect request state and indicates CCBS possibility,
975 this call will be finally released.
976 3. If enabled the next search looks for a pending SAT call.
977 If such a call is found the call is rejected and the SIM card
978 will be informed.
979 4. The next step is to clear all calls of the call table
980 exept a waiting call. The function returns if at least one
981 call could be found.
982 5. If no call was found, the function searches for a waiting
983 call. If a waiting call was found, the call will be
984 terminated declaring the user as busy.
985 6. If none of the above situations match, the function
986 returns with a fail.
987
988 */
989
990 GLOBAL T_ACI_RETURN sAT_H ( T_ACI_CMD_SRC srcId )
991 {
992 SHORT cId; /* holds call id */
993 SHORT waitId = NO_ENTRY; /* holds call waiting id */
994 T_CC_CMD_PRM * pCCCmdPrm; /* points to CC command parameters */
995 #if defined (GPRS) AND defined (DTI)
996 T_ACI_RETURN ret_value;
997 #endif /* GPRS */
998
999 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
1000 T_ACI_CLOG cmdLog; /* holds logging info */
1001 #endif
1002
1003 TRACE_FUNCTION ("sAT_H()");
1004
1005 /* check command source */
1006 if(!cmh_IsVldCmdSrc (srcId))
1007 {
1008 return( AT_FAIL );
1009 }
1010
1011 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm;
1012
1013
1014 #if defined (GPRS) AND defined (DTI)
1015 /* handle command for GPRS */
1016 if ( TRUE EQ cmhSM_sAT_H( srcId, &ret_value ) )
1017 return ret_value;
1018 #endif /* GPRS */
1019
1020 /* prepare log command */
1021 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
1022 cmdLog.atCmd = AT_CMD_H;
1023 cmdLog.cmdType = CLOG_TYPE_Set;
1024 cmdLog.retCode = AT_EXCT;
1025 cmdLog.sId = ACI_NumParmNotPresent;
1026 cmdLog.cmdPrm.sH.srcId = srcId;
1027 #endif
1028
1029 #ifdef ACI /* for ATI only version */
1030 cmhMMI_handleAudioTone ( AT_CMD_H, RAT_OK, CPI_MSG_NotPresent );
1031 #endif
1032
1033 /*
1034 *-------------------------------------------------------------------
1035 * find an active call and check call mode in case of
1036 * in-call modification
1037 *-------------------------------------------------------------------
1038 */
1039 #if defined (FAX_AND_DATA) AND defined (DTI)
1040 cId = psaCC_ctbFindCall( OWN_SRC_INV, CS_ACT, NO_VLD_CT );
1041
1042 if( cId NEQ NO_ENTRY AND
1043 cmhCC_ChckInCallMdfy( cId, AT_CMD_H ) )
1044 {
1045 switch( cmhCC_getcalltype(cId) )
1046 {
1047 case( TRANS_CALL ):
1048 ccShrdPrm.datStat = DS_MDF_REQ;
1049 cmhTRA_Deactivate();
1050
1051 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
1052 cmdLog.cId = cId+1;
1053 rAT_PercentCLOG( &cmdLog );
1054 #endif
1055 return( AT_EXCT );
1056
1057 case( NON_TRANS_CALL ):
1058 ccShrdPrm.datStat = DS_MDF_REQ;
1059 cmhL2R_Deactivate();
1060
1061 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
1062 cmdLog.cId = cId+1;
1063 rAT_PercentCLOG( &cmdLog );
1064 #endif
1065 return( AT_EXCT );
1066
1067 #ifdef FF_FAX
1068 case( FAX_CALL ):
1069 ccShrdPrm.datStat = DS_MDF_REQ;
1070 cmhT30_Deactivate ();
1071
1072 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
1073 cmdLog.cId = cId+1;
1074 rAT_PercentCLOG( &cmdLog );
1075 #endif
1076 return( AT_EXCT );
1077 #endif /* FF_FAX */
1078 }
1079 }
1080 #endif /* FAX_AND_DATA */
1081
1082 /*
1083 * 3GPP standard 27007
1084 * (+CVHU)
1085 */
1086 if( ccShrdPrm.cvhu EQ CVHU_DropDTR_ATH_IGNORED OR
1087 ((psiShrdPrm.dtr_clearcall EQ TRUE) AND
1088 (ccShrdPrm.cvhu EQ CVHU_DropDTR_IGNORED)) )
1089 {
1090 psiShrdPrm.dtr_clearcall = FALSE;
1091 return (AT_CMPL);
1092 }
1093 /*
1094 *-------------------------------------------------------------------
1095 * check for a call with CCBS possible
1096 *-------------------------------------------------------------------
1097 */
1098 if( pCCCmdPrm -> mltyDscFlg NEQ 0 )
1099 return( AT_BUSY );
1100
1101 /*
1102 *-------------------------------------------------------------------
1103 * check for a redial call
1104 *-------------------------------------------------------------------
1105 */
1106 /* Implements Measure 80 */
1107 if (cmhCC_check_RedialCall(AT_CMD_H) EQ TRUE )
1108 {
1109 return( AT_CMPL );
1110 }
1111
1112 cId = psaCC_ctbFindCall( OWN_SRC_INV, CS_ACT_REQ, CT_MOC );
1113
1114 if (cId EQ NO_ENTRY)
1115 cId = psaCC_ctbFindCall( OWN_SRC_INV, CS_DSC_REQ, CT_MOC ); /* also search for calls in disconnect state */
1116
1117 if( cId NEQ NO_ENTRY )
1118 {
1119 if( psaCC_ctb(cId)->CCBSstat EQ CCBSS_PSSBL )
1120 {
1121 pCCCmdPrm -> mltyDscFlg = 0;
1122
1123 cmhCC_flagCall( cId, &(pCCCmdPrm -> mltyDscFlg));
1124 psaCC_ctb(cId)->nrmCs = MNCC_CAUSE_CALL_CLEAR;
1125 psaCC_ctb(cId)->curCmd = AT_CMD_H;
1126 psaCC_ctb(cId)->curSrc = srcId;
1127 psaCC_ClearCall (cId);
1128
1129 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
1130 cmdLog.cId = cId+1;
1131 rAT_PercentCLOG( &cmdLog );
1132 #endif
1133 return( AT_EXCT );
1134 }
1135 }
1136
1137 /*
1138 *-------------------------------------------------------------------
1139 * check for a CCBS recall
1140 *-------------------------------------------------------------------
1141 */
1142 cId = psaCC_ctbFindCall( (T_OWN)CMD_SRC_NONE, CS_ACT_REQ, CT_NI_MOC );
1143
1144 if( cId NEQ NO_ENTRY )
1145 {
1146 psaCC_ctb(cId)->nrmCs = MNCC_CAUSE_CALL_REJECT;
1147 psaCC_ClearCall (cId);
1148
1149 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
1150 cmdLog.cId = cId+1;
1151 cmdLog.retCode = AT_CMPL;
1152 rAT_PercentCLOG( &cmdLog );
1153 #endif
1154
1155 psaCC_FreeCtbNtry (cId);
1156 return( AT_CMPL );
1157 }
1158
1159 /*
1160 *-------------------------------------------------------------------
1161 * check for a pending SAT call
1162 *-------------------------------------------------------------------
1163 */
1164 #ifdef SIM_TOOLKIT
1165 if (cmhCC_check_pending_satCall() EQ TRUE )
1166 {
1167 return( AT_CMPL );
1168 }
1169 #endif /* SIM_TOOLKIT */
1170
1171 /*
1172 *-------------------------------------------------------------------
1173 * clear all calls except a waiting call
1174 *-------------------------------------------------------------------
1175 */
1176 pCCCmdPrm -> mltyDscFlg = 0;
1177
1178 for( cId = 0; cId < MAX_CALL_NR; cId++ )
1179 {
1180 cmhCC_ClearCall( cId, MNCC_CAUSE_CALL_CLEAR, srcId, AT_CMD_H, &waitId );
1181 }
1182
1183 if( pCCCmdPrm -> mltyDscFlg )
1184 {
1185 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
1186 cmdLog.cId = cId+1;
1187 rAT_PercentCLOG( &cmdLog );
1188 #endif
1189 return( AT_EXCT );
1190 }
1191
1192 /*
1193 *-------------------------------------------------------------------
1194 * disconnect a waiting call with user determined user busy
1195 *-------------------------------------------------------------------
1196 */
1197 /* Implements Measure 164 */
1198 if ( waitId NEQ NO_ENTRY )
1199 {
1200 cmhCC_disconnect_waiting_call ( srcId, waitId, AT_CMD_H,
1201 &(pCCCmdPrm -> mltyDscFlg) );
1202 return( AT_EXCT );
1203 }
1204
1205 /*
1206 *-------------------------------------------------------------------
1207 * nothing to act on
1208 *-------------------------------------------------------------------
1209 */
1210 return( AT_CMPL );
1211 }
1212
1213 /*
1214 +--------------------------------------------------------------------+
1215 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
1216 | STATE : code ROUTINE : sAT_PlusCHUP |
1217 +--------------------------------------------------------------------+
1218
1219 PURPOSE : This is the functional counterpart to the +CHUP AT command
1220 which is responsible to terminate a call.
1221
1222 1. The next step is to clear all calls of the call table
1223 exept a waiting call. The function returns if at least one
1224 call could be found.
1225 2. If no call was found, the function searches for a waiting
1226 call. If a waiting call was found, the call will be
1227 terminated declaring the user as busy.
1228 3. If none of the above situations match, the function
1229 returns with a fail.
1230
1231 */
1232
1233 GLOBAL T_ACI_RETURN sAT_PlusCHUP ( T_ACI_CMD_SRC srcId )
1234 {
1235 SHORT cId; /* holds call id */
1236 SHORT waitId = NO_ENTRY; /* holds call waiting id */
1237 T_CC_CMD_PRM * pCCCmdPrm; /* points to CC command parameters */
1238
1239 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
1240 T_ACI_CLOG cmdLog; /* holds logging info */
1241 #endif
1242 TRACE_FUNCTION ("sAT_CHUP()");
1243
1244 /*
1245 *-------------------------------------------------------------------
1246 * check command source
1247 *-------------------------------------------------------------------
1248 */
1249 if(!cmh_IsVldCmdSrc (srcId))
1250 {
1251 return( AT_FAIL );
1252 }
1253
1254 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm;
1255
1256 /*
1257 *-------------------------------------------------------------------
1258 * prepare log command
1259 *-------------------------------------------------------------------
1260 */
1261 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
1262 cmdLog.atCmd = AT_CMD_CHUP;
1263 cmdLog.cmdType = CLOG_TYPE_Set;
1264 cmdLog.retCode = AT_EXCT;
1265 cmdLog.sId = ACI_NumParmNotPresent;
1266 cmdLog.cmdPrm.sCHUP.srcId = srcId;
1267 #endif
1268 /*
1269 *-------------------------------------------------------------------
1270 * check for a redial call
1271 *-------------------------------------------------------------------
1272 */
1273 /* Implements Measure 80 */
1274 if (cmhCC_check_RedialCall(AT_CMD_CHUP) EQ TRUE )
1275 {
1276 return( AT_CMPL );
1277 }
1278
1279 /*
1280 *-------------------------------------------------------------------
1281 * check for a pending SAT call
1282 *-------------------------------------------------------------------
1283 */
1284 #ifdef SIM_TOOLKIT
1285 if (cmhCC_check_pending_satCall() EQ TRUE )
1286 {
1287 return( AT_CMPL );
1288 }
1289 #endif /* SIM_TOOLKIT */
1290
1291 /*
1292 *-------------------------------------------------------------------
1293 * clear only active call
1294 *-------------------------------------------------------------------
1295 */
1296 if( pCCCmdPrm -> mltyDscFlg NEQ 0 )
1297 return( AT_BUSY );
1298
1299 cId = psaCC_ctbFindCall( OWN_SRC_INV, CS_ACT, NO_VLD_CT);
1300
1301 if( cId NEQ NO_ENTRY )
1302 {
1303 cmhCC_ClearCall(cId, MNCC_CAUSE_CALL_CLEAR, srcId, AT_CMD_CHUP, &waitId );
1304 }
1305
1306 if( pCCCmdPrm -> mltyDscFlg )
1307 {
1308 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
1309 cmdLog.cId = cId+1;
1310 rAT_PercentCLOG( &cmdLog );
1311 #endif
1312 return( AT_EXCT );
1313 }
1314
1315 /*
1316 *-------------------------------------------------------------------
1317 * disconnect a waiting call with user determined user busy
1318 *-------------------------------------------------------------------
1319 */
1320 /* Implements Measure 164 */
1321 if ( waitId NEQ NO_ENTRY )
1322 {
1323 cmhCC_disconnect_waiting_call ( srcId, waitId, AT_CMD_CHUP,
1324 &(pCCCmdPrm -> mltyDscFlg) );
1325 return( AT_EXCT );
1326 }
1327
1328 /*
1329 *-------------------------------------------------------------------
1330 * nothing to act on
1331 *-------------------------------------------------------------------
1332 */
1333 return( AT_CMPL );
1334 }
1335
1336 /*
1337 +--------------------------------------------------------------------+
1338 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
1339 | STATE : code ROUTINE : sAT_A |
1340 +--------------------------------------------------------------------+
1341
1342 PURPOSE : This is the functional counterpart to the A AT command
1343 which is responsible to accept an incoming call. The A
1344 command accepts an incoming call if no call is currently
1345 active. Otherwise if a call is in active state the A command
1346 starts to modify the active call. If the call mode set by
1347 the +CMOD command indicates a single call no modification
1348 takes place and the A command returns with a fail.
1349
1350 */
1351
1352 GLOBAL T_ACI_RETURN sAT_A ( T_ACI_CMD_SRC srcId )
1353 {
1354 SHORT cId; /* holds call id */
1355 T_CC_CMD_PRM * pCCCmdPrm; /* points to CC command parameters */
1356
1357 #if defined (GPRS) AND defined (DTI)
1358 T_ACI_RETURN ret_value;
1359 #endif /* GPRS */
1360
1361 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
1362 T_ACI_CLOG cmdLog; /* holds logging info */
1363 #endif
1364
1365 TRACE_FUNCTION ("sAT_A()");
1366
1367 /*
1368 *-------------------------------------------------------------------
1369 * check command source
1370 *-------------------------------------------------------------------
1371 */
1372 if(!cmh_IsVldCmdSrc (srcId))
1373 {
1374 return( AT_FAIL );
1375 }
1376
1377 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm;
1378
1379 /*
1380 *-------------------------------------------------------------------
1381 * handle command for GPRS
1382 *-------------------------------------------------------------------
1383 */
1384 #if defined (GPRS) AND defined (DTI)
1385
1386 if ( TRUE EQ cmhSM_sAT_A( srcId, &ret_value ) )
1387 return ret_value;
1388
1389 #endif /* GPRS */
1390
1391 /*
1392 *-------------------------------------------------------------------
1393 * prepare log command
1394 *-------------------------------------------------------------------
1395 */
1396 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
1397 cmdLog.atCmd = AT_CMD_A;
1398 cmdLog.cmdType = CLOG_TYPE_Set;
1399 cmdLog.retCode = AT_EXCT;
1400 cmdLog.sId = ACI_NumParmNotPresent;
1401 cmdLog.cmdPrm.sA.srcId = srcId;
1402 #endif
1403
1404 /*
1405 *-------------------------------------------------------------------
1406 * check for an active call
1407 *-------------------------------------------------------------------
1408 */
1409 #ifdef FAX_AND_DATA
1410
1411 cId = psaCC_ctbFindCall( OWN_SRC_INV, CS_ACT, NO_VLD_CT );
1412
1413 if( cId NEQ NO_ENTRY )
1414 {
1415
1416 /*
1417 *-----------------------------------------------------------------
1418 * check call mode to modify the call
1419 *-----------------------------------------------------------------
1420 */
1421 if( cmhCC_ChckInCallMdfy( cId, AT_CMD_A ) )
1422 {
1423 cmhCC_flagCall( cId, &(pCCCmdPrm->mltyCncFlg));
1424 psaCC_ctb(cId)->curCmd = AT_CMD_A;
1425 psaCC_ctb(cId)->curSrc = srcId;
1426 psaCC_ModifyCall(cId);
1427
1428 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
1429 cmdLog.cId = cId+1;
1430 rAT_PercentCLOG( &cmdLog );
1431 #endif
1432 return( AT_EXCT );
1433 }
1434 /*
1435 *----------------------------------------------------------------------------------
1436 * ATA can be used to answer the second SAT call when the first call is active
1437 *----------------------------------------------------------------------------------
1438 */
1439 #ifdef SIM_TOOLKIT
1440 cId = psaCC_ctbFindCall( OWN_SRC_INV, CS_SAT_REQ, NO_VLD_CT );
1441 #ifdef FF_SAT_E
1442 if( cId EQ NO_ENTRY )
1443 {
1444 cId = psaCC_ctbFindCall( OWN_SRC_INV, CS_SAT_CSD_REQ, NO_VLD_CT );
1445 }
1446 #endif /* FF_SAT_E */
1447 if( cId EQ NO_ENTRY )
1448 {
1449 TRACE_FUNCTION ("Already a call is active !!!");
1450 return( AT_FAIL);
1451 }
1452 #else
1453 /* Added Below Two lines to fix ACI-SPR-22325*/
1454 TRACE_FUNCTION ("Already a call is active !!!");
1455 return( AT_FAIL );
1456 #endif
1457 }
1458 #endif /* of #ifdef FAX_AND_DATA */
1459
1460
1461 /*
1462 *-------------------------------------------------------------------
1463 * check for an incoming call to accept
1464 *-------------------------------------------------------------------
1465 */
1466 if( pCCCmdPrm -> mltyCncFlg NEQ 0 )
1467
1468 return( AT_BUSY );
1469
1470 cId = psaCC_ctbFindCall( (T_OWN)CMD_SRC_NONE, CS_ACT_REQ, CT_MTC );
1471
1472 if( cId NEQ NO_ENTRY )
1473 {
1474 /* accept the call */
1475 cmhCC_flagCall( cId, &(pCCCmdPrm->mltyCncFlg));
1476
1477 cmhCC_AcceptCall(cId, srcId, AT_CMD_A);
1478
1479 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
1480 cmdLog.cId = cId+1;
1481 rAT_PercentCLOG( &cmdLog );
1482 #endif
1483 return( AT_EXCT );
1484 }
1485
1486 /*
1487 *-------------------------------------------------------------------
1488 * check for a CCBS recall condition
1489 *-------------------------------------------------------------------
1490 */
1491 cId = psaCC_ctbFindCall( (T_OWN)CMD_SRC_NONE, CS_ACT_REQ, CT_NI_MOC );
1492
1493 if( cId NEQ NO_ENTRY )
1494 {
1495 /* accept the call */
1496 {
1497 cmhCC_flagCall( cId, &(pCCCmdPrm->mltyCncFlg));
1498
1499 cmhCC_NewCall(cId, srcId, AT_CMD_A);
1500
1501 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
1502 cmdLog.cId = cId+1;
1503 rAT_PercentCLOG( &cmdLog );
1504 #endif
1505 return( AT_EXCT );
1506 }
1507 }
1508
1509 /*
1510 *-------------------------------------------------------------------
1511 * check for a pending SAT call
1512 *-------------------------------------------------------------------
1513 */
1514 #ifdef SIM_TOOLKIT
1515 /* triggered by SETUP CALL command */
1516 cId = psaCC_ctbFindCall( OWN_SRC_INV, CS_SAT_REQ, NO_VLD_CT );
1517
1518 #ifdef FF_SAT_E
1519 if( cId EQ NO_ENTRY )
1520 /* triggered by OPEN CHANNEL command */
1521 cId = psaCC_ctbFindCall( OWN_SRC_INV, CS_SAT_CSD_REQ, NO_VLD_CT );
1522 #endif /* FF_SAT_E */
1523
1524 if( cId NEQ NO_ENTRY )
1525 {
1526 if( psaCC_ctb(cId)->SATinv )
1527 {
1528 if( !cmhSAT_UserAcptCall( cId, (UBYTE)srcId ) )
1529 {
1530 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_CmdDetailsSAT );
1531 return( AT_FAIL );
1532 }
1533 }
1534 else
1535 {
1536 cmhCC_flagCall( cId, &(pCCCmdPrm->mltyCncFlg));
1537 cmhCC_NewCall(cId, srcId, AT_CMD_A);
1538 }
1539
1540 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
1541 cmdLog.cId = cId+1;
1542 rAT_PercentCLOG( &cmdLog );
1543 #endif
1544
1545 return( AT_EXCT );
1546 }
1547 #if defined (GPRS) AND defined (FF_SAT_E) AND defined (DTI)
1548 else
1549 {
1550 /* check for a pending SAT GPRS channel */
1551 if( cmhSAT_OpChnGPRSPend(PDP_CONTEXT_CID_INVALID, OPCH_WAIT_CNF))
1552 {
1553 if( !cmhSAT_UserAcptCntxt( (UBYTE)srcId ) )
1554 {
1555 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_CmdDetailsSAT );
1556 return( AT_FAIL );
1557 }
1558 return( AT_EXCT );
1559 }
1560 }
1561 #endif /* GPRS AND FF_SAT_E */
1562 #endif /* SIM_TOOLKIT */
1563
1564
1565 /*
1566 *-------------------------------------------------------------------
1567 * call not found
1568 *-------------------------------------------------------------------
1569 */
1570 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_CallNotFound );
1571 return( AT_FAIL );
1572 }
1573
1574 /*
1575 +--------------------------------------------------------------------+
1576 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
1577 | STATE : code ROUTINE : sAT_PlusCLIR |
1578 +--------------------------------------------------------------------+
1579
1580 PURPOSE : This is the functional counterpart to the +CLIR AT command
1581 which is responsible to enable or disable the presentation
1582 of the own calling id for mobile originated calls.
1583
1584 */
1585
1586 GLOBAL T_ACI_RETURN sAT_PlusCLIR ( T_ACI_CMD_SRC srcId,
1587 T_ACI_CLIR_MOD mode )
1588 {
1589 T_CC_CMD_PRM * pCCCmdPrm; /* points to CC command parameters */
1590
1591 TRACE_FUNCTION ("sAT_PlusCLIR()");
1592
1593 /*
1594 *-------------------------------------------------------------------
1595 * check command source
1596 *-------------------------------------------------------------------
1597 */
1598 if(!cmh_IsVldCmdSrc (srcId))
1599 {
1600 return( AT_FAIL );
1601 }
1602
1603 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm;
1604
1605 /*
1606 *-------------------------------------------------------------------
1607 * process the mode parameter
1608 *-------------------------------------------------------------------
1609 */
1610 switch( mode )
1611 {
1612 case( CLIR_MOD_NotPresent ):
1613 break;
1614
1615 case( CLIR_MOD_Subscript ):
1616 case( CLIR_MOD_Invoc ):
1617 case( CLIR_MOD_Supp ):
1618 pCCCmdPrm -> CLIRmode = mode;
1619 break;
1620
1621 default:
1622 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
1623 return( AT_FAIL );
1624 }
1625
1626 return( AT_CMPL );
1627 }
1628
1629 /*
1630 +--------------------------------------------------------------------+
1631 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
1632 | STATE : code ROUTINE : sAT_PlusCMOD |
1633 +--------------------------------------------------------------------+
1634
1635 PURPOSE : This is the functional counterpart to the +CMOD AT command
1636 which is responsible to set the mode for mobile originated
1637 calls.
1638
1639 */
1640
1641 GLOBAL T_ACI_RETURN sAT_PlusCMOD ( T_ACI_CMD_SRC srcId,
1642 T_ACI_CMOD_MOD mode )
1643 {
1644 TRACE_FUNCTION ("sAT_PlusCMOD()");
1645
1646 /* check command source */
1647 if(!cmh_IsVldCmdSrc (srcId))
1648 {
1649 return( AT_FAIL );
1650 }
1651
1652 /* process the mode parameter */
1653 switch( mode )
1654 {
1655 case( CMOD_MOD_NotPresent ):
1656 break;
1657
1658 case( CMOD_MOD_Single ):
1659
1660 #ifdef FAX_AND_DATA
1661 case( CMOD_MOD_VoiceFax ):
1662 case( CMOD_MOD_VoiceDat ):
1663 case( CMOD_MOD_VoiceFlwdDat ):
1664 #endif /* of #ifdef FAX_AND_DATA */
1665
1666 ccShrdPrm.CMODmode = mode;
1667 break;
1668
1669 default:
1670 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
1671 return( AT_FAIL );
1672 }
1673
1674 return( AT_CMPL );
1675 }
1676
1677 #ifdef FAX_AND_DATA
1678 /*
1679 +--------------------------------------------------------------------+
1680 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
1681 | STATE : code ROUTINE : sAT_PlusCBST |
1682 +--------------------------------------------------------------------+
1683
1684 PURPOSE : This is the functional counterpart to the +CBST AT command
1685 which is responsible to set the bearer service parameters
1686 for following mobile originated calls.
1687
1688 */
1689
1690 GLOBAL T_ACI_RETURN sAT_PlusCBST ( T_ACI_CMD_SRC srcId,
1691 T_ACI_BS_SPEED speed,
1692 T_ACI_CBST_NAM name,
1693 T_ACI_CBST_CE ce)
1694 {
1695 TRACE_FUNCTION ("sAT_PlusCBST()");
1696
1697 /* check command source */
1698 if(!cmh_IsVldCmdSrc (srcId))
1699 {
1700 return( AT_FAIL );
1701 }
1702
1703 /* process the speed parameter */
1704 switch( speed )
1705 {
1706 case( BS_SPEED_NotPresent ):
1707 speed = ccShrdPrm.CBSTspeed;
1708 break;
1709
1710 case( BS_SPEED_AUTO ):
1711 case( BS_SPEED_300_V21 ):
1712 case( BS_SPEED_1200_V22 ):
1713 case( BS_SPEED_1200_75_V23 ):
1714 case( BS_SPEED_2400_V22bis ):
1715 case( BS_SPEED_2400_V26ter ):
1716 case( BS_SPEED_4800_V32 ):
1717 case( BS_SPEED_9600_V32 ):
1718 case( BS_SPEED_9600_V34 ):
1719 case( BS_SPEED_14400_V34 ):
1720 /* case( BS_SPEED_1200_V120 ): This layer 1 protocol is not supported
1721 case( BS_SPEED_2400_V120 ):
1722 case( BS_SPEED_4800_V120 ):
1723 case( BS_SPEED_9600_V120 ):
1724 case( BS_SPEED_14400_V120 ): */
1725 case( BS_SPEED_300_V110 ):
1726 case( BS_SPEED_1200_V110 ):
1727 case( BS_SPEED_2400_V110 ):
1728 case( BS_SPEED_4800_V110 ):
1729 case( BS_SPEED_9600_V110 ):
1730 case( BS_SPEED_14400_V110 ):
1731 break;
1732
1733 default:
1734 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
1735 return( AT_FAIL );
1736 }
1737
1738 /* process the name parameter */
1739 switch( name )
1740 {
1741 case( CBST_NAM_NotPresent ):
1742 name = ccShrdPrm.CBSTname;
1743 break;
1744
1745 case( CBST_NAM_Asynch ):
1746 case( CBST_NAM_Synch ):
1747 break;
1748
1749 default:
1750 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
1751 return( AT_FAIL );
1752 }
1753
1754 /* process the ce parameter */
1755 switch( ce )
1756 {
1757 case( CBST_CE_NotPresent ):
1758 ce = ccShrdPrm.CBSTce;
1759 break;
1760
1761 case( CBST_CE_Transparent ):
1762 case( CBST_CE_NonTransparent ):
1763 case( CBST_CE_BothTransPref ):
1764 case( CBST_CE_BothNonTransPref ):
1765 break;
1766
1767 default:
1768 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
1769 return( AT_FAIL );
1770 }
1771
1772 /* assign the parameters */
1773 ccShrdPrm.CBSTspeed = speed;
1774 ccShrdPrm.CBSTname = name;
1775 ccShrdPrm.CBSTce = ce;
1776
1777 /* update CC setting for MTC */
1778 psaCC_Config();
1779 return( AT_CMPL );
1780
1781 }
1782 #endif /* FAX_AND_DATA */
1783
1784 /*
1785 +--------------------------------------------------------------------+
1786 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
1787 | STATE : code ROUTINE : sAT_PlusCSTA |
1788 +--------------------------------------------------------------------+
1789
1790 PURPOSE : This is the functional counterpart to the +CSTA AT command
1791 which is responsible to set the type of address for further
1792 dialing commands.
1793
1794 */
1795
1796 GLOBAL T_ACI_RETURN sAT_PlusCSTA ( T_ACI_CMD_SRC srcId,
1797 T_ACI_TOA * toa )
1798 {
1799 T_CC_CMD_PRM * pCCCmdPrm; /* points to CC command parameters */
1800
1801 TRACE_FUNCTION ("sAT_PlusCSTA()");
1802
1803 /*
1804 *-------------------------------------------------------------------
1805 * check command source
1806 *-------------------------------------------------------------------
1807 */
1808 if(!cmh_IsVldCmdSrc (srcId))
1809 {
1810 return( AT_FAIL );
1811 }
1812
1813 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm;
1814
1815 /*
1816 *-------------------------------------------------------------------
1817 * process the toa parameter
1818 *-------------------------------------------------------------------
1819 */
1820 if( ! toa ) return( AT_CMPL );
1821
1822 switch( toa -> ton )
1823 {
1824 case( TON_Unknown ):
1825 case( TON_International ):
1826 case( TON_National ):
1827 case( TON_NetSpecific ):
1828 case( TON_DedAccess ):
1829 break;
1830
1831 default:
1832 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
1833 return( AT_FAIL );
1834 }
1835
1836 switch( toa -> npi )
1837 {
1838 case( NPI_Unknown ):
1839 case( NPI_IsdnTelephony ):
1840 case( NPI_Data ):
1841 case( NPI_Telex ):
1842 case( NPI_National ):
1843 case( NPI_Private ):
1844 break;
1845
1846 default:
1847 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
1848 return( AT_FAIL );
1849 }
1850
1851 pCCCmdPrm -> CSTAtoa.ton = toa -> ton;
1852 pCCCmdPrm -> CSTAtoa.npi = toa -> npi;
1853 pCCCmdPrm -> CSTAdef = FALSE;
1854
1855 return( AT_CMPL );
1856 }
1857
1858
1859 /*
1860 +--------------------------------------------------------------------+
1861 | PROJECT : GSM-PS (6147) MODULE : CMH_DMY |
1862 | STATE : code ROUTINE : sAT_PlusCTFR |
1863 +--------------------------------------------------------------------+
1864
1865 PURPOSE : This refers to a service that causes an incoming alerting
1866 call to be forwarded to a specified number. Action command
1867 does this.
1868
1869 */
1870
1871 GLOBAL T_ACI_RETURN sAT_PlusCTFR ( T_ACI_CMD_SRC srcId,
1872 CHAR *number,
1873 T_ACI_TOA *type,
1874 CHAR *subaddr,
1875 T_ACI_TOS *satype)
1876 {
1877 T_CC_CMD_PRM * pCCCmdPrm; /* points to CC command parameters */
1878 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
1879 T_ACI_CLOG cmdLog; /* holds logging info */
1880 #endif /* #if defined SMI OR defined MFW OR defined FF_MMI_RIV */
1881 SHORT cId; /* holds call id */
1882 SHORT dscId; /* holds call disconnect id */
1883 UBYTE idx; /* holds index value */
1884
1885 TRACE_FUNCTION ("sAT_PlusCTFR()");
1886
1887 /*
1888 *-------------------------------------------------------------------
1889 * check command source
1890 *-------------------------------------------------------------------
1891 */
1892 if(!cmh_IsVldCmdSrc (srcId))
1893 {
1894 return( AT_FAIL );
1895 }
1896
1897 /*
1898 * Check that number contains a valid dial string.
1899 * A dial string is valid if it contains at least one valid dial
1900 * character, garbage within the dial string is ignored (also spaces).
1901 */
1902 if (strpbrk (number, "0123456789*#AaBbCc") EQ NULL)
1903 {
1904 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
1905 return( AT_FAIL );
1906 }
1907
1908 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm;
1909
1910 /*
1911 *-------------------------------------------------------------------
1912 * prepare log command
1913 *-------------------------------------------------------------------
1914 */
1915 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
1916 cmdLog.atCmd = AT_CMD_CTFR;
1917 cmdLog.cmdType = CLOG_TYPE_Set;
1918 cmdLog.retCode = AT_EXCT;
1919 cmdLog.sId = ACI_NumParmNotPresent;
1920 cmdLog.cId = NOT_PRESENT_8BIT;
1921 cmdLog.cmdPrm.sCTFR.srcId = srcId;
1922 cmdLog.cmdPrm.sCTFR.number = number;
1923 cmdLog.cmdPrm.sCTFR.type = type;
1924 cmdLog.cmdPrm.sCTFR.subaddr = subaddr;
1925 cmdLog.cmdPrm.sCTFR.satype = satype;
1926 #endif /* #if defined SMI OR defined MFW OR defined FF_MMI_RIV */
1927
1928 /*
1929 *-------------------------------------------------------------------
1930 * find the call for which Call Deflection shall be invoked
1931 *-------------------------------------------------------------------
1932 */
1933 dscId = -1;
1934
1935 for (cId = 0; cId < MAX_CALL_NR; cId++)
1936 {
1937 if ((ccShrdPrm.ctb[cId] NEQ NULL) AND
1938 (psaCC_ctb(cId)->calStat EQ CS_ACT_REQ) AND
1939 (psaCC_ctb(cId)->calType EQ CT_MTC))
1940 {
1941 dscId = cId;
1942 break;
1943 }
1944 }
1945
1946 if ((dscId >= 0) AND
1947 (psaCC_ctb(dscId)->curCmd NEQ AT_CMD_NONE))
1948 {
1949 return( AT_BUSY );
1950 }
1951
1952 /*
1953 * There is no check here whether CD is applicable for the specific
1954 * telecommunication service (22.004 Normative Annex A), as CD is
1955 * applicable for all CC telecommunication services.
1956 * GSM 07.07 says CD was only applicable for teleservice 11, but this
1957 * seems to be wrong.
1958 */
1959
1960 /*
1961 *-------------------------------------------------------------------
1962 * Clear the incoming call with facility invoke component for CD
1963 *-------------------------------------------------------------------
1964 */
1965 /*lint -e{661} cId causes out of bounds access, it does not! */
1966 if( dscId >= 0 ) /* Implies cId also >= 0 */
1967 {
1968 cmhCC_flagCall( dscId, &(pCCCmdPrm -> mltyDscFlg));
1969 psaCC_ctb(cId)->nrmCs = MNCC_CAUSE_CALL_CLEAR;
1970 psaCC_ctb(cId)->curCmd = AT_CMD_CTFR;
1971 psaCC_ctb(cId)->curSrc = srcId;
1972
1973 #ifdef FF_ATI
1974 io_setRngInd (IO_RING_OFF, CRING_SERV_TYP_NotPresent, CRING_SERV_TYP_NotPresent ); /* V.24 Ring Indicator Line */
1975 #endif
1976 for (idx = 0; idx < CMD_SRC_MAX; idx++)
1977 {
1978 R_AT (RAT_CRING_OFF, (T_ACI_CMD_SRC)idx)(dscId + 1);
1979 }
1980
1981 CCD_START;
1982 {
1983 psaCC_asmCDReq (number, type, subaddr, satype);
1984
1985 psaCC_asmComponent (dscId);
1986
1987 psaCC_ClearCall (dscId);
1988 }
1989 CCD_END;
1990
1991 psaCC_ctb(cId)->CDStat = CD_Requested;
1992
1993 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
1994 cmdLog.cId = dscId + 1;
1995 rAT_PercentCLOG( &cmdLog );
1996 #endif /* #if defined SMI OR defined MFW OR defined FF_MMI_RIV */
1997
1998 return( AT_EXCT );
1999 }
2000
2001 /*
2002 * No call with matching criteria has been found in the call table.
2003 */
2004 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow );
2005 return AT_FAIL;
2006 }
2007
2008 /*
2009 +--------------------------------------------------------------------+
2010 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
2011 | STATE : code ROUTINE : find_waiting_held_call |
2012 +--------------------------------------------------------------------+
2013
2014 PURPOSE : find waiting held calls
2015
2016 */
2017
2018 LOCAL T_ACI_RETURN find_waiting_held_call(SHORT *cwaId,
2019 SHORT *hldId,
2020 SHORT *rclId)
2021 {
2022 SHORT cId;
2023
2024 /* reinitialize */
2025 *cwaId = -1;
2026 *hldId = -1;
2027 *rclId = -1;
2028
2029 for( cId = 0; cId < MAX_CALL_NR; cId++ )
2030 {
2031 if (ccShrdPrm.ctb[cId] NEQ NULL)
2032 {
2033 if( psaCC_ctb(cId)->calStat EQ CS_ACT_REQ AND
2034 psaCC_ctb(cId)->calOwn EQ ((T_OWN)CMD_SRC_NONE) AND
2035 psaCC_ctb(cId)->calType EQ CT_MTC )
2036 {
2037 *cwaId = cId;
2038 }
2039
2040 if( psaCC_ctb(cId)->calStat EQ CS_HLD )
2041 {
2042 if(*hldId EQ -1)
2043 {
2044 /* take only first found call on hold (ex: in case of multiparty) */
2045 *hldId = cId;
2046 }
2047 }
2048
2049 if( psaCC_ctb(cId)->calStat EQ CS_ACT_REQ AND
2050 psaCC_ctb(cId)->calOwn EQ ((T_OWN)CMD_SRC_NONE) AND
2051 psaCC_ctb(cId)->calType EQ CT_NI_MOC )
2052 {
2053 *rclId = cId;
2054 }
2055 }
2056 }
2057
2058 if((*cwaId >= 0 AND psaCC_ctb(*cwaId)->curCmd NEQ AT_CMD_NONE) OR
2059 (*hldId >= 0 AND psaCC_ctb(*hldId)->curCmd NEQ AT_CMD_NONE) OR
2060 (*rclId >= 0 AND psaCC_ctb(*rclId)->curCmd NEQ AT_CMD_NONE) )
2061 {
2062 return( AT_BUSY );
2063 }
2064 return(AT_CMPL);
2065 }
2066
2067 /* SEND LOG info to MFW */
2068 LOCAL void chld_ratlog( T_ACI_CMD_SRC srcId,
2069 T_ACI_CHLD_MOD mode,
2070 CHAR *call,
2071 T_ACI_CHLD_ACT act,
2072 SHORT cId,
2073 T_ACI_RETURN acireturn )
2074 {
2075 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
2076 T_ACI_CLOG cmdLog; /* holds logging info */
2077
2078 /* prepare log command */
2079 cmdLog.atCmd = AT_CMD_CHLD;
2080 cmdLog.cmdType = CLOG_TYPE_Set;
2081 cmdLog.sId = ACI_NumParmNotPresent;
2082 cmdLog.cmdPrm.sCHLD.srcId = srcId;
2083 cmdLog.cmdPrm.sCHLD.mode = mode;
2084 cmdLog.cmdPrm.sCHLD.call = call;
2085
2086 cmdLog.cmdPrm.sCHLD.act = act;
2087 cmdLog.cId = cId+1;
2088 cmdLog.retCode = acireturn;
2089
2090
2091 rAT_PercentCLOG( &cmdLog );
2092 #endif /* SMI OR defined MFW */
2093 }
2094
2095 /*
2096 +--------------------------------------------------------------------+
2097 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
2098 | STATE : code ROUTINE : chld_RelHldOrUdub |
2099 +--------------------------------------------------------------------+
2100
2101 PURPOSE : ???
2102 */
2103 LOCAL T_ACI_RETURN chld_RelHldOrUdub(T_ACI_CMD_SRC srcId)
2104 {
2105 T_CC_CMD_PRM *pCCCmdPrm; /* points to CC command parameters */
2106 SHORT cId;
2107 UBYTE idx; /* holds index value */
2108 SHORT dscId; /* holds call disconnect id */
2109
2110 TRACE_FUNCTION("chld_RelHldOrUdub");
2111
2112 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm;
2113
2114 /*
2115 *---------------------------------------------------------------
2116 * clear a waiting call
2117 *---------------------------------------------------------------
2118 */
2119 pCCCmdPrm -> mltyCncFlg = 0;
2120 pCCCmdPrm -> mltyDscFlg = 0;
2121
2122 cId = psaCC_ctbFindCall( (T_OWN)CMD_SRC_NONE, CS_ACT_REQ, CT_MTC );
2123
2124 if( cId >= 0 )
2125 {
2126 if( psaCC_ctb(cId)->curCmd NEQ AT_CMD_NONE )
2127 return( AT_BUSY );
2128
2129 pCCCmdPrm -> CHLDmode = CHLD_MOD_RelHldOrUdub;
2130 CHLDaddInfo = NO_CHLD_ADD_INFO;
2131
2132 cmhCC_ClearCall(cId, MNCC_CAUSE_USER_BUSY, srcId, AT_CMD_CHLD, NULL);
2133
2134 /* inform MFW */
2135 chld_ratlog( srcId, pCCCmdPrm -> CHLDmode, NULL, CHLD_ACT_Release, cId, AT_EXCT );
2136
2137 #ifdef FF_ATI
2138 io_setRngInd (IO_RING_OFF, CRING_SERV_TYP_NotPresent, CRING_SERV_TYP_NotPresent ); /* V.24 Ring Indicator Line */
2139 #endif
2140 for( idx = 0; idx < CMD_SRC_MAX; idx++ )
2141 {
2142 R_AT( RAT_CRING_OFF, (T_ACI_CMD_SRC)idx )( cId+1 );
2143 }
2144
2145 return( AT_EXCT );
2146 }
2147
2148 /*
2149 *---------------------------------------------------------------
2150 * clear a CCBS recall
2151 *---------------------------------------------------------------
2152 */
2153 cId = psaCC_ctbFindCall( (T_OWN)CMD_SRC_NONE, CS_ACT_REQ, CT_NI_MOC );
2154
2155 if( cId >= 0 )
2156 {
2157 if( psaCC_ctb(cId)->curCmd NEQ AT_CMD_NONE )
2158
2159 return( AT_BUSY );
2160
2161 psaCC_ctb(cId)->nrmCs = MNCC_CAUSE_USER_BUSY;
2162
2163 psaCC_ClearCall (cId);
2164
2165 /* inform MFW */
2166 chld_ratlog( srcId, pCCCmdPrm -> CHLDmode, NULL, CHLD_ACT_Release, cId, AT_CMPL );
2167
2168 psaCC_FreeCtbNtry (cId);
2169 return( AT_CMPL );
2170 }
2171
2172 /*
2173 *---------------------------------------------------------------
2174 * or clear all held calls
2175 *---------------------------------------------------------------
2176 */
2177 dscId = -1;
2178 for( cId = 0; cId < MAX_CALL_NR; cId++ )
2179 {
2180 if (ccShrdPrm.ctb[cId] NEQ NULL AND
2181 psaCC_ctb(cId)->calStat EQ CS_HLD AND
2182 psaCC_ctb(cId)->curCmd EQ AT_CMD_NONE)
2183 {
2184 cmhCC_ClearCall( cId, MNCC_CAUSE_CALL_CLEAR, srcId, AT_CMD_CHLD, NULL);
2185 dscId = cId;
2186 }
2187 }
2188
2189 if( ! pCCCmdPrm -> mltyDscFlg )
2190 {
2191 return( AT_BUSY );
2192 }
2193 else if (dscId >= 0)
2194 {
2195 pCCCmdPrm -> CHLDmode = CHLD_MOD_RelHldOrUdub;
2196 CHLDaddInfo = NO_CHLD_ADD_INFO;
2197
2198 /* inform MFW */
2199 chld_ratlog( srcId, pCCCmdPrm->CHLDmode, NULL, CHLD_ACT_Release, dscId, AT_EXCT );
2200 return( AT_EXCT );
2201 }
2202 else
2203 {
2204 return( AT_FAIL );
2205 }
2206 }
2207
2208 /*-----------------------------------------------------------------
2209 * release all active calls, and accept held or waiting call
2210 *-----------------------------------------------------------------*/
2211 LOCAL T_ACI_RETURN chld_RelActAndAcpt(T_ACI_CMD_SRC srcId)
2212 {
2213 SHORT cwaId; /* holds call waiting id */
2214 SHORT hldId; /* holds call hold id */
2215 SHORT rclId; /* holds recall id */
2216 SHORT dscId = -1; /* will be set if a call is disconnected (with its cId) */
2217 SHORT cId;
2218 T_ACI_RETURN ret;
2219 T_CC_CMD_PRM *pCCCmdPrm; /* points to CC command parameters */
2220
2221 TRACE_FUNCTION("chld_RelActAndAcpt");
2222
2223 /* find the waiting or held call */
2224 ret = find_waiting_held_call(&cwaId, &hldId, &rclId);
2225
2226 TRACE_EVENT_P1("cwaId = %d", cwaId);
2227 if(ret EQ AT_BUSY)
2228 return(AT_BUSY);
2229
2230 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm;
2231
2232 /*
2233 *---------------------------------------------------------------
2234 * clear all active calls
2235 *---------------------------------------------------------------
2236 */
2237 pCCCmdPrm -> mltyCncFlg = 0;
2238 pCCCmdPrm -> mltyDscFlg = 0;
2239
2240 for( cId = 0; cId < MAX_CALL_NR; cId++ )
2241 {
2242 if (ccShrdPrm.ctb[cId] NEQ NULL AND
2243 psaCC_ctb(cId)->calStat EQ CS_ACT AND
2244 psaCC_ctb(cId)->curCmd EQ AT_CMD_NONE)
2245 {
2246 psaCC_StopDTMF (cId); /* HM 27.07.00 */
2247 dscId = cId;
2248
2249 cmhCC_ClearCall( cId, MNCC_CAUSE_CALL_CLEAR, srcId, AT_CMD_CHLD, NULL );
2250 }
2251 }
2252
2253 /*
2254 *---------------------------------------------------------------
2255 * accept the waiting call
2256 *---------------------------------------------------------------
2257 */
2258 if( cwaId >= 0 )
2259 {
2260 cmhCC_flagCall( cwaId, &(pCCCmdPrm -> mltyCncFlg));
2261 pCCCmdPrm -> CHLDmode = CHLD_MOD_RelActAndAcpt;
2262
2263 if( dscId NEQ -1 )
2264 {
2265 CHLDaddInfo = CHLD_ADD_INFO_ACC_CAL;
2266 }
2267 else
2268 {
2269 cmhCC_AcceptCall(cwaId, srcId, AT_CMD_CHLD);
2270 }
2271
2272 /* inform MFW */
2273 chld_ratlog( srcId, pCCCmdPrm->CHLDmode, NULL, CHLD_ACT_Accept, cwaId, AT_EXCT );
2274 return( AT_EXCT );
2275 }
2276
2277 /*
2278 *---------------------------------------------------------------
2279 * accept the CCBS recall
2280 *---------------------------------------------------------------
2281 */
2282 if( rclId >= 0 )
2283 {
2284 cmhCC_flagCall( rclId, &(pCCCmdPrm -> mltyCncFlg));
2285 pCCCmdPrm -> CHLDmode = CHLD_MOD_RelActAndAcpt;
2286
2287 /*
2288 * The MSC in GSM 04.93, figure 4.3.2 says the SETUP for the CCBS
2289 * call is sent immediately after the DISCONNECT for the existing
2290 * call was sent into the network, they do not wait for a RELEASE
2291 * from the network. This seems to be different for the call waiting
2292 * case, compare this with the MSC in GSM 11.10 clause 31.3.1.2.
2293 */
2294 cmhCC_NewCall(rclId, srcId, AT_CMD_D);
2295
2296 /* inform MFW */
2297 chld_ratlog( srcId, pCCCmdPrm->CHLDmode, NULL, CHLD_ACT_Accept, rclId, AT_EXCT );
2298 return( AT_EXCT );
2299 }
2300
2301 /*
2302 *---------------------------------------------------------------
2303 * retrieve the held call
2304 *---------------------------------------------------------------
2305 */
2306 if( hldId >= 0 )
2307 {
2308 cmhCC_flagCall( hldId, &(pCCCmdPrm -> mltyCncFlg));
2309 pCCCmdPrm -> CHLDmode = CHLD_MOD_RelActAndAcpt;
2310
2311 if( dscId NEQ -1 )
2312 {
2313 CHLDaddInfo = CHLD_ADD_INFO_RTV_CAL;
2314 }
2315 else
2316 {
2317 cmhCC_RetrieveCall(hldId, srcId);
2318 }
2319
2320 /* inform MFW */
2321 chld_ratlog( srcId,
2322 pCCCmdPrm->CHLDmode,
2323 NULL,
2324 (psaCC_ctb(hldId)->mptyStat EQ CS_ACT)? CHLD_ACT_RetrieveMpty:CHLD_ACT_Retrieve,
2325 hldId,
2326 AT_EXCT );
2327
2328 return( AT_EXCT );
2329 }
2330
2331 /*
2332 *---------------------------------------------------------------
2333 * at least one call was disconnected
2334 *---------------------------------------------------------------
2335 */
2336 if( dscId NEQ -1 )
2337 {
2338 pCCCmdPrm -> CHLDmode = CHLD_MOD_RelActAndAcpt;
2339 CHLDaddInfo = NO_CHLD_ADD_INFO;
2340
2341 /* inform MFW */
2342 chld_ratlog( srcId, pCCCmdPrm->CHLDmode, NULL, CHLD_ACT_Release, dscId, AT_EXCT );
2343 return( AT_EXCT );
2344 }
2345 return (AT_FAIL);
2346 }
2347
2348
2349 /*
2350 +--------------------------------------------------------------------+
2351 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
2352 | STATE : code ROUTINE : chld_RelActSpec |
2353 +--------------------------------------------------------------------+
2354
2355 PURPOSE : release a specific active call
2356 */
2357 LOCAL T_ACI_RETURN chld_RelActSpec(T_ACI_CMD_SRC srcId, CHAR *call)
2358 {
2359 T_CC_CMD_PRM *pCCCmdPrm; /* points to CC command parameters */
2360 SHORT spcId; /* holds specified call id */
2361
2362 T_ACI_RETURN retCode;
2363
2364 TRACE_FUNCTION("chld_RelActSpec");
2365
2366 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm;
2367 /* Implements Measure 117 */
2368 retCode = chld_Rel_MultipartySpec( srcId, &spcId,
2369 CHLD_MOD_RelActSpec, call );
2370 if ( retCode NEQ AT_CMPL )
2371 {
2372 return retCode;
2373 }
2374 /*
2375 *---------------------------------------------------------------
2376 * clear the specific active call if possible
2377 *---------------------------------------------------------------
2378 */
2379 if (ccShrdPrm.ctb[spcId] EQ NULL OR psaCC_ctb(spcId)->calStat NEQ CS_ACT)
2380 {
2381 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow );
2382 return( AT_FAIL ); /* specific call does not match condition */
2383 }
2384
2385 cmhCC_ClearCall ( spcId, MNCC_CAUSE_CALL_CLEAR, srcId, AT_CMD_CHLD, NULL );
2386
2387 pCCCmdPrm -> CHLDmode = CHLD_MOD_RelActSpec;
2388 CHLDaddInfo = NO_CHLD_ADD_INFO;
2389
2390 /* inform MFW */
2391 chld_ratlog( srcId, pCCCmdPrm->CHLDmode, call, CHLD_ACT_Release, spcId, AT_EXCT );
2392 return( AT_EXCT );
2393 }
2394
2395 /*
2396 +--------------------------------------------------------------------+
2397 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
2398 | STATE : code ROUTINE : chld_RelAnySpec |
2399 +--------------------------------------------------------------------+
2400
2401 PURPOSE : release a specific call
2402 */
2403 LOCAL T_ACI_RETURN chld_RelAnySpec(T_ACI_CMD_SRC srcId, CHAR *call)
2404 {
2405 T_CC_CMD_PRM *pCCCmdPrm; /* points to CC command parameters */
2406 SHORT spcId; /* holds specified call id */
2407 SHORT waitId = NO_ENTRY; /* holds call waiting id */
2408 UBYTE idx = 0; /* temporary counter */
2409
2410 T_ACI_RETURN retCode;
2411
2412 TRACE_FUNCTION("chld_RelAnySpec");
2413
2414 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm;
2415 /* Implements Measure 117 */
2416 retCode = chld_Rel_MultipartySpec( srcId, &spcId,
2417 CHLD_MOD_RelAnySpec, call );
2418 if ( retCode NEQ AT_CMPL )
2419 {
2420 return retCode;
2421 }
2422 /*
2423 *---------------------------------------------------------------
2424 * clear the specific call if possible
2425 *---------------------------------------------------------------
2426 */
2427 if (ccShrdPrm.ctb[spcId] EQ NULL)
2428 {
2429 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow );
2430 return( AT_FAIL ); /* specific call does not match condition */
2431 }
2432
2433 cmhCC_ClearCall ( spcId, MNCC_CAUSE_CALL_CLEAR, srcId, AT_CMD_CHLD, &waitId );
2434
2435 /* The call that shall be released is a waiting call (stop ringing) */
2436 if( waitId NEQ NO_ENTRY )
2437 {
2438 cmhCC_flagCall( waitId, &(pCCCmdPrm -> mltyDscFlg));
2439 psaCC_ctb(waitId)->nrmCs = MNCC_CAUSE_USER_BUSY;
2440 psaCC_ctb(waitId)->curCmd = AT_CMD_CHLD;
2441 psaCC_ctb(waitId)->curSrc = srcId;
2442 psaCC_ClearCall (waitId);
2443
2444 #ifdef AT_INTERPRETER
2445 io_setRngInd (IO_RING_OFF, CRING_SERV_TYP_NotPresent, CRING_SERV_TYP_NotPresent ); /* V.24 Ring Indicator Line */
2446 #endif
2447 for( idx = 0; idx < CMD_SRC_MAX; idx++ )
2448 {
2449 R_AT( RAT_CRING_OFF, (T_ACI_CMD_SRC)idx )( waitId+1 );
2450 }
2451 }
2452
2453 pCCCmdPrm->CHLDmode = CHLD_MOD_RelAnySpec;
2454 CHLDaddInfo = NO_CHLD_ADD_INFO;
2455
2456 /* inform MFW */
2457 chld_ratlog( srcId, pCCCmdPrm->CHLDmode, call, CHLD_ACT_Release, spcId, AT_EXCT );
2458 return( AT_EXCT );
2459 }
2460
2461
2462 /*
2463 +--------------------------------------------------------------------+
2464 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
2465 | STATE : code ROUTINE : chld_HldActAndAcpt |
2466 +--------------------------------------------------------------------+
2467
2468 PURPOSE : place all active calls on hold, and accept held or waiting
2469 call
2470 */
2471 LOCAL T_ACI_RETURN chld_HldActAndAcpt(T_ACI_CMD_SRC srcId)
2472 {
2473 T_CC_CMD_PRM *pCCCmdPrm; /* points to CC command parameters */
2474 SHORT cId; /* holds call id */
2475 T_ACI_RETURN ret;
2476 SHORT cwaId; /* holds call waiting id */
2477 SHORT hldId; /* holds call hold id */
2478 SHORT rclId; /* holds recall id */
2479 BOOL hldCalFlg = FALSE; /* flags a held call */
2480 BOOL mptyHldFlg = FALSE; /* flags a multiparty held call */
2481 T_ACI_CHLD_ACT chldact; /* contains the type of CHLD activity when informing MFW */
2482 TRACE_FUNCTION("chld_HldActAndAcpt");
2483
2484 /* find the waiting or held call */
2485 ret = find_waiting_held_call(&cwaId, &hldId, &rclId);
2486
2487 if(ret EQ AT_BUSY)
2488 return(AT_BUSY);
2489
2490 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm;
2491
2492 //Spec 3GPP TS 22.083 Sec 1.6.83.2 which says - Although the call is offered to the subscriber, she cannot accept the call as long as she has one active call and one call on hold.
2493 #if 0
2494 if( cwaId >=0 AND hldId >=0 )
2495 {
2496 /* check for Active Call if already Held Call and Waiting Call */
2497 for( cId = 0; cId < MAX_CALL_NR; cId++ )
2498 {
2499 if (ccShrdPrm.ctb[cId] NEQ NULL AND
2500 psaCC_ctb(cId)->calStat EQ CS_ACT AND
2501 psaCC_ctb(cId)->curCmd EQ AT_CMD_NONE )
2502 {
2503 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_OneCallOnHold );
2504 return( AT_FAIL ); /* only one call could be on hold,
2505 no chance for the waiting call */
2506 }
2507 }
2508 }
2509 #endif
2510 /*
2511 *---------------------------------------------------------------
2512 * put all active calls on hold
2513 *---------------------------------------------------------------
2514 */
2515 /* Implements Measure 181 and 182 */
2516 if ( chld_HoldActiveCalls( srcId, &mptyHldFlg, &hldCalFlg, &cId ) EQ FALSE )
2517 {
2518 return( AT_FAIL ); /* no data calls supported */
2519 }
2520
2521 /*
2522 *-------------------------------------------------------------------------
2523 * retrieve the held call first, if there is a active call and a hold call
2524 *-------------------------------------------------------------------------
2525 */
2526 if( hldCalFlg AND hldId >= 0 )
2527 {
2528 cmhCC_flagCall( hldId, &(pCCCmdPrm -> mltyCncFlg));
2529 pCCCmdPrm -> CHLDmode = CHLD_MOD_HldActAndAcpt;
2530
2531 cmhCC_RetrieveCall(hldId, srcId);
2532
2533 /* inform MFW */
2534 if( hldCalFlg )
2535 {
2536 chldact = (mptyHldFlg)? CHLD_ACT_SwapMpty:CHLD_ACT_Swap;
2537 }
2538 else
2539 {
2540 chldact = (psaCC_ctb(hldId)->mptyStat EQ CS_ACT)? CHLD_ACT_RetrieveMpty :CHLD_ACT_Retrieve;
2541 }
2542 chld_ratlog( srcId, pCCCmdPrm->CHLDmode, NULL, chldact, hldId, AT_EXCT );
2543 return( AT_EXCT );
2544 }
2545
2546 /*
2547 *---------------------------------------------------------------
2548 * accept the waiting call
2549 *---------------------------------------------------------------
2550 */
2551 if( cwaId >= 0 )
2552 {
2553 cmhCC_flagCall( cwaId, &(pCCCmdPrm -> mltyCncFlg));
2554 pCCCmdPrm -> CHLDmode = CHLD_MOD_HldActAndAcpt;
2555
2556 if( hldCalFlg )
2557 {
2558 CHLDaddInfo = CHLD_ADD_INFO_ACC_CAL;
2559 }
2560 else
2561 {
2562 cmhCC_AcceptCall(cwaId, srcId, AT_CMD_CHLD);
2563 }
2564
2565 /* inform MFW */
2566 chld_ratlog( srcId, pCCCmdPrm->CHLDmode, NULL, CHLD_ACT_Accept, cwaId, AT_EXCT );
2567 return( AT_EXCT );
2568 }
2569
2570 /*
2571 *---------------------------------------------------------------
2572 * accept the CCBS recall
2573 *---------------------------------------------------------------
2574 */
2575 if( rclId >= 0 )
2576 {
2577 cmhCC_flagCall( rclId, &(pCCCmdPrm -> mltyCncFlg));
2578 pCCCmdPrm -> CHLDmode = CHLD_MOD_HldActAndAcpt;
2579
2580 if( hldCalFlg )
2581 {
2582 CHLDaddInfo = CHLD_ADD_INFO_DIAL_CAL;
2583 }
2584 else
2585 {
2586 cmhCC_NewCall(rclId, srcId, AT_CMD_CHLD);
2587 }
2588 /* inform MFW */
2589 chld_ratlog( srcId, pCCCmdPrm->CHLDmode, NULL, CHLD_ACT_Accept, rclId, AT_EXCT );
2590 return( AT_EXCT );
2591 }
2592
2593 /*
2594 *---------------------------------------------------------------
2595 * retrieve the held call
2596 *---------------------------------------------------------------
2597 */
2598 if( hldId >= 0 )
2599 {
2600 cmhCC_flagCall( hldId, &(pCCCmdPrm -> mltyCncFlg));
2601 pCCCmdPrm -> CHLDmode = CHLD_MOD_HldActAndAcpt;
2602
2603 cmhCC_RetrieveCall(hldId, srcId);
2604
2605 /* inform MFW */
2606 if( hldCalFlg )
2607 {
2608 chldact = (mptyHldFlg)? CHLD_ACT_SwapMpty:CHLD_ACT_Swap;
2609 }
2610 else
2611 {
2612 chldact = (psaCC_ctb(hldId)->mptyStat EQ CS_ACT)? CHLD_ACT_RetrieveMpty :CHLD_ACT_Retrieve;
2613 }
2614 chld_ratlog( srcId, pCCCmdPrm->CHLDmode, NULL, chldact, hldId, AT_EXCT );
2615 return( AT_EXCT );
2616 }
2617
2618 /*
2619 *---------------------------------------------------------------
2620 * at least one call was put on hold
2621 *---------------------------------------------------------------
2622 */
2623 if( hldCalFlg )
2624 {
2625 pCCCmdPrm -> CHLDmode = CHLD_MOD_HldActAndAcpt;
2626 CHLDaddInfo = NO_CHLD_ADD_INFO;
2627
2628 /* inform MFW */
2629 chld_ratlog( srcId, pCCCmdPrm->CHLDmode,
2630 NULL,
2631 (mptyHldFlg)? CHLD_ACT_HoldMpty:CHLD_ACT_Hold,
2632 cId, AT_EXCT );
2633 return( AT_EXCT );
2634 }
2635 return( AT_FAIL );
2636 }
2637
2638 /*
2639 +--------------------------------------------------------------------+
2640 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
2641 | STATE : code ROUTINE : chld_HldActExc |
2642 +--------------------------------------------------------------------+
2643
2644 PURPOSE : put all active calls on hold except the specified call
2645 */
2646 LOCAL T_ACI_RETURN chld_HldActExc(T_ACI_CMD_SRC srcId, CHAR *call)
2647 {
2648 T_CC_CMD_PRM *pCCCmdPrm; /* points to CC command parameters */
2649 SHORT spcId; /* holds specified call id */
2650 SHORT cId; /* holds call id */
2651 BOOL hldCalFlg = FALSE; /* flags a held call */
2652 BOOL mptyHldFlg = FALSE; /* flags a multiparty held call */
2653 T_ACI_CHLD_ACT chld_act;
2654
2655 TRACE_FUNCTION("chld_HldActExc");
2656
2657 if( call EQ NULL )
2658 {
2659 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
2660 return( AT_FAIL ); /* no call specified */
2661 }
2662
2663 spcId = atoi( call );
2664
2665 if( spcId EQ 0 OR spcId > MAX_CALL_NR )
2666 {
2667 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
2668 return( AT_FAIL );
2669 }
2670
2671 spcId--; /* adapt to call table index */
2672
2673 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm;
2674
2675 pCCCmdPrm -> mltyCncFlg = 0;
2676 pCCCmdPrm -> mltyDscFlg = 0;
2677
2678 /*
2679 *-------------------------------------------------------------
2680 * if specified call is active and no multiparty
2681 *-------------------------------------------------------------
2682 */
2683 /* no action needed */
2684
2685 /*
2686 *-------------------------------------------------------------
2687 * if specified call is active and member of multiparty
2688 *-------------------------------------------------------------
2689 */
2690 if (ccShrdPrm.ctb[spcId] NEQ NULL AND
2691 psaCC_ctb(spcId)->calStat EQ CS_ACT AND
2692 psaCC_ctb(spcId)->mptyStat EQ CS_ACT AND
2693 psaCC_ctb(spcId)->curCmd EQ AT_CMD_NONE)
2694 {
2695 /* If this is a multiparty with only one call left then we must not split! */
2696 if (psaCC_CountMPTY() > 1)
2697 {
2698 cmhCC_flagCall( spcId, &(pCCCmdPrm -> mltyCncFlg));
2699
2700 psaCC_ctb(spcId)->curCmd = AT_CMD_CHLD;
2701 psaCC_ctb(spcId)->curSrc = srcId;
2702
2703 psaCC_SplitMPTY(spcId);
2704
2705 chld_act = CHLD_ACT_SplitMpty;
2706 }
2707 else
2708 {
2709 /* call is already active, so command has no effect */
2710 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Unknown );
2711 return( AT_FAIL );
2712 }
2713 }
2714
2715 /*
2716 *-------------------------------------------------------------
2717 * if specified call is on hold and no multiparty
2718 *-------------------------------------------------------------
2719 */
2720 else if (ccShrdPrm.ctb[spcId] NEQ NULL AND
2721 psaCC_ctb(spcId)->calStat EQ CS_HLD AND
2722 psaCC_ctb(spcId)->mptyStat EQ CS_IDL AND
2723 psaCC_ctb(spcId)->curCmd EQ AT_CMD_NONE)
2724 {
2725 for( cId = 0; cId < MAX_CALL_NR; cId++ )
2726 {
2727 if (ccShrdPrm.ctb[cId] NEQ NULL AND
2728 psaCC_ctb(cId)->calStat EQ CS_ACT AND
2729 psaCC_ctb(cId)->curCmd EQ AT_CMD_NONE)
2730 {
2731 if( cmhCC_getcalltype(cId) NEQ VOICE_CALL )
2732 {
2733 pCCCmdPrm -> mltyCncFlg = 0;
2734 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_CallTypeNoHold );
2735 return( AT_FAIL ); /* no data calls supported */
2736 }
2737
2738 hldCalFlg = TRUE;
2739 if( psaCC_ctb(cId)->mptyStat EQ CS_ACT )
2740 {
2741 mptyHldFlg = TRUE;
2742 }
2743 cmhCC_HoldCall(cId, srcId, AT_CMD_CHLD);
2744 }
2745 }
2746
2747 cmhCC_flagCall( spcId, &(pCCCmdPrm -> mltyCncFlg));
2748 pCCCmdPrm -> CHLDmode = CHLD_MOD_HldActExc;
2749
2750 cmhCC_RetrieveCall(spcId, srcId);
2751
2752 if( hldCalFlg )
2753 {
2754 chld_act = (mptyHldFlg)?
2755 CHLD_ACT_SwapMpty:CHLD_ACT_Swap;
2756 }
2757 else
2758 chld_act = (mptyHldFlg)?
2759 CHLD_ACT_RetrieveMpty:CHLD_ACT_Retrieve;
2760 }
2761
2762 /*
2763 *-------------------------------------------------------------
2764 * if specified call is on hold and member of multiparty
2765 *-------------------------------------------------------------
2766 */
2767 else if (ccShrdPrm.ctb[spcId] NEQ NULL AND
2768 psaCC_ctb(spcId)->calStat EQ CS_HLD AND
2769 psaCC_ctb(spcId)->mptyStat EQ CS_ACT AND
2770 psaCC_ctb(spcId)->curCmd EQ AT_CMD_NONE)
2771 {
2772 for( cId = 0; cId < MAX_CALL_NR; cId++ )
2773 {
2774 if (ccShrdPrm.ctb[cId] NEQ NULL AND
2775 psaCC_ctb(cId)->calStat EQ CS_ACT AND
2776 psaCC_ctb(cId)->curCmd EQ AT_CMD_NONE)
2777 {
2778 if( cmhCC_getcalltype(cId) NEQ VOICE_CALL )
2779 {
2780 pCCCmdPrm -> mltyCncFlg = 0;
2781 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_CallTypeNoHold );
2782 return( AT_FAIL ); /* no data calls supported */
2783 }
2784
2785 hldCalFlg = TRUE;
2786
2787 cmhCC_HoldCall(cId, srcId, AT_CMD_CHLD);
2788 }
2789 }
2790
2791 cmhCC_flagCall( spcId, &(pCCCmdPrm -> mltyCncFlg));
2792 pCCCmdPrm -> CHLDmode = CHLD_MOD_HldActExc;
2793
2794 CHLDaddInfo = NO_CHLD_ADD_INFO;
2795
2796 psaCC_ctb(spcId)->curCmd = AT_CMD_CHLD;
2797 psaCC_ctb(spcId)->curSrc = srcId;
2798
2799 /* If this is a multiparty with only one call left then we must not split! */
2800 if (psaCC_CountMPTY() > 1)
2801 {
2802 psaCC_SplitMPTY(spcId);
2803 chld_act = CHLD_ACT_SplitMpty;
2804 }
2805 else
2806 {
2807 cmhCC_RetrieveCall(spcId, srcId);
2808 chld_act = CHLD_ACT_Retrieve;
2809 }
2810 }
2811
2812 /*
2813 *-------------------------------------------------------------
2814 * if other command is running on specified call
2815 *-------------------------------------------------------------
2816 */
2817 else if (ccShrdPrm.ctb[spcId] NEQ NULL AND
2818 psaCC_ctb(spcId)->curCmd NEQ AT_CMD_NONE)
2819 {
2820 return( AT_BUSY );
2821 }
2822
2823 /*
2824 *-------------------------------------------------------------
2825 * unknown condition
2826 *-------------------------------------------------------------
2827 */
2828 else
2829 {
2830 TRACE_ERROR ("Unknown condition");
2831 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Unknown );
2832 return( AT_FAIL );
2833 }
2834
2835
2836 /*
2837 *-------------------------------------------------------------
2838 * send return code
2839 *-------------------------------------------------------------
2840 */
2841 if( pCCCmdPrm -> mltyCncFlg NEQ 0 )
2842 {
2843 pCCCmdPrm -> CHLDmode = CHLD_MOD_HldActExc;
2844
2845 /* inform MFW */
2846 chld_ratlog( srcId, pCCCmdPrm->CHLDmode, call, chld_act, spcId, AT_EXCT );
2847 return( AT_EXCT );
2848 }
2849 else
2850 {
2851 return( AT_CMPL );
2852 }
2853 }
2854
2855 /*-----------------------------------------------------------------
2856 * add a held call to the conversation
2857 *-----------------------------------------------------------------*/
2858 LOCAL T_ACI_RETURN chld_AddHld(T_ACI_CMD_SRC srcId)
2859 {
2860 SHORT actId; /* holds call active id */
2861 T_CC_CMD_PRM *pCCCmdPrm; /* points to CC command parameters */
2862
2863 TRACE_FUNCTION("chld_AddHld( )");
2864
2865 /* search a held call */
2866 if( psaCC_ctbFindCall( OWN_SRC_INV, CS_HLD, NO_VLD_CT ) EQ NO_ENTRY )
2867 {
2868 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow );
2869 return( AT_FAIL );
2870 }
2871
2872 actId = psaCC_ctbFindCall( OWN_SRC_INV, CS_ACT, NO_VLD_CT );
2873
2874 if( actId EQ NO_ENTRY )
2875 {
2876 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow );
2877 return( AT_FAIL );
2878 }
2879
2880 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm;
2881
2882 cmhCC_flagCall( actId, &(pCCCmdPrm -> mltyCncFlg));
2883
2884 psaCC_ctb(actId)->curCmd = AT_CMD_CHLD;
2885 psaCC_ctb(actId)->curSrc = srcId;
2886
2887 psaCC_BuildMPTY(actId);
2888
2889 pCCCmdPrm -> CHLDmode = CHLD_MOD_AddHld;
2890
2891 /* inform MFW */
2892 chld_ratlog( srcId, pCCCmdPrm->CHLDmode, NULL, CHLD_ACT_BuildMpty, actId, AT_EXCT );
2893 return( AT_EXCT );
2894 }
2895
2896 /*-----------------------------------------------------------------
2897 * explicit call transfer
2898 *-----------------------------------------------------------------*/
2899 LOCAL T_ACI_RETURN chld_Ect(T_ACI_CMD_SRC srcId)
2900 {
2901 SHORT cId; /* holds call id */
2902 SHORT actId; /* holds call active id */
2903 SHORT hldId; /* holds call hold id */
2904 T_CC_CMD_PRM * pCCCmdPrm; /* points to CC command parameters */
2905
2906 TRACE_FUNCTION("chld_Ect");
2907 /*
2908 *---------------------------------------------------------------
2909 * find the active(req) or held call
2910 *---------------------------------------------------------------
2911 */
2912 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm;
2913
2914 actId = hldId = -1;
2915
2916 for( cId = 0; cId < MAX_CALL_NR; cId++ )
2917 {
2918 if (ccShrdPrm.ctb[cId] NEQ NULL)
2919 {
2920 if( cmhCC_getcalltype(cId) NEQ VOICE_CALL )
2921 {
2922 /* not a valid id for ECT */
2923 }
2924 else if (psaCC_ctb(cId)->calStat EQ CS_ACT OR
2925 (psaCC_ctb(cId)->calStat EQ CS_ACT_REQ AND
2926 psaCC_ctb(cId)->calType EQ CT_MOC))
2927 {
2928 if( actId EQ -1 ) actId = cId;
2929 }
2930 else if( psaCC_ctb(cId)->calStat EQ CS_HLD )
2931 {
2932 if( hldId EQ -1 ) hldId = cId;
2933 }
2934 }
2935 }
2936
2937 /* curCmd of actId will be updated only if hldId is valid. */
2938 if( hldId >= 0 AND
2939 psaCC_ctb(hldId)->curCmd NEQ AT_CMD_NONE )
2940 {
2941 TRACE_EVENT_P1("CHLD ECT: hldId busy with %d", psaCC_ctb(hldId)->curCmd);
2942 return( AT_BUSY );
2943 }
2944 /*
2945 * if command state is not idle and update the curCmd only if it is NONE
2946 */
2947 if(actId >= 0 AND hldId >= 0)
2948 {
2949 switch(psaCC_ctb(actId)->curCmd)
2950 {
2951 case(AT_CMD_NONE):
2952 psaCC_ctb(actId)->curCmd = AT_CMD_CHLD;
2953 psaCC_ctb(actId)->curSrc = srcId;
2954 break;
2955 case(AT_CMD_D):
2956 /* command state where actId might find itself */
2957 break;
2958 default:
2959 TRACE_EVENT_P1("CHLD ECT: actId busy with %d", psaCC_ctb(actId)->curCmd);
2960 return( AT_BUSY );
2961 }
2962 }
2963
2964 if( actId >= 0 AND hldId >= 0 )
2965 {
2966 if( psaCC_ECT(hldId) NEQ 0 )
2967 {
2968 return(AT_FAIL);
2969 }
2970 /* Update params only if the facility message is successfully
2971 sent to the network */
2972 cmhCC_flagCall( actId, &(pCCCmdPrm -> mltyDscFlg));
2973 cmhCC_flagCall( hldId, &(pCCCmdPrm -> mltyDscFlg));
2974 psaCC_ctb(hldId)->curCmd = AT_CMD_CHLD;
2975 psaCC_ctb(hldId)->curSrc = srcId;
2976 ccShrdPrm.cIdMPTY = actId;
2977
2978 pCCCmdPrm -> CHLDmode = CHLD_MOD_Ect;
2979
2980 /* inform MFW */
2981 chld_ratlog( srcId, pCCCmdPrm->CHLDmode, NULL, CHLD_ACT_ECT, actId, AT_EXCT );
2982 return( AT_EXCT );
2983 }
2984
2985 TRACE_EVENT("CHLD: ECT: could not find interesting call ids");
2986 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow );
2987 return( AT_FAIL );
2988 }
2989
2990 /*-----------------------------------------------------------------
2991 * activate call completion to busy subscriber
2992 *-----------------------------------------------------------------*/
2993 LOCAL T_ACI_RETURN chld_Ccbs(T_ACI_CMD_SRC srcId)
2994 {
2995 T_CC_CMD_PRM *pCCCmdPrm; /* points to CC command parameters */
2996 SHORT dscId = -1; /* will be set if a call is disconnected (with its cId) */
2997 SHORT cId; /* holds call id */
2998
2999 TRACE_FUNCTION("chld_Ccbs");
3000
3001 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm;
3002
3003 /*
3004 *---------------------------------------------------------------
3005 * find the call with CCBS possible
3006 *---------------------------------------------------------------
3007 */
3008 for( cId = 0; cId < MAX_CALL_NR; cId++ )
3009 {
3010 if (ccShrdPrm.ctb[cId] NEQ NULL AND
3011 psaCC_ctb(cId)->calStat EQ CS_DSC_REQ AND
3012 psaCC_ctb(cId)->calType EQ CT_MOC AND
3013 psaCC_ctb(cId)->CCBSstat EQ CCBSS_PSSBL)
3014 {
3015 dscId = cId;
3016 break;
3017 }
3018 }
3019
3020 if( dscId >= 0 AND
3021 psaCC_ctb(dscId)->curCmd NEQ AT_CMD_NONE )
3022
3023 return( AT_BUSY );
3024
3025 /*
3026 *---------------------------------------------------------------
3027 * clear a call with CCBS possible
3028 *---------------------------------------------------------------
3029 */
3030 /*lint -e{661} cId causes out of bounds access, it does not! */
3031 if( dscId >= 0 )
3032 {
3033 pCCCmdPrm -> CHLDmode = CHLD_MOD_Ccbs;
3034 CHLDaddInfo = NO_CHLD_ADD_INFO;
3035 psaCC_ctb(cId)->CCBSstat = CCBSS_REQ;
3036
3037 cmhCC_ClearCall ( dscId, MNCC_CAUSE_CALL_CLEAR, srcId, AT_CMD_CHLD, NULL );
3038
3039 /* inform MFW */
3040 chld_ratlog( srcId, pCCCmdPrm->CHLDmode, NULL, CHLD_ACT_CCBS, dscId, AT_EXCT );
3041 return( AT_EXCT );
3042 }
3043
3044 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow );
3045 return( AT_FAIL );
3046 }
3047
3048
3049 /*
3050 +--------------------------------------------------------------------+
3051 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
3052 | STATE : code ROUTINE : chld_OnlyHold |
3053 +--------------------------------------------------------------------+
3054
3055 PURPOSE : Put a call on hold (and nothing else ==> do not accept
3056 any other call)
3057 */
3058 LOCAL T_ACI_RETURN chld_OnlyHold(T_ACI_CMD_SRC srcId)
3059 {
3060 SHORT hldId; /* holds call hold id */
3061 SHORT cId; /* holds call id */
3062 T_CC_CMD_PRM *pCCCmdPrm; /* points to CC command parameters */
3063 BOOL hldCalFlg = FALSE; /* flags a held call */
3064 BOOL mptyHldFlg = FALSE; /* flags a multiparty held call */
3065
3066 TRACE_FUNCTION("chld_OnlyHold");
3067
3068 /* find held call */
3069 hldId = -1;
3070
3071 for( cId = 0; cId < MAX_CALL_NR; cId++ )
3072 {
3073 if (ccShrdPrm.ctb[cId] NEQ NULL)
3074 {
3075 if( psaCC_ctb(cId)->calStat EQ CS_HLD )
3076 {
3077 if( hldId EQ -1 ) hldId = cId;
3078 }
3079 }
3080 }
3081
3082 if( hldId >=0 )
3083 {
3084 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_OneCallOnHold );
3085 return( AT_FAIL ); /* only one call could be on hold */
3086 }
3087
3088 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm;
3089
3090 /* put all active calls on hold */
3091 /* Implements Measure 181 and 182 */
3092 if ( chld_HoldActiveCalls( srcId, &mptyHldFlg, &hldCalFlg, &cId ) EQ FALSE )
3093 {
3094 return( AT_FAIL ); /* no data calls supported */
3095 }
3096
3097 /* at least one call was put on hold */
3098 if( hldCalFlg )
3099 {
3100 pCCCmdPrm -> CHLDmode = CHLD_MOD_OnlyHold;
3101 CHLDaddInfo = NO_CHLD_ADD_INFO;
3102
3103 /* inform MFW */
3104 chld_ratlog( srcId, pCCCmdPrm->CHLDmode,
3105 NULL,
3106 (mptyHldFlg)? CHLD_ACT_HoldMpty:CHLD_ACT_Hold,
3107 cId, AT_EXCT );
3108 return( AT_EXCT );
3109 }
3110 return( AT_FAIL );
3111 }
3112
3113 /*
3114 +--------------------------------------------------------------------+
3115 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
3116 | STATE : code ROUTINE : chld_RelDialCall |
3117 +--------------------------------------------------------------------+
3118
3119 PURPOSE : release diealling call (special function for FAE's
3120 */
3121 LOCAL T_ACI_RETURN chld_RelDialCall(T_ACI_CMD_SRC srcId)
3122 {
3123 T_CC_CMD_PRM *pCCCmdPrm; /* points to CC command parameters */
3124 SHORT cId;
3125
3126 TRACE_FUNCTION("chld_RelDialCall");
3127
3128 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm;
3129
3130 /*
3131 *---------------------------------------------------------------
3132 * clear the dialling call
3133 *---------------------------------------------------------------
3134 */
3135 pCCCmdPrm -> mltyCncFlg = 0;
3136 pCCCmdPrm -> mltyDscFlg = 0;
3137
3138 cId = psaCC_ctbFindCall( (T_OWN)srcId, CS_ACT_REQ, CT_MOC );
3139
3140 TRACE_EVENT_P1("Call Id of dialling call = %d",cId);
3141
3142 if( cId >= 0 )
3143 {
3144 pCCCmdPrm -> CHLDmode = CHLD_MOD_RelDialCall;
3145 CHLDaddInfo = NO_CHLD_ADD_INFO;
3146
3147 cmhCC_ClearCall(cId, MNCC_CAUSE_CALL_CLEAR, srcId, AT_CMD_CHLD, NULL);
3148
3149 /* inform MFW */
3150 chld_ratlog( srcId, pCCCmdPrm -> CHLDmode, NULL, CHLD_ACT_Release, cId, AT_EXCT );
3151
3152 return( AT_EXCT );
3153 }
3154
3155 /* Unable to find call */
3156 return( AT_FAIL);
3157 }
3158
3159
3160 /*
3161 +--------------------------------------------------------------------+
3162 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
3163 | STATE : code ROUTINE : chld_RetrieveHoldCall |
3164 +--------------------------------------------------------------------+
3165
3166 PURPOSE : retrieve an held call (and nothing else)
3167 - waiting call's still knocked on
3168 - will hold active call
3169 */
3170 LOCAL T_ACI_RETURN chld_RetrieveHoldCall(T_ACI_CMD_SRC srcId)
3171 {
3172 T_CC_CMD_PRM *pCCCmdPrm; /* points to CC command parameters */
3173 SHORT cId; /* call id */
3174 SHORT cwaId = -1; /* holds call waiting id */
3175 SHORT hldId = -1; /* holds call hold id */
3176 SHORT rclId = -1; /* holds recall id */
3177 BOOL mptyHldFlg = FALSE; /* flags a multiparty held call */
3178 BOOL hldCalFlg = FALSE; /* flags a held call */
3179 T_ACI_CHLD_ACT chldact; /* contains the type of CHLD activity when informing MFW */
3180
3181 TRACE_FUNCTION("chld_RetrieveHoldCall");
3182
3183 /* find the waiting or held call */
3184 if( find_waiting_held_call(&cwaId, &hldId, &rclId) EQ AT_BUSY)
3185 {
3186 return(AT_BUSY);
3187 }
3188
3189 if( hldId < 0 )
3190 { /* no held call found */
3191 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_CallNotFound );
3192 return( AT_FAIL );
3193 }
3194
3195 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm; /* temp copy */
3196
3197 /*
3198 *---------------------------------------------------------------
3199 * put all active calls on hold
3200 *---------------------------------------------------------------
3201 */
3202 /* Implements Measure 181 and 182 */
3203 if ( chld_HoldActiveCalls( srcId, &mptyHldFlg, &hldCalFlg, &cId ) EQ FALSE )
3204 {
3205 return( AT_FAIL ); /* no data calls supported */
3206 }
3207
3208 /* maybe, one or more calls were put on hold */
3209 if( hldCalFlg )
3210 {
3211 pCCCmdPrm -> CHLDmode = CHLD_MOD_HldActAndAcpt;
3212 CHLDaddInfo = NO_CHLD_ADD_INFO;
3213
3214 /* inform MFW */
3215 chld_ratlog( srcId, pCCCmdPrm->CHLDmode,
3216 NULL,
3217 (mptyHldFlg)? CHLD_ACT_HoldMpty:CHLD_ACT_Hold,
3218 cId, AT_EXCT );
3219 }
3220
3221 /*
3222 *---------------------------------------------------------------
3223 * retrieve the held call
3224 *---------------------------------------------------------------
3225 */
3226 cmhCC_flagCall(hldId, &(pCCCmdPrm -> mltyCncFlg));
3227 pCCCmdPrm -> CHLDmode = CHLD_MOD_RetrieveHoldCall;
3228
3229 cmhCC_RetrieveCall(hldId, srcId);
3230
3231 /* inform MFW */
3232 chldact = (psaCC_ctb(hldId)->mptyStat EQ CS_ACT)? CHLD_ACT_RetrieveMpty :CHLD_ACT_Retrieve;
3233 chld_ratlog( srcId, pCCCmdPrm->CHLDmode, NULL, chldact, hldId, AT_EXCT );
3234 return( AT_EXCT );
3235 }
3236
3237
3238 /*
3239 +--------------------------------------------------------------------+
3240 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
3241 | STATE : code ROUTINE : chld_RetrieveHoldCallSpec|
3242 +--------------------------------------------------------------------+
3243
3244 PURPOSE : retrieve specific held call (and nothing else)
3245 - release waiting call
3246 - will hold active call
3247 */
3248 LOCAL T_ACI_RETURN chld_RetrieveHoldCallSpec(T_ACI_CMD_SRC srcId, CHAR *call)
3249 {
3250 T_CC_CMD_PRM *pCCCmdPrm; /* points to CC command parameters */
3251 SHORT cId; /* call id */
3252 SHORT temp_cId;
3253 BOOL mptyHldFlg = FALSE; /* flags a multiparty held call */
3254 BOOL hldCalFlg = FALSE; /* flags a held call */
3255 T_ACI_CHLD_ACT chldact; /* contains the type of CHLD activity when informing MFW */
3256
3257 TRACE_FUNCTION("chld_RetrieveHoldCallSpec");
3258
3259 if( call EQ NULL )
3260 {
3261 TRACE_ERROR("CALL parameter is needed !!!");
3262 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
3263 return( AT_FAIL ); /* no call specified */
3264 }
3265
3266 cId = atoi( call ); /* char --> int */
3267
3268 if( (cId EQ 0) OR (cId > MAX_CALL_NR) )
3269 {
3270 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
3271 return( AT_FAIL );
3272 }
3273
3274 cId--; /* adapt to call table index */
3275
3276 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm;
3277
3278 /* test whether specified call is a held call */
3279 if ((ccShrdPrm.ctb[cId] EQ NULL) OR
3280 (psaCC_ctb(cId)->calStat NEQ CS_HLD) OR
3281 (psaCC_ctb(cId)->curCmd NEQ AT_CMD_NONE) OR
3282 (cmhCC_getcalltype(cId) NEQ VOICE_CALL))
3283 { /* no held call or no voice call --> error */
3284 pCCCmdPrm -> mltyCncFlg = 0;
3285 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_CallTypeNoHold );
3286 return( AT_FAIL ); /* no data calls supported */
3287 }
3288
3289
3290 /*
3291 *---------------------------------------------------------------
3292 * put all active calls on hold
3293 *---------------------------------------------------------------
3294 */
3295 pCCCmdPrm -> mltyCncFlg = 0;
3296 pCCCmdPrm -> mltyDscFlg = 0;
3297
3298 for( temp_cId = 0; temp_cId < MAX_CALL_NR; temp_cId++ )
3299 {
3300 T_CC_CALL_TBL *pCallTable = ccShrdPrm.ctb[temp_cId];
3301
3302 if( pCallTable NEQ NULL AND
3303 pCallTable->calStat EQ CS_ACT AND
3304 pCallTable->curCmd EQ AT_CMD_NONE )
3305 {
3306 if( cmhCC_getcalltype(temp_cId) NEQ VOICE_CALL )
3307 {
3308 pCCCmdPrm -> mltyCncFlg = 0;
3309 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_CallTypeNoHold );
3310 return( AT_FAIL ); /* no data calls supported */
3311 }
3312
3313 if( (pCallTable->mptyStat EQ CS_IDL) OR
3314 ((pCallTable->mptyStat EQ CS_ACT) AND (mptyHldFlg EQ FALSE)) )
3315 {
3316 hldCalFlg = TRUE;
3317 }
3318
3319 /* if active call is a multiparty call */
3320 if( pCallTable->mptyStat EQ CS_ACT )
3321 {
3322 mptyHldFlg = TRUE;
3323 }
3324
3325 cmhCC_HoldCall(temp_cId, srcId, AT_CMD_CHLD);
3326 }
3327 }
3328
3329 /* maybe, one or more calls were put on hold */
3330 if( hldCalFlg )
3331 {
3332 pCCCmdPrm->CHLDmode = CHLD_MOD_HldActAndAcpt;
3333 CHLDaddInfo = NO_CHLD_ADD_INFO;
3334
3335 /* inform MFW */
3336 chld_ratlog( srcId, pCCCmdPrm->CHLDmode,
3337 NULL,
3338 (mptyHldFlg)? CHLD_ACT_HoldMpty:CHLD_ACT_Hold,
3339 cId, AT_EXCT );
3340 }
3341
3342 /*
3343 *---------------------------------------------------------------
3344 * retrieve the held call
3345 *---------------------------------------------------------------
3346 */
3347 cmhCC_flagCall(cId, &(pCCCmdPrm -> mltyCncFlg));
3348 pCCCmdPrm -> CHLDmode = CHLD_MOD_RetrieveHoldCallSpec;
3349
3350 cmhCC_RetrieveCall(cId, srcId);
3351
3352 /* inform MFW */
3353 if (psaCC_ctb(cId)->mptyStat EQ CS_ACT)
3354 chldact = CHLD_ACT_RetrieveMpty;
3355 else
3356 chldact = CHLD_ACT_Retrieve;
3357 chld_ratlog( srcId, pCCCmdPrm->CHLDmode, NULL, chldact, cId, AT_EXCT );
3358 return( AT_EXCT );
3359 }
3360
3361 /*
3362 +--------------------------------------------------------------------+
3363 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
3364 | STATE : code ROUTINE : sAT_PlusCHLD |
3365 +--------------------------------------------------------------------+
3366
3367 PURPOSE : This is the functional counterpart to the +CHLD AT command
3368 which is responsible to handle the supplementary services
3369 witin a call
3370 */
3371 GLOBAL T_ACI_RETURN sAT_PlusCHLD ( T_ACI_CMD_SRC srcId,
3372 T_ACI_CHLD_MOD mode,
3373 CHAR *call)
3374 {
3375 TRACE_FUNCTION ("sAT_PlusCHLD()");
3376
3377 if( mode > CHLD_MOD_RelDialCall )
3378 { /* not allowed modes inside '+'-command */
3379 TRACE_EVENT("this mode is not allowed for sAT_PlusCHLD()");
3380 return( AT_FAIL );
3381 }
3382 else
3383 {
3384 return( cmhCC_CHLD_Serv(srcId, mode, call) );
3385 }
3386 }
3387
3388
3389 /*
3390 +--------------------------------------------------------------------+
3391 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
3392 | STATE : code ROUTINE : sAT_PercentCHLD |
3393 +--------------------------------------------------------------------+
3394
3395 PURPOSE : This is the functional counterpart to the %CHLD AT command
3396 which is responsible to handle the supplementary services
3397 witin a call
3398 */
3399 GLOBAL T_ACI_RETURN sAT_PercentCHLD ( T_ACI_CMD_SRC srcId,
3400 T_ACI_CHLD_MOD mode,
3401 CHAR *call)
3402 {
3403 TRACE_FUNCTION ("sAT_PercentCHLD()");
3404
3405 return( cmhCC_CHLD_Serv(srcId, mode, call) );
3406 }
3407
3408 /*
3409 +--------------------------------------------------------------------+
3410 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
3411 | STATE : code ROUTINE : sAT_PlusCCUG |
3412 +--------------------------------------------------------------------+
3413
3414 PURPOSE : This is the functional counterpart to the +CCUG AT command
3415 which is responsible to set the parameters for closed user
3416 group supplementary services.
3417
3418 <mode> : CUG mode.
3419 <index> : CUG index.
3420 <info> : CUG info.
3421 */
3422
3423 GLOBAL T_ACI_RETURN sAT_PlusCCUG ( T_ACI_CMD_SRC srcId,
3424 T_ACI_CCUG_MOD mode,
3425 T_ACI_CCUG_IDX index,
3426 T_ACI_CCUG_INFO info)
3427 {
3428 T_CC_CMD_PRM * pCCCmdPrm; /* points to CC command parameters */
3429
3430 TRACE_FUNCTION ("sAT_PlusCCUG()");
3431
3432 /*
3433 *-------------------------------------------------------------------
3434 * check command source
3435 *-------------------------------------------------------------------
3436 */
3437 if(!cmh_IsVldCmdSrc (srcId))
3438 {
3439 return( AT_FAIL );
3440 }
3441
3442 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm;
3443
3444 /*
3445 *-------------------------------------------------------------------
3446 * process the mode parameter
3447 *-------------------------------------------------------------------
3448 */
3449 switch( mode )
3450 {
3451 case( CCUG_MOD_NotPresent ):
3452
3453 mode = pCCCmdPrm -> CCUGmode;
3454 break;
3455
3456 case( CCUG_MOD_DisableTmp ):
3457 case( CCUG_MOD_EnableTmp ):
3458
3459 break;
3460
3461 default:
3462 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
3463 return( AT_FAIL );
3464 }
3465
3466 /*
3467 *-------------------------------------------------------------------
3468 * process the index parameter
3469 *-------------------------------------------------------------------
3470 */
3471 switch( index )
3472 {
3473 case( CCUG_IDX_NotPresent ):
3474
3475 index = pCCCmdPrm -> CCUGidx;
3476 break;
3477
3478 case( CCUG_IDX_0 ):
3479 case( CCUG_IDX_1 ):
3480 case( CCUG_IDX_2 ):
3481 case( CCUG_IDX_3 ):
3482 case( CCUG_IDX_4 ):
3483 case( CCUG_IDX_5 ):
3484 case( CCUG_IDX_6 ):
3485 case( CCUG_IDX_7 ):
3486 case( CCUG_IDX_8 ):
3487 case( CCUG_IDX_9 ):
3488 case( CCUG_IDX_No ):
3489
3490 break;
3491
3492 default:
3493 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
3494 return( AT_FAIL );
3495 }
3496
3497 /*
3498 *-------------------------------------------------------------------
3499 * process the info parameter
3500 *-------------------------------------------------------------------
3501 */
3502 switch( info )
3503 {
3504 case( CCUG_INFO_NotPresent ):
3505
3506 info = pCCCmdPrm -> CCUGinfo;
3507 break;
3508
3509 case( CCUG_INFO_No ):
3510 case( CCUG_INFO_SuppOa ):
3511 case( CCUG_INFO_SuppPrefCug ):
3512 case( CCUG_INFO_SuppBoth ):
3513
3514 break;
3515
3516 default:
3517 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
3518 return( AT_FAIL );
3519 }
3520
3521 /*
3522 *-------------------------------------------------------------------
3523 * assign the parameters
3524 *-------------------------------------------------------------------
3525 */
3526 pCCCmdPrm -> CCUGmode = mode;
3527 pCCCmdPrm -> CCUGidx = index;
3528 pCCCmdPrm -> CCUGinfo = info;
3529
3530 return( AT_CMPL );
3531 }
3532
3533 /*
3534 +--------------------------------------------------------------------+
3535 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
3536 | STATE : code ROUTINE : sAT_PlusVTS |
3537 +--------------------------------------------------------------------+
3538
3539 PURPOSE : This is the functional counterpart to the +VTS AT command
3540 which is responsible to send DTMF tones.
3541 */
3542
3543 GLOBAL T_ACI_RETURN sAT_PlusVTS ( T_ACI_CMD_SRC srcId,
3544 CHAR dtmf,
3545 T_ACI_VTS_MOD mode )
3546 {
3547 SHORT cId; /* holds call id */
3548 BOOL param_ok;
3549
3550 TRACE_FUNCTION ("sAT_PlusVTS()");
3551
3552 /*
3553 *-------------------------------------------------------------------
3554 * check command source
3555 *-------------------------------------------------------------------
3556 */
3557 if(!cmh_IsVldCmdSrc (srcId))
3558 {
3559 return( AT_FAIL );
3560 }
3561
3562
3563 cId = cmhCC_find_call_for_DTMF( );
3564 if (cId EQ NO_ENTRY)
3565 {
3566 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow );
3567 return( AT_FAIL );
3568 }
3569
3570 /* allow to send DTMF tone one after another quickly
3571 if( psaCC_ctb(cId)->dtmfCmd NEQ AT_CMD_NONE )
3572 return( AT_BUSY );*/
3573
3574 /* if DTMF are already being sent */
3575 if (( ccShrdPrm.dtmf.cnt AND mode NEQ VTS_MOD_ManStop ) OR
3576 ( ccShrdPrm.dtmf.cur AND (mode NEQ VTS_MOD_ManStop)))
3577 {
3578 TRACE_EVENT("DTMF are already being sent !");
3579 return( AT_BUSY );
3580 }
3581 else if ( !ccShrdPrm.dtmf.cur AND mode EQ VTS_MOD_ManStop )
3582 {
3583 TRACE_EVENT("Cannot stop a DTMF tone that hasn't been started!");
3584 return( AT_FAIL );
3585 }
3586 else if ( ccShrdPrm.dtmf.cur AND (ccShrdPrm.dtmf.cur NEQ dtmf ))
3587 {
3588 TRACE_EVENT("Cannot stop a different DTMF tone than the one that is started!");
3589 return( AT_FAIL );
3590 }
3591
3592 /* process mode parameter */
3593 switch( mode )
3594 {
3595 case( VTS_MOD_Auto ):
3596 psaCC_ctb(cId)->dtmfMode = MNCC_DTMF_MOD_AUTO;
3597 break;
3598
3599 case( VTS_MOD_ManStart ):
3600 psaCC_ctb(cId)->dtmfMode = MNCC_DTMF_MOD_MAN_START;
3601 ccShrdPrm.dtmf.cur = dtmf;
3602 break;
3603
3604 case( VTS_MOD_ManStop ):
3605 psaCC_ctb(cId)->dtmfMode = MNCC_DTMF_MOD_MAN_STOP;
3606 break;
3607
3608 default:
3609 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow );
3610 return( AT_FAIL );
3611 }
3612
3613 psaCC_ctb(cId)->dtmfCmd = AT_CMD_VTS; /* wait for confirmation */
3614 psaCC_ctb(cId)->dtmfSrc = (T_OWN)srcId;
3615 /* has to remember tone sent in case of an abort */
3616 ccShrdPrm.dtmf.cnt = 1;
3617 ccShrdPrm.dtmf.dig[0] = dtmf;
3618 ccShrdPrm.dtmf.cId = cId;
3619
3620 param_ok = cmhCC_SendDTMFdig ( AT_CMD_VTS, cId, dtmf, psaCC_ctb(cId)->dtmfMode);
3621
3622 if( param_ok )
3623 {
3624 return( AT_EXCT );
3625 }
3626 else
3627 {
3628 ccShrdPrm.dtmf.cnt = 0;
3629 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
3630 return( AT_FAIL );
3631 }
3632 }
3633
3634 /*
3635 +--------------------------------------------------------------------+
3636 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
3637 | STATE : code ROUTINE : sAT_PlusCSNS |
3638 +--------------------------------------------------------------------+
3639
3640 PURPOSE : This is the functional counterpart to the +CSNS AT command
3641 which is responsible to set the parameters for single
3642 numbering scheme.
3643 */
3644
3645 GLOBAL T_ACI_RETURN sAT_PlusCSNS ( T_ACI_CMD_SRC srcId,
3646 T_ACI_CSNS_MOD mode)
3647 {
3648
3649 TRACE_FUNCTION ("sAT_PlusCSNS()");
3650
3651 /*
3652 *-------------------------------------------------------------------
3653 * check command source
3654 *-------------------------------------------------------------------
3655 */
3656 if(!cmh_IsVldCmdSrc (srcId))
3657 {
3658 return( AT_FAIL );
3659 }
3660
3661
3662 /*
3663 *-------------------------------------------------------------------
3664 * check parameter mode
3665 *-------------------------------------------------------------------
3666 */
3667 switch( mode )
3668 {
3669 case( CSNS_MOD_NotPresent ):
3670
3671 mode = CSNS_MOD_Voice;
3672 break;
3673
3674 case( CSNS_MOD_Voice ):
3675 #ifdef FAX_AND_DATA
3676 case( CSNS_MOD_VAFVoice ):
3677 case( CSNS_MOD_Fax ):
3678 case( CSNS_MOD_VADVoice ):
3679 case( CSNS_MOD_Data ):
3680 case( CSNS_MOD_VAFFax ):
3681 case( CSNS_MOD_VADData ):
3682 case( CSNS_MOD_VFD ):
3683 #endif /* FAX_AND_DATA */
3684 break;
3685
3686 default:
3687 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
3688 return( AT_FAIL );
3689 }
3690
3691 ccShrdPrm.snsMode = mode;
3692
3693 psaCC_Config( );
3694
3695 return( AT_CMPL );
3696 }
3697
3698 /*
3699 +--------------------------------------------------------------------+
3700 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
3701 | STATE : code ROUTINE : sAT_AndF |
3702 +--------------------------------------------------------------------+
3703
3704 PURPOSE : Reset all values to defaults.
3705 */
3706
3707 GLOBAL T_ACI_RETURN sAT_AndF ( T_ACI_CMD_SRC srcId,
3708 SHORT value)
3709 {
3710
3711 TRACE_FUNCTION ("sAT_AndF()");
3712
3713 /*
3714 *-------------------------------------------------------------------
3715 * check command source
3716 *-------------------------------------------------------------------
3717 */
3718 if(!cmh_IsVldCmdSrc (srcId))
3719 {
3720 return( AT_FAIL );
3721 }
3722
3723 /*
3724 *-------------------------------------------------------------------
3725 * check parameter value
3726 *-------------------------------------------------------------------
3727 */
3728 if( value NEQ 0 AND value NEQ ACI_NumParmNotPresent )
3729 {
3730 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
3731 return( AT_FAIL );
3732 }
3733
3734 /*
3735 *-------------------------------------------------------------------
3736 * reset value to defaults
3737 *-------------------------------------------------------------------
3738 */
3739 cmh_Reset ( srcId, TRUE );
3740
3741 return( AT_CMPL );
3742 }
3743
3744
3745 /*
3746 +--------------------------------------------------------------------+
3747 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
3748 | STATE : code ROUTINE : sGsmAT_Z |
3749 +--------------------------------------------------------------------+
3750
3751 PURPOSE : Reset all values to factory defaults in the GSM part of ACI.
3752 */
3753
3754 GLOBAL T_ACI_RETURN sGsmAT_Z ( T_ACI_CMD_SRC srcId )
3755 {
3756 SHORT cId; /* holds call id */
3757 SHORT waitId = NO_ENTRY; /* holds call waiting id */
3758 T_CC_CMD_PRM * pCCCmdPrm; /* points to CC command parameters */
3759
3760 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
3761 T_ACI_CLOG cmdLog; /* holds logging info */
3762 #endif
3763
3764 TRACE_FUNCTION ("sGsmAT_Z()");
3765
3766 /*
3767 *-------------------------------------------------------------------
3768 * command source is checked
3769 *-------------------------------------------------------------------
3770 */
3771 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm;
3772
3773 /*
3774 *-------------------------------------------------------------------
3775 * prepare log command
3776 *-------------------------------------------------------------------
3777 */
3778 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
3779 cmdLog.atCmd = AT_CMD_Z;
3780 cmdLog.cmdType = CLOG_TYPE_Set;
3781 cmdLog.retCode = AT_EXCT;
3782 cmdLog.sId = ACI_NumParmNotPresent;
3783 cmdLog.cmdPrm.sH.srcId = srcId;
3784 #endif /* End of SMI Or defined MFW*/
3785
3786 /*
3787 *-------------------------------------------------------------------
3788 * clear all calls except a waiting call
3789 *-------------------------------------------------------------------
3790 */
3791 pCCCmdPrm -> mltyDscFlg = 0;
3792
3793 for( cId = 0; cId < MAX_CALL_NR; cId++ )
3794 {
3795 /* Clear only calls in use ! */
3796 if (ccShrdPrm.ctb[cId] NEQ NULL)
3797 {
3798 cmhCC_ClearCall(cId,MNCC_CAUSE_CALL_CLEAR, srcId, AT_CMD_Z, &waitId);
3799 }
3800 }
3801
3802 if( pCCCmdPrm -> mltyDscFlg )
3803 {
3804 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
3805 cmdLog.cId = cId+1;
3806 rAT_PercentCLOG( &cmdLog );
3807 #endif
3808 return( AT_EXCT );
3809 }
3810
3811 /*
3812 *-------------------------------------------------------------------
3813 * disconnect a waiting call with user determined user busy
3814 *-------------------------------------------------------------------
3815 */
3816 /* Implements Measure 165 */
3817 if ( waitId NEQ NO_ENTRY )
3818 {
3819 cmhCC_disconnect_waiting_call ( srcId, waitId, AT_CMD_Z,
3820 &(pCCCmdPrm -> mltyDscFlg) );
3821 return( AT_EXCT );
3822 }
3823
3824 /*
3825 *-------------------------------------------------------------------
3826 * reset value to default if no call is active
3827 *-------------------------------------------------------------------
3828 */
3829 cmh_Reset ( srcId, TRUE );
3830
3831 R_AT(RAT_Z, srcId)();
3832
3833 return( AT_CMPL );
3834 }
3835
3836 /*
3837 +--------------------------------------------------------------------+
3838 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
3839 | STATE : code ROUTINE : sAT_Z |
3840 +--------------------------------------------------------------------+
3841
3842 PURPOSE : Reset all values to factory defaults.
3843 */
3844
3845 GLOBAL T_ACI_RETURN sAT_Z ( T_ACI_CMD_SRC srcId,
3846 SHORT value)
3847 {
3848
3849 TRACE_FUNCTION ("sAT_Z()");
3850
3851 /*
3852 *-------------------------------------------------------------------
3853 * check command source
3854 *-------------------------------------------------------------------
3855 */
3856 if(!cmh_IsVldCmdSrc (srcId))
3857 {
3858 return( AT_FAIL );
3859 }
3860
3861 /*
3862 *-------------------------------------------------------------------
3863 * check parameter value
3864 *-------------------------------------------------------------------
3865 */
3866 if( value NEQ 0 AND value NEQ ACI_NumParmNotPresent )
3867 {
3868 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
3869 return( AT_FAIL );
3870 }
3871
3872 /*
3873 *-------------------------------------------------------------------
3874 * clear all calls and reset all value to default
3875 *-------------------------------------------------------------------
3876 */
3877
3878 #if defined (GPRS) AND defined (DTI)
3879 return sGprsAT_Z ( srcId );
3880 #else
3881 return sGsmAT_Z ( srcId );
3882 #endif /* GPRS */
3883 }
3884
3885 #if defined (FAX_AND_DATA) AND defined (DTI)
3886 /*
3887 +--------------------------------------------------------------------+
3888 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
3889 | STATE : code ROUTINE : sAT_O |
3890 +--------------------------------------------------------------------+
3891
3892 PURPOSE : Return to online mode
3893 */
3894
3895 GLOBAL T_ACI_RETURN sAT_O ( T_ACI_CMD_SRC srcId )
3896 {
3897 SHORT cId; /* holds call id */
3898 T_DTI_CONN_CB *dti_conn_cb;
3899 T_DTI_ENTITY_ID entity_list[2];
3900 #ifdef FF_PSI
3901 T_ACI_DTI_PRC_PSI *src_infos_psi = NULL;
3902 #endif /* FF_PSI */
3903 TRACE_FUNCTION("sAT_O()");
3904
3905 /*
3906 *-------------------------------------------------------------------
3907 * check command source
3908 *-------------------------------------------------------------------
3909 */
3910 if(!cmh_IsVldCmdSrc (srcId))
3911 {
3912 return( AT_FAIL );
3913 }
3914
3915 /*
3916 *-------------------------------------------------------------------
3917 * find active call
3918 *-------------------------------------------------------------------
3919 */
3920 cId = psaCC_ctbFindCall( OWN_SRC_INV, CS_ACT, NO_VLD_CT );
3921
3922 if( cId EQ NO_ENTRY )
3923 {
3924 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_CallNotFound );
3925 return( AT_FAIL );
3926 }
3927
3928 switch( cmhCC_getcalltype(cId) )
3929 {
3930 case( TRANS_CALL ):
3931 entity_list[0] = DTI_ENTITY_TRA;
3932 dti_conn_cb = TRA_connect_dti_cb;
3933 break;
3934
3935 case( NON_TRANS_CALL ):
3936 entity_list[0] = DTI_ENTITY_L2R;
3937 dti_conn_cb = L2R_connect_dti_cb;
3938 break;
3939
3940 default:
3941 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow );
3942 return( AT_FAIL );
3943 }
3944
3945 if( psaCC_ctb(cId)->curCmd NEQ AT_CMD_NONE )
3946 return( AT_BUSY );
3947
3948 R_AT( RAT_CONNECT, srcId )
3949 ( AT_CMD_O, cmhCC_GetDataRate(&psaCC_ctb(cId)->
3950 BC[psaCC_ctb(cId)->curBC]),
3951 cId+1, FALSE );
3952
3953 psaCC_ctb(cId)->curCmd = AT_CMD_O;
3954 psaCC_ctb(cId)->curSrc = srcId;
3955
3956
3957 if (IS_SRC_BT(srcId))
3958 {
3959 entity_list[1] = DTI_ENTITY_BLUETOOTH;
3960 dti_cntrl_est_dpath((UBYTE)srcId, entity_list, 2, SPLIT, dti_conn_cb);
3961 }
3962 else
3963 {
3964 #ifdef FF_PSI
3965 src_infos_psi = find_element(psi_src_params,(UBYTE) srcId, cmhPSItest_srcId);
3966 memset(&psi_ato,0,sizeof(T_ACI_PSI_CALL_TYPE));
3967 if (src_infos_psi NEQ NULL)
3968 {
3969 psi_ato.src_id = (UBYTE)srcId;
3970 psi_ato.entity_to_conn = entity_list[0];
3971 psi_ato.num_entities = 1;
3972 psi_ato.mode = SPLIT;
3973 psi_ato.cb = dti_conn_cb;
3974 psi_ato.capability = DTI_CPBLTY_SER;
3975 psi_ato.cid = DTI_CID_NOTPRESENT;
3976 psi_ato.last_cmd = AT_CMD_O;
3977 }
3978 else
3979 {
3980 #endif /* FF_PSI */
3981 dti_cntrl_est_dpath_indirect ( (UBYTE)srcId,
3982 entity_list,
3983 1,
3984 SPLIT,
3985 dti_conn_cb,
3986 DTI_CPBLTY_SER,
3987 DTI_CID_NOTPRESENT);
3988 #ifdef FF_PSI
3989 }
3990 #endif /* FF_PSI */
3991 }
3992
3993 return( AT_EXCT );
3994 }
3995 #endif
3996
3997 /*
3998 +-------------------------------------------------------------------+
3999 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
4000 | ROUTINE : sAT_PercentALS |
4001 +-------------------------------------------------------------------+
4002
4003 PURPOSE : set the ALS mode for outgoing calls (voice)
4004 ALS_MOD_SPEECH:
4005 indicates bearer capability => BEARER_SERV_SPEECH
4006 ALS_MOD_AUX_SPEECH:
4007 indicates bearer capability => BEARER_SERV_AUX_SPEECH
4008 */
4009
4010 GLOBAL T_ACI_RETURN sAT_PercentALS( T_ACI_CMD_SRC srcId,
4011 T_ACI_ALS_MOD mode )
4012 {
4013 TRACE_FUNCTION("sAT_PercentALS()");
4014
4015 if( !cmh_IsVldCmdSrc( srcId ) )
4016 {
4017 return( AT_FAIL );
4018 }
4019
4020 /* line will really change? */
4021 if (mode EQ cmhPrm[srcId].ccCmdPrm.ALSmode)
4022 {
4023 return (AT_CMPL);
4024 }
4025
4026 if ( ALSlock NEQ ALS_MOD_NOTPRESENT )
4027 {
4028 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow );
4029 return( AT_FAIL );
4030 }
4031
4032 if ( mode EQ ALS_MOD_SPEECH )
4033 {
4034 cmhPrm[srcId].ccCmdPrm.ALSmode = ALS_MOD_SPEECH;
4035 return( AT_CMPL );
4036 }
4037 else if ( mode EQ ALS_MOD_AUX_SPEECH )
4038 {
4039 /* E-Plus SIM-Card inserted (mcc=0x262, mnc=0x03) ? */
4040 if (cmhSIM_plmn_is_hplmn(0x262, 0x03F))
4041 {
4042 cmhPrm[srcId].ccCmdPrm.ALSmode = ALS_MOD_AUX_SPEECH;
4043 return( AT_CMPL );
4044 }
4045 else
4046 {
4047 simEntStat.curCmd = AT_CMD_ALS;
4048 simShrdPrm.owner = (T_OWN)srcId;
4049 simEntStat.entOwn = srcId;
4050
4051 ccShrdPrm.als_cmd = ALS_CMD_SET;
4052
4053 cmhCC_checkALS_Support();
4054 return (AT_EXCT);
4055 }
4056 }
4057 else
4058 {
4059 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
4060 return( AT_FAIL );
4061 }
4062 }
4063
4064 /*
4065 +-------------------------------------------------------------------+
4066 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
4067 | ROUTINE : sAT_PercentCTTY |
4068 +-------------------------------------------------------------------+
4069
4070 PURPOSE : Handling TTY
4071 */
4072
4073 GLOBAL T_ACI_RETURN sAT_PercentCTTY (T_ACI_CMD_SRC srcId,
4074 T_ACI_CTTY_MOD mode,
4075 T_ACI_CTTY_REQ req)
4076 {
4077
4078 #ifdef FF_TTY
4079 SHORT cId; /* holds call id */
4080 T_TTY_CMD ttyAction = TTY_OFF;
4081 T_MNCC_bcpara *bc;
4082
4083 TRACE_FUNCTION("sAT_PercentCTTY()");
4084
4085 if (!cmh_IsVldCmdSrc( srcId ))
4086 {
4087 return AT_FAIL;
4088 }
4089
4090 /*
4091 * find if any call is active
4092 */
4093 cId = psaCC_ctbFindCall( OWN_SRC_INV, CS_ACT, NO_VLD_CT);
4094
4095 if(cId NEQ NO_ENTRY )
4096 {
4097 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId];
4098
4099 TRACE_EVENT ("sAT_PercentCTTY() Active call found ");
4100
4101 /*
4102 * if command state is not idle
4103 */
4104 switch(ctb->curCmd)
4105 {
4106 case(AT_CMD_NONE):
4107 break;
4108 default:
4109 TRACE_EVENT_P1("CTTY: cId busy with %d", ctb->curCmd);
4110 return( AT_BUSY );
4111 }
4112
4113 /*
4114 * Check if the active call is a TTY call
4115 */
4116 bc = &ctb->BC[ctb->curBC];
4117
4118 if (bc->bearer_serv EQ MNCC_BEARER_SERV_SPEECH_CTM OR
4119 bc->bearer_serv EQ MNCC_BEARER_SERV_AUX_SPEECH_CTM)
4120 {
4121 if ((mode EQ CTTY_MOD_Disable) OR (mode EQ CTTY_MOD_Enable))
4122 {
4123 cmhPrm[srcId].ccCmdPrm.CTTYmode = mode;
4124 }
4125
4126 switch (req)
4127 {
4128 case CTTY_REQ_Off:
4129 /*
4130 * stop the running TTY, a normal voice call
4131 */
4132 ccShrdPrm.ctmReq = MNCC_CTM_DISABLED;
4133 ccShrdPrm.ttyCmd = (UBYTE)TTY_OFF;
4134
4135 cmhCC_TTY_Control (cId, TTY_STOP);
4136 return( AT_CMPL );
4137
4138 case CTTY_REQ_On:
4139 ccShrdPrm.ctmReq = MNCC_CTM_ENABLED;
4140 ccShrdPrm.ttyCmd = (UBYTE)TTY_ALL;
4141 break;
4142 case CTTY_REQ_HCO:
4143 ccShrdPrm.ctmReq = MNCC_CTM_ENABLED;
4144 ccShrdPrm.ttyCmd = (UBYTE)TTY_HCO;
4145 break;
4146 case CTTY_REQ_VCO:
4147 ccShrdPrm.ctmReq = MNCC_CTM_ENABLED;
4148 ccShrdPrm.ttyCmd = (UBYTE)TTY_VCO;
4149 break;
4150 default:
4151 ACI_ERR_DESC (ACI_ERR_CLASS_Ext, EXT_ERR_Parameter);
4152 return AT_FAIL;
4153 }
4154
4155 audio_dyn_set_tty (ttyAction = (T_TTY_CMD)ccShrdPrm.ttyCmd);
4156
4157 /*
4158 * This is for the case when mode is changed from Voice to any other
4159 */
4160 ccShrdPrm.ctmState = TTY_STATE_ACTIVE;
4161
4162 cmhCC_notifyTTY (CTTY_NEG_Grant, cmhCC_getTTYtrx_state (ttyAction));
4163
4164 return AT_CMPL;
4165 }
4166 else
4167 {
4168 /*
4169 * If the active call is a normal GSM call then its a wrong bearer cap
4170 */
4171 TRACE_EVENT_P1 ("TTY wrong BCAP: %d", (int)bc->bearer_serv);
4172 return (AT_FAIL);
4173 }
4174 }
4175 else
4176 {
4177 /*
4178 * If no active call then its a static switching set the bearer cap
4179 * for next and subsequent calls
4180 */
4181 TRACE_EVENT ("sAT_PercentCTTY() No active call found ");
4182
4183 if ((mode EQ CTTY_MOD_Disable) OR (mode EQ CTTY_MOD_Enable))
4184 {
4185 cmhPrm[srcId].ccCmdPrm.CTTYmode = mode;
4186 }
4187 switch (req)
4188 {
4189 case CTTY_REQ_Off:
4190 ccShrdPrm.ctmReq = MNCC_CTM_DISABLED;
4191 ccShrdPrm.ttyCmd = (UBYTE)TTY_OFF;
4192 psaCC_Config ();
4193 break;
4194 case CTTY_REQ_On:
4195 ccShrdPrm.ctmReq = MNCC_CTM_ENABLED;
4196 ccShrdPrm.ttyCmd = (UBYTE)TTY_ALL;
4197 psaCC_Config ();
4198 break;
4199 case CTTY_REQ_HCO:
4200 ccShrdPrm.ctmReq = MNCC_CTM_ENABLED;
4201 ccShrdPrm.ttyCmd = (UBYTE)TTY_HCO;
4202 psaCC_Config ();
4203 break;
4204 case CTTY_REQ_VCO:
4205 ccShrdPrm.ctmReq = MNCC_CTM_ENABLED;
4206 ccShrdPrm.ttyCmd = (UBYTE)TTY_VCO;
4207 psaCC_Config ();
4208 break;
4209 default:
4210 ACI_ERR_DESC (ACI_ERR_CLASS_Ext, EXT_ERR_Parameter);
4211 return AT_FAIL;
4212 }
4213 if (req EQ CTTY_REQ_Off)
4214 {
4215 if (ccShrdPrm.ctmState EQ TTY_STATE_IDLE)
4216 {
4217 ccShrdPrm.ctmState = TTY_STATE_NONE;
4218 }
4219 }
4220 else
4221 {
4222 if (ccShrdPrm.ctmState EQ TTY_STATE_NONE)
4223 {
4224 ccShrdPrm.ctmState = TTY_STATE_IDLE;
4225 }
4226 }
4227 return AT_CMPL;
4228 }
4229 #else
4230 ACI_ERR_DESC (ACI_ERR_CLASS_Cme, CME_ERR_OpNotSupp);
4231 return AT_FAIL;
4232 #endif /* FF_TTY */
4233 }
4234
4235 #ifdef DTI
4236 #if defined (FF_WAP) || defined (FF_GPF_TCPIP) || defined (FF_SAT_E)
4237 /*
4238 +--------------------------------------------------------------------+
4239 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
4240 | STATE : code ROUTINE : sAT_PercentWAP |
4241 +--------------------------------------------------------------------+
4242
4243 PURPOSE : set next call as a WAP call / unsent WAP call
4244 */
4245
4246 GLOBAL T_ACI_RETURN sAT_PercentWAP ( T_ACI_CMD_SRC srcId , SHORT setflag )
4247 {
4248 TRACE_FUNCTION("sAT_PercentWAP()");
4249
4250 switch (setflag)
4251 {
4252 case (0): /* unsent WAP call */
4253 /* End of processing of WAP entities */
4254 /* WAP-dedicated variables shall be reinitialized */
4255 wapId = NO_ENTRY;
4256 Wap_Call = FALSE;
4257 wap_state = Wap_Not_Init;
4258 if ( wap_dti_id NEQ DTI_DTI_ID_NOTPRESENT )
4259 {
4260 dti_cntrl_erase_entry (wap_dti_id);
4261 wap_dti_id = DTI_DTI_ID_NOTPRESENT;
4262 }
4263 break;
4264
4265 case (1): /* next call will be a WAP call */
4266 if (!Wap_Call)
4267 {
4268 Wap_Call = TRUE;
4269 #ifdef FF_PPP
4270 /* FST: not possible in the moment -> see #ifdef before function definition */
4271
4272 /* reset is_PPP_CALL */
4273 pppShrdPrm.is_PPP_CALL = FALSE;
4274 #endif /* FF_PPP */
4275 }
4276 else
4277 {
4278 TRACE_EVENT("ERROR: a WAP Call is currently in progress");
4279 return AT_FAIL;
4280 }
4281 break;
4282 }
4283
4284 return AT_CMPL;
4285 }
4286 #endif /* of WAP || FF_GPF_TCPIP || SAT E */
4287 #endif /* DTI */
4288
4289 #if defined MFW AND defined TI_PS_FF_AT_P_CMD_MMITEST
4290 /* MMI TEST AT COMMAND */
4291
4292
4293 /*
4294 +--------------------------------------------------------------------+
4295 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
4296 | STATE : code ROUTINE : sAT_PercentMMITEST |
4297 +--------------------------------------------------------------------+
4298
4299 PURPOSE : This command has been introduced in order to use the AT command interface for some MMI
4300 specific testing. It shoudnt be compiled without MMI.
4301
4302 */
4303
4304
4305 GLOBAL T_ACI_RETURN sAT_PercentMMITEST(T_ACI_CMD_SRC srcId, char *param)
4306 {
4307
4308 TRACE_FUNCTION ("sAT_PercentMMITEST ()");
4309
4310 /*
4311 *-------------------------------------------------------------------
4312 * check command source
4313 *-------------------------------------------------------------------
4314 */
4315 if(!cmh_IsVldCmdSrc (srcId))
4316 {
4317 return( AT_FAIL );
4318 }
4319
4320 rAT_PercentMMITEST(param);
4321
4322 return AT_CMPL;
4323 } /* sAT_PercentMMITEST */
4324
4325 #endif
4326
4327 /*
4328 +--------------------------------------------------------------------+
4329 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
4330 | STATE : code ROUTINE : rdlPrm_init |
4331 +--------------------------------------------------------------------+
4332
4333 PURPOSE : initializing of redial parameter
4334 */
4335 GLOBAL void rdlPrm_init(void)
4336 {
4337 TRACE_FUNCTION ("rdlPrm_init ()");
4338
4339 #ifdef TI_PS_FF_AT_P_CMD_RDLB
4340 rdlPrm.rdlBlN = NO_NOTIF_USER;
4341 #endif /* TI_PS_FF_AT_P_CMD_RDLB */
4342 rdlPrm.rdlcId = NO_ENTRY;
4343 rdlPrm.rdlMod = AUTOM_REPEAT_OFF;
4344 rdlPrm.rdlModN = NO_NOTIF_USER;
4345 rdlPrm.rdlBlMod = BLMODE_NO_PRESENT;
4346
4347
4348 #if defined(_TARGET_)
4349 cmhCC_rd_mode_FFS(AUTOM_REP_NOT_PRESENT,READ_RDLmode); /* read redial mode from FFS */
4350 if(rdlPrm.rdlMod EQ AUTOM_REPEAT_ON)
4351 {
4352 #ifdef TI_PS_FF_AT_P_CMD_RDLB
4353 if(cc_blacklist_ptr EQ NULL)
4354 {
4355 ACI_MALLOC(cc_blacklist_ptr,sizeof(T_ACI_CC_REDIAL_BLACKL));
4356 memset(cc_blacklist_ptr, 0 , sizeof(T_ACI_CC_REDIAL_BLACKL));
4357 }
4358 #endif /* TI_PS_FF_AT_P_CMD_RDLB */
4359 }
4360 #endif /* _TARGET_ */
4361 }
4362
4363 /*
4364 +--------------------------------------------------------------------+
4365 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
4366 | STATE : code ROUTINE : rdlPrm_exit |
4367 +--------------------------------------------------------------------+
4368
4369 PURPOSE :
4370 */
4371 GLOBAL void rdlPrm_exit(void)
4372 {
4373 TRACE_FUNCTION ("rdlPrm_exit ()");
4374
4375 #ifdef TI_PS_FF_AT_P_CMD_RDLB
4376 rdlPrm.rdlBlN = NO_NOTIF_USER;
4377 #endif /* TI_PS_FF_AT_P_CMD_RDLB */
4378 rdlPrm.rdlcId = NO_ENTRY;
4379 rdlPrm.rdlMod = AUTOM_REP_NOT_PRESENT;
4380 rdlPrm.rdlModN = NO_NOTIF_USER;
4381 rdlPrm.rdlBlMod = BLMODE_NO_PRESENT;
4382
4383 #ifdef TI_PS_FF_AT_P_CMD_RDLB
4384 if(cc_blacklist_ptr NEQ NULL)
4385 {
4386 ACI_MFREE(cc_blacklist_ptr);
4387 }
4388 #endif /* TI_PS_FF_AT_P_CMD_RDLB */
4389 }
4390
4391 /*
4392 +--------------------------------------------------------------------+
4393 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
4394 | STATE : code ROUTINE : sAT_PercentRDL |
4395 +--------------------------------------------------------------------+
4396
4397 PURPOSE : This command has been introduced in order to set the
4398 redial mode and notification state referring to outgoing
4399 calls on ON/OFF
4400 */
4401 GLOBAL T_ACI_RETURN sAT_PercentRDL(T_ACI_CMD_SRC srcId,
4402 T_ACI_CC_REDIAL_MODE redial_mode,
4403 T_ACI_CC_REDIAL_NOTIF notification)
4404 {
4405 int i;
4406
4407 TRACE_FUNCTION ("sAT_PercentRDL ()");
4408
4409 /*
4410 *-------------------------------------------------------------------
4411 * check command source
4412 *-------------------------------------------------------------------
4413 */
4414 if(!cmh_IsVldCmdSrc (srcId))
4415 {
4416 return( AT_FAIL );
4417 }
4418
4419 if(redial_mode EQ AUTOM_REP_NOT_PRESENT)
4420 {
4421 redial_mode = rdlPrm.rdlMod;
4422 }
4423
4424 switch(notification)
4425 {
4426 case NOTIF_NO_PRESENT:
4427 notification = rdlPrm.rdlModN;
4428 break;
4429 case NOTIF_USER:
4430 case NO_NOTIF_USER:
4431 rdlPrm.rdlModN = notification;
4432 break;
4433 default:
4434 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
4435 return( AT_FAIL );
4436 }
4437
4438 switch(redial_mode)
4439 {
4440 case AUTOM_REPEAT_OFF:
4441 #if defined(_TARGET_)
4442 /* store redial mode in FFS */
4443 cmhCC_rd_mode_FFS(redial_mode,WRITE_RDLmode);
4444 #endif /* _TARGET_ */
4445 /* stop redialling timer if necessary */
4446 if (rdlPrm.rdlcId NEQ NO_ENTRY)
4447 {
4448 TIMERSTOP(ACI_REPEAT_HND);
4449 #ifdef SIM_TOOLKIT
4450 if( ( ccShrdPrm.ctb[rdlPrm.rdlcId]->SATinv & SAT_REDIAL ) )
4451 { /* This is the call invoked by SAT */
4452 T_ACI_SAT_TERM_RESP resp_data;
4453 psaSAT_InitTrmResp( &resp_data );
4454 psaSAT_SendTrmResp( RSLT_USR_CLR_DWN, &resp_data );
4455 }
4456 if(satShrdPrm.dur)
4457 {
4458 TIMERSTOP(ACI_SAT_MAX_DUR_HND);
4459 satShrdPrm.dur = -1;
4460 }
4461 #endif /* SIM_TOOLKIT */
4462 if(rdlPrm.rdlcId NEQ -1)
4463 {/* clear call id entry in call table if marked as used */
4464 psaCC_FreeCtbNtry (rdlPrm.rdlcId);
4465 for(i = 0; i < CMD_SRC_MAX; i++)
4466 {
4467 R_AT(RAT_RDL, (T_ACI_CMD_SRC)i)(REDIAL_STOP);
4468 }
4469 }
4470 }
4471 /* reset redial parameter */
4472 rdlPrm_init();
4473 return AT_CMPL;
4474 case AUTOM_REPEAT_ON:
4475 rdlPrm.rdlMod = redial_mode;
4476 #if defined(_TARGET_)
4477 /* store redial mode in FFS */
4478 cmhCC_rd_mode_FFS(redial_mode,WRITE_RDLmode);
4479 #endif /* _TARGET_ */
4480 #ifdef TI_PS_FF_AT_P_CMD_RDLB
4481 /* allocate blacklist for phone numbers forbidden to call */
4482 if(cc_blacklist_ptr EQ NULL)
4483 {
4484 /* Check if we have enough RAM for the following ACI_MALLOC */
4485 USHORT free, alloc;
4486 int ret;
4487 ret = vsi_m_status ( hCommACI,
4488 sizeof(T_ACI_CC_REDIAL_BLACKL),
4489 PRIM_POOL_PARTITION,
4490 &free,
4491 &alloc );
4492 if (ret EQ VSI_ERROR || free EQ 0)
4493 {
4494 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_MemFull);
4495 return (AT_FAIL);
4496 }
4497 ACI_MALLOC(cc_blacklist_ptr,sizeof(T_ACI_CC_REDIAL_BLACKL));
4498 memset(cc_blacklist_ptr, 0 , sizeof(T_ACI_CC_REDIAL_BLACKL));
4499 }
4500 #endif /* TI_PS_FF_AT_P_CMD_RDLB */
4501 return AT_CMPL;
4502 default:
4503 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
4504 return( AT_FAIL );
4505 }
4506 }
4507
4508 #ifdef TI_PS_FF_AT_P_CMD_RDLB
4509 /*
4510 +--------------------------------------------------------------------+
4511 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
4512 | STATE : code ROUTINE : sAT_PercentRDLB |
4513 +--------------------------------------------------------------------+
4514
4515 PURPOSE : This command has been introduced in order to delete the
4516 black list entries (forbidden outgoing phone numbers)
4517 */
4518 GLOBAL T_ACI_RETURN sAT_PercentRDLB(T_ACI_CMD_SRC srcId,
4519 T_ACI_CC_REDIAL_BLMODE blacklist_mode,
4520 T_ACI_CC_REDIAL_NOTIF notification)
4521 {
4522 TRACE_FUNCTION ("sAT_PercentRDLB ()");
4523
4524 /*
4525 *-------------------------------------------------------------------
4526 * check command source
4527 *-------------------------------------------------------------------
4528 */
4529 if(!cmh_IsVldCmdSrc (srcId))
4530 {
4531 return( AT_FAIL );
4532 }
4533
4534 if(rdlPrm.rdlMod EQ AUTOM_REPEAT_ON)
4535 {
4536
4537 switch(blacklist_mode)
4538 {
4539 case BLMODE_NO_PRESENT:
4540 rdlPrm.rdlBlMod = BL_NO_DELETE; /* if no parameter is given the black list is not deleted */
4541 break;
4542 case BL_NO_DELETE:
4543 case BL_DELETE:
4544 /* store black list mode */
4545 rdlPrm.rdlBlMod = blacklist_mode;
4546 break;
4547 default:
4548 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
4549 return( AT_FAIL );
4550 }
4551
4552 /* store black list notification mode */
4553 switch(notification)
4554 {
4555 case NOTIF_NO_PRESENT:
4556 notification = rdlPrm.rdlBlN;
4557 break;
4558 case NOTIF_USER:
4559 case NO_NOTIF_USER:
4560 rdlPrm.rdlBlN = notification;
4561 break;
4562 default:
4563 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
4564 return( AT_FAIL );
4565 }
4566 /* reset black list entries */
4567 if(rdlPrm.rdlBlMod EQ BL_DELETE)
4568 {
4569 cc_blacklist_ptr->blCount = 0;
4570 }
4571 return AT_CMPL;
4572 }
4573 else
4574 {/* redial mode switched OFF */
4575 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
4576 return( AT_FAIL );
4577 }
4578 }
4579 #endif /* TI_PS_FF_AT_P_CMD_RDLB */
4580
4581 #ifdef TI_PS_FF_AT_P_CMD_CUSCFG
4582 /*
4583 +--------------------------------------------------------------------+
4584 | PROJECT : GSM-PS (6147) MODULE : CMH_CCQ |
4585 | STATE : code ROUTINE : sAT_PercentCUSCFG |
4586 +--------------------------------------------------------------------+
4587
4588 PURPOSE : This is the functional counterpart to the AT%CUSCFG set command
4589 which sets the customization state of the facility specified.
4590
4591 */
4592 GLOBAL T_ACI_RETURN sAT_PercentCUSCFG(T_ACI_CMD_SRC srcId,
4593 T_ACI_CUSCFG_FAC facility,
4594 T_ACI_CUSCFG_MOD mode,
4595 CHAR * value)
4596 {
4597 TRACE_FUNCTION ("sAT_PercentCUSCFG ()");
4598
4599 /*
4600 *-------------------------------------------------------------------
4601 * check command source
4602 *-------------------------------------------------------------------
4603 */
4604 if(!cmh_IsVldCmdSrc (srcId))
4605 {
4606 return( AT_FAIL );
4607 }
4608
4609 switch(facility)
4610 {
4611 case CUSCFG_FAC_MO_SM_Control:
4612 cuscfgParams.MO_SM_Control_SIM = mode;
4613 break;
4614
4615 case CUSCFG_FAC_MO_Call_Control:
4616 cuscfgParams.MO_Call_Control_SIM = mode;
4617 break;
4618
4619 case CUSCFG_FAC_MO_SS_Control:
4620 cuscfgParams.MO_SS_Control_SIM = mode;
4621 break;
4622
4623 case CUSCFG_FAC_MO_USSD_Control:
4624 cuscfgParams.MO_USSD_Control_SIM = mode;
4625 break;
4626
4627 case CUSCFG_FAC_2_Digit_Call:
4628 cuscfgParams.Two_digit_MO_Call = mode;
4629 break;
4630
4631 case CUSCFG_FAC_Ext_USSD_Res:
4632 cuscfgParams.Ext_USSD_Response = mode;
4633 break;
4634
4635 case CUSCFG_FAC_T_MOBILE_Eons:
4636 cuscfgParams.T_MOBILE_Eons = mode;
4637 break;
4638
4639 case CUSCFG_FAC_USSD_As_MO_Call:
4640 cuscfgParams.USSD_As_MO_Call = mode;
4641 break;
4642
4643 default:
4644 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
4645 return( AT_FAIL );
4646 }
4647 return(AT_CMPL);
4648 }
4649 #endif /* TI_PS_FF_AT_P_CMD_CUSCFG */
4650
4651 /* Implements Measure 80 */
4652 /*
4653 +------------------------------------------------------------------------------
4654 | Function : cmhCC_check_RedialCall
4655 +------------------------------------------------------------------------------
4656 | Purpose : Checks for a Redial Call.
4657 |
4658 | Parameters : at_cmd_id - AT Command Identifier.
4659 | (AT_CMD_H OR AT_CMD_CHUP)
4660 |
4661 | Return : BOOL
4662 +------------------------------------------------------------------------------
4663 */
4664
4665 LOCAL BOOL cmhCC_check_RedialCall( T_ACI_AT_CMD at_cmd_id )
4666 {
4667 SHORT cId;
4668 int i;
4669
4670 TRACE_FUNCTION ("cmhCC_check_RedialCall()");
4671
4672 cId = psaCC_ctbFindCall( OWN_SRC_INV, CS_ACT_REQ, CT_MOC_RDL);
4673
4674 if( cId NEQ NO_ENTRY )
4675 {
4676 #ifdef SIM_TOOLKIT
4677 if( ( ccShrdPrm.ctb[cId]->SATinv & SAT_REDIAL ) )
4678 { /* This is the call invoked by SAT */
4679 T_ACI_SAT_TERM_RESP resp_data;
4680 psaSAT_InitTrmResp( &resp_data );
4681 psaSAT_SendTrmResp( RSLT_USR_CLR_DWN, &resp_data );
4682 }
4683 #endif /* SIM_TOOLKIT */
4684
4685 ccShrdPrm.ctb[cId]->calType = CT_MOC;
4686
4687 if(rdlPrm.rdlMod EQ AUTOM_REPEAT_ON)
4688 {
4689 for(i = 0; i < CMD_SRC_MAX; i++)
4690 {
4691 R_AT(RAT_RDL, (T_ACI_CMD_SRC)i)(REDIAL_STOP);
4692 }
4693 rdlPrm.rdlcId = NO_ENTRY;
4694 }
4695 if (at_cmd_id EQ AT_CMD_H)
4696 {
4697 ccShrdPrm.ctb[cId]->nrmCs = MNCC_CAUSE_CALL_CLEAR;
4698 psaCC_ClearCall (cId);
4699 psaCC_FreeCtbNtry (cId);
4700 return( TRUE );
4701 }
4702 }
4703 else
4704 {/* redial timer is running */
4705 if ((rdlPrm.rdlMod EQ AUTOM_REPEAT_ON) AND (rdlPrm.rdlcId NEQ NO_ENTRY))
4706 {
4707 #ifdef SIM_TOOLKIT
4708 if( ( ccShrdPrm.ctb[rdlPrm.rdlcId]->SATinv & SAT_REDIAL ) )
4709 { /* This is the call invoked by SAT */
4710 T_ACI_SAT_TERM_RESP resp_data;
4711
4712 psaSAT_InitTrmResp( &resp_data );
4713 psaSAT_SendTrmResp( RSLT_USR_CLR_DWN, &resp_data );
4714 }
4715 /* Stop the SAT maximum duration timer */
4716 if(satShrdPrm.dur)
4717 {
4718 TIMERSTOP(ACI_SAT_MAX_DUR_HND);
4719 satShrdPrm.dur = -1;
4720 }
4721 #endif /* SIM_TOOLKIT */
4722 /* clear call id entry in call table if marked as used */
4723 psaCC_FreeCtbNtry (rdlPrm.rdlcId);
4724
4725 for(i = 0; i < CMD_SRC_MAX; i++)
4726 {
4727 R_AT(RAT_RDL, (T_ACI_CMD_SRC)i)(REDIAL_STOP);
4728 }
4729 /* reset some redial parameter */
4730 rdlPrm.rdlcId = NO_ENTRY;
4731 return( TRUE );
4732 }
4733 }
4734 return( FALSE );
4735 }
4736
4737 /*
4738 +------------------------------------------------------------------------------
4739 | Function : cmhCC_check_pending_satCall()
4740 +------------------------------------------------------------------------------
4741 | Purpose : Checks for a Redial Call.
4742 |
4743 | Parameters : None
4744 |
4745 | Return : BOOL
4746 +------------------------------------------------------------------------------
4747 */
4748 LOCAL BOOL cmhCC_check_pending_satCall( )
4749 {
4750 SHORT cId; /* holds call id */
4751 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
4752 T_ACI_CLOG cmdLog; /* holds logging info */
4753 #endif
4754 /* triggered by SETUP CALL command */
4755 cId = psaCC_ctbFindCall( OWN_SRC_INV, CS_SAT_REQ, NO_VLD_CT );
4756 #ifdef FF_SAT_E
4757 if( cId EQ NO_ENTRY )
4758 {
4759 /* triggered by OPEN CHANNEL command */
4760 cId = psaCC_ctbFindCall( OWN_SRC_INV, CS_SAT_CSD_REQ, NO_VLD_CT );
4761 }
4762 #endif
4763 if( cId NEQ NO_ENTRY )
4764 {
4765 if( ( ccShrdPrm.ctb[cId]->SATinv & SAT_REDIAL ) )
4766 { /* This is the call invoked by SAT */
4767 T_ACI_SAT_TERM_RESP resp_data;
4768 psaSAT_InitTrmResp( &resp_data );
4769 psaSAT_SendTrmResp( RSLT_USR_CLR_DWN, &resp_data );
4770 }
4771 if( psaCC_ctb(cId)->SATinv )
4772 cmhSAT_UserRejCall(psaCC_ctb(cId)->calStat);
4773
4774 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
4775 cmdLog.cId = cId+1;
4776 cmdLog.retCode = AT_CMPL;
4777 rAT_PercentCLOG( &cmdLog );
4778 #endif
4779 psaCC_FreeCtbNtry (cId);
4780 return( TRUE );
4781 }
4782 #if defined (GPRS) AND defined (FF_SAT_E) AND defined (DTI)
4783 /* check for pending SAT GPRS context */
4784 else
4785 {
4786 if( cmhSAT_OpChnGPRSPend(PDP_CONTEXT_CID_INVALID, OPCH_WAIT_CNF))
4787 {
4788 cmhSAT_UserRejCntxt();
4789
4790 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
4791 cmdLog.cId = cId+1;
4792 cmdLog.retCode = AT_CMPL;
4793 rAT_PercentCLOG( &cmdLog );
4794 #endif
4795 return( TRUE );
4796 }
4797 }
4798 #endif /* GPRS AND FF_SAT_E */
4799 psaCC_FreeCtbNtry (cId);
4800 return( FALSE );
4801 }
4802
4803 /* Implements Measure 181 and 182 */
4804 /*
4805 +------------------------------------------------------------------------------
4806 | Function : chld_HoldActiveCalls
4807 +------------------------------------------------------------------------------
4808 | Purpose : Puts All Active Calls on Hold.
4809 |
4810 | Parameters : srcId - AT command source identifier.
4811 | mptyHldFlg - Points to a Flag that Helds a Call
4812 | hldCalFlg - Points to a Flag that Helds a MultiParty Call
4813 | cId - context Id
4814 |
4815 | Return : BOOL
4816 +------------------------------------------------------------------------------
4817 */
4818
4819 LOCAL BOOL chld_HoldActiveCalls( T_ACI_CMD_SRC srcId,
4820 BOOL *mptyHldFlg, BOOL *hldCalFlg, SHORT *cId)
4821 {
4822 T_CC_CMD_PRM *pCCCmdPrm;
4823
4824 TRACE_FUNCTION("chld_HoldActiveCalls()");
4825
4826 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm;
4827 pCCCmdPrm -> mltyCncFlg = 0;
4828 pCCCmdPrm -> mltyDscFlg = 0;
4829
4830 for( *cId = 0; *cId < MAX_CALL_NR; (*cId)++ )
4831 {
4832 if (ccShrdPrm.ctb[*cId] NEQ NULL AND
4833 ccShrdPrm.ctb[*cId]->calStat EQ CS_ACT AND
4834 ccShrdPrm.ctb[*cId]->curCmd EQ AT_CMD_NONE)
4835 {
4836 if( cmhCC_getcalltype(*cId) NEQ VOICE_CALL )
4837 {
4838 pCCCmdPrm -> mltyCncFlg = 0;
4839 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_CallTypeNoHold );
4840 return( FALSE ); /* no data calls supported */
4841 }
4842
4843 if( (ccShrdPrm.ctb[*cId]->mptyStat EQ CS_IDL) OR
4844 ((ccShrdPrm.ctb[*cId]->mptyStat EQ CS_ACT) AND ((*mptyHldFlg) EQ FALSE)))
4845 {
4846 *hldCalFlg = TRUE;
4847 }
4848
4849 /* if active call is a multiparty call */
4850 if( ccShrdPrm.ctb[*cId]->mptyStat EQ CS_ACT )
4851 {
4852 *mptyHldFlg = TRUE;
4853 }
4854
4855 cmhCC_HoldCall(*cId, srcId, AT_CMD_CHLD);
4856 }
4857 }
4858 return( TRUE );
4859 }
4860
4861 /* Implements Measure 117 */
4862 /*
4863 +------------------------------------------------------------------------------
4864 | Function : chld_Rel_MultipartySpec
4865 +------------------------------------------------------------------------------
4866 | Purpose : Releases a Specific Multi Party Calls
4867 |
4868 | Parameters : srcId - AT command source identifier.
4869 | spcId - Holds specified call id.
4870 | chld_mode - CHLD Command Mode.
4871 | (CHLD_MOD_RelAnySpec OR CHLD_MOD_RelActSpec)
4872 | call
4873 |
4874 | Return : T_ACI_RETURN (ACI Functional Return Codes)
4875 +------------------------------------------------------------------------------
4876 */
4877
4878 LOCAL T_ACI_RETURN chld_Rel_MultipartySpec( T_ACI_CMD_SRC srcId, SHORT *spcId,
4879 T_ACI_CHLD_MOD chld_mode,
4880 CHAR *call )
4881 {
4882 T_CC_CMD_PRM *pCCCmdPrm;
4883 SHORT cId;
4884 SHORT dscId = -1;
4885
4886 TRACE_FUNCTION( "chld_Rel_MultypartySpec()" );
4887
4888 pCCCmdPrm = &cmhPrm[srcId].ccCmdPrm;
4889
4890 /* get specific call id */
4891 if( call EQ NULL )
4892 {
4893 TRACE_ERROR("CALL parameter is needed !!!");
4894 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
4895 return( AT_FAIL ); /* no call specified */
4896 }
4897
4898 *spcId = atoi( call );
4899
4900 if( (*spcId) EQ 0 OR (*spcId) > MAX_CALL_NR )
4901 {
4902 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
4903 return( AT_FAIL );
4904 }
4905
4906 (*spcId)--; /* adapt to call table index */
4907
4908 pCCCmdPrm -> mltyCncFlg = 0;
4909 pCCCmdPrm -> mltyDscFlg = 0;
4910
4911 if( (*spcId) EQ -1 )
4912 {
4913 for( cId = 0; cId < MAX_CALL_NR; cId++ )
4914 {
4915 if (ccShrdPrm.ctb[cId] NEQ NULL AND
4916 psaCC_ctb(cId)->mptyStat EQ CS_ACT AND
4917 psaCC_ctb(cId)->curCmd EQ AT_CMD_NONE)
4918 {
4919 psaCC_StopDTMF (cId);
4920
4921 cmhCC_ClearCall ( cId, MNCC_CAUSE_CALL_CLEAR, srcId, AT_CMD_CHLD, NULL );
4922 dscId = cId;
4923 }
4924 }
4925
4926 if( dscId NEQ -1 )
4927 {
4928 pCCCmdPrm -> CHLDmode = chld_mode;
4929 CHLDaddInfo = NO_CHLD_ADD_INFO;
4930
4931 /* inform MFW */
4932 chld_ratlog( srcId, pCCCmdPrm->CHLDmode, call, CHLD_ACT_ReleaseMpty, dscId, AT_EXCT );
4933 return( AT_EXCT );
4934 }
4935 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow );
4936 return(AT_FAIL);
4937 }
4938 return(AT_CMPL);
4939 }
4940
4941 /* Implements Measure 164 and 165 */
4942 /*
4943 +------------------------------------------------------------------------------
4944 | Function : cmhCC_disconnect_waiting_call
4945 +------------------------------------------------------------------------------
4946 | Purpose : Disconnect a waiting call with user determined user busy
4947 |
4948 | Parameters : waitId - Holds call waiting id.
4949 | at_cmd_id - AT Command Identifier.
4950 | (AT_CMD_H/AT_CMD_CHUP/AT_CMD_Z)
4951 | mltyDscFlg - Flag for MultiCall Operation
4952 |
4953 | Return : void
4954 +------------------------------------------------------------------------------
4955 */
4956
4957 LOCAL void cmhCC_disconnect_waiting_call( T_ACI_CMD_SRC srcId,
4958 SHORT waitId,
4959 T_ACI_AT_CMD at_cmd_id,
4960 USHORT *mltyDscFlg )
4961 {
4962 UBYTE idx;
4963 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
4964 T_ACI_CLOG cmdLog;
4965 #endif
4966
4967 TRACE_FUNCTION ("cmhCC_disconnect_waiting_call()");
4968
4969 cmhCC_flagCall( waitId, mltyDscFlg );
4970 ccShrdPrm.ctb[waitId]->nrmCs = MNCC_CAUSE_USER_BUSY;
4971 ccShrdPrm.ctb[waitId]->curCmd = at_cmd_id;
4972 ccShrdPrm.ctb[waitId]->curSrc = srcId;
4973 psaCC_ClearCall (waitId);
4974
4975 #if defined SMI OR defined MFW OR defined FF_MMI_RIV
4976 cmdLog.cId = waitId+1;
4977 rAT_PercentCLOG( &cmdLog );
4978 #endif
4979
4980 #ifdef FF_ATI
4981 io_setRngInd (IO_RING_OFF, CRING_SERV_TYP_NotPresent, CRING_SERV_TYP_NotPresent ); /* V.24 Ring Indicator Line */
4982 #endif
4983 for( idx = 0; idx < CMD_SRC_MAX; idx++ )
4984 {
4985 R_AT( RAT_CRING_OFF, (T_ACI_CMD_SRC)idx )( waitId+1 );
4986 }
4987 }
4988
4989 /* Implements Measure 64 */
4990 /*
4991 +------------------------------------------------------------------------------
4992 | Function : cmhCC_CheckRedialTimer
4993 +------------------------------------------------------------------------------
4994 | Purpose : Checks the Redial Timer and Stops it, if neccessary
4995 |
4996 | Parameters : sim_toolkit_enable
4997 |
4998 | Return : void
4999 +------------------------------------------------------------------------------
5000 */
5001
5002 GLOBAL void cmhCC_CheckRedialTimer( BOOL sim_toolkit_enable )
5003 {
5004 int i;
5005
5006 TRACE_FUNCTION ( "cmhCC_CheckRedialTimer()" );
5007
5008 /* stop redialling timer if necessary */
5009 if (rdlPrm.rdlcId NEQ NO_ENTRY)
5010 {
5011 TIMERSTOP(ACI_REPEAT_HND);
5012
5013 #ifdef SIM_TOOLKIT
5014 if( sim_toolkit_enable )
5015 {
5016 if( ( ccShrdPrm.ctb[rdlPrm.rdlcId]->SATinv & SAT_REDIAL ) )
5017 { /* This is the call invoked by SAT */
5018 T_ACI_SAT_TERM_RESP resp_data;
5019
5020 psaSAT_InitTrmResp( &resp_data );
5021 psaSAT_SendTrmResp( RSLT_USR_CLR_DWN, &resp_data );
5022 }
5023 /* Stop SAT maximum redial duration timer */
5024 if(satShrdPrm.dur)
5025 {
5026 TIMERSTOP(ACI_SAT_MAX_DUR_HND);
5027 satShrdPrm.dur = -1;
5028 }
5029 }
5030 #endif /* SIM_TOOLKIT */
5031
5032 psaCC_FreeCtbNtry (rdlPrm.rdlcId);
5033
5034 for(i = 0; i < CMD_SRC_MAX; i++)
5035 {
5036 R_AT(RAT_RDL, (T_ACI_CMD_SRC)i)(REDIAL_STOP);
5037 }
5038
5039 /* reset some redial parameter */
5040 rdlPrm.rdlcId = NO_ENTRY;
5041 }
5042
5043 }
5044
5045 #ifdef TI_PS_FF_AT_CMD_P_ECC
5046 /*
5047 +--------------------------------------------------------------------+
5048 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
5049 | STATE : code ROUTINE : sAT_PercentECC |
5050 +--------------------------------------------------------------------+
5051 | Description : This is the functional counterpart to the AT%ECC
5052 | set command which sets additional ECC to local array
5053 | in ACI
5054 | Parameters : <srcId> : Source Id
5055 | <index> : Index
5056 | <ecc_numer> : ECC number to be stored
5057 |
5058 | Return : T_ACI_RETURN
5059 +---------------------------------------------------------------------
5060 */
5061
5062 GLOBAL T_ACI_RETURN sAT_PercentECC( T_ACI_CMD_SRC srcId,
5063 U8 index,
5064 char *ecc_number)
5065 {
5066 TRACE_FUNCTION ("sAT_PercentECC ()");
5067
5068 /*
5069 *-------------------------------------------------------------------
5070 * check command source
5071 *-------------------------------------------------------------------
5072 */
5073 if(!cmh_IsVldCmdSrc (srcId))
5074 {
5075 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
5076 return( AT_FAIL );
5077 }
5078 /*
5079 *-------------------------------------------------------------------
5080 * check for valid index
5081 *-------------------------------------------------------------------
5082 */
5083 if (index >= ADDITIONAL_ECC_NUMBER_MAX)
5084 {
5085 ACI_ERR_DESC(ACI_ERR_CLASS_Cme, CME_ERR_InvIdx);
5086 return( AT_FAIL );
5087 }
5088 /*
5089 *-------------------------------------------------------------------
5090 * check for valid length of ECC number
5091 *-------------------------------------------------------------------
5092 */
5093 if ((!strlen(ecc_number)) OR (strlen(ecc_number) > ADDITIONAL_ECC_NUMBER_LENGTH))
5094 {
5095 ACI_ERR_DESC(ACI_ERR_CLASS_Cme, CME_ERR_TxtToLong);
5096 return( AT_FAIL );
5097 }
5098
5099 strncpy(additional_ecc_numbers[index], ecc_number, strlen(ecc_number));
5100 return(AT_CMPL);
5101 }
5102
5103 /*
5104 +-----------------------------------------------------------------------------------+
5105 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
5106 | STATE : code ROUTINE : cmhCC_additional_ecc_numbers_initialize |
5107 +-----------------------------------------------------------------------------------+
5108 | Description : Initializes array which stores ECC numbers to default values
5109 |
5110 | Parameters : void
5111 | Return : void
5112 +------------------------------------------------------------------------------------
5113 */
5114
5115 GLOBAL void cmhCC_additional_ecc_numbers_initialize(void)
5116 {
5117 TRACE_FUNCTION("cmhCC_additional_ecc_numbers_initialize()");
5118 //memset(additional_ecc_numbers, 0x00, ADDITIONAL_ECC_NUMBER_MAX*(ADDITIONAL_ECC_NUMBER_LENGTH));
5119 memset(additional_ecc_numbers, 0x00, ADDITIONAL_ECC_NUMBER_MAX*(ADDITIONAL_ECC_NUMBER_LENGTH+1)); //OMAPS00117704/OMAPS00117705
5120 }
5121
5122 /*
5123 +---------------------------------------------------------------------------+
5124 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
5125 | STATE : code ROUTINE : cmhCC_isNrInAdditionalECC |
5126 +---------------------------------------------------------------------------+
5127 | Description : Checks the passed number with additional ECC numbers
5128 |
5129 | Parameters : <number> : Dialed number
5130 | Return : BOOL
5131 +----------------------------------------------------------------------------
5132 */
5133
5134 GLOBAL BOOL cmhCC_isNrInAdditionalECC(char *number)
5135 {
5136 U8 idx;
5137
5138 TRACE_FUNCTION("cmhCC_isNrInAdditionalECC()");
5139
5140 for (idx=0; idx < ADDITIONAL_ECC_NUMBER_MAX; idx++)
5141 {
5142 if (!strcmp(number, additional_ecc_numbers[idx]))
5143 {
5144 return (TRUE);
5145 }
5146 }
5147 return (FALSE);
5148 }
5149 #endif /* TI_PS_FF_AT_CMD_P_ECC */
5150
5151 /*
5152 +--------------------------------------------------------------------+
5153 | PROJECT : GSM-PS (6147) MODULE : CMH_CCS |
5154 | STATE : code ROUTINE : sAT_PlusCVHU |
5155 +--------------------------------------------------------------------+
5156
5157 PURPOSE : This is a set call for +CVHU for the control of the voice
5158 hangup
5159
5160 */
5161 GLOBAL T_ACI_RETURN sAT_PlusCVHU ( T_ACI_CMD_SRC srcId, T_ACI_CVHU_MODE mode)
5162 {
5163 TRACE_FUNCTION("sAT_PlusCVHU()");
5164
5165 /*
5166 *-------------------------------------------------------------------
5167 * check command source
5168 *-------------------------------------------------------------------
5169 */
5170 if(!cmh_IsVldCmdSrc (srcId))
5171 {
5172 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
5173 return( AT_FAIL );
5174 }
5175
5176 switch(mode)
5177 {
5178 case CVHU_DropDTR_IGNORED:
5179 case CVHU_DropDTR_ATH_IGNORED:
5180 case CVHU_DropDTR_Same_AndD:
5181 ccShrdPrm.cvhu = mode;
5182 return(AT_CMPL);
5183 default:
5184 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
5185 return( AT_FAIL );
5186 }
5187 }
5188 /*==== EOF ========================================================*/