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

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