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