FreeCalypso > hg > freecalypso-citrine
comparison g23m-aci/aci/psa_ccf.c @ 0:75a11d740a02
initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 09 Jun 2016 00:02:41 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:75a11d740a02 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GSM-PS (6147) | |
4 | Modul : PSA_CCF | |
5 +----------------------------------------------------------------------------- | |
6 | Copyright 2002 Texas Instruments Berlin, AG | |
7 | All rights reserved. | |
8 | | |
9 | This file is confidential and a trade secret of Texas | |
10 | Instruments Berlin, AG | |
11 | The receipt of or possession of this file does not convey | |
12 | any rights to reproduce or disclose its contents or to | |
13 | manufacture, use, or sell anything it may describe, in | |
14 | whole, or in part, without the specific written consent of | |
15 | Texas Instruments Berlin, AG. | |
16 +----------------------------------------------------------------------------- | |
17 | Purpose : This module defines the functions for the protocol | |
18 | stack adapter for call control. | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifndef PSA_CCF_C | |
23 #define PSA_CCF_C | |
24 #endif | |
25 | |
26 #include "config.h" | |
27 #include "fixedconf.h" | |
28 #include "condat-features.h" | |
29 #include "aci_conf.h" | |
30 | |
31 #include "aci_all.h" | |
32 | |
33 #undef TRACING | |
34 | |
35 /*==== INCLUDES ===================================================*/ | |
36 | |
37 #include "l4_tim.h" | |
38 #include "ccdapi.h" | |
39 | |
40 #include "aci_cmh.h" | |
41 #include "ati_cmd.h" | |
42 #include "aci_cmd.h" | |
43 #include "phb.h" | |
44 | |
45 #ifdef FAX_AND_DATA | |
46 #include "aci_fd.h" | |
47 #endif /* of #ifdef FAX_AND_DATA */ | |
48 | |
49 #include "aci.h" | |
50 #include "psa.h" | |
51 #include "psa_cc.h" | |
52 #include "psa_mmi.h" | |
53 #include "psa_ss.h" | |
54 #include "cmh.h" | |
55 #include "cmh_cc.h" | |
56 #include "psa_util.h" | |
57 #include "cmh_phb.h" | |
58 #include "psa_sim.h" | |
59 #include "aci_mem.h" | |
60 #include "hl_audio_drv.h" | |
61 | |
62 #include "gdi.h" | |
63 #include "rtcdrv.h" | |
64 #include "audio.h" | |
65 #include "aoc.h" | |
66 | |
67 #ifdef SIM_TOOLKIT | |
68 #include "psa_sat.h" | |
69 #include "cmh_sat.h" | |
70 #endif /* SIM_TOOLKIT */ | |
71 | |
72 /*==== CONSTANTS ==================================================*/ | |
73 #define MAX_MOCTI_NR (7) /* max number of ti's for MOC */ | |
74 #define SA_DEL ('-') /* subaddress delimiter */ | |
75 | |
76 #define MAX_ITM (5) /* max number of items per line */ | |
77 #define ITM_WDT (14) /* item width in chars */ | |
78 #define HDR_WDT (10) /* header width in chars */ | |
79 | |
80 /*modify by dongfeng for ASTec28850, ASTec27950*/ | |
81 #define EMRGNCY_NUM {"112","911",""} | |
82 /* default emergency numbers */ | |
83 | |
84 #define EMRGNCY_NUM_NS {"118","119","000","08","110","999",""} /* additional default emergency */ | |
85 /* numbers for use without SIM */ | |
86 | |
87 | |
88 /*==== TYPES ======================================================*/ | |
89 | |
90 | |
91 /*==== EXPORT =====================================================*/ | |
92 | |
93 | |
94 /*==== VARIABLES ==================================================*/ | |
95 LOCAL UBYTE tiPool = 0xFF; /* holds pool of transaction identifiers */ | |
96 | |
97 LOCAL const CHAR * const ec_string[] = EMRGNCY_NUM; | |
98 LOCAL const CHAR * const ec_string_ns[] = EMRGNCY_NUM_NS; | |
99 | |
100 EXTERN T_ACI_CUSCFG_PARAMS cuscfgParams; | |
101 EXTERN SHORT Ext_USSD_Res_Pending_sId; | |
102 | |
103 /* Implements Measure#32: Row 1245, 1277 & 1312 */ | |
104 const char * const format_2X_str="%02X"; | |
105 | |
106 /* | |
107 * Phonebook search list | |
108 * | |
109 * Description : this is the list of phonebooks, which will be searched | |
110 * for known entries. This is done during phonebook | |
111 * dialling and the indication of incoming calls. It is | |
112 * important to leave the EOL indicator at the end of | |
113 * the list to terminate the list. | |
114 * Available phonebooks: | |
115 * | |
116 * ECC Emergency call numbers | |
117 * ADN Abbreviated dialing number | |
118 * FDN Fixed dialing number | |
119 * BDN Barred dialing number | |
120 * LDN Last dialing number | |
121 * LRN Last received number | |
122 * SDN Service dialing number | |
123 */ | |
124 | |
125 const SHORT phbSrchLst[] = | |
126 { | |
127 ADN, | |
128 SDN, | |
129 FDN, | |
130 /*--- EOL -------------------------------------------------------*/ | |
131 -1 | |
132 }; | |
133 | |
134 /*==== FUNCTIONS ==================================================*/ | |
135 | |
136 LOCAL UBYTE psaCC_handleInternatPlus( char *number ); | |
137 | |
138 LOCAL CHAR *psaCC_ctbAdr2Num ( CHAR *pNumBuf, UBYTE maxSize, UBYTE *num, | |
139 UBYTE c_num, UBYTE ton); | |
140 | |
141 /* | |
142 +-------------------------------------------------------------------+ | |
143 | PROJECT : GSM-PS (6147) MODULE : PSA_CCS | | |
144 | ROUTINE : psaCC_send_satevent | | |
145 +-------------------------------------------------------------------+ | |
146 | |
147 PURPOSE : Tries to send an event to SAT. | |
148 | |
149 */ | |
150 GLOBAL void psaCC_send_satevent( UBYTE event, | |
151 SHORT callId , | |
152 T_CC_INITIATER actionSrc, | |
153 BOOL check_SatDiscEvent ) | |
154 { | |
155 /* DOES NOTHING IF SIM TOOLKIT IS NOT HERE */ | |
156 #ifdef SIM_TOOLKIT /* monitoring for SAT */ | |
157 T_CC_CALL_TBL * pCtbNtry; /* holds pointer to call table entry */ | |
158 | |
159 pCtbNtry = ccShrdPrm.ctb[callId]; | |
160 | |
161 if( check_SatDiscEvent EQ TRUE ) /* not sure whether this is needed */ | |
162 { | |
163 if ( !pCtbNtry -> SatDiscEvent ) | |
164 { | |
165 pCtbNtry -> SatDiscEvent = TRUE; | |
166 if ( psaSAT_ChkEventList(event) ) | |
167 { | |
168 cmhSAT_EventDwn( event, callId, actionSrc ); | |
169 } | |
170 } | |
171 } | |
172 else | |
173 { | |
174 if ( psaSAT_ChkEventList(event) ) | |
175 { | |
176 cmhSAT_EventDwn( event, callId, actionSrc ); | |
177 } | |
178 } | |
179 #endif /* SIM_TOOLKIT */ | |
180 } | |
181 | |
182 /* | |
183 +-------------------------------------------------------------------+ | |
184 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
185 | ROUTINE : psaCC_ctbNewEntry | | |
186 +-------------------------------------------------------------------+ | |
187 | |
188 PURPOSE : returns the call table index for a free entry to be used, | |
189 otherwise the function return -1 to indicate that no | |
190 entry is free. | |
191 | |
192 NOTE: Having the condition to consider a call table | |
193 entry as be available to be reused not only | |
194 if ntryUsdFlg equals FALSE, but also if | |
195 calStat equals CS_IDL seems to be undesirable. | |
196 | |
197 */ | |
198 | |
199 GLOBAL SHORT psaCC_ctbNewEntry ( void ) | |
200 { | |
201 SHORT ctbIdx; /* holds call table index */ | |
202 | |
203 for (ctbIdx = 0; ctbIdx < MAX_CALL_NR; ctbIdx++) | |
204 { | |
205 if (ccShrdPrm.ctb[ctbIdx] EQ NULL) | |
206 { | |
207 psaCC_InitCtbNtry( ctbIdx ); | |
208 return( ctbIdx ); | |
209 } | |
210 } | |
211 return( -1 ); | |
212 } | |
213 | |
214 | |
215 /* | |
216 +-------------------------------------------------------------------+ | |
217 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
218 | ROUTINE : psaCC_ctbFindTi | | |
219 +-------------------------------------------------------------------+ | |
220 | |
221 PURPOSE : returns the call table index for the entry that holds | |
222 call parameters for the passed transaction identifier. | |
223 Returning -1 indicates that the passed ti was not found. | |
224 */ | |
225 | |
226 GLOBAL SHORT psaCC_ctbFindTi ( UBYTE ti2Find ) | |
227 { | |
228 SHORT ctbIdx; /* holds call table index */ | |
229 | |
230 for( ctbIdx = 0; ctbIdx < MAX_CALL_NR; ctbIdx++ ) | |
231 { | |
232 T_CC_CALL_TBL *ctbx = ccShrdPrm.ctb[ctbIdx]; | |
233 | |
234 if (ctbx NEQ NULL AND | |
235 ctbx->ti EQ ti2Find ) | |
236 | |
237 return( ctbIdx ); | |
238 } | |
239 | |
240 return( -1 ); | |
241 } | |
242 | |
243 /* | |
244 +-------------------------------------------------------------------+ | |
245 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
246 | ROUTINE : psaCC_ctbFindCall | | |
247 +-------------------------------------------------------------------+ | |
248 | |
249 PURPOSE : returns the call table index for the entry that holds | |
250 call parameters for the call with the searched call owner, | |
251 call status and call type. | |
252 Returning -1 indicates that no such call was found. | |
253 */ | |
254 | |
255 GLOBAL SHORT psaCC_ctbFindCall ( T_OWN calOwn, | |
256 T_CC_CLST calStat, | |
257 T_CC_CLTP calType ) | |
258 { | |
259 SHORT ctbIdx; /* holds call table index */ | |
260 | |
261 for( ctbIdx = 0; ctbIdx < MAX_CALL_NR; ctbIdx++ ) | |
262 { | |
263 T_CC_CALL_TBL *ctbx = ccShrdPrm.ctb[ctbIdx]; | |
264 | |
265 if (ctbx NEQ NULL AND | |
266 ctbx->calStat EQ calStat) | |
267 { | |
268 if( calOwn EQ OWN_SRC_INV OR | |
269 ctbx->calOwn EQ calOwn ) | |
270 { | |
271 if( calType EQ NO_VLD_CT OR | |
272 ctbx->calType EQ calType ) | |
273 | |
274 return( ctbIdx ); | |
275 } | |
276 } | |
277 } | |
278 | |
279 return( -1 ); | |
280 } | |
281 | |
282 /* | |
283 +-------------------------------------------------------------------+ | |
284 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
285 | ROUTINE : psaCC_ctbCallInUse | | |
286 +-------------------------------------------------------------------+ | |
287 | |
288 PURPOSE : checks the call table if there is a call in use by a | |
289 owner, or if the call table is idle. The function returns | |
290 TRUE or FALSE. | |
291 */ | |
292 | |
293 GLOBAL BOOL psaCC_ctbCallInUse ( void ) | |
294 { | |
295 SHORT ctbIdx; /* holds call table index */ | |
296 | |
297 for( ctbIdx = 0; ctbIdx < MAX_CALL_NR; ctbIdx++ ) | |
298 { | |
299 T_CC_CALL_TBL *ctbx = ccShrdPrm.ctb[ctbIdx]; | |
300 | |
301 if (ctbx NEQ NULL) | |
302 { | |
303 switch( ctbx->calStat ) | |
304 { | |
305 case( CS_ACT ): | |
306 case( CS_ACT_REQ ): | |
307 case( CS_HLD_REQ ): | |
308 case( CS_HLD ): | |
309 case( CS_DSC_REQ ): | |
310 case( CS_CPL_REQ ): | |
311 case( CS_MDF_REQ ): | |
312 if( ctbx->calOwn NEQ (T_OWN)CMD_SRC_NONE ) | |
313 return( TRUE ); | |
314 } | |
315 } | |
316 } | |
317 | |
318 return( FALSE ); | |
319 } | |
320 | |
321 //TISH, patch for OMAPS00110151/OMAPS00130693 | |
322 //start | |
323 GLOBAL SHORT psaCC_ctbCountActiveCall ( void ) | |
324 { | |
325 SHORT ctbIdx; /* holds call table index */ | |
326 SHORT activeCallNum=0; | |
327 for( ctbIdx = 0; ctbIdx < MAX_CALL_NR; ctbIdx++ ) | |
328 { | |
329 T_CC_CALL_TBL *ctbx = ccShrdPrm.ctb[ctbIdx]; | |
330 | |
331 if (ctbx NEQ NULL && ctbx->calStat EQ CS_ACT) | |
332 activeCallNum++; | |
333 } | |
334 return activeCallNum; | |
335 } | |
336 //end | |
337 | |
338 /* | |
339 +-------------------------------------------------------------------+ | |
340 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
341 | ROUTINE : psaCC_ctbAnyCallInUse | | |
342 +-------------------------------------------------------------------+ | |
343 | |
344 PURPOSE : checks the call table if there is a any call in use, | |
345 or if the call table is idle. The function returns | |
346 TRUE or FALSE. | |
347 */ | |
348 | |
349 GLOBAL BOOL psaCC_ctbAnyCallInUse ( void ) | |
350 { | |
351 SHORT ctbIdx; /* holds call table index */ | |
352 | |
353 for( ctbIdx = 0; ctbIdx < MAX_CALL_NR; ctbIdx++ ) | |
354 { | |
355 T_CC_CALL_TBL *ctbx = ccShrdPrm.ctb[ctbIdx]; | |
356 | |
357 if (ctbx NEQ NULL) | |
358 { | |
359 switch( ctbx->calStat ) | |
360 { | |
361 case( CS_ACT ): | |
362 case( CS_ACT_REQ ): | |
363 case( CS_HLD_REQ ): | |
364 case( CS_HLD ): | |
365 case( CS_DSC_REQ ): | |
366 case( CS_CPL_REQ ): | |
367 case( CS_MDF_REQ ): | |
368 return( TRUE ); | |
369 } | |
370 } | |
371 } | |
372 | |
373 return( FALSE ); | |
374 } | |
375 | |
376 | |
377 /* | |
378 +-------------------------------------------------------------------+ | |
379 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
380 | ROUTINE : psaCC_ctbDialNr2CldAdr | | |
381 +-------------------------------------------------------------------+ | |
382 | |
383 PURPOSE : this function converts a dial string into the settings | |
384 for the called address parameters for the passed call id. | |
385 The function returns -1 if an error occurs. | |
386 */ | |
387 | |
388 GLOBAL SHORT psaCC_ctbDialNr2CldAdr ( SHORT cId, char * pDialStr ) | |
389 { | |
390 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
391 char * pSubAdr; /* points to subaddress */ | |
392 | |
393 /* | |
394 *------------------------------------------------------------------- | |
395 * seach for subaddress | |
396 *------------------------------------------------------------------- | |
397 */ | |
398 pSubAdr = strchr( pDialStr, SA_DEL ); | |
399 | |
400 if ( pSubAdr ) /* subaddress found */ | |
401 { | |
402 /* | |
403 * cutoff the subaddr from the dialnumber | |
404 */ | |
405 *pSubAdr = 0x0; | |
406 pSubAdr++; | |
407 | |
408 /* | |
409 * fill in subaddress information | |
410 */ | |
411 ctb->cldPtySub.tos = MNCC_TOS_NSAP; | |
412 | |
413 ctb->cldPtySub.c_subaddr = | |
414 (UBYTE)utl_dialStr2BCD (pSubAdr, ctb->cldPtySub.subaddr, MNCC_SUB_LENGTH); | |
415 | |
416 ctb->cldPtySub.odd_even = | |
417 (ctb->cldPtySub.c_subaddr & 1) ? MNCC_OE_ODD : MNCC_OE_EVEN; | |
418 } | |
419 else /* subaddress not found */ | |
420 { | |
421 ctb->cldPtySub.tos = MNCC_TOS_NOT_PRES; | |
422 ctb->cldPtySub.odd_even = MNCC_OE_EVEN; | |
423 ctb->cldPtySub.c_subaddr = 0; | |
424 } | |
425 | |
426 /* | |
427 *------------------------------------------------------------------- | |
428 * fill in address information | |
429 *------------------------------------------------------------------- | |
430 */ | |
431 ctb->cldPty.npi = MNCC_NPI_ISDN_TEL_NUMB_PLAN; | |
432 | |
433 ctb->cldPty.ton = ((pDialStr[0] EQ '+') ? MNCC_TON_INT_NUMB : MNCC_TON_UNKNOWN); | |
434 | |
435 /* | |
436 * 00 is not an indication for an international number | |
437 if( pDialStr[0] EQ '0' AND pDialStr[1] EQ '0' ) | |
438 { | |
439 pDialStr += 2; | |
440 ctb->cldPty.ton = TON_INT_NUMB; | |
441 } | |
442 */ | |
443 | |
444 if (ctb->cldPty.called_num NEQ NULL) | |
445 { | |
446 ACI_MFREE (ctb->cldPty.called_num); | |
447 ctb->cldPty.called_num = NULL; | |
448 } | |
449 ctb->cldPty.c_called_num = | |
450 (UBYTE)utl_dialStr2BCD (pDialStr, NULL, MNCC_MAX_CC_CALLED_NUMBER); | |
451 if (ctb->cldPty.c_called_num NEQ 0) | |
452 { | |
453 ACI_MALLOC (ctb->cldPty.called_num, | |
454 ctb->cldPty.c_called_num); | |
455 (void)utl_dialStr2BCD (pDialStr, | |
456 ctb->cldPty.called_num, | |
457 ctb->cldPty.c_called_num); | |
458 } | |
459 | |
460 return( 0 ); | |
461 } | |
462 | |
463 /* | |
464 +-------------------------------------------------------------------+ | |
465 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
466 | ROUTINE : psaCC_ctbClrAdr2Num | | |
467 +-------------------------------------------------------------------+ | |
468 | |
469 PURPOSE : this function converts the parameters of the calling | |
470 address for the passed call id into a dial number. The | |
471 string is copied into the passed buffer. In case the | |
472 buffer size is not sufficient to hold the called number, | |
473 the number is cut to maxSize. The function returns a pointer | |
474 to the buffer or NULL if an error occurs. | |
475 */ | |
476 | |
477 GLOBAL CHAR *psaCC_ctbClrAdr2Num ( SHORT cId, CHAR *pNumBuf, UBYTE maxSize ) | |
478 { | |
479 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
480 | |
481 TRACE_FUNCTION ("psaCC_ctbClrAdr2Num()"); | |
482 | |
483 /* Implements Measure# 188 */ | |
484 return (psaCC_ctbAdr2Num ( pNumBuf, maxSize , ctb->clgPty.num, | |
485 ctb->clgPty.c_num, ctb->clgPty.ton)); | |
486 } | |
487 | |
488 /* | |
489 +-------------------------------------------------------------------+ | |
490 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
491 | ROUTINE : psaCC_ctbClrAdr2Sub | | |
492 +-------------------------------------------------------------------+ | |
493 | |
494 PURPOSE : this function converts the parameters of the calling | |
495 subaddress for the passed call id into a dial subnumber. | |
496 The string is copied into the passed buffer. The function | |
497 returns a pointer to the buffer or 0 if an error occurs. | |
498 */ | |
499 | |
500 GLOBAL CHAR *psaCC_ctbClrAdr2Sub ( SHORT cId, CHAR * pSubBuf ) | |
501 { | |
502 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
503 | |
504 /* | |
505 *------------------------------------------------------------------- | |
506 * convert BCD subaddress | |
507 *------------------------------------------------------------------- | |
508 */ | |
509 if (ctb->clgPtySub.c_subaddr EQ 0 ) | |
510 { | |
511 *pSubBuf = '\0'; /* empty string */ | |
512 return( NULL ); | |
513 } | |
514 utl_BCD2DialStr (ctb->clgPtySub.subaddr, pSubBuf, | |
515 ctb->clgPtySub.c_subaddr); | |
516 | |
517 return( pSubBuf ); | |
518 } | |
519 | |
520 /* | |
521 +-------------------------------------------------------------------+ | |
522 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
523 | ROUTINE : psaCC_ctbCldAdr2Num | | |
524 +-------------------------------------------------------------------+ | |
525 | |
526 PURPOSE : this function converts the parameters of the called | |
527 address for the passed call id into a dial number. The | |
528 string is copied into the passed buffer. In case the | |
529 buffer size is not sufficient to hold the called number, | |
530 the number is cut to maxSize. This is currently necessary | |
531 to protect the protocol stack from memory overwriting, as | |
532 the called party address for CC may have a size of up to | |
533 80 digits, but there may not be this room foreseen in some | |
534 phonebook entries. The function returns a pointer | |
535 to the buffer or NULL if an error occurs. | |
536 */ | |
537 | |
538 GLOBAL CHAR *psaCC_ctbCldAdr2Num ( SHORT cId, CHAR *pNumBuf, UBYTE maxSize ) | |
539 { | |
540 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
541 | |
542 /* Implements Measure# 188 */ | |
543 return (psaCC_ctbAdr2Num ( pNumBuf, maxSize ,ctb->cldPty.called_num, | |
544 ctb->cldPty.c_called_num, ctb->cldPty.ton)); | |
545 } | |
546 | |
547 /* | |
548 +-------------------------------------------------------------------+ | |
549 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
550 | ROUTINE : psaCC_ctbCldAdr2Sub | | |
551 +-------------------------------------------------------------------+ | |
552 | |
553 PURPOSE : this function converts the parameters of the called | |
554 subaddress for the passed call id into a dial subnumber. | |
555 The string is copied into the passed buffer. The function | |
556 returns a pointer to the buffer or 0 if an error occurs. | |
557 */ | |
558 | |
559 GLOBAL CHAR *psaCC_ctbCldAdr2Sub ( SHORT cId, CHAR * pSubBuf ) | |
560 { | |
561 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
562 | |
563 /* | |
564 *------------------------------------------------------------------- | |
565 * convert BCD subaddress | |
566 *------------------------------------------------------------------- | |
567 */ | |
568 if (ctb->cldPtySub.c_subaddr EQ 0 ) | |
569 { | |
570 *pSubBuf = '\0'; /* empty string */ | |
571 return( NULL ); | |
572 } | |
573 utl_BCD2DialStr (ctb->cldPtySub.subaddr, pSubBuf, | |
574 ctb->cldPtySub.c_subaddr); | |
575 | |
576 return( pSubBuf ); | |
577 } | |
578 | |
579 /* | |
580 +-------------------------------------------------------------------+ | |
581 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
582 | ROUTINE : psaCC_ctbRdrAdr2Num | | |
583 +-------------------------------------------------------------------+ | |
584 | |
585 PURPOSE : this function converts the parameters of the redirecting | |
586 address for the passed call id into a dial number. The | |
587 string is copied into the passed buffer. In case the | |
588 buffer size is not sufficient to hold the called number, | |
589 the number is cut to maxSize. The function returns a pointer | |
590 to the buffer or NULL if an error occurs. | |
591 */ | |
592 | |
593 GLOBAL CHAR *psaCC_ctbRdrAdr2Num ( SHORT cId, CHAR *pNumBuf, UBYTE maxSize ) | |
594 { | |
595 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
596 | |
597 /* Implements Measure# 189 */ | |
598 return (psaCC_ctbAdr2Num ( pNumBuf, maxSize ,ctb->rdrPty.redir_num, | |
599 ctb->rdrPty.c_redir_num, ctb->rdrPty.ton)); | |
600 } | |
601 | |
602 /* | |
603 +-------------------------------------------------------------------+ | |
604 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
605 | ROUTINE : psaCC_ctbRdrAdr2Sub | | |
606 +-------------------------------------------------------------------+ | |
607 | |
608 PURPOSE : this function converts the parameters of the redirecting | |
609 subaddress for the passed call id into a dial subnumber. | |
610 The string is copied into the passed buffer. The function | |
611 returns a pointer to the buffer or 0 if an error occurs. | |
612 */ | |
613 | |
614 GLOBAL CHAR *psaCC_ctbRdrAdr2Sub ( SHORT cId, CHAR * pSubBuf ) | |
615 { | |
616 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
617 | |
618 /* | |
619 *------------------------------------------------------------------- | |
620 * convert BCD subaddress | |
621 *------------------------------------------------------------------- | |
622 */ | |
623 if (ctb->rdrPtySub.c_subaddr EQ 0 ) | |
624 { | |
625 *pSubBuf = '\0'; /* empty string */ | |
626 return( NULL ); | |
627 } | |
628 utl_BCD2DialStr (ctb->rdrPtySub.subaddr, pSubBuf, | |
629 ctb->rdrPtySub.c_subaddr); | |
630 | |
631 return( pSubBuf ); | |
632 } | |
633 | |
634 /* | |
635 +-------------------------------------------------------------------+ | |
636 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
637 | ROUTINE : psaCC_ctbGetAplha | | |
638 +-------------------------------------------------------------------+ | |
639 | |
640 PURPOSE : this function returns the pointer of the aplha identifier | |
641 in the call table for the specified call. If no alpha | |
642 identifier is available a NULL pointer will be returned. | |
643 */ | |
644 | |
645 GLOBAL T_ACI_PB_TEXT *psaCC_ctbGetAlpha ( SHORT cId ) | |
646 { | |
647 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
648 | |
649 if( ctb->alphIdUni.len EQ 0 ) | |
650 | |
651 return( NULL ); | |
652 | |
653 else | |
654 | |
655 return( &ctb->alphIdUni ); | |
656 } | |
657 | |
658 /* | |
659 +-------------------------------------------------------------------+ | |
660 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
661 | ROUTINE : psaCC_chgCalTypCnt | | |
662 +-------------------------------------------------------------------+ | |
663 | |
664 PURPOSE : this function modifies the call type counter (MOC/MTC) | |
665 defined by the passed call id by the passed delta value. | |
666 | |
667 NOTE: The purpose of this function is to be able to set | |
668 ccShrdPrm.TCHasg to FALSE if all calls are gone. | |
669 Nice try, but this could achieved more easily by | |
670 having a clean call table management. | |
671 Misconcepted code. | |
672 | |
673 */ | |
674 | |
675 GLOBAL void psaCC_chngCalTypCnt ( SHORT cId, SHORT dlt ) | |
676 { | |
677 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
678 | |
679 TRACE_EVENT_P3 ("MOC = %d, MTC = %d, cId = %d", | |
680 (int)ccShrdPrm.nrOfMOC, (int)ccShrdPrm.nrOfMTC, (int)cId); | |
681 | |
682 switch( ctb->calType ) | |
683 { | |
684 case( CT_MOC ): | |
685 | |
686 ccShrdPrm.nrOfMOC += dlt; | |
687 | |
688 if( ccShrdPrm.nrOfMOC < 0 ) ccShrdPrm.nrOfMOC = 0; | |
689 | |
690 break; | |
691 | |
692 case( CT_MTC ): | |
693 | |
694 ccShrdPrm.nrOfMTC += dlt; | |
695 | |
696 if( ccShrdPrm.nrOfMTC < 0 ) ccShrdPrm.nrOfMTC = 0; | |
697 | |
698 break; | |
699 | |
700 case( CT_MOC_RDL): | |
701 | |
702 break; | |
703 | |
704 default: | |
705 | |
706 TRACE_EVENT( "UNEXP CALL TYPE IN CTB" ); | |
707 } | |
708 | |
709 if (ctb->calType NEQ CT_MOC_RDL) | |
710 { | |
711 if (ccShrdPrm.nrOfMTC EQ 0 AND /* update state of TCH assignment */ | |
712 ccShrdPrm.nrOfMOC EQ 0) | |
713 { | |
714 /* If there is any call in CS_ACT_REQ state then do not disable vocoder */ | |
715 if(psaCC_ctbFindCall( (T_OWN)CMD_SRC_NONE, CS_ACT_REQ, CT_MTC ) < 0) | |
716 { | |
717 ccShrdPrm.TCHasg = FALSE; | |
718 } | |
719 cmhCC_TTY_Control (cId, TTY_STOP); | |
720 } | |
721 } | |
722 | |
723 } | |
724 | |
725 | |
726 /* | |
727 +-------------------------------------------------------------------+ | |
728 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
729 | ROUTINE : psaCC_chkPrgDesc | | |
730 +-------------------------------------------------------------------+ | |
731 | |
732 PURPOSE : this function checks for a valid progress description. | |
733 if valid, it updates the shared parameters and notifies | |
734 ACI. | |
735 */ | |
736 | |
737 GLOBAL void psaCC_chkPrgDesc ( SHORT cId, UBYTE prgDesc, UBYTE msgType ) | |
738 { | |
739 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
740 | |
741 TRACE_FUNCTION("psaCC_chkPrgDesc( )"); | |
742 | |
743 /* check in-band tones anouncement during call establishment | |
744 GSM 04.08/5.5.1 */ | |
745 | |
746 ccShrdPrm.msgType = msgType; | |
747 ctb->prgDesc = prgDesc; | |
748 | |
749 if( msgType EQ MT_SETUP OR | |
750 msgType EQ MT_ALRT OR | |
751 msgType EQ MT_PROC OR | |
752 msgType EQ MT_SYNC OR | |
753 msgType EQ MT_PROGR OR | |
754 msgType EQ MT_CONN ) | |
755 { | |
756 | |
757 if( prgDesc EQ MNCC_PROG_INBAND_AVAIL OR | |
758 prgDesc EQ MNCC_PROG_NO_END_TO_END_PLMN OR | |
759 prgDesc EQ MNCC_PROG_DEST_NON_PLMN OR | |
760 prgDesc EQ MNCC_PROG_ORIGIN_NON_PLMN OR | |
761 (prgDesc >= 6 AND prgDesc <= 20) ) | |
762 { | |
763 /* if( ccShrdPrm.TCHasg EQ TRUE ) */ | |
764 { | |
765 TRACE_EVENT("Call with In-band tones"); | |
766 if (msgType NEQ MT_SETUP) //mars for AMR can not play with mobile MT call | |
767 ctb->inBndTns = TRUE; /* implicit connect to In-band tones */ | |
768 } | |
769 } | |
770 else if ( msgType EQ MT_ALRT ) | |
771 { | |
772 cmhCC_CallAlerted(cId); | |
773 } | |
774 } | |
775 | |
776 /* check in-band tones anouncement during call disconnection | |
777 GSM 04.08/5.4.4.1.1/5.4.4.1.2 */ | |
778 else if( msgType EQ MT_DISC ) | |
779 { | |
780 if( prgDesc EQ MNCC_PROG_INBAND_AVAIL ) | |
781 { | |
782 TRACE_EVENT("Call with In-band tones"); | |
783 if (msgType NEQ MT_SETUP) //mars for AMR can not play with mobile MT call | |
784 ctb->inBndTns = TRUE; | |
785 } | |
786 else | |
787 ctb->inBndTns = FALSE; | |
788 } | |
789 | |
790 /* | |
791 * In the case of MT_DISC (mncc_disconnect_ind) cmhCC_CallDisconnected() | |
792 * called the CPI macro | |
793 */ | |
794 if(MT_DISC NEQ msgType) | |
795 { | |
796 cmhCC_CallProceeding (cId); | |
797 } | |
798 | |
799 /* Attach/Detach user connection as required */ | |
800 psaCC_setSpeechMode (); | |
801 } | |
802 | |
803 /* | |
804 +-------------------------------------------------------------------+ | |
805 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
806 | ROUTINE : psaCC_getMOCTi | | |
807 +-------------------------------------------------------------------+ | |
808 | |
809 PURPOSE : this function selects a ti out of a pool of valid ti's | |
810 and inserts it into the passed call table entry if the | |
811 table index is valid. if no ti is available the function | |
812 returns -1 otherwise it returns the selected ti. | |
813 a bit of the pool stands for a valid ti. | |
814 0 indicates a used ti, 1 indicates a free ti. | |
815 */ | |
816 GLOBAL SHORT psaCC_getMOCTi( SHORT cId ) | |
817 { | |
818 UBYTE idx; /* holds pool idx */ | |
819 | |
820 for( idx = 0; idx < MAX_MOCTI_NR; idx++ ) | |
821 { | |
822 if( tiPool & (1u << idx) ) | |
823 { | |
824 tiPool &= ~(1u << idx); | |
825 | |
826 if( cId >= 0 ) | |
827 psaCC_ctb(cId)->ti = idx; | |
828 return( idx ); | |
829 } | |
830 } | |
831 return( -1 ); | |
832 } | |
833 /* | |
834 +-------------------------------------------------------------------+ | |
835 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
836 | ROUTINE : psaCC_retMOCTi | | |
837 +-------------------------------------------------------------------+ | |
838 | |
839 PURPOSE : this function returns a used ti to the ti pool if the | |
840 call was a MOC. the ti is free for the next MOC | |
841 afterwards. | |
842 a bit of the pool stands for a valid ti. | |
843 0 indicates a used ti, 1 indicates a free ti. | |
844 */ | |
845 | |
846 GLOBAL void psaCC_retMOCTi( UBYTE ti ) | |
847 { | |
848 if( ti < MAX_MOCTI_NR ) | |
849 | |
850 tiPool |= (0x01 << ti); | |
851 } | |
852 | |
853 | |
854 /* | |
855 +-------------------------------------------------------------------+ | |
856 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
857 | ROUTINE : psaCC_setSpeechMode | | |
858 +-------------------------------------------------------------------+ | |
859 | |
860 PURPOSE : this function attachs or detachs the user connection. | |
861 | |
862 */ | |
863 | |
864 GLOBAL void psaCC_setSpeechMode (void) | |
865 { | |
866 SHORT ctbIdx; /* holds call table index */ | |
867 BOOL user_attach; /* Attach/Detach user connection */ | |
868 | |
869 TRACE_FUNCTION ("psaCC_setSpeechMode()"); | |
870 | |
871 user_attach = FALSE; | |
872 | |
873 if (((ccShrdPrm.chMod EQ MNCC_CHM_SPEECH) OR | |
874 (ccShrdPrm.chMod EQ MNCC_CHM_SPEECH_V2) OR | |
875 (ccShrdPrm.chMod EQ MNCC_CHM_SPEECH_V3)) AND (ccShrdPrm.syncCs NEQ MNCC_CAUSE_REEST_STARTED)) | |
876 { | |
877 /* | |
878 * The channel mode is appropriate for speech. | |
879 * Find any non-IDLE speech call where inband tones are available | |
880 * or the active state has been reached. If there is such a call, | |
881 * attach the user connection, otherwise detach it. | |
882 */ | |
883 for (ctbIdx = 0; ctbIdx < MAX_CALL_NR; ctbIdx++) | |
884 { | |
885 T_CC_CALL_TBL *ctbx = ccShrdPrm.ctb[ctbIdx]; | |
886 | |
887 if ((ctbx NEQ NULL) AND | |
888 (ctbx->calStat NEQ NO_VLD_CS) AND | |
889 (ctbx->calStat NEQ CS_IDL) AND | |
890 (ctbx->calStat NEQ CS_HLD)) | |
891 { | |
892 /* | |
893 * The call is non-Idle and non-Hold. Check for inband tones, | |
894 * active or call modification requested state. | |
895 */ | |
896 if ( ctbx->inBndTns OR | |
897 (ctbx->calStat EQ CS_ACT) OR | |
898 (ctbx->calStat EQ CS_CPL_REQ) OR | |
899 (ctbx->calStat EQ CS_MDF_REQ)) | |
900 { | |
901 //TISH: open vocoder if there is active call | |
902 if (ctbx->calStat EQ CS_ACT) | |
903 { | |
904 user_attach = TRUE; | |
905 break; | |
906 } | |
907 if (ccShrdPrm.TCHasg NEQ TRUE) | |
908 { | |
909 /* CCBS: 4.08/5.4.4.2ff do not connect to the in-band tone/announcement | |
910 */ | |
911 } | |
912 else | |
913 { | |
914 user_attach = TRUE; | |
915 break; | |
916 } | |
917 } | |
918 } | |
919 } | |
920 } | |
921 | |
922 hl_drv_set_vocoder_state(user_attach); | |
923 | |
924 /* Implements Measure#32: Row 1237 & 1238 */ | |
925 if(user_attach) | |
926 { | |
927 TRACE_EVENT("User state: attach user"); | |
928 } | |
929 else | |
930 { | |
931 TRACE_EVENT("User state: detach user"); | |
932 } | |
933 } | |
934 | |
935 /* | |
936 +-------------------------------------------------------------------+ | |
937 | PROJECT : GSM-PS (6147) MODULE : CMH_CC | | |
938 | ROUTINE : psaCC_phbSrchNum | | |
939 +-------------------------------------------------------------------+ | |
940 | |
941 PURPOSE : phonebook search for number | |
942 | |
943 */ | |
944 | |
945 GLOBAL void psaCC_phbSrchNum ( SHORT cId, T_CC_CLTP call_type) | |
946 { | |
947 UBYTE maxLen = MAX_ALPHA; /* maximum length of entry */ | |
948 CHAR numBuf[MAX_PHB_NUM_LEN]; /* buffers number 'number\0' */ | |
949 | |
950 TRACE_FUNCTION("psaCC_phbSrchNum"); | |
951 | |
952 switch(call_type) | |
953 { | |
954 case CT_MOC: | |
955 case CT_MOC_RDL: | |
956 case CT_NI_MOC: | |
957 if(!psaCC_ctbCldAdr2Num(cId, numBuf, MAX_PHB_NUM_LEN)) | |
958 return; | |
959 break; | |
960 case CT_MTC: | |
961 if(!psaCC_ctbClrAdr2Num (cId, numBuf, MAX_PHB_NUM_LEN)) | |
962 return; | |
963 break; | |
964 default: | |
965 return; | |
966 } | |
967 | |
968 psaCC_phbSrchNumPlnTxt( numBuf, &maxLen, &psaCC_ctb(cId)->alphIdUni ); | |
969 | |
970 return; | |
971 } | |
972 | |
973 /* | |
974 +-------------------------------------------------------------------+ | |
975 | PROJECT : GSM-PS (6147) MODULE : CMH_CC | | |
976 | ROUTINE : psaCC_phbSrchNumPlnTxt | | |
977 +-------------------------------------------------------------------+ | |
978 | |
979 PURPOSE : phonebook search for number. Returns TRUE if at least | |
980 any matching number is found. | |
981 | |
982 */ | |
983 | |
984 GLOBAL BOOL psaCC_phbSrchNumPlnTxt ( CHAR * inNum, | |
985 UBYTE * inoutMaxLen, | |
986 T_ACI_PB_TEXT * outTxt ) | |
987 { | |
988 #ifdef TI_PS_FFS_PHB | |
989 SHORT order_num; /* Order number of entry by number */ | |
990 #else | |
991 SHORT mtch = 0; /* holds number of matches */ | |
992 SHORT fstIdx; /* holds first index */ | |
993 #endif | |
994 UBYTE lstIdx; /* holds phonebook list index */ | |
995 T_PHB_RECORD ntry; /* found entry */ | |
996 | |
997 outTxt->cs = CS_NotPresent; | |
998 outTxt->len = 0; | |
999 | |
1000 for ( lstIdx = 0; phbSrchLst[lstIdx] NEQ -1; lstIdx++ ) | |
1001 { | |
1002 #ifdef TI_PS_FFS_PHB | |
1003 order_num = 0; | |
1004 if (pb_search_number ((T_PHB_TYPE)phbSrchLst[lstIdx], | |
1005 (const UBYTE*)inNum, | |
1006 &order_num) EQ PHB_OK) | |
1007 { | |
1008 /* Implements Measure #30 */ | |
1009 if (pb_sim_read_alpha_num_record ((T_PHB_TYPE)phbSrchLst[lstIdx], | |
1010 order_num, &ntry, | |
1011 NUMBER_IDX) EQ PHB_OK) | |
1012 #else | |
1013 pb_search_number ( (UBYTE)phbSrchLst[lstIdx], | |
1014 (UBYTE*)inNum, | |
1015 PHB_NEW_SEARCH, | |
1016 &fstIdx, &mtch, &ntry ); | |
1017 | |
1018 { | |
1019 if ( mtch NEQ 0 ) | |
1020 #endif | |
1021 { | |
1022 *inoutMaxLen = ( UBYTE ) MINIMUM ( ntry.tag_len, MAX_ALPHA ); | |
1023 | |
1024 while ( ( outTxt->len < *inoutMaxLen ) AND | |
1025 ( ntry.tag[outTxt->len] NEQ 0xFF ) ) | |
1026 { | |
1027 outTxt->data[outTxt->len] = ntry.tag[outTxt->len]; | |
1028 outTxt->len++; | |
1029 } | |
1030 outTxt->cs = CS_Sim; | |
1031 | |
1032 return TRUE; | |
1033 } | |
1034 } | |
1035 } | |
1036 | |
1037 return FALSE; | |
1038 } | |
1039 | |
1040 /* | |
1041 +-------------------------------------------------------------------+ | |
1042 | PROJECT : GSM-PS (6147) MODULE : CMH_CC | | |
1043 | ROUTINE : psaCC_phbMfwSrchNumPlnTxt | | |
1044 +-------------------------------------------------------------------+ | |
1045 | |
1046 PURPOSE : phonebook search for number. Returns TRUE if at least | |
1047 any matching number is found. | |
1048 | |
1049 */ | |
1050 | |
1051 GLOBAL BOOL psaCC_phbMfwSrchNumPlnTxt ( CHAR * inNum, | |
1052 T_ACI_PB_TEXT * outTxt ) | |
1053 { | |
1054 #ifdef TI_PS_FFS_PHB | |
1055 SHORT order_num; /* Order number of entry by number */ | |
1056 #else | |
1057 SHORT mtch = 0; /* holds number of matches */ | |
1058 SHORT fstIdx; /* holds first index */ | |
1059 #endif | |
1060 UBYTE maxLen; /* holds max alpha length */ | |
1061 UBYTE lstIdx; /* holds phonebook list index */ | |
1062 T_PHB_RECORD ntry; /* found entry */ | |
1063 | |
1064 TRACE_FUNCTION("psaCC_phbMfwSrchNumPlnTxt()"); | |
1065 | |
1066 outTxt->len = 0; | |
1067 | |
1068 for ( lstIdx = 0; phbSrchLst[lstIdx] NEQ -1; lstIdx++ ) | |
1069 { | |
1070 #ifdef TI_PS_FFS_PHB | |
1071 order_num = 0; | |
1072 if (pb_search_number ((T_PHB_TYPE)phbSrchLst[lstIdx], | |
1073 (const UBYTE*)inNum, | |
1074 &order_num) EQ PHB_OK) | |
1075 { | |
1076 /* Implements Measure #30 */ | |
1077 if (pb_sim_read_alpha_num_record ((T_PHB_TYPE)phbSrchLst[lstIdx], | |
1078 order_num, &ntry, | |
1079 NUMBER_IDX) EQ PHB_OK) | |
1080 #else | |
1081 pb_search_number ( (UBYTE)phbSrchLst[lstIdx], | |
1082 (UBYTE*)inNum, | |
1083 PHB_NEW_SEARCH, | |
1084 &fstIdx, &mtch, &ntry ); | |
1085 | |
1086 { | |
1087 if ( mtch NEQ 0 ) | |
1088 #endif | |
1089 { | |
1090 maxLen = ( UBYTE ) MINIMUM ( ntry.tag_len, MAX_ALPHA ); | |
1091 | |
1092 outTxt -> len = 0; | |
1093 | |
1094 while ( outTxt -> len < maxLen AND ntry.tag[outTxt -> len] NEQ 0xFF ) | |
1095 { | |
1096 outTxt -> data[outTxt -> len] = ntry.tag[outTxt -> len]; | |
1097 outTxt -> len++; | |
1098 } | |
1099 | |
1100 return TRUE; | |
1101 } | |
1102 } | |
1103 } | |
1104 | |
1105 return FALSE; | |
1106 } | |
1107 | |
1108 /* | |
1109 +-------------------------------------------------------------------+ | |
1110 | PROJECT : GSM-PS (6147) MODULE : CMH_CC | | |
1111 | ROUTINE : psaCC_phbSrchName | | |
1112 +-------------------------------------------------------------------+ | |
1113 | |
1114 PURPOSE : phonebook search for name | |
1115 | |
1116 */ | |
1117 | |
1118 GLOBAL BOOL psaCC_phbSrchName ( T_ACI_CMD_SRC srcId, | |
1119 T_ACI_PB_TEXT *srchName, | |
1120 T_CLPTY_PRM *calPrm ) | |
1121 { | |
1122 #ifdef TI_PS_FFS_PHB | |
1123 T_PHB_MATCH match_criteria; /* matching criteria */ | |
1124 SHORT order_num; /* Order number of entry by number */ | |
1125 #else | |
1126 SHORT fstIdx; /* holds first index */ | |
1127 SHORT srchRslt = 0; /* holds search result */ | |
1128 #endif | |
1129 UBYTE lstIdx; /* holds phonebook list index */ | |
1130 T_PHB_RECORD phbNtry; /* holds phonebook entry */ | |
1131 | |
1132 memset( calPrm, 0x0, sizeof(T_CLPTY_PRM)); | |
1133 | |
1134 /* | |
1135 *------------------------------------------------------------------- | |
1136 * check for name search | |
1137 *------------------------------------------------------------------- | |
1138 */ | |
1139 for( lstIdx = 0; phbSrchLst[lstIdx] NEQ -1; lstIdx++ ) | |
1140 { | |
1141 #ifdef TI_PS_FFS_PHB | |
1142 if (srcId EQ CMD_SRC_LCL) | |
1143 match_criteria = PHB_MATCH_GE; | |
1144 else | |
1145 match_criteria = PHB_MATCH_PARTIAL; | |
1146 | |
1147 order_num = 0; | |
1148 if (pb_search_name ((T_PHB_TYPE)phbSrchLst[lstIdx], | |
1149 match_criteria, | |
1150 srchName, | |
1151 &order_num) EQ PHB_OK) | |
1152 { | |
1153 /* Implements Measure #30 */ | |
1154 if ( pb_sim_read_alpha_num_record ((T_PHB_TYPE)phbSrchLst[lstIdx], | |
1155 order_num, &phbNtry, NAME_IDX) | |
1156 EQ PHB_OK) | |
1157 #else | |
1158 pb_search_name ( srcId, | |
1159 (UBYTE)phbSrchLst[lstIdx], srchName, PHB_NEW_SEARCH, | |
1160 &fstIdx, &srchRslt, &phbNtry ); | |
1161 { | |
1162 if( srchRslt NEQ 0 ) | |
1163 #endif | |
1164 { | |
1165 cmhPHB_getAdrStr( calPrm->num, MAX_PHB_NUM_LEN-1, | |
1166 phbNtry.number, phbNtry.len ); | |
1167 | |
1168 cmh_demergeTOA ( phbNtry.ton_npi, &calPrm->ton, &calPrm->npi ); | |
1169 | |
1170 return( TRUE ); | |
1171 } | |
1172 } | |
1173 } | |
1174 | |
1175 return( FALSE ); | |
1176 } | |
1177 | |
1178 /* | |
1179 +-------------------------------------------------------------------+ | |
1180 | PROJECT : GSM-PS (6147) MODULE : CMH_CC | | |
1181 | ROUTINE : psaCC_phbSrchECC | | |
1182 +-------------------------------------------------------------------+ | |
1183 | |
1184 PURPOSE : phonebook search for emergency number | |
1185 | |
1186 */ | |
1187 | |
1188 GLOBAL UBYTE psaCC_phbSrchECC ( CHAR* dialStr, BOOL srchECC ) | |
1189 { | |
1190 | |
1191 #ifdef TI_PS_FFS_PHB | |
1192 SHORT order_num; /* Order number of entry by number */ | |
1193 UBYTE dummy_num_len; | |
1194 UBYTE tag_len; | |
1195 UBYTE idx; | |
1196 SHORT max_rcd, used_rcd; | |
1197 #else | |
1198 SHORT mtch; /* holds number of matches */ | |
1199 SHORT fstIdx; /* holds first index */ | |
1200 T_PHB_RECORD ntry; /* found entry */ | |
1201 UBYTE service, tag_len; | |
1202 UBYTE idx; | |
1203 SHORT max_rcd, ecc_on_sim_count, avail_rcd; | |
1204 #endif | |
1205 SHORT dummy_max_ext, dummy_used_ext; | |
1206 | |
1207 TRACE_FUNCTION("psaCC_phbSrchECC"); | |
1208 | |
1209 if (dialStr EQ NULL) | |
1210 return( MNCC_PRIO_NORM_CALL ); | |
1211 | |
1212 /* remove any CLIR suppression/invocation prior checking for ECC */ | |
1213 /* Implements Measure#32: Row 89, 90, 116, 117, 1241 & 1242 */ | |
1214 if (!strncmp( dialStr, ksd_supp_clir_str, 4) OR | |
1215 !strncmp( dialStr, ksd_inv_clir_str, 4)) | |
1216 dialStr+=4; /* skip CLIR supression/invocation digits */ | |
1217 | |
1218 if ( *dialStr EQ '\0' ) | |
1219 return( MNCC_PRIO_NORM_CALL ); /* empty dialStr passed? */ | |
1220 | |
1221 /* | |
1222 * if emergency call numbers from SIM are available, only use | |
1223 * the emergency call numbers from the SIM | |
1224 */ | |
1225 #ifdef TI_PS_FFS_PHB | |
1226 if (pb_read_sizes (ECC, &max_rcd, &used_rcd, &dummy_num_len, &tag_len, | |
1227 &dummy_max_ext, &dummy_used_ext) EQ PHB_OK) | |
1228 { | |
1229 if ( used_rcd ) | |
1230 { | |
1231 /* SIM emergency numbers in SIM phonebook available */ | |
1232 order_num = 0; | |
1233 if (pb_search_number (ECC, (const UBYTE*)dialStr, &order_num) EQ PHB_OK) | |
1234 { | |
1235 TRACE_EVENT("EMERGENCY_CALL (PHONEBOOK)!"); | |
1236 return( MNCC_PRIO_EMERG_CALL ); | |
1237 } | |
1238 | |
1239 /* Implements Measure#32: Row 1239 */ | |
1240 if (!strcmp(num_911_str,dialStr) OR !strcmp(num_112_str,dialStr)) | |
1241 { | |
1242 TRACE_EVENT("EMERGENCY_CALL (!PHONEBOOK) 911 or 112"); | |
1243 return( MNCC_PRIO_EMERG_CALL ); | |
1244 } | |
1245 /* no valid emergency number */ | |
1246 return( MNCC_PRIO_NORM_CALL ); | |
1247 } | |
1248 } | |
1249 #else | |
1250 if (pb_read_status( ECC, &service, &max_rcd, &ecc_on_sim_count, &tag_len, &avail_rcd, | |
1251 &dummy_max_ext, &dummy_used_ext) EQ PHB_OK) | |
1252 { | |
1253 if ( ecc_on_sim_count ) | |
1254 { | |
1255 /* SIM emergency numbers have been read and stored in phonebook */ | |
1256 if (pb_search_number( ECC, (UBYTE*)dialStr, PHB_NEW_SEARCH, &fstIdx, &mtch, &ntry ) EQ PHB_OK) | |
1257 { | |
1258 if( mtch ) | |
1259 { | |
1260 TRACE_EVENT("EMERGENCY_CALL (PHONEBOOK)!"); | |
1261 return( MNCC_PRIO_EMERG_CALL ); | |
1262 } | |
1263 /* Implements Measure#32: Row 1239 */ | |
1264 if(!strcmp(num_911_str,dialStr) OR !strcmp(num_112_str,dialStr)) | |
1265 { | |
1266 TRACE_EVENT("EMERGENCY_CALL (!PHONEBOOK) 911 or 112"); | |
1267 return( MNCC_PRIO_EMERG_CALL ); | |
1268 } | |
1269 /* no valid emergency number */ | |
1270 return( MNCC_PRIO_NORM_CALL ); | |
1271 } | |
1272 } | |
1273 } | |
1274 #endif | |
1275 | |
1276 /* check the default emergency numbers */ | |
1277 for (idx=0; *ec_string[idx] NEQ '\0'; idx++) | |
1278 { | |
1279 if ( !strcmp(ec_string[idx], dialStr) ) | |
1280 { | |
1281 /* if dialStr is a service number, then no emergency call */ | |
1282 #ifdef TI_PS_FFS_PHB | |
1283 //TISH, patch for OMAPS00137002 | |
1284 //start | |
1285 #if 0 | |
1286 order_num = 0; | |
1287 if (pb_search_number (SDN, (const UBYTE*)dialStr, &order_num) EQ PHB_OK) | |
1288 { | |
1289 break; | |
1290 } | |
1291 #endif | |
1292 //end | |
1293 TRACE_EVENT("EMERGENCY_CALL! (DEFAULT)"); | |
1294 return( MNCC_PRIO_EMERG_CALL ); | |
1295 } | |
1296 } | |
1297 #else | |
1298 //TISH, patch for OMAPS00137002 | |
1299 //start | |
1300 #if 0 | |
1301 if (pb_search_number( SDN, (UBYTE*)dialStr, PHB_NEW_SEARCH, &fstIdx, &mtch, &ntry ) EQ PHB_OK) | |
1302 { | |
1303 if( mtch ) | |
1304 { | |
1305 break; | |
1306 } | |
1307 } | |
1308 #endif | |
1309 //end | |
1310 TRACE_EVENT("EMERGENCY_CALL! (DEFAULT)"); | |
1311 return( MNCC_PRIO_EMERG_CALL ); | |
1312 } | |
1313 } | |
1314 #endif | |
1315 | |
1316 /*if no valid SIM is inserted check the additional default emergency numbers */ | |
1317 if ((simShrdPrm.SIMStat NEQ SS_OK) AND | |
1318 (simShrdPrm.SIMStat NEQ SS_BLKD)) | |
1319 { | |
1320 /* compare each additional default emergency call number */ | |
1321 for (idx=0; *ec_string_ns[idx] NEQ '\0'; idx++) | |
1322 { | |
1323 if ( !strcmp(ec_string_ns[idx], dialStr) ) | |
1324 { | |
1325 TRACE_EVENT("EMERGENCY_CALL! (DEFAULT WITHOUT SIM)"); | |
1326 return ( MNCC_PRIO_EMERG_CALL ); | |
1327 } | |
1328 } | |
1329 } | |
1330 | |
1331 /* search for emergency call numbers in the phonebook */ | |
1332 if( srchECC ) | |
1333 #ifdef TI_PS_FFS_PHB | |
1334 { | |
1335 order_num = 0; | |
1336 if (pb_search_number (ECC, (const UBYTE*)dialStr, &order_num) EQ PHB_OK) | |
1337 { | |
1338 TRACE_EVENT("EMERGENCY_CALL!"); | |
1339 return( MNCC_PRIO_EMERG_CALL ); | |
1340 } | |
1341 } | |
1342 #else | |
1343 { | |
1344 if (pb_search_number( ECC, (UBYTE*)dialStr, PHB_NEW_SEARCH, &fstIdx, &mtch, &ntry ) EQ PHB_OK) | |
1345 { | |
1346 if( mtch ) | |
1347 { | |
1348 TRACE_EVENT("EMERGENCY_CALL!"); | |
1349 return( MNCC_PRIO_EMERG_CALL ); | |
1350 } | |
1351 } | |
1352 } | |
1353 #endif | |
1354 | |
1355 #ifdef TI_PS_FF_AT_CMD_P_ECC | |
1356 /* | |
1357 *-------------------------------------------------------------------- | |
1358 * compare the dialed number with the ECC numbers already stored | |
1359 *-------------------------------------------------------------------- | |
1360 */ | |
1361 if(cmhCC_isNrInAdditionalECC(dialStr)) | |
1362 { | |
1363 TRACE_EVENT("EMERGENCY_CALL! (additional ECC number)"); | |
1364 return (MNCC_PRIO_EMERG_CALL); | |
1365 } | |
1366 #endif /* TI_PS_FF_AT_CMD_P_ECC */ | |
1367 /* no valid emergency number */ | |
1368 return( MNCC_PRIO_NORM_CALL ); | |
1369 } | |
1370 | |
1371 /* | |
1372 +-------------------------------------------------------------------+ | |
1373 | PROJECT : GSM-PS (6147) MODULE : CMH_CC | | |
1374 | ROUTINE : psaCC_phbNtryFnd | | |
1375 +-------------------------------------------------------------------+ | |
1376 | |
1377 PURPOSE : phonebook search if entry exist | |
1378 | |
1379 */ | |
1380 | |
1381 GLOBAL BOOL psaCC_phbNtryFnd ( UBYTE phb, T_CLPTY_PRM* calPrm ) | |
1382 { | |
1383 #ifndef TI_PS_FFS_PHB | |
1384 SHORT mtchDmy = 0; /* holds number of matches */ | |
1385 SHORT fstIdxDmy; /* holds first index */ | |
1386 #endif | |
1387 T_PHB_RECORD ntry; /* holds phonebook entry */ | |
1388 SHORT order_num; /* Order number of entry by number */ | |
1389 UBYTE toa; /* Type Of Address */ | |
1390 | |
1391 TRACE_FUNCTION("psaCC_phbNtryFnd()"); | |
1392 | |
1393 /* Problem for GSM string in FDN: if the call number includes an | |
1394 international '+', the number will not be found, because the | |
1395 FDN entry will not have a '+' for international calls, but ton | |
1396 is set to TON_International. | |
1397 Solution: copy the call parameter. If ton is not set to international, | |
1398 then check if '+' is embeded in the call number. If it has a '+', | |
1399 then remove it from the copied call number, set ton of the copy | |
1400 to international and use the copy for the FDN search. | |
1401 */ | |
1402 | |
1403 /* search number */ | |
1404 toa = cmh_mergeTOA ( calPrm -> ton, calPrm -> npi ); | |
1405 | |
1406 if( phb EQ FDN ) | |
1407 { | |
1408 T_CLPTY_PRM *calPrmCopy; | |
1409 | |
1410 ACI_MALLOC (calPrmCopy, sizeof (T_CLPTY_PRM)); | |
1411 | |
1412 *calPrmCopy = *calPrm; /* Struct assignment */ | |
1413 | |
1414 /* check if '+' is within the string and remove it if it is */ | |
1415 if (psaCC_handleInternatPlus(calPrmCopy->num)) | |
1416 { | |
1417 /* set calling parameter for international */ | |
1418 calPrmCopy->ton = TON_International; | |
1419 toa = cmh_mergeTOA( calPrmCopy->ton, calPrmCopy->npi ); | |
1420 } | |
1421 if (calPrm->ton EQ MNCC_TON_UNKNOWN) | |
1422 { | |
1423 toa = 0; | |
1424 } | |
1425 ACI_MFREE (calPrmCopy); | |
1426 return (pb_check_fdn(toa, (const UBYTE*)calPrm->num) EQ PHB_OK); | |
1427 } | |
1428 else | |
1429 #ifdef TI_PS_FFS_PHB | |
1430 { | |
1431 order_num = 0; | |
1432 if (pb_search_number ((T_PHB_TYPE)phb, (const UBYTE*)calPrm->num, &order_num) NEQ PHB_OK) | |
1433 return FALSE; | |
1434 | |
1435 /* Implements Measure #30 */ | |
1436 if (pb_sim_read_alpha_num_record ((T_PHB_TYPE)phb, order_num, &ntry, NUMBER_IDX) | |
1437 NEQ PHB_OK) | |
1438 return FALSE; | |
1439 } | |
1440 | |
1441 return ((toa EQ ntry.ton_npi) OR (ntry.ton_npi EQ 0xFF)); | |
1442 #else | |
1443 { | |
1444 pb_search_number( phb, (UBYTE*)calPrm->num, PHB_NEW_SEARCH, | |
1445 &fstIdxDmy,&mtchDmy,&ntry ); | |
1446 } | |
1447 | |
1448 if( mtchDmy NEQ 0 AND ((toa EQ ntry.ton_npi) OR (ntry.ton_npi EQ 0xFF) OR (toa EQ 0)) ) /* VO patch 02.03.01 */ | |
1449 { | |
1450 return( TRUE ); | |
1451 } | |
1452 else | |
1453 { | |
1454 return( FALSE ); | |
1455 } | |
1456 #endif | |
1457 } | |
1458 | |
1459 /* | |
1460 +-------------------------------------------------------------------+ | |
1461 | PROJECT : GSM-PS (6147) MODULE : CMH_CC | | |
1462 | ROUTINE : psaCC_handleInternatPlus| | |
1463 +-------------------------------------------------------------------+ | |
1464 | |
1465 PURPOSE : check if '+' is embeded in the call number. If it | |
1466 has a '+', then remove it from the call number | |
1467 | |
1468 RETURNS : TRUE, if '+' has been found | |
1469 FALSE, if '+' has not been found | |
1470 */ | |
1471 LOCAL UBYTE psaCC_handleInternatPlus( char *number ) | |
1472 { | |
1473 UBYTE i; | |
1474 UBYTE str_len = strlen((char*)number); | |
1475 | |
1476 TRACE_FUNCTION("psaCC_handleInternatPlus()"); | |
1477 | |
1478 /* Specific pos to check are number[4], number[5] and number[6] */ | |
1479 if ( str_len > 4 ) | |
1480 { | |
1481 for (i=4; (number[i] != 0) && (i<=6); i++) | |
1482 { | |
1483 if ( number[i] EQ '+' ) | |
1484 { | |
1485 /* '+' for international number found */ | |
1486 | |
1487 /* move all digits to right of '+' 1 position to the left to | |
1488 remove the '+' from the call number */ | |
1489 memmove( (&number[i]), (&number[i+1]), str_len - (i+1) ); | |
1490 number[str_len-1] = '\0'; | |
1491 | |
1492 return TRUE; | |
1493 } | |
1494 } | |
1495 } | |
1496 /* no '+' for international number found */ | |
1497 return FALSE; | |
1498 } | |
1499 | |
1500 | |
1501 /* | |
1502 +-------------------------------------------------------------------+ | |
1503 | PROJECT : GSM-PS (6147) MODULE : CMH_CC | | |
1504 | ROUTINE : psaCC_phbAddNtry | | |
1505 +-------------------------------------------------------------------+ | |
1506 | |
1507 PURPOSE : add call table setting to specified phonebook | |
1508 | |
1509 NOTE: This function can be called with a cId EQ NO_ENTRY. | |
1510 Not nice. | |
1511 | |
1512 */ | |
1513 | |
1514 GLOBAL void psaCC_phbAddNtry ( UBYTE phb, SHORT cId, UBYTE clTp, T_CLPTY_PRM *cldPty ) | |
1515 { | |
1516 #ifndef TI_PS_FFS_PHB | |
1517 SHORT mtch; /* holds number of matches */ | |
1518 SHORT fstIdx; /* holds first index */ | |
1519 #endif | |
1520 T_PHB_RECORD ntry; /* holds phonebook entry */ | |
1521 SHORT order_num; /* holds first index */ | |
1522 CHAR numBuf[MAX_PHB_NUM_LEN]; /* buffers number 'number\0' */ | |
1523 rtc_time_type rtc_time; /* creation time for LDN,LRN,.. entry */ | |
1524 | |
1525 TRACE_FUNCTION ("psaCC_phbAddNtry()"); | |
1526 | |
1527 if( phb EQ LDN AND PBCFldn EQ PBCF_LDN_Disable ) return; | |
1528 if( phb EQ LRN AND PBCFlrn EQ PBCF_LRN_Disable ) return; | |
1529 if( phb EQ LMN AND PBCFlmn EQ PBCF_LMN_Disable ) return; | |
1530 | |
1531 if (cldPty NEQ NULL) /* Explicit number passed? */ | |
1532 { | |
1533 strncpy(numBuf, cldPty->num, MAX_PHB_NUM_LEN-1); | |
1534 numBuf[MAX_PHB_NUM_LEN-1]='\0'; | |
1535 } | |
1536 else /* otherwise read number from CTB and add DTMF */ | |
1537 { | |
1538 switch (clTp) | |
1539 { | |
1540 case CT_MTC: | |
1541 /* Save time stamp of MT Call even if number is not known */ | |
1542 psaCC_ctbClrAdr2Num( cId, numBuf, MAX_PHB_NUM_LEN ); | |
1543 break; | |
1544 case CT_MOC: | |
1545 case CT_NI_MOC: /* Maybe also for CCBS */ | |
1546 if (!psaCC_ctbCldAdr2Num( cId, numBuf, MAX_PHB_NUM_LEN )) | |
1547 return; | |
1548 break; | |
1549 default: /* invalid or no call */ | |
1550 return; | |
1551 } | |
1552 | |
1553 if (strlen(numBuf) < MAX_PHB_NUM_LEN-1) /* is there still room for DTMF digits? */ | |
1554 { | |
1555 strncat(numBuf, | |
1556 (char *)ccShrdPrm.dtmf.dig, | |
1557 (MAX_PHB_NUM_LEN-1) - strlen(numBuf) ); /* remember the previos cut off DTMF digits */ | |
1558 } | |
1559 } | |
1560 | |
1561 if ((phb NEQ LDN) AND (phb NEQ LRN) AND (phb NEQ LMN)) | |
1562 #ifdef TI_PS_FFS_PHB | |
1563 { | |
1564 order_num = 0; | |
1565 if (pb_search_number ((T_PHB_TYPE)phb, (const UBYTE*)numBuf, &order_num) EQ PHB_OK) | |
1566 return; /* entry already exist */ | |
1567 } | |
1568 | |
1569 memset (&ntry, 0, sizeof (T_PHB_RECORD)); | |
1570 | |
1571 ntry.phy_recno = 0; /* Search for a free record */ | |
1572 memset((char *)ntry.tag, 0xFF, PHB_MAX_TAG_LEN); | |
1573 memset((char *)ntry.subaddr, 0xFF, PHB_PACKED_SUB_LEN); | |
1574 #else | |
1575 { | |
1576 pb_search_number( phb, (UBYTE*)numBuf, PHB_NEW_SEARCH, | |
1577 &fstIdx,&mtch,&ntry ); | |
1578 | |
1579 if( mtch NEQ 0 ) return; /* entry already exist */ | |
1580 } | |
1581 | |
1582 ntry.index = 0; | |
1583 memset((char *)ntry.tag, 0xFF, PHB_MAX_TAG_LEN); | |
1584 memset((char *)ntry.subaddr, 0xFF, PHB_PACKED_NUM_LEN); | |
1585 #endif | |
1586 | |
1587 if (cldPty NEQ NULL) /* Explicit number passed? */ | |
1588 { | |
1589 T_ACI_PB_TEXT tag; | |
1590 ntry.tag_len = PHB_MAX_TAG_LEN; | |
1591 | |
1592 if (psaCC_phbSrchNumPlnTxt ( numBuf, &ntry.tag_len, &tag )) | |
1593 memcpy(ntry.tag, tag.data, ntry.tag_len); | |
1594 else | |
1595 ntry.tag_len = 0; | |
1596 | |
1597 ntry.ton_npi=((cldPty->ton & 0x07) << 4 ) + | |
1598 (cldPty->npi & 0x0F) + 0x80; | |
1599 } | |
1600 else | |
1601 { | |
1602 /* | |
1603 * Probably it is important to use this pointer variable here! | |
1604 */ | |
1605 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
1606 | |
1607 if ( ctb->alphIdUni.cs EQ CS_Sim ) | |
1608 { | |
1609 cmhPHB_getTagSim( &ctb->alphIdUni, ntry.tag, PHB_MAX_TAG_LEN ); | |
1610 ntry.tag_len = MINIMUM ( ctb->alphIdUni.len, PHB_MAX_TAG_LEN ); | |
1611 } | |
1612 else | |
1613 ntry.tag_len = 0; | |
1614 | |
1615 if( clTp EQ CT_MOC ) | |
1616 ntry.ton_npi = ((ctb->cldPty.ton & 0x07) << 4 ) + | |
1617 (ctb->cldPty.npi & 0x0F) + 0x80; | |
1618 | |
1619 else if ( clTp EQ CT_MTC ) | |
1620 ntry.ton_npi = ((ctb->clgPty.ton & 0x07) << 4 ) + | |
1621 (ctb->clgPty.npi & 0x0F) + 0x80; | |
1622 } | |
1623 | |
1624 cmhPHB_getAdrBcd ( ntry.number, &ntry.len, | |
1625 PHB_PACKED_NUM_LEN, numBuf ); | |
1626 | |
1627 ntry.cc_id = 0xFF; | |
1628 #ifdef TI_PS_FFS_PHB | |
1629 ntry.v_time = FALSE; | |
1630 ntry.v_line = FALSE; | |
1631 #endif | |
1632 | |
1633 if ( ( phb EQ LDN ) OR ( phb EQ LRN ) OR ( phb EQ LMN ) ) | |
1634 { | |
1635 if ( rtc_read_time ( &rtc_time ) EQ TRUE ) | |
1636 { | |
1637 #ifdef TI_PS_FFS_PHB | |
1638 ntry.v_time = TRUE; | |
1639 ntry.time.year = rtc_time.year; | |
1640 ntry.time.month = rtc_time.month; | |
1641 ntry.time.day = rtc_time.day; | |
1642 ntry.time.hour = rtc_time.hour; | |
1643 ntry.time.minute = rtc_time.minute; | |
1644 ntry.time.second = rtc_time.second; | |
1645 #else | |
1646 ntry.year = rtc_time.year; | |
1647 ntry.month = rtc_time.month; | |
1648 ntry.day = rtc_time.day; | |
1649 ntry.hour = rtc_time.hour; | |
1650 ntry.minute = rtc_time.minute; | |
1651 ntry.second = rtc_time.second; | |
1652 #endif | |
1653 | |
1654 } | |
1655 | |
1656 #ifdef TI_PS_FFS_PHB | |
1657 ntry.v_line = TRUE; | |
1658 #endif | |
1659 | |
1660 if (cId NEQ NO_ENTRY AND | |
1661 psaCC_ctb(cId)->BC[0].bearer_serv EQ MNCC_BEARER_SERV_AUX_SPEECH) | |
1662 { | |
1663 ntry.line = 2; | |
1664 } | |
1665 else | |
1666 { | |
1667 ntry.line = 1; | |
1668 } | |
1669 } | |
1670 /* ACI-SPR-16301: result might also be PHB_EXCT */ | |
1671 #ifdef TI_PS_FFS_PHB | |
1672 if( pb_add_record ( (T_PHB_TYPE)phb, ntry.phy_recno, &ntry ) EQ PHB_FAIL ) | |
1673 #else | |
1674 if( pb_add_record ( phb, ntry.index, &ntry ) EQ PHB_FAIL ) | |
1675 #endif | |
1676 { | |
1677 TRACE_EVENT( "PHONEBOOK ADDING FAILED" ); | |
1678 } | |
1679 } | |
1680 | |
1681 /* | |
1682 +-------------------------------------------------------------------+ | |
1683 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
1684 | ROUTINE : psaCC_asmBuildMPTY | | |
1685 +-------------------------------------------------------------------+ | |
1686 | |
1687 PURPOSE : assemble the build multiparty SS facility | |
1688 information element. return invoke id. | |
1689 */ | |
1690 | |
1691 GLOBAL void psaCC_asmBuildMPTY ( void ) | |
1692 { | |
1693 TRACE_FUNCTION("psaCC_asmBuildMPTY"); | |
1694 | |
1695 memset( &ssFIECodeBuf, 0, sizeof( ssFIECodeBuf )); | |
1696 | |
1697 ssFIECodeBuf.l_buf = 8; | |
1698 ssFIECodeBuf.o_buf = 0; | |
1699 ssFIECodeBuf.buf[0] = OPC_BUILD_MPTY; | |
1700 | |
1701 ccShrdPrm.cmpType = CT_INV; | |
1702 } | |
1703 | |
1704 /* Implements Measure #86 */ | |
1705 | |
1706 /* | |
1707 +-------------------------------------------------------------------+ | |
1708 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
1709 | ROUTINE : psaCC_asmSplitMPTY | | |
1710 +-------------------------------------------------------------------+ | |
1711 | |
1712 PURPOSE : assemble the split multiparty SS facility | |
1713 information element. return invoke id. | |
1714 */ | |
1715 | |
1716 GLOBAL void psaCC_asmSplitMPTY ( void ) | |
1717 { | |
1718 TRACE_FUNCTION("psaCC_asmSplitMPTY"); | |
1719 | |
1720 memset( &ssFIECodeBuf, 0, sizeof( ssFIECodeBuf )); | |
1721 | |
1722 ssFIECodeBuf.l_buf = 8; | |
1723 ssFIECodeBuf.o_buf = 0; | |
1724 ssFIECodeBuf.buf[0] = OPC_SPLIT_MPTY; | |
1725 | |
1726 ccShrdPrm.cmpType = CT_INV; | |
1727 } | |
1728 | |
1729 /* | |
1730 +-------------------------------------------------------------------+ | |
1731 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
1732 | ROUTINE : psaCC_asmECT | | |
1733 +-------------------------------------------------------------------+ | |
1734 | |
1735 PURPOSE : assemble the explicit call transfer SS facility | |
1736 information element. return invoke id. | |
1737 */ | |
1738 | |
1739 GLOBAL void psaCC_asmECT ( void ) | |
1740 { | |
1741 TRACE_FUNCTION("psaCC_asmECT"); | |
1742 | |
1743 memset( &ssFIECodeBuf, 0, sizeof( ssFIECodeBuf )); | |
1744 | |
1745 ssFIECodeBuf.l_buf = 8; | |
1746 ssFIECodeBuf.o_buf = 0; | |
1747 ssFIECodeBuf.buf[0] = OPC_EXPLICIT_CT; | |
1748 | |
1749 ccShrdPrm.cmpType = CT_INV; | |
1750 } | |
1751 | |
1752 /* | |
1753 +-------------------------------------------------------------------+ | |
1754 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
1755 | ROUTINE : psaCC_asmCUGInfo | | |
1756 +-------------------------------------------------------------------+ | |
1757 | |
1758 PURPOSE : assemble the forward CUG info SS facility | |
1759 information element. | |
1760 */ | |
1761 | |
1762 GLOBAL void psaCC_asmCUGInfo ( SHORT cId ) | |
1763 { | |
1764 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
1765 MCAST( CUGinf, FWD_CUG_INFO_INV ); | |
1766 | |
1767 TRACE_FUNCTION("psaCC_asmCUGInfo"); | |
1768 | |
1769 memset( CUGinf, 0, sizeof( T_FWD_CUG_INFO_INV )); | |
1770 | |
1771 /* set basic settings */ | |
1772 CUGinf->msg_type = FWD_CUG_INFO_INV; | |
1773 CUGinf->v_forwardCUGInfoArg = TRUE; | |
1774 | |
1775 /* set CUG info */ | |
1776 if( ctb->CUGidx NEQ NOT_PRESENT_8BIT ) | |
1777 { | |
1778 CUGinf->forwardCUGInfoArg.v_cugIndex = TRUE; | |
1779 CUGinf->forwardCUGInfoArg.cugIndex = ctb->CUGidx; | |
1780 } | |
1781 CUGinf->forwardCUGInfoArg.v_suppressPrefCUG = ctb->CUGprf; | |
1782 CUGinf->forwardCUGInfoArg.v_suppressOA = ctb->OAsup; | |
1783 | |
1784 memset( &ssFIECodeBuf, 0, sizeof( ssFIECodeBuf )); | |
1785 ssFIECodeBuf.l_buf = MAX_FIE_CODE_BUF_LEN<<3; | |
1786 ccd_codeMsg (CCDENT_FAC, UPLINK, | |
1787 (T_MSGBUF *)&ssFIECodeBuf, _decodedMsg, | |
1788 NOT_PRESENT_8BIT); | |
1789 | |
1790 ccShrdPrm.cmpType = CT_INV; | |
1791 } | |
1792 | |
1793 | |
1794 /* | |
1795 +-------------------------------------------------------------------+ | |
1796 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
1797 | ROUTINE : psaCC_asmCDReq | | |
1798 +-------------------------------------------------------------------+ | |
1799 | |
1800 PURPOSE : Assemble the Invoke component for CallDeflection. | |
1801 On calling this function, it is assumed the semaphore | |
1802 for the shared CCD buffer is already set. | |
1803 | |
1804 */ | |
1805 | |
1806 GLOBAL void psaCC_asmCDReq ( const CHAR *number, | |
1807 const T_ACI_TOA *type, | |
1808 const CHAR *subaddr, | |
1809 const T_ACI_TOS *satype) | |
1810 { | |
1811 MCAST ( invokeCD, CALL_DEFLECTION_INV ); | |
1812 UBYTE ton, tos; /* holds type of number/subaddress */ | |
1813 UBYTE npi, oe; /* holds numbering plan/odd.even indicator */ | |
1814 UBYTE ccdRet; | |
1815 | |
1816 TRACE_FUNCTION ("psaCC_asmCDReq()"); | |
1817 | |
1818 memset( invokeCD, 0, sizeof( T_CALL_DEFLECTION_INV )); | |
1819 | |
1820 /* set basic settings */ | |
1821 invokeCD->msg_type = CALL_DEFLECTION_INV; | |
1822 invokeCD->v_callDeflectionArg = TRUE; | |
1823 | |
1824 /* Process T_deflectedToNumber (mandatory element) */ | |
1825 if ((type EQ NULL) OR | |
1826 (type->npi EQ NPI_NotPresent) OR | |
1827 (type->ton EQ TON_NotPresent)) | |
1828 { | |
1829 /* Use defaults */ | |
1830 ton = (number[0] EQ '+') ? NOA_INTER_NUM : NOA_UNKNOWN; | |
1831 npi = NPI_ISDN; | |
1832 } | |
1833 else | |
1834 { | |
1835 /* Use given values */ | |
1836 ton = type->ton; | |
1837 npi = type->npi; | |
1838 } | |
1839 invokeCD->callDeflectionArg.v_deflectedToNumber = TRUE; | |
1840 invokeCD->callDeflectionArg.deflectedToNumber.v_noa = TRUE; | |
1841 invokeCD->callDeflectionArg.deflectedToNumber.noa = ton; | |
1842 invokeCD->callDeflectionArg.deflectedToNumber.v_npi = TRUE; | |
1843 invokeCD->callDeflectionArg.deflectedToNumber.npi = npi; | |
1844 invokeCD->callDeflectionArg.deflectedToNumber.c_bcdDigit = | |
1845 (UBYTE)utl_dialStr2BCD (number, | |
1846 invokeCD->callDeflectionArg.deflectedToNumber.bcdDigit, | |
1847 MAX_PARTY_NUM); | |
1848 | |
1849 /* Process T_deflectedToSubaddress (optional element) */ | |
1850 if (subaddr NEQ NULL) | |
1851 { | |
1852 if ((satype EQ NULL) OR | |
1853 (satype->tos EQ TOS_NotPresent) OR | |
1854 (satype->oe EQ OE_NotPresent)) | |
1855 { | |
1856 /* Use defaults */ | |
1857 tos = TOS_X213; | |
1858 oe = OEI_EVEN; | |
1859 } | |
1860 else | |
1861 { | |
1862 /* Use given values */ | |
1863 tos = satype->tos; | |
1864 oe = satype->oe; | |
1865 } | |
1866 invokeCD->callDeflectionArg.v_deflectedToSubaddress = TRUE; | |
1867 invokeCD->callDeflectionArg.deflectedToSubaddress.v_tos = TRUE; | |
1868 invokeCD->callDeflectionArg.deflectedToSubaddress.tos = tos; | |
1869 invokeCD->callDeflectionArg.deflectedToSubaddress.v_oei = TRUE; | |
1870 invokeCD->callDeflectionArg.deflectedToSubaddress.oei = oe; | |
1871 invokeCD->callDeflectionArg.deflectedToSubaddress.c_subadr_str = | |
1872 (UBYTE)utl_dialStr2BCD(subaddr, | |
1873 invokeCD->callDeflectionArg.deflectedToSubaddress.subadr_str, | |
1874 MAX_SUBADDR_NUM); | |
1875 } | |
1876 | |
1877 memset( &ssFIECodeBuf, 0, sizeof( ssFIECodeBuf )); | |
1878 ssFIECodeBuf.l_buf = MAX_FIE_CODE_BUF_LEN<<3; | |
1879 | |
1880 ccdRet = ccd_codeMsg (CCDENT_FAC, UPLINK, | |
1881 (T_MSGBUF *)&ssFIECodeBuf, _decodedMsg, | |
1882 NOT_PRESENT_8BIT); | |
1883 | |
1884 switch (ccdRet) | |
1885 { | |
1886 case ccdOK: | |
1887 break; | |
1888 case ccdWarning: | |
1889 TRACE_EVENT ("ccdWarning"); | |
1890 break; | |
1891 default: | |
1892 TRACE_ERROR ("ccdError/other problem"); | |
1893 break; | |
1894 } | |
1895 | |
1896 ccShrdPrm.cmpType = CT_INV; /* Component Type = Invoke */ | |
1897 } | |
1898 | |
1899 | |
1900 /* | |
1901 +-------------------------------------------------------------------+ | |
1902 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
1903 | ROUTINE : psaCC_asmComponent | | |
1904 +-------------------------------------------------------------------+ | |
1905 | |
1906 PURPOSE : Build the componenet. The content of the component is | |
1907 expected in ssFIECodeBuf, the ready built component will | |
1908 be returned in ssFIECodeBuf. | |
1909 | |
1910 */ | |
1911 | |
1912 GLOBAL void psaCC_asmComponent ( SHORT cId ) | |
1913 { | |
1914 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
1915 MCAST (comp, COMPONENT); | |
1916 UBYTE ccdRet; | |
1917 | |
1918 TRACE_FUNCTION ("psaCC_asmComponent()"); | |
1919 | |
1920 memset (comp, 0, sizeof (T_COMPONENT)); | |
1921 | |
1922 comp->v_inv_comp = TRUE; | |
1923 comp->inv_comp.v_inv_id = TRUE; | |
1924 comp->inv_comp.inv_id = ctb->iId = ccShrdPrm.iIdNxt++; | |
1925 comp->inv_comp.v_op_code = TRUE; | |
1926 comp->inv_comp.op_code = ctb->opCode = ssFIECodeBuf.buf[0]; | |
1927 comp->inv_comp.v_params = TRUE; | |
1928 comp->inv_comp.params.l_params = ssFIECodeBuf.l_buf - 8; | |
1929 comp->inv_comp.params.o_params = 8; | |
1930 | |
1931 memcpy (comp->inv_comp.params.b_params, | |
1932 ssFIECodeBuf.buf + (ssFIECodeBuf.o_buf >> 3), | |
1933 ssFIECodeBuf.l_buf >> 3); | |
1934 | |
1935 ccdRet = ccd_codeMsg (CCDENT_FAC, | |
1936 UPLINK, | |
1937 (T_MSGBUF *)&ssFIECodeBuf, | |
1938 _decodedMsg, | |
1939 COMPONENT); | |
1940 | |
1941 if (ccdRet NEQ ccdOK) | |
1942 { | |
1943 TRACE_EVENT_P1 ("ccdRet=%d NEQ ccdOK", ccdRet); | |
1944 } | |
1945 } | |
1946 | |
1947 | |
1948 /* | |
1949 +-------------------------------------------------------------------+ | |
1950 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
1951 | ROUTINE : psaCC_asmCCBSReq | | |
1952 +-------------------------------------------------------------------+ | |
1953 | |
1954 PURPOSE : assemble the access register CC entry SS facility | |
1955 information element. | |
1956 */ | |
1957 | |
1958 GLOBAL void psaCC_asmCCBSReq ( SHORT cId ) | |
1959 { | |
1960 MCAST( CCBSreq, ACC_REGISTER_CC_ENTRY_INV ); | |
1961 | |
1962 TRACE_FUNCTION("psaCC_asmCCBSReq"); | |
1963 | |
1964 memset( CCBSreq, 0, sizeof( T_ACC_REGISTER_CC_ENTRY_INV )); | |
1965 | |
1966 /* set basic settings */ | |
1967 CCBSreq->msg_type = ACC_REGISTER_CC_ENTRY_INV; | |
1968 CCBSreq->v_accRegisterCCEntryArg = TRUE; | |
1969 CCBSreq->accRegisterCCEntryArg.l_accRegisterCCEntryArg = 0; | |
1970 | |
1971 memset( &ssFIECodeBuf, 0, sizeof( ssFIECodeBuf )); | |
1972 ssFIECodeBuf.l_buf = MAX_FIE_CODE_BUF_LEN<<3; | |
1973 ccd_codeMsg (CCDENT_FAC, UPLINK, | |
1974 (T_MSGBUF *)&ssFIECodeBuf, _decodedMsg, | |
1975 NOT_PRESENT_8BIT); | |
1976 | |
1977 ccShrdPrm.cmpType = CT_INV; | |
1978 } | |
1979 | |
1980 /* | |
1981 +-------------------------------------------------------------------+ | |
1982 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
1983 | ROUTINE : psaCC_dasmInvokeCmp | | |
1984 +-------------------------------------------------------------------+ | |
1985 | |
1986 PURPOSE : disassemble the result component. | |
1987 */ | |
1988 | |
1989 GLOBAL void psaCC_dasmInvokeCmp ( SHORT cId, T_inv_comp *invCmp ) | |
1990 { | |
1991 USHORT ivId; /* holds invoke Id */ | |
1992 UBYTE opCode; /* holds operation code */ | |
1993 | |
1994 TRACE_FUNCTION("psaCC_dasmInvokeCmp"); | |
1995 | |
1996 if( invCmp -> v_inv_id ) | |
1997 ivId = invCmp -> inv_id; | |
1998 else | |
1999 ivId = NOT_PRESENT_16BIT; | |
2000 | |
2001 if( invCmp -> v_op_code ) | |
2002 opCode = invCmp -> op_code; | |
2003 else | |
2004 opCode = NOT_PRESENT_8BIT; | |
2005 | |
2006 if( invCmp -> params.l_params ) | |
2007 { | |
2008 UBYTE ccdRet; | |
2009 | |
2010 memcpy( &ssFIECodeBuf, &invCmp -> params, sizeof(ssFIECodeBuf)); | |
2011 | |
2012 ccdRet = ccd_decodeMsg (CCDENT_FAC, | |
2013 DOWNLINK, | |
2014 (T_MSGBUF *) &ssFIECodeBuf, | |
2015 (UBYTE *) _decodedMsg, | |
2016 opCode); | |
2017 | |
2018 if( ccdRet NEQ ccdOK ) | |
2019 { | |
2020 TRACE_EVENT_P1( "CCD Decoding Error: %d",ccdRet ); | |
2021 psaCC_ctb(cId)->failType = SSF_CCD_DEC; | |
2022 cmhCC_SSTransFail(cId); | |
2023 } | |
2024 } | |
2025 | |
2026 /* determine to which operation the invoke belongs to */ | |
2027 switch( opCode ) | |
2028 { | |
2029 /* | |
2030 * Advice of Charge Information received | |
2031 */ | |
2032 case OPC_FWD_CHARGE_ADVICE: | |
2033 { | |
2034 MCAST( aoc_para, FWD_CHG_ADVICE_INV); | |
2035 | |
2036 aoc_parameter (cId, aoc_para); | |
2037 | |
2038 if (aoc_info (cId, AOC_START_AOC)) | |
2039 { | |
2040 /* | |
2041 * build return result to infrastructure | |
2042 * directly without using CCD (it´s too simple) | |
2043 */ | |
2044 PALLOC (facility_req, MNCC_FACILITY_REQ); | |
2045 | |
2046 facility_req->fac_inf.l_fac = 5*8; | |
2047 facility_req->fac_inf.o_fac = 0; | |
2048 facility_req->fac_inf.fac [0] = 0xA2; /* component type tag */ | |
2049 facility_req->fac_inf.fac [1] = 3; /* component type length */ | |
2050 facility_req->fac_inf.fac [2] = 2; /* invoke id tag */ | |
2051 facility_req->fac_inf.fac [3] = 1; /* invoke id length */ | |
2052 facility_req->fac_inf.fac [4] = (UBYTE)ivId; /* invoke id */ | |
2053 | |
2054 facility_req->ti = psaCC_ctb(cId)->ti; | |
2055 facility_req->ss_version = NOT_PRESENT_8BIT; | |
2056 | |
2057 PSENDX (CC, facility_req); | |
2058 } | |
2059 } | |
2060 break; | |
2061 | |
2062 case( OPC_NOTIFY_SS ): | |
2063 { | |
2064 MCAST( ntfySS, NOTIFY_SS_INV ); | |
2065 | |
2066 cmhCC_NotifySS( cId, ntfySS ); | |
2067 } | |
2068 break; | |
2069 | |
2070 case( OPC_FWD_CHECK_SS_IND ): | |
2071 { | |
2072 cmhCC_CheckSS( cId); | |
2073 } | |
2074 break; | |
2075 } | |
2076 } | |
2077 | |
2078 /* | |
2079 +-------------------------------------------------------------------+ | |
2080 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
2081 | ROUTINE : psaCC_dasmResultCmp | | |
2082 +-------------------------------------------------------------------+ | |
2083 | |
2084 PURPOSE : disassemble the result component. | |
2085 */ | |
2086 | |
2087 GLOBAL void psaCC_dasmResultCmp ( SHORT cId, T_res_comp *resCmp ) | |
2088 { | |
2089 UBYTE opCode; /* holds operation code */ | |
2090 | |
2091 TRACE_FUNCTION("psaCC_dasmResultCmp"); | |
2092 | |
2093 /* get operation code of the result */ | |
2094 if( resCmp -> v_sequence AND resCmp -> sequence.v_op_code ) | |
2095 opCode = resCmp -> sequence.op_code; | |
2096 else | |
2097 opCode = psaCC_ctb(cId)->opCode; | |
2098 | |
2099 /* decode additional parameters of result */ | |
2100 if( resCmp -> v_sequence AND resCmp -> sequence.params.l_params ) | |
2101 { | |
2102 UBYTE ccdRet; | |
2103 | |
2104 memcpy( &ssFIECodeBuf, &resCmp -> sequence.params, sizeof(ssFIECodeBuf)); | |
2105 | |
2106 ccdRet = ccd_decodeMsg (CCDENT_FAC, | |
2107 DOWNLINK, | |
2108 (T_MSGBUF *) &ssFIECodeBuf, | |
2109 (UBYTE *) _decodedMsg, | |
2110 opCode); | |
2111 | |
2112 if( ccdRet NEQ ccdOK ) | |
2113 { | |
2114 TRACE_EVENT_P1( "CCD Decoding Error: %d",ccdRet ); | |
2115 return; | |
2116 } | |
2117 } | |
2118 | |
2119 /* determine to which operation the result belongs to */ | |
2120 switch( opCode ) | |
2121 { | |
2122 case( OPC_BUILD_MPTY ): | |
2123 { | |
2124 MCAST( bldMPTY, BUILD_MPTY_RES ); | |
2125 | |
2126 cmhCC_MPTYBuild( cId, bldMPTY ); | |
2127 } | |
2128 break; | |
2129 | |
2130 case( OPC_EXPLICIT_CT ): | |
2131 { | |
2132 TIMERSTOP( ACI_TECT ); | |
2133 } | |
2134 break; | |
2135 | |
2136 case( OPC_SPLIT_MPTY ): | |
2137 { | |
2138 MCAST( splMPTY, SPLIT_MPTY_RES ); | |
2139 | |
2140 cmhCC_MPTYSplit( cId, splMPTY ); | |
2141 } | |
2142 break; | |
2143 | |
2144 case( OPC_HOLD_MPTY ): | |
2145 { | |
2146 MCAST( hldMPTY, HOLD_MPTY_RES ); | |
2147 | |
2148 cmhCC_MPTYHeld( cId, hldMPTY ); | |
2149 } | |
2150 break; | |
2151 | |
2152 case( OPC_RETRIEVE_MPTY ): | |
2153 { | |
2154 MCAST( rtvMPTY, RETRIEVE_MPTY_RES ); | |
2155 | |
2156 cmhCC_MPTYRetrieved( cId, rtvMPTY ); | |
2157 } | |
2158 break; | |
2159 | |
2160 case( OPC_ACC_REGISTER_CC_ENTRY ): | |
2161 { | |
2162 MCAST( ccbs, ACC_REGISTER_CC_ENTRY_RES ); | |
2163 | |
2164 cmhCC_CCBSRegistered( cId, ccbs ); | |
2165 } | |
2166 break; | |
2167 | |
2168 case( OPC_CALL_DEFLECTION ): | |
2169 { | |
2170 cmhCC_CDRegistered ( cId ); | |
2171 } | |
2172 break; | |
2173 | |
2174 } | |
2175 } | |
2176 | |
2177 /* | |
2178 +-------------------------------------------------------------------+ | |
2179 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
2180 | ROUTINE : psaCC_dasmErrorCmp | | |
2181 +-------------------------------------------------------------------+ | |
2182 | |
2183 PURPOSE : disassemble the error component. | |
2184 */ | |
2185 | |
2186 GLOBAL void psaCC_dasmErrorCmp ( SHORT cId, T_err_comp *errCmp ) | |
2187 { | |
2188 TRACE_FUNCTION("psaCC_dasmErrorCmp"); | |
2189 | |
2190 if( errCmp -> v_err_code ) | |
2191 { | |
2192 psaCC_ctb(cId)->failType = SSF_ERR_PRB; | |
2193 psaCC_ctb(cId)->errCd = errCmp -> err_code; | |
2194 } | |
2195 | |
2196 cmhCC_SSTransFail (cId); | |
2197 } | |
2198 | |
2199 /* | |
2200 +-------------------------------------------------------------------+ | |
2201 | PROJECT : GSM-PS (6147) MODULE : PSA_SSF | | |
2202 | ROUTINE : psaCC_dasmRejectCmp | | |
2203 +-------------------------------------------------------------------+ | |
2204 | |
2205 PURPOSE : disassemble the error component. | |
2206 */ | |
2207 | |
2208 GLOBAL void psaCC_dasmRejectCmp ( SHORT cId, T_rej_comp *rejCmp ) | |
2209 { | |
2210 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
2211 | |
2212 TRACE_FUNCTION("psaCC_dasmRejectCmp"); | |
2213 | |
2214 if( rejCmp -> v_gen_problem ) | |
2215 { | |
2216 ctb->failType = SSF_GEN_PRB; | |
2217 ctb->rejPrb = rejCmp -> gen_problem; | |
2218 } | |
2219 | |
2220 else if( rejCmp -> v_inv_problem ) | |
2221 { | |
2222 ctb->failType = SSF_INV_PRB; | |
2223 ctb->rejPrb = rejCmp -> inv_problem; | |
2224 } | |
2225 | |
2226 else if( rejCmp -> v_res_problem ) | |
2227 { | |
2228 ctb->failType = SSF_RSL_PRB; | |
2229 ctb->rejPrb = rejCmp -> res_problem; | |
2230 } | |
2231 | |
2232 else if( rejCmp -> v_err_problem ) | |
2233 { | |
2234 ctb->failType = SSF_ERR_PRB; | |
2235 ctb->rejPrb = rejCmp -> err_problem; | |
2236 } | |
2237 | |
2238 cmhCC_SSTransFail(cId); | |
2239 } | |
2240 | |
2241 /* | |
2242 +-------------------------------------------------------------------+ | |
2243 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
2244 | ROUTINE : psaCC_DTMFSent | | |
2245 +-------------------------------------------------------------------+ | |
2246 | |
2247 PURPOSE : previous DTMF digit was sent | |
2248 | |
2249 */ | |
2250 GLOBAL void psaCC_DTMFSent ( SHORT cId ) | |
2251 { | |
2252 TRACE_FUNCTION( "psaCC_DTMFSent()" ); | |
2253 | |
2254 | |
2255 /*------------------------------------------------------------------- | |
2256 * check current command | |
2257 *------------------------------------------------------------------- | |
2258 */ | |
2259 if (!psaCC_ctbIsValid (cId)) | |
2260 return; | |
2261 | |
2262 | |
2263 #ifdef SIM_TOOLKIT | |
2264 if ( psaCC_ctb(cId)->dtmfSrc EQ OWN_SRC_SAT ) /* confirm to SAT send DTMF cmd */ | |
2265 { | |
2266 cmhCC_SatDTMFsent ( cId ); | |
2267 return; | |
2268 } | |
2269 else | |
2270 #endif /* SIM_TOOLKIT */ | |
2271 { | |
2272 cmhCC_DTMFsent ( cId ); | |
2273 } | |
2274 } | |
2275 | |
2276 /* | |
2277 +-------------------------------------------------------------------+ | |
2278 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
2279 | ROUTINE : psaCC_StopDTMF | | |
2280 +-------------------------------------------------------------------+ | |
2281 | |
2282 PURPOSE : stop further DTMF generation for that call | |
2283 | |
2284 */ | |
2285 | |
2286 GLOBAL void psaCC_StopDTMF ( SHORT cId ) | |
2287 { | |
2288 #ifdef SIM_TOOLKIT | |
2289 T_ACI_SAT_TERM_RESP resp_data; | |
2290 #endif /* SIM_TOOLKIT */ | |
2291 | |
2292 TRACE_FUNCTION( "psaCC_StopDTMF()" ); | |
2293 | |
2294 if( cId EQ ccShrdPrm.dtmf.cId ) | |
2295 { | |
2296 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[cId]; | |
2297 | |
2298 TIMERSTOP( ACI_TDTMF); | |
2299 | |
2300 #ifdef SIM_TOOLKIT | |
2301 psaSAT_InitTrmResp( &resp_data ); | |
2302 | |
2303 /* if other dtmf were to be sent in send DTMF SAT cmd*/ | |
2304 if ( ctb->dtmfSrc EQ OWN_SRC_SAT AND | |
2305 ccShrdPrm.dtmf.cnt NEQ 0 ) | |
2306 { | |
2307 resp_data.add_content = ADD_ME_NO_SPCH_CALL; /* tell SIM that it failed */ | |
2308 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
2309 } | |
2310 else /*Stop DTMF generation before calling cmhCC_DTMFstopped */ | |
2311 #endif /* SIM_TOOLKIT */ | |
2312 { | |
2313 cmhCC_DTMFstopped ( cId ); | |
2314 } | |
2315 ctb->dtmfSrc = OWN_SRC_INV; | |
2316 ctb->dtmfCmd = AT_CMD_NONE; | |
2317 ccShrdPrm.dtmf.cId = NO_ENTRY; | |
2318 ccShrdPrm.dtmf.cnt = 0; | |
2319 ccShrdPrm.dtmf.cur = 0; | |
2320 } | |
2321 } | |
2322 | |
2323 /* | |
2324 +-------------------------------------------------------------------+ | |
2325 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
2326 | ROUTINE : psaCC_DTMFTimeout | | |
2327 +-------------------------------------------------------------------+ | |
2328 | |
2329 PURPOSE : handle DTMF timeout | |
2330 | |
2331 */ | |
2332 | |
2333 GLOBAL void psaCC_DTMFTimeout ( void ) | |
2334 { | |
2335 TRACE_FUNCTION( "psaCC_DTMFTimeout()" ); | |
2336 | |
2337 psaCC_DTMFSent( ccShrdPrm.dtmf.cId ); | |
2338 } | |
2339 | |
2340 /* | |
2341 +-------------------------------------------------------------------+ | |
2342 | PROJECT : GSM-PS (6147) MODULE : PSA_CC | | |
2343 | ROUTINE : psaCC_InitCtbNtry | | |
2344 +-------------------------------------------------------------------+ | |
2345 | |
2346 PURPOSE : allocate and initialize the indexed call table entry. | |
2347 | |
2348 */ | |
2349 | |
2350 GLOBAL void psaCC_InitCtbNtry ( SHORT idx ) | |
2351 { | |
2352 T_CC_CALL_TBL *ctb; | |
2353 | |
2354 /* | |
2355 *------------------------------------------------------------------- | |
2356 * initialize call table entry | |
2357 *------------------------------------------------------------------- | |
2358 */ | |
2359 TRACE_FUNCTION ("psaCC_InitCtbNtry()"); | |
2360 | |
2361 if (ccShrdPrm.ctb[idx] NEQ NULL) | |
2362 { | |
2363 TRACE_EVENT ("Suspicious: ccShrdPrm.ctb[idx] was not freed"); | |
2364 ACI_MFREE (ccShrdPrm.ctb[idx]); /* Make sure we get no leak */ | |
2365 } | |
2366 ACI_MALLOC (ccShrdPrm.ctb[idx], sizeof (T_CC_CALL_TBL)); | |
2367 | |
2368 ctb = ccShrdPrm.ctb[idx]; | |
2369 | |
2370 ctb->ti = 0xFF; | |
2371 ctb->calStat = NO_VLD_CS; | |
2372 ctb->calType = NO_VLD_CT; | |
2373 ctb->alrtStat = AS_IDL; | |
2374 ctb->inBndTns = FALSE; | |
2375 ctb->prgDesc = MNCC_PROG_NOT_PRES; | |
2376 ctb->BC[0].rate = DEF_BC1_UR; | |
2377 ctb->BC[0].bearer_serv = DEF_BC1_BS; | |
2378 ctb->BC[0].conn_elem = DEF_BC1_CE; | |
2379 ctb->BC[0].stop_bits = DEF_BC1_SB; | |
2380 ctb->BC[0].data_bits = DEF_BC1_DB; | |
2381 ctb->BC[0].parity = DEF_BC1_PR; | |
2382 ctb->BC[0].flow_control = DEF_BC1_FC; | |
2383 ctb->BC[0].modem_type = DEF_BC1_MT; | |
2384 ctb->BC[0].transfer_cap = DEF_BC1_TC; | |
2385 ctb->BC[0].rate_adaption= DEF_BC1_RA; | |
2386 ctb->BC[1].rate = DEF_BC2_UR; | |
2387 ctb->BC[1].bearer_serv = DEF_BC2_BS; | |
2388 ctb->BC[1].conn_elem = DEF_BC2_CE; | |
2389 ctb->BC[1].stop_bits = DEF_BC2_SB; | |
2390 ctb->BC[1].data_bits = DEF_BC2_DB; | |
2391 ctb->BC[1].parity = DEF_BC2_PR; | |
2392 ctb->BC[1].flow_control = DEF_BC2_FC; | |
2393 ctb->BC[1].modem_type = DEF_BC2_MT; | |
2394 ctb->curBC = 0; | |
2395 ctb->rptInd = DEF_RPT_IND; | |
2396 ctb->sigInf = MNCC_SIG_NOT_PRES; | |
2397 ctb->prio = 0xFF; | |
2398 ctb->CLIRsup = DEF_CLIR_SUP; | |
2399 ctb->mptyStat = CS_IDL; | |
2400 ctb->iId = 0; | |
2401 ctb->srvStat = SSS_IDL; | |
2402 ctb->srvType = NO_VLD_ST; | |
2403 ctb->SSver = DEF_SS_VER; | |
2404 ctb->CUGidx = NOT_PRESENT_8BIT; | |
2405 ctb->CUGprf = FALSE; | |
2406 ctb->OAsup = FALSE; | |
2407 ctb->opCode = NOT_PRESENT_8BIT; | |
2408 ctb->rslt = CAUSE_MAKE (DEFBY_CONDAT, | |
2409 ORIGSIDE_MS, | |
2410 MNCC_CC_ORIGINATING_ENTITY, | |
2411 NOT_PRESENT_8BIT); | |
2412 ctb->nrmCs = CAUSE_MAKE (DEFBY_CONDAT, | |
2413 ORIGSIDE_MS, | |
2414 MNCC_CC_ORIGINATING_ENTITY, | |
2415 NOT_PRESENT_8BIT); | |
2416 ctb->rejCs = CAUSE_MAKE (DEFBY_CONDAT, | |
2417 ORIGSIDE_MS, | |
2418 MNCC_CC_ORIGINATING_ENTITY, | |
2419 NOT_PRESENT_8BIT); | |
2420 ctb->failType = NO_VLD_SSF; | |
2421 ctb->rejPrb = NOT_PRESENT_8BIT; | |
2422 ctb->errCd = NOT_PRESENT_8BIT; | |
2423 ctb->ssDiag = MNCC_SS_DIAG_NOT_PROVIDED; | |
2424 ctb->SATinv = FALSE; | |
2425 ctb->CCBSstat = NO_VLD_CCBSS; | |
2426 ctb->CDStat = NO_VLD_CD; | |
2427 ctb->curCmd = AT_CMD_NONE; | |
2428 ctb->curSrc = CMD_SRC_NONE; | |
2429 ctb->dtmfCmd = AT_CMD_NONE; | |
2430 ctb->dtmfSrc = (T_OWN)CMD_SRC_NONE; | |
2431 ctb->calOwn = (T_OWN)CMD_SRC_NONE; | |
2432 ctb->alphIdUni.cs = CS_NotPresent; | |
2433 ctb->alphIdUni.len = 0; | |
2434 | |
2435 memset (&ctb->cldPty, 0, sizeof(T_dyn_called_party)); | |
2436 memset (&ctb->cldPtySub, 0, sizeof(T_MNCC_called_party_sub)); | |
2437 memset (&ctb->clgPty, 0, sizeof(T_MNCC_calling_party)); | |
2438 memset (&ctb->clgPtySub, 0, sizeof(T_MNCC_calling_party_sub)); | |
2439 memset (&ctb->rdrPty, 0, sizeof(T_dyn_redir_party)); | |
2440 memset (&ctb->rdrPtySub, 0, sizeof(T_dyn_redir_party_sub)); | |
2441 ctb->rdlCnt = 0; | |
2442 ctb->rdlTimIndex = RDL_TIM_INDEX_NOT_PRESENT; | |
2443 ctb->curCs = MNCC_CAUSE_NO_MS_CAUSE; | |
2444 ccShrdPrm.ccCs[idx] = CAUSE_MAKE (DEFBY_STD, | |
2445 ORIGSIDE_MS, | |
2446 MNCC_ACI_ORIGINATING_ENTITY, | |
2447 NOT_PRESENT_8BIT); | |
2448 ccShrdPrm.callType[idx] = (S8)NO_VLD_CC_CALL_TYPE; | |
2449 ctb->numRawCauseBytes = 0; | |
2450 ctb->rawCauseBytes = NULL; | |
2451 #ifdef SIM_TOOLKIT | |
2452 /* | |
2453 *----------------------------------------------------------------- | |
2454 * SAT settings | |
2455 *----------------------------------------------------------------- | |
2456 */ | |
2457 ctb->SatDiscEvent = FALSE; | |
2458 #endif | |
2459 } | |
2460 | |
2461 /* | |
2462 +-------------------------------------------------------------------+ | |
2463 | PROJECT : GSM-PS (6147) MODULE : PSA_CC | | |
2464 | ROUTINE : psaCC_FreeRdrPty | | |
2465 +-------------------------------------------------------------------+ | |
2466 | |
2467 PURPOSE : free (re-initialize) the redirecting party number and | |
2468 the redirecting party subaddress of the indexed call | |
2469 table entry. | |
2470 | |
2471 */ | |
2472 | |
2473 GLOBAL void psaCC_FreeRdrPty ( SHORT idx ) | |
2474 { | |
2475 T_CC_CALL_TBL *ctb = ccShrdPrm.ctb[idx]; | |
2476 | |
2477 TRACE_FUNCTION ("psaCC_FreeRdrPty()"); | |
2478 | |
2479 if (ctb->rdrPty.redir_num NEQ NULL) | |
2480 { | |
2481 ACI_MFREE (ctb->rdrPty.redir_num); | |
2482 memset (&ctb->rdrPty, 0, sizeof(T_dyn_redir_party)); | |
2483 } | |
2484 if (ctb->rdrPtySub.subaddr NEQ NULL) | |
2485 { | |
2486 ACI_MFREE (ctb->rdrPtySub.subaddr); | |
2487 memset (&ctb->rdrPtySub, 0, sizeof(T_dyn_redir_party_sub)); | |
2488 } | |
2489 } | |
2490 | |
2491 | |
2492 /* | |
2493 +-------------------------------------------------------------------+ | |
2494 | PROJECT : GSM-PS (6147) MODULE : PSA_CC | | |
2495 | ROUTINE : psaCC_FreeCtbNtry | | |
2496 +-------------------------------------------------------------------+ | |
2497 | |
2498 PURPOSE : free (re-initialize) the indexed call table entry. | |
2499 | |
2500 */ | |
2501 | |
2502 GLOBAL void psaCC_FreeCtbNtry ( SHORT idx ) | |
2503 { | |
2504 T_CC_CALL_TBL *ctb; | |
2505 USHORT listcounter; | |
2506 T_ACI_LIST *msg2send; | |
2507 | |
2508 TRACE_FUNCTION ("psaCC_FreeCtbNtry()"); | |
2509 | |
2510 if (!psaCC_ctbIsValid (idx)) | |
2511 { | |
2512 TRACE_ERROR ("Try to clear an invalid entry!"); | |
2513 return; | |
2514 } | |
2515 | |
2516 /* | |
2517 * Probably it is important to use this pointer variable here! | |
2518 */ | |
2519 ctb = ccShrdPrm.ctb[idx]; | |
2520 | |
2521 /* | |
2522 * Save the last cause, if any, for later query with qAT_PlusCEER() | |
2523 */ | |
2524 if (GET_CAUSE_VALUE(ctb->rejCs) NEQ NOT_PRESENT_8BIT) | |
2525 { | |
2526 ccShrdPrm.ccCs[idx] = ctb->rejCs; | |
2527 } | |
2528 else if (GET_CAUSE_VALUE(ctb->nrmCs) NEQ NOT_PRESENT_8BIT) | |
2529 { | |
2530 ccShrdPrm.ccCs[idx] = ctb->nrmCs; | |
2531 } | |
2532 else if (GET_CAUSE_VALUE(ctb->rslt) NEQ NOT_PRESENT_8BIT) | |
2533 { | |
2534 ccShrdPrm.ccCs[idx] = ctb->rslt; | |
2535 } | |
2536 else | |
2537 { | |
2538 /* in case network has sent no extended report */ | |
2539 ccShrdPrm.ccCs[idx] = CAUSE_MAKE (DEFBY_STD, | |
2540 ORIGSIDE_MS, | |
2541 MNCC_ACI_ORIGINATING_ENTITY, | |
2542 NOT_PRESENT_8BIT); | |
2543 } | |
2544 | |
2545 /* | |
2546 * Save the call type. Fax/Data needs this information. | |
2547 */ | |
2548 ccShrdPrm.callType[idx] = (T_CC_CALL_TYPE)cmhCC_getcalltype(idx); | |
2549 | |
2550 /* Deleting linked list of Facility primitives */ | |
2551 if ((listcounter = get_list_count(ccShrdPrm.facility_list)) > 0) | |
2552 { | |
2553 for (;listcounter > 0 ; listcounter --) | |
2554 { | |
2555 msg2send = get_next_element( ccShrdPrm.facility_list, NULL); | |
2556 remove_first_element(ccShrdPrm.facility_list); | |
2557 PFREE(msg2send); | |
2558 } | |
2559 } | |
2560 ccShrdPrm.facility_list= NULL; | |
2561 ccShrdPrm.aocRsmpPend = 0; | |
2562 | |
2563 if (ctb->cldPty.called_num NEQ NULL) | |
2564 { | |
2565 ACI_MFREE (ctb->cldPty.called_num); | |
2566 ctb->cldPty.called_num = NULL; | |
2567 } | |
2568 | |
2569 psaCC_FreeRdrPty (idx); | |
2570 | |
2571 ACI_MFREE (ccShrdPrm.ctb[idx]); | |
2572 ccShrdPrm.ctb[idx] = NULL; | |
2573 } | |
2574 | |
2575 /* | |
2576 +-------------------------------------------------------------------+ | |
2577 | PROJECT : GSM-PS (6147) MODULE : CMH | | |
2578 | ROUTINE : psaCC_ctbIsValid | | |
2579 +-------------------------------------------------------------------+ | |
2580 | |
2581 PURPOSE : This function returns whether a given call table entry | |
2582 is valid (means non-NULL). | |
2583 Caution with TRACE_EVENTs etc., it could be used in | |
2584 a signal handler. | |
2585 | |
2586 */ | |
2587 | |
2588 GLOBAL BOOL psaCC_ctbIsValid (SHORT cId) | |
2589 { | |
2590 return ((cId >= 0) AND | |
2591 (cId < MAX_CALL_NR) AND | |
2592 (ccShrdPrm.ctb[cId] NEQ NULL)); | |
2593 } | |
2594 | |
2595 | |
2596 /* | |
2597 +-------------------------------------------------------------------+ | |
2598 | PROJECT : GSM-PS (6147) MODULE : CMH | | |
2599 | ROUTINE : psaCC_ctb | | |
2600 +-------------------------------------------------------------------+ | |
2601 | |
2602 PURPOSE : This function returns a pointer to the call table | |
2603 described by the cId. It is assumed that cId is valid, | |
2604 no return of NULL pointer expected here. | |
2605 What's the sense of this function? There were problems | |
2606 encountered with the target compiler having a too | |
2607 complicated pointer expression. | |
2608 | |
2609 */ | |
2610 | |
2611 GLOBAL T_CC_CALL_TBL * psaCC_ctb (SHORT cId) | |
2612 { | |
2613 return (ccShrdPrm.ctb[cId]); | |
2614 } | |
2615 | |
2616 | |
2617 /* | |
2618 +-------------------------------------------------------------------+ | |
2619 | PROJECT : GSM-PS (6147) MODULE : PSA_CC | | |
2620 | ROUTINE : psaCC_Init | | |
2621 +-------------------------------------------------------------------+ | |
2622 | |
2623 PURPOSE : initialize the protocol stack adapter for CC. | |
2624 | |
2625 */ | |
2626 | |
2627 /* initialize CC parametrs for MTC bearer capabilities */ | |
2628 GLOBAL void psaCC_init_mtcbearer ( void ) | |
2629 { | |
2630 /* wasn't really used apparently | |
2631 ccShrdPrm.mtcBC.rate = DEF_BC1_UR; | |
2632 ccShrdPrm.mtcBC.bearer_serv = DEF_BC1_BS; | |
2633 ccShrdPrm.mtcBC.conn_elem = DEF_BC1_CE; | |
2634 ccShrdPrm.mtcBC.stop_bits = DEF_BC1_SB; | |
2635 ccShrdPrm.mtcBC.data_bits = DEF_BC1_DB; | |
2636 ccShrdPrm.mtcBC.parity = DEF_BC1_PR; | |
2637 ccShrdPrm.mtcBC.flow_control = DEF_BC1_FC; | |
2638 ccShrdPrm.mtcBC.modem_type = DEF_BC1_MT;*/ | |
2639 | |
2640 /* initialize CC for MTC calls */ | |
2641 #ifdef FAX_AND_DATA | |
2642 ccShrdPrm.CBSTspeed = BS_SPEED_9600_V32; | |
2643 ccShrdPrm.CBSTname = CBST_NAM_Asynch; | |
2644 ccShrdPrm.CBSTce = CBST_CE_NonTransparent; | |
2645 #endif /* FAX_AND_DATA */ | |
2646 ccShrdPrm.snsMode = MNCC_SNS_MODE_VOICE; | |
2647 #ifdef FF_TTY | |
2648 ccShrdPrm.ctmReq = MNCC_CTM_DISABLED; | |
2649 ccShrdPrm.ctmState = TTY_STATE_NONE; | |
2650 ccShrdPrm.ttyCmd = (UBYTE)TTY_OFF; | |
2651 ccShrdPrm.ctmOvwr = FALSE; | |
2652 #endif /* FF_TTY */ | |
2653 psaCC_Config( ); | |
2654 } | |
2655 | |
2656 GLOBAL void psaCC_Init ( void ) | |
2657 { | |
2658 UBYTE ctbIdx; /* holds index to call table */ | |
2659 | |
2660 /* initialize call table */ | |
2661 for( ctbIdx = 0; ctbIdx < MAX_CALL_NR; ctbIdx++ ) | |
2662 { | |
2663 ccShrdPrm.ctb[ctbIdx] = NULL; | |
2664 } | |
2665 | |
2666 /* initialize shared parameter */ | |
2667 ccShrdPrm.cIdFail = -1; | |
2668 ccShrdPrm.nrOfMOC = 0; | |
2669 ccShrdPrm.nrOfMTC = 0; | |
2670 ccShrdPrm.chMod = NOT_PRESENT_8BIT; | |
2671 ccShrdPrm.chType = NOT_PRESENT_8BIT; | |
2672 ccShrdPrm.syncCs = CAUSE_MAKE(DEFBY_CONDAT, ORIGSIDE_MS, MNCC_CC_ORIGINATING_ENTITY, NOT_PRESENT_8BIT); | |
2673 ccShrdPrm.TCHasg = FALSE; | |
2674 ccShrdPrm.datStat = DS_IDL; | |
2675 ccShrdPrm.CMODmode = CMOD_MOD_Single; | |
2676 ccShrdPrm.msgType = NO_VLD_MT; | |
2677 ccShrdPrm.dtmf.cId = NO_ENTRY; | |
2678 ccShrdPrm.dtmf.cnt = 0; | |
2679 ccShrdPrm.dtmf.cur = 0; | |
2680 ccShrdPrm.facility_list = NULL; | |
2681 ccShrdPrm.cvhu = CVHU_DropDTR_IGNORED; | |
2682 #if defined (FF_WAP) || defined (FF_SAT_E) | |
2683 ccShrdPrm.wapStat = CC_WAP_STACK_DOWN; | |
2684 #endif | |
2685 cuscfgParams.MO_SM_Control_SIM = CUSCFG_STAT_Disabled; | |
2686 cuscfgParams.MO_Call_Control_SIM = CUSCFG_STAT_Disabled; | |
2687 cuscfgParams.MO_SS_Control_SIM = CUSCFG_STAT_Disabled; | |
2688 cuscfgParams.MO_USSD_Control_SIM = CUSCFG_STAT_Disabled; | |
2689 cuscfgParams.Two_digit_MO_Call = CUSCFG_STAT_Disabled; | |
2690 cuscfgParams.Ext_USSD_Response = CUSCFG_STAT_Disabled; | |
2691 cuscfgParams.USSD_As_MO_Call = CUSCFG_STAT_Disabled; | |
2692 | |
2693 Ext_USSD_Res_Pending_sId = NOT_PRESENT_8BIT; | |
2694 | |
2695 psaCC_init_mtcbearer( ); | |
2696 #ifdef TI_PS_FF_AT_CMD_P_ECC | |
2697 /* Initialize additional ECC numbers */ | |
2698 cmhCC_additional_ecc_numbers_initialize(); | |
2699 #endif /* TI_PS_FF_AT_CMD_P_ECC */ | |
2700 } | |
2701 | |
2702 /* | |
2703 +-------------------------------------------------------------------------+ | |
2704 | PROJECT : GSM-PS (6147) MODULE : PSA_CCP | | |
2705 | ROUTINE : psaCC_ProcessCmp | | |
2706 +-------------------------------------------------------------------------+ | |
2707 | |
2708 PURPOSE : processes the each component sent by the function | |
2709 psa_mncc_facility_ind(). | |
2710 | |
2711 */ | |
2712 | |
2713 | |
2714 GLOBAL void psaCC_ProcessCmp ( T_MNCC_FACILITY_IND *mncc_facility_ind ) | |
2715 { | |
2716 SHORT cId; /* holds call id */ | |
2717 BOOL facility_stored = FALSE; | |
2718 | |
2719 TRACE_FUNCTION ("psaCC_ProcessCmp()"); | |
2720 | |
2721 /* | |
2722 *------------------------------------------------------------------- | |
2723 * find call in call table | |
2724 *------------------------------------------------------------------- | |
2725 */ | |
2726 cId = psaCC_ctbFindTi( mncc_facility_ind -> ti ); | |
2727 | |
2728 if( cId < 0 ) | |
2729 { | |
2730 /* | |
2731 * ignore primitive, due to not found transaction identifier. | |
2732 */ | |
2733 TRACE_EVENT ("primitive rejected due to unused ti"); | |
2734 PFREE(mncc_facility_ind); | |
2735 return; | |
2736 } | |
2737 | |
2738 psaCC_DumpFIE (&mncc_facility_ind -> fac_inf ); | |
2739 cmhCC_sendFie( CSCN_FACILITY_DIRECTION_IN, | |
2740 cId, | |
2741 &mncc_facility_ind -> fac_inf ); | |
2742 | |
2743 /* decode component type */ | |
2744 CCD_START; | |
2745 { | |
2746 UBYTE ccdRet; | |
2747 | |
2748 MCAST( com, COMPONENT ); | |
2749 memset( com, 0, sizeof( T_COMPONENT )); | |
2750 | |
2751 ccdRet = ccd_decodeMsg (CCDENT_FAC, | |
2752 DOWNLINK, | |
2753 (T_MSGBUF *) &mncc_facility_ind -> fac_inf, | |
2754 (UBYTE *) _decodedMsg, | |
2755 COMPONENT); | |
2756 | |
2757 if( ccdRet NEQ ccdOK ) | |
2758 { | |
2759 TRACE_EVENT_P1("CCD Decoding Error: %d",ccdRet ); | |
2760 psaCC_ctb(cId)->failType = SSF_CCD_DEC; | |
2761 cmhCC_SSTransFail(cId); | |
2762 } | |
2763 else | |
2764 { | |
2765 /* Buffer MNCC_FACILITY_IND primitive | |
2766 if the Call direction is MTC | |
2767 and no TCHasg Flag | |
2768 and RING is not sent yet | |
2769 and no signal information | |
2770 | |
2771 */ | |
2772 if (psaCC_ctb(cId)->calType EQ CT_MTC AND !ccShrdPrm.TCHasg AND | |
2773 psaCC_ctb(cId)->calStat EQ CS_ACT_REQ AND psaCC_ctb(cId)->sigInf EQ MNCC_SIG_NOT_PRES) | |
2774 { | |
2775 if ( ccShrdPrm.facility_list EQ NULL) | |
2776 { | |
2777 ccShrdPrm.facility_list = new_list (); | |
2778 insert_list(ccShrdPrm.facility_list, mncc_facility_ind); | |
2779 } | |
2780 else | |
2781 { | |
2782 insert_list(ccShrdPrm.facility_list, mncc_facility_ind); | |
2783 } | |
2784 facility_stored = TRUE; | |
2785 } | |
2786 else | |
2787 { | |
2788 if( com->v_inv_comp ) | |
2789 { | |
2790 psaCC_dasmInvokeCmp( cId, &com->inv_comp ); | |
2791 } | |
2792 else if( com->v_res_comp ) | |
2793 { | |
2794 psaCC_dasmResultCmp( cId, &com->res_comp ); | |
2795 } | |
2796 else if( com->v_err_comp ) | |
2797 { | |
2798 #ifdef SIM_TOOLKIT | |
2799 if( psaCC_ctb(cId)->SATinv ) | |
2800 { | |
2801 psaCC_ctb(cId)->SATinv = FALSE; | |
2802 psaSAT_SSErrComp((T_fac_inf *) &mncc_facility_ind -> fac_inf, FALSE ); | |
2803 } | |
2804 #endif | |
2805 psaCC_dasmErrorCmp( cId, &com->err_comp ); | |
2806 } | |
2807 else if( com->v_rej_comp ) | |
2808 { | |
2809 #ifdef SIM_TOOLKIT | |
2810 if( psaCC_ctb(cId)->SATinv ) | |
2811 { | |
2812 psaCC_ctb(cId)->SATinv = FALSE; | |
2813 psaSAT_SSRejComp( RSLT_NTW_UNAB_PROC ); | |
2814 } | |
2815 #endif | |
2816 psaCC_dasmRejectCmp( cId, &com->rej_comp ); | |
2817 } | |
2818 else | |
2819 { | |
2820 TRACE_EVENT( "WRONG COMPONENT TYPE RECEIVED" ); | |
2821 cmhCC_SSTransFail (cId); | |
2822 } | |
2823 } | |
2824 } | |
2825 } | |
2826 CCD_END; | |
2827 | |
2828 /* | |
2829 *------------------------------------------------------------------- | |
2830 * free the primitive buffer if not stored | |
2831 *------------------------------------------------------------------- | |
2832 */ | |
2833 if (!facility_stored) | |
2834 { | |
2835 PFREE (mncc_facility_ind); | |
2836 } | |
2837 | |
2838 } | |
2839 | |
2840 /* | |
2841 +-------------------------------------------------------------------+ | |
2842 | PROJECT : GSM-PS (6147) MODULE : PSA_CC | | |
2843 | ROUTINE : psaCC_DumpFIE | | |
2844 +-------------------------------------------------------------------+ | |
2845 | |
2846 PURPOSE : Dump facility information element to debug output. | |
2847 | |
2848 */ | |
2849 | |
2850 GLOBAL void psaCC_DumpFIE ( T_MNCC_fac_inf * fie ) | |
2851 { | |
2852 CHAR strBuf[40+1]; /* holds string buffer */ | |
2853 UBYTE idx, cnt,mcnt; /* buffer index */ | |
2854 CHAR *pDest; /* points to destination */ | |
2855 | |
2856 TRACE_EVENT( "FIE SENT/RECEIVED:" ); | |
2857 | |
2858 mcnt = fie->l_fac >> 3; | |
2859 /* G23 uses ever offset 0 !!! */ | |
2860 | |
2861 /* format FIE */ | |
2862 for( cnt = 0; cnt < mcnt; cnt+=idx ) | |
2863 { | |
2864 pDest = strBuf; | |
2865 | |
2866 for( idx = 0; idx < 20 AND idx+cnt < mcnt; idx++ ) | |
2867 { | |
2868 /* Implements Measure#32: Row 1245 */ | |
2869 pDest += sprintf( pDest, format_2X_str, (UBYTE)fie->fac[idx+cnt] ); | |
2870 } | |
2871 | |
2872 *pDest = 0x0; | |
2873 | |
2874 TRACE_EVENT_P1("%s", strBuf ); | |
2875 } | |
2876 } | |
2877 | |
2878 /* | |
2879 +-------------------------------------------------------------------+ | |
2880 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
2881 | ROUTINE : psaCC_ctbDump | | |
2882 +-------------------------------------------------------------------+ | |
2883 | |
2884 PURPOSE : this function dumps the call table to the debug output. | |
2885 */ | |
2886 | |
2887 #ifdef TRACING | |
2888 // What you are searching for has been removed by Conquest issue | |
2889 // ACI-ENH-30932 for the Locosto project in the assumption noone | |
2890 // is using it anymore. If I was wrong get the function back from | |
2891 // the version control system and let me know. | |
2892 // HM, 4-May-2005 | |
2893 #endif /* of #ifdef TRACING */ | |
2894 | |
2895 /* | |
2896 +-------------------------------------------------------------------+ | |
2897 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
2898 | ROUTINE : psaCC_ctbDumpBC | | |
2899 +-------------------------------------------------------------------+ | |
2900 | |
2901 PURPOSE : this function dumps the BC to the debug output. | |
2902 */ | |
2903 | |
2904 #ifdef TRACING | |
2905 // What you are searching for has been removed by Conquest issue | |
2906 // ACI-ENH-30932 for the Locosto project in the assumption noone | |
2907 // is using it anymore. If I was wrong get the function back from | |
2908 // the version control system and let me know. | |
2909 // HM, 4-May-2005 | |
2910 #endif /* of #ifdef TRACING */ | |
2911 | |
2912 /* Implements Measure# 188 & 189*/ | |
2913 /* | |
2914 +-------------------------------------------------------------------+ | |
2915 | PROJECT : GSM-PS (6147) MODULE : PSA_CCF | | |
2916 | ROUTINE : psaCC_ctbClrAdr2Num | | |
2917 +-------------------------------------------------------------------+ | |
2918 | |
2919 PURPOSE : this function converts the parameters of the calling | |
2920 address for the passed call id into a dial number. The | |
2921 string is copied into the passed buffer. In case the | |
2922 buffer size is not sufficient to hold the called number, | |
2923 the number is cut to maxSize. The function returns a pointer | |
2924 to the buffer or NULL if an error occurs. | |
2925 */ | |
2926 | |
2927 LOCAL CHAR *psaCC_ctbAdr2Num ( CHAR *pNumBuf, UBYTE maxSize, UBYTE *num, | |
2928 UBYTE c_num, UBYTE ton) | |
2929 { | |
2930 TRACE_FUNCTION ("psaCC_ctbAdr2Num()"); | |
2931 /* | |
2932 *------------------------------------------------------------------- | |
2933 * convert BCD address | |
2934 *------------------------------------------------------------------- | |
2935 */ | |
2936 if (c_num EQ 0) | |
2937 { | |
2938 *pNumBuf = '\0'; /* empty string */ | |
2939 return( NULL ); | |
2940 } | |
2941 | |
2942 maxSize -= 1; /* for trailing '\0' */ | |
2943 | |
2944 /* | |
2945 * International call add + at the beginning | |
2946 */ | |
2947 if (ton EQ MNCC_TON_INT_NUMB) | |
2948 { | |
2949 *pNumBuf = '+'; | |
2950 utl_BCD2DialStr (num, pNumBuf+1, | |
2951 (UBYTE)MINIMUM(maxSize-1, c_num)); | |
2952 } | |
2953 else | |
2954 { | |
2955 utl_BCD2DialStr (num, pNumBuf, | |
2956 (UBYTE)MINIMUM(maxSize, c_num)); | |
2957 } | |
2958 return( pNumBuf ); | |
2959 } | |
2960 | |
2961 /*==== EOF ========================================================*/ | |
2962 |