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