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