comparison src/g23m-aci/aci/psa_ccs.c @ 162:53929b40109c

src/g23m-aci: initial import from TCS3.2/LoCosto
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 11 Oct 2016 02:02:43 +0000
parents
children
comparison
equal deleted inserted replaced
161:4557e2a9c18e 162:53929b40109c
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-PS (6147)
4 | Modul : PSA_CCS
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose : This module defines the signalling functions of the
18 | protocol stack adapter for call control.
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef PSA_CCS_C
23 #define PSA_CCS_C
24 #endif
25
26 #include "aci_all.h"
27
28 /*==== INCLUDES ===================================================*/
29 #include "ccdapi.h"
30
31 #include "aci_cmh.h"
32 #include "ati_cmd.h"
33 #include "aci_cmd.h"
34 #include "aci.h"
35 #include "psa.h"
36 #include "psa_cc.h"
37 #include "psa_ss.h"
38 #include "aoc.h"
39 #include "l4_tim.h"
40
41 #if !defined (MFW)
42 #include "aci_io.h"
43 #endif
44
45 #include "aci_fd.h"
46 #include "cmh.h"
47
48 #include "cmh_cc.h"
49 #include "psa_cc.h"
50
51 #include "wap_aci.h"
52 #include "aci_mem.h"
53 /*==== CONSTANTS ==================================================*/
54
55 /*==== TYPES ======================================================*/
56
57 /*==== IMPORT =====================================================*/
58
59 /*==== VARIABLES ==================================================*/
60
61 /*==== FUNCTIONS ==================================================*/
62
63
64 /*
65 +-------------------------------------------------------------------+
66 | PROJECT : GSM-PS (6147) MODULE : PSA_CCS |
67 | ROUTINE : psaCC_NewCall |
68 +-------------------------------------------------------------------+
69
70 PURPOSE : setup a new call
71
72 */
73
74 GLOBAL SHORT psaCC_NewCall ( SHORT cId )
75 {
76 T_CC_CALL_TBL *pCtbNtry = ccShrdPrm.ctb[cId];
77
78 TRACE_FUNCTION ("psaCC_NewCall()");
79
80 if (pCtbNtry EQ NULL)
81 return -1;
82
83 /* get a valid ti for a MOC, otherwise return */
84 if (psaCC_ctb(cId)->calType NEQ CT_NI_MOC )
85 {
86 if( psaCC_getMOCTi( cId ) < 0 ) return ( -1 );
87 }
88
89 #if defined (FF_WAP) || defined (FF_GPF_TCPIP) || defined (FF_SAT_E)
90 /* if this call is a WAP call then set wapId to the current Call Id */
91 if (Wap_Call EQ TRUE)
92 {
93 wapId = cId;
94 }
95 #endif /* defined(WAP) OR defined(FF_GPF_TCPIP) */
96
97 /*
98 *-------------------------------------------------------------------
99 * create and send primitive
100 *-------------------------------------------------------------------
101 */
102 {
103 PALLOC (mncc_setup_req, MNCC_SETUP_REQ);
104
105 /*
106 * fill in primitive parameter: setup request
107 */
108 mncc_setup_req -> ti = pCtbNtry -> ti;
109 mncc_setup_req -> prio = pCtbNtry -> prio;
110 mncc_setup_req -> ri = pCtbNtry -> rptInd;
111
112 mncc_setup_req->called_party.ton = pCtbNtry->cldPty.ton;
113 mncc_setup_req->called_party.npi = pCtbNtry->cldPty.npi;
114 mncc_setup_req->called_party.c_called_num = pCtbNtry->cldPty.c_called_num;
115 memcpy (mncc_setup_req->called_party.called_num,
116 pCtbNtry->cldPty.called_num,
117 pCtbNtry->cldPty.c_called_num);
118
119 mncc_setup_req -> called_party_sub = pCtbNtry -> cldPtySub;
120 mncc_setup_req -> clir_sup = pCtbNtry -> CLIRsup;
121 memcpy( &(mncc_setup_req->bcpara),&(pCtbNtry->BC[0]),
122 sizeof( T_MNCC_bcpara) );
123 memcpy( &(mncc_setup_req->bcpara2),&(pCtbNtry->BC[1]),
124 sizeof( T_MNCC_bcpara) );
125
126 /*
127 * fill in CUG info facility
128 */
129 if( !(pCtbNtry -> CUGidx EQ NOT_PRESENT_8BIT AND
130 pCtbNtry -> CUGprf EQ FALSE AND
131 pCtbNtry -> OAsup EQ FALSE ))
132 {
133 CCD_START;
134 psaCC_asmCUGInfo( cId );
135
136 {
137 UBYTE ccdRet;
138
139 MCAST( com, COMPONENT );
140
141 memset( com, 0, sizeof( T_COMPONENT ));
142
143 com -> v_inv_comp = TRUE;
144 com -> inv_comp.v_inv_id = TRUE;
145 com -> inv_comp.inv_id = pCtbNtry -> iId
146 = ccShrdPrm.iIdNxt++;
147 com -> inv_comp.v_op_code = TRUE;
148 com -> inv_comp.op_code = pCtbNtry -> opCode
149 = ssFIECodeBuf.buf[0];
150 com -> inv_comp.v_params = TRUE;
151 com -> inv_comp.params.l_params = ssFIECodeBuf.l_buf-8;
152 com -> inv_comp.params.o_params = 8;
153 memcpy( com -> inv_comp.params.b_params,
154 ssFIECodeBuf.buf, ssFIECodeBuf.l_buf );
155
156 mncc_setup_req -> fac_inf.l_fac = MNCC_FACILITY_LEN<<3;
157 mncc_setup_req -> fac_inf.o_fac = 0;
158 ccdRet = ccd_codeMsg (CCDENT_FAC,
159 UPLINK,
160 (T_MSGBUF *) &mncc_setup_req -> fac_inf,
161 (UBYTE *) _decodedMsg,
162 COMPONENT);
163
164 if( ccdRet NEQ ccdOK )
165 {
166 TRACE_EVENT_P1("CCD Coding Error: %d",ccdRet );
167 memset( &mncc_setup_req -> fac_inf, 0, sizeof( T_MNCC_fac_inf));
168 }
169 }
170 CCD_END;
171 }
172 else
173 {
174 memset( &mncc_setup_req -> fac_inf, 0, sizeof( T_MNCC_fac_inf));
175 }
176
177 if(pCtbNtry -> calType NEQ CT_MOC_RDL)
178 {
179 pCtbNtry -> calType = CT_MOC;
180 }
181 pCtbNtry -> curBC = 0;
182
183 PSENDX (CC, mncc_setup_req);
184
185 /*
186 * update call status
187 */
188 pCtbNtry -> calStat = CS_ACT_REQ;
189 /* Inform that a call is initiated */
190 psaCC_chngCalTypCnt( cId, +1 );
191 }
192 #ifdef FF_TTY
193 /* TTY notification */
194 cmhCC_notifyTTY (((pCtbNtry->BC[0].bearer_serv EQ MNCC_BEARER_SERV_SPEECH_CTM OR
195 pCtbNtry->BC[0].bearer_serv EQ MNCC_BEARER_SERV_AUX_SPEECH_CTM)?
196 CTTY_NEG_Request: CTTY_NEG_None),
197 CTTY_TRX_Unknown);
198 #endif /* FF_TTY */
199 if(cmhCC_atdsendok ( cId ))
200 {
201 R_AT( RAT_OK, (T_ACI_CMD_SRC)pCtbNtry->curSrc ) ( pCtbNtry->curCmd );
202 }
203
204 /* start call time measurement */
205 aoc_info (cId, AOC_START_TIME);
206
207 /* Disable voice path in case this is first call */
208 psaCC_setSpeechMode ();
209
210 return 0;
211 }
212
213 /*
214 +-------------------------------------------------------------------+
215 | PROJECT : GSM-PS (6147) MODULE : PSA_CCS |
216 | ROUTINE : psaCC_AcceptCall |
217 +-------------------------------------------------------------------+
218 PURPOSE : In addition to sending the setup response for an MT call
219 this function enables the vocoder if the call is a voice
220 call
221 */
222
223 GLOBAL void psaCC_AcceptCall ( SHORT cId )
224 {
225 T_CC_CALL_TBL * pCtbNtry; /* holds pointer to call table entry */
226
227 TRACE_FUNCTION ("psaCC_AcceptCall()");
228
229 /* update call status and attach the user if not done previously */
230 pCtbNtry = ccShrdPrm.ctb[cId];
231 pCtbNtry -> calStat = CS_CPL_REQ;
232
233
234 psaCC_setSpeechMode();
235
236 /* create and send primitive */
237 {
238 PALLOC (mncc_setup_res, MNCC_SETUP_RES);
239 mncc_setup_res -> ti = pCtbNtry -> ti;
240 PSENDX (CC, mncc_setup_res);
241 psaCC_send_satevent( EVENT_CALL_CONN, cId, NEAR_END, FALSE );
242 }
243
244 /* start call time measurement */
245 aoc_info (cId, AOC_START_TIME);
246 }
247
248 /*
249 +-------------------------------------------------------------------+
250 | PROJECT : GSM-PS (6147) MODULE : PSA_CCS |
251 | ROUTINE : psaCC_ClearCall |
252 +-------------------------------------------------------------------+
253
254 PURPOSE : clear a call
255 */
256
257 GLOBAL void psaCC_ClearCall ( SHORT cId )
258 {
259 T_CC_CALL_TBL *pCtbNtry = ccShrdPrm.ctb[cId];
260
261 TRACE_FUNCTION ("psaCC_ClearCall()");
262
263 if (!psaCC_ctbIsValid (cId))
264 return; /* Ensure we are not dereferencing NULL */
265
266 psaCC_StopDTMF ( cId );
267
268 /* inform advice of charge module */
269 aoc_info (cId, AOC_STOP_TIME);
270
271 /*
272 *-----------------------------------------------------------------
273 * relase call if in disconnect request state
274 *-----------------------------------------------------------------
275 */
276 if( pCtbNtry -> calStat EQ CS_DSC_REQ )
277 {
278 PALLOC (mncc_release_req, MNCC_RELEASE_REQ);
279
280 /* fill in primitive parameter: release request */
281 mncc_release_req -> ti = pCtbNtry -> ti;
282 mncc_release_req -> cause = pCtbNtry -> nrmCs;
283
284 /* fill in CCBS request facility */
285 if( pCtbNtry -> CCBSstat EQ CCBSS_REQ )
286 {
287 CCD_START;
288 {
289 psaCC_asmCCBSReq( cId );
290 psaCC_asmComponent( cId );
291 }
292 CCD_END;
293
294 mncc_release_req -> fac_inf.l_fac = ssFIECodeBuf.l_buf;
295 mncc_release_req -> fac_inf.o_fac = 0;
296 memcpy (mncc_release_req->fac_inf.fac,
297 ssFIECodeBuf.buf + (ssFIECodeBuf.o_buf >> 3),
298 ssFIECodeBuf.l_buf >> 3);
299
300 mncc_release_req -> ss_version = MNCC_SS_VERSION_3;
301 }
302 else
303 {
304 memset( &mncc_release_req -> fac_inf, 0, sizeof( T_MNCC_fac_inf));
305 mncc_release_req -> ss_version = MNCC_SS_VER_NOT_PRES;
306 }
307
308 PSENDX (CC, mncc_release_req);
309
310 psaCC_send_satevent( EVENT_CALL_DISC, cId, NEAR_END, TRUE );
311 }
312
313 /*
314 *-----------------------------------------------------------------
315 * relase call if in activate request state, network initiated
316 *-----------------------------------------------------------------
317 */
318 else if( pCtbNtry -> calStat EQ CS_ACT_REQ AND
319 pCtbNtry -> calType EQ CT_NI_MOC )
320 {
321 PALLOC (mncc_reject_req, MNCC_REJECT_REQ);
322
323 /* fill in primitive parameter: release request */
324 mncc_reject_req -> ti = pCtbNtry -> ti;
325 mncc_reject_req -> cause = pCtbNtry -> nrmCs;
326
327 PSENDX (CC, mncc_reject_req);
328
329 /* free call table entry */
330 psaCC_retMOCTi( pCtbNtry -> ti );
331
332 psaCC_FreeCtbNtry (cId);
333 }
334
335 /*
336 *-----------------------------------------------------------------
337 * disconnect all other calls
338 *-----------------------------------------------------------------
339 */
340 else
341 {
342 PALLOC (disc_req, MNCC_DISCONNECT_REQ); /* T_MNCC_DISCONNECT_REQ */
343 disc_req -> ti = pCtbNtry -> ti;
344 disc_req -> cause = pCtbNtry -> nrmCs;
345 if (pCtbNtry -> curCmd EQ AT_CMD_CTFR)
346 {
347 /* We expect here an already built facility in ssFIECodeBuf */
348 disc_req -> fac_inf.l_fac = ssFIECodeBuf.l_buf;
349 disc_req -> fac_inf.o_fac = 0;
350 memcpy (disc_req->fac_inf.fac,
351 ssFIECodeBuf.buf,
352 ssFIECodeBuf.l_buf >> 3);
353 disc_req -> ss_version = MNCC_SS_VERSION_2;
354 }
355 else
356 {
357 disc_req -> fac_inf.l_fac = 0;
358 disc_req -> ss_version = MNCC_SS_VER_NOT_PRES;
359 }
360 PSENDX (CC, disc_req);
361
362 /* update call status */
363 pCtbNtry -> calStat = CS_DSC_REQ;
364
365 //TISH, hot fix for GCF 27.22.7.3, added in 2007-03-23
366 //start 38.patch for GCF test case: 27.22.7.3
367 if (pCtbNtry -> nrmCs EQ 0x510)
368 {
369 pCtbNtry->numRawCauseBytes=2;
370 ACI_MALLOC(pCtbNtry -> rawCauseBytes,2);
371 pCtbNtry -> rawCauseBytes[0]=0xe0;
372 pCtbNtry -> rawCauseBytes[1]=0x90;
373 }
374 //end
375
376
377 /* monitoring for SAT */
378 psaCC_send_satevent( EVENT_CALL_DISC, cId , NEAR_END, TRUE );
379
380 //TISH, hot fix for GCF 27.22.7.3, added in 2007-03-23
381 //start 38.patch for GCF test case: 27.22.7.3
382 if (pCtbNtry -> nrmCs EQ 0x510)
383 {
384 pCtbNtry->numRawCauseBytes=0;
385 ACI_MFREE(pCtbNtry -> rawCauseBytes);
386 }
387 //end
388
389 }
390 /* Switch off audio path after user action (e.g. hangup) */
391 /* clb this breaks ACI056 (among others..) necessary ?? pCtbNtry -> inBndTns = FALSE; */
392 pCtbNtry -> inBndTns = FALSE;
393 psaCC_setSpeechMode ();
394 }
395
396 /*
397 +-------------------------------------------------------------------+
398 | PROJECT : GSM-PS (6147) MODULE : PSA_CCS |
399 | ROUTINE : psaCC_HoldCall |
400 +-------------------------------------------------------------------+
401
402 PURPOSE : put a call into hold state
403
404 */
405
406 GLOBAL void psaCC_HoldCall ( SHORT cId )
407 {
408 T_CC_CALL_TBL *pCtbNtry = ccShrdPrm.ctb[cId];
409
410 TRACE_FUNCTION ("psaCC_HoldCall()");
411
412 if (pCtbNtry EQ NULL)
413 return; /* Ensure not to dereference NULL */
414
415 /*
416 *-------------------------------------------------------------------
417 * create and send primitive
418 *-------------------------------------------------------------------
419 */
420 psaCC_StopDTMF ( cId );
421
422 {
423 PALLOC (mncc_hold_req, MNCC_HOLD_REQ);
424
425 /*
426 * fill in primitive parameter: hold request
427 */
428
429 mncc_hold_req -> ti = pCtbNtry -> ti;
430
431 PSENDX (CC, mncc_hold_req);
432
433 /* update call status */
434 pCtbNtry -> calStat = CS_HLD_REQ;
435
436 }
437 }
438
439 /*
440 +-------------------------------------------------------------------+
441 | PROJECT : GSM-PS (6147) MODULE : PSA_CCS |
442 | ROUTINE : psaCC_RetrieveCall |
443 +-------------------------------------------------------------------+
444
445 PURPOSE : retrieve a held call
446
447 */
448
449 GLOBAL void psaCC_RetrieveCall ( SHORT cId )
450 {
451 T_CC_CALL_TBL *pCtbNtry = ccShrdPrm.ctb[cId];
452
453 TRACE_FUNCTION ("psaCC_RetrieveCall()");
454
455 /*
456 *-------------------------------------------------------------------
457 * create and send primitive
458 *-------------------------------------------------------------------
459 */
460 {
461 PALLOC (mncc_retrieve_req, MNCC_RETRIEVE_REQ);
462
463 /*
464 * fill in primitive parameter: retrieve request
465 */
466
467 mncc_retrieve_req -> ti = pCtbNtry -> ti;
468
469 PSENDX (CC, mncc_retrieve_req);
470
471 /*
472 * update call status ???
473 */
474 }
475 }
476
477 /*
478 +-------------------------------------------------------------------+
479 | PROJECT : GSM-PS (6147) MODULE : PSA_CCS |
480 | ROUTINE : psaCC_ModifyCall |
481 +-------------------------------------------------------------------+
482
483 PURPOSE : modify an active call
484
485 */
486
487 GLOBAL SHORT psaCC_ModifyCall ( SHORT cId )
488 {
489 T_CC_CALL_TBL *pCtbNtry = ccShrdPrm.ctb[cId];
490 UBYTE nomBC; /* holds nominal bearer capabilities */
491
492 TRACE_FUNCTION ("psaCC_ModifyCall()");
493
494 if (pCtbNtry EQ NULL)
495 return -1;
496
497 /*
498 *-------------------------------------------------------------------
499 * check if call is in a active state
500 *-------------------------------------------------------------------
501 */
502 if(
503 (pCtbNtry -> calStat NEQ CS_ACT) AND
504 (pCtbNtry -> calStat NEQ CS_ACT_REQ)
505 )
506 return( -1 );
507 /*
508 *-------------------------------------------------------------------
509 * create and send primitive
510 *-------------------------------------------------------------------
511 */
512 psaCC_StopDTMF ( cId );
513 {
514 PALLOC (mncc_modify_req, MNCC_MODIFY_REQ);
515
516 /*
517 * fill in primitive parameter: modify request
518 */
519 nomBC = (pCtbNtry -> curBC)?0:1;
520
521 switch( pCtbNtry -> BC[nomBC].bearer_serv )
522 {
523 case( MNCC_BEARER_SERV_AUX_SPEECH ):
524 case( MNCC_BEARER_SERV_SPEECH ):
525 case( MNCC_BEARER_SERV_AUX_SPEECH_CTM):
526 case( MNCC_BEARER_SERV_SPEECH_CTM ):
527 mncc_modify_req -> serv = MNCC_SERV_SPEECH;
528 break;
529
530 case( MNCC_BEARER_SERV_FAX ):
531 case( MNCC_BEARER_SERV_ASYNC ):
532 case( MNCC_BEARER_SERV_SYNC ):
533 case( MNCC_BEARER_SERV_PAD_ACCESS ):
534 case( MNCC_BEARER_SERV_PACKET_ACCESS ):
535 mncc_modify_req -> serv = MNCC_SERV_DATA;
536
537 /* check for TTY service */
538 cmhCC_TTY_Control ( cId, TTY_PAUSE );
539 break;
540
541 default:
542 mncc_modify_req -> serv = MNCC_SERV_NOT_PRES;
543 }
544 mncc_modify_req -> ti = pCtbNtry -> ti;
545
546 PSENDX (CC, mncc_modify_req);
547
548 /*
549 * update call status
550 */
551 pCtbNtry -> calStat = CS_MDF_REQ;
552 }
553 return 0;
554 }
555
556 /*
557 +-------------------------------------------------------------------+
558 | PROJECT : GSM-PS (6147) MODULE : PSA_CCS |
559 | ROUTINE : psaCC_SendDTMF |
560 +-------------------------------------------------------------------+
561
562 PURPOSE : send DTMF tones
563
564 */
565
566 GLOBAL SHORT psaCC_SendDTMF ( SHORT cId,
567 UBYTE digit,
568 UBYTE mode )
569 {
570
571 TRACE_FUNCTION ("psaCC_SendDTMF()");
572
573 if (ccShrdPrm.ctb[cId] EQ NULL)
574 return -1; /* Ensure not to dereference NULL */
575
576 /*
577 *-------------------------------------------------------------------
578 * create and send primitive
579 *-------------------------------------------------------------------
580 */
581 {
582 PALLOC (mncc_start_dtmf_req, MNCC_START_DTMF_REQ);
583
584 /*
585 * fill in primitive parameter: DTMF tone request
586 */
587
588 mncc_start_dtmf_req -> ti = psaCC_ctb(cId)->ti;
589 mncc_start_dtmf_req -> key = digit;
590 mncc_start_dtmf_req -> dtmf_mod = mode;
591
592 PSENDX (CC, mncc_start_dtmf_req);
593 }
594
595 return 0;
596 }
597
598 /*
599 +-------------------------------------------------------------------+
600 | PROJECT : GSM-PS (6147) MODULE : PSA_CCS |
601 | ROUTINE : psaCC_Config |
602 +-------------------------------------------------------------------+
603 PURPOSE : configure CC entity
604 */
605
606 GLOBAL void psaCC_Config ( void )
607 {
608 T_MNCC_bcpara *mtcBC;
609
610 TRACE_FUNCTION ("psaCC_Config()");
611
612 /* create and send primitive */
613 {
614 PALLOC (mncc_configure_req, MNCC_CONFIGURE_REQ);
615
616 /* fill in primitive parameter: configure request */
617 memset(&(mncc_configure_req -> called_party_sub), 0,
618 sizeof(T_MNCC_called_party_sub));
619
620 /* MTC bearer caps */
621 mtcBC = &mncc_configure_req -> bcpara;
622 #ifdef FAX_AND_DATA
623 mtcBC->rate = cmhCC_SelRate( ccShrdPrm.CBSTspeed );
624 #else
625 mtcBC->rate = MNCC_UR_NOT_PRES;
626 #endif /* FAX_AND_DATA */
627
628 if( ccShrdPrm.snsMode EQ CSNS_MOD_Fax OR
629 ccShrdPrm.snsMode EQ CSNS_MOD_VAFVoice OR
630 ccShrdPrm.snsMode EQ CSNS_MOD_VAFFax )
631 {
632 mtcBC->bearer_serv = MNCC_BEARER_SERV_FAX;
633 mtcBC->modem_type = MNCC_MT_NONE;
634 mtcBC->conn_elem = MNCC_CONN_ELEM_TRANS;
635 }
636 else
637 {
638 #ifdef FAX_AND_DATA
639 mtcBC->bearer_serv = cmhCC_SelServ( ccShrdPrm.CBSTname );
640 mtcBC->modem_type = cmhCC_SelMT ( ccShrdPrm.CBSTspeed );
641 mtcBC->conn_elem = cmhCC_SelCE ( ccShrdPrm.CBSTce );
642 mtcBC->transfer_cap = cmhCC_SelTransferCap ( ccShrdPrm.CBSTspeed );
643 mtcBC->rate_adaption = cmhCC_SelRateAdaption( ccShrdPrm.CBSTspeed );
644 #else
645 mtcBC->bearer_serv = MNCC_BEARER_SERV_NOT_PRES;
646 mtcBC->modem_type = MNCC_MT_NONE;
647 mtcBC->conn_elem = MNCC_CONN_ELEM_NOT_PRES;
648 #endif /* FAX_AND_DATA */
649 }
650
651
652 /* not sure whether this is taken into account by CC */
653 mtcBC->stop_bits = DEF_BC1_SB; /*cmhCC_SelStopBit( srcId );*/
654 mtcBC->data_bits = DEF_BC1_DB; /*cmhCC_SelDataBit( srcId );*/
655 mtcBC->parity = DEF_BC1_PR; /*cmhCC_SelParity ( srcId );*/
656 mtcBC->flow_control = DEF_BC1_FC;
657 /*****************************************************/
658
659 /* mncc_configure_req -> bcpara = *mtcBC; superfluous */
660 mncc_configure_req -> sns_mode = ccShrdPrm.snsMode;
661 #ifdef FF_TTY
662 mncc_configure_req -> ctm_ena = ccShrdPrm.ctmReq;
663 #else
664 mncc_configure_req -> ctm_ena = MNCC_CTM_DISABLED;
665 #endif /* FF_TTY */
666 PSENDX (CC, mncc_configure_req);
667 }
668 }
669
670 /*
671 +-------------------------------------------------------------------+
672 | PROJECT : GSM-PS (6147) MODULE : PSA_CCS |
673 | ROUTINE : psaCC_SendSS |
674 +-------------------------------------------------------------------+
675
676 PURPOSE : send SS facility
677
678 */
679
680 LOCAL SHORT psaCC_SendSS ( SHORT cId )
681 {
682 T_CC_CALL_TBL *pCtbNtry = ccShrdPrm.ctb[cId];
683 UBYTE ccdRet; /* holds CCD return value */
684
685 TRACE_FUNCTION ("psaCC_SendSS()");
686
687 if (pCtbNtry EQ NULL)
688 return -1; /* Ensure not to dereference NULL */
689
690 /*
691 *-------------------------------------------------------------------
692 * create and send primitive
693 *-------------------------------------------------------------------
694 */
695 {
696 PALLOC (mncc_facility_req, MNCC_FACILITY_REQ);
697
698 /*
699 * fill in primitive parameter: facility request
700 */
701
702 mncc_facility_req -> ti = pCtbNtry -> ti;
703 mncc_facility_req -> ss_version = pCtbNtry -> SSver;
704
705 CCD_START;
706 {
707 MCAST( com, COMPONENT );
708
709 memset( com, 0, sizeof( T_COMPONENT ));
710 switch( ccShrdPrm.cmpType )
711 {
712 case( CT_INV ):
713 com -> v_inv_comp = TRUE;
714 com -> inv_comp.v_inv_id = TRUE;
715 com -> inv_comp.inv_id = pCtbNtry -> iId
716 = ccShrdPrm.iIdNxt++;
717 com -> inv_comp.v_op_code = TRUE;
718 com -> inv_comp.op_code = pCtbNtry -> opCode
719 = ssFIECodeBuf.buf[0];
720 com -> inv_comp.v_params = TRUE;
721 com -> inv_comp.params.l_params = ssFIECodeBuf.l_buf-8;
722 com -> inv_comp.params.o_params = 8;
723 memcpy( com -> inv_comp.params.b_params,
724 ssFIECodeBuf.buf, ssFIECodeBuf.l_buf );
725 break;
726 case( CT_RET_RSLT ):
727 break;
728 case( CT_RET_ERR ):
729 break;
730 case( CT_RET_REJ ):
731 break;
732 }
733 mncc_facility_req -> fac_inf.l_fac = MNCC_FACILITY_LEN<<3;
734 mncc_facility_req -> fac_inf.o_fac = 0;
735 ccdRet = ccd_codeMsg (CCDENT_FAC,
736 UPLINK,
737 (T_MSGBUF *) &mncc_facility_req -> fac_inf,
738 (UBYTE *) _decodedMsg,
739 COMPONENT);
740
741 if( ccdRet NEQ ccdOK )
742 {
743 TRACE_EVENT_P1( "CCD Coding Error: %d",ccdRet );
744 PFREE( mncc_facility_req );
745 CCD_END;
746 return( -1 );
747 }
748 }
749 CCD_END;
750
751 pCtbNtry -> srvType = ST_MOS;
752
753 psaCC_DumpFIE ( &mncc_facility_req -> fac_inf );
754 cmhCC_sendFie ( CSCN_FACILITY_DIRECTION_OUT,
755 cId,
756 &mncc_facility_req -> fac_inf );
757
758 PSENDX (CC, mncc_facility_req);
759 }
760
761 return 0;
762 }
763
764 /*
765 +-------------------------------------------------------------------+
766 | PROJECT : GSM-PS (6147) MODULE : PSA_CCS |
767 | ROUTINE : psaCC_BuildMPTY |
768 +-------------------------------------------------------------------+
769
770 PURPOSE : build multiparty
771
772 */
773
774 GLOBAL void psaCC_BuildMPTY ( SHORT cId )
775 {
776 SHORT ctbIdx; /* holds call table index */
777
778 TRACE_FUNCTION ("psaCC_BuildMPTY()");
779
780 /*
781 *-------------------------------------------------------------------
782 * set multiparty status for held calls
783 *-------------------------------------------------------------------
784 */
785 for( ctbIdx = 0; ctbIdx < MAX_CALL_NR; ctbIdx++ )
786 {
787 if (ccShrdPrm.ctb[ctbIdx] NEQ NULL AND
788 psaCC_ctb(ctbIdx)->calStat EQ CS_HLD )
789 {
790 if( psaCC_ctb(ctbIdx)->mptyStat NEQ CS_ACT )
791
792 psaCC_ctb(ctbIdx)->mptyStat = CS_ACT_REQ;
793 }
794 }
795
796 /* set multiparty status for active call */
797 if( psaCC_ctb(cId)->mptyStat NEQ CS_ACT )
798 psaCC_ctb(cId)->mptyStat = CS_ACT_REQ;
799
800 /*
801 *-------------------------------------------------------------------
802 * send facility information element
803 *-------------------------------------------------------------------
804 */
805 psaCC_asmBuildMPTY();
806
807 if( psaCC_SendSS(cId) EQ 0 )
808 {
809 ccShrdPrm.cIdMPTY = cId;
810 TIMERSTART( TMPTY_VALUE, ACI_TMPTY );
811 }
812
813 psaCC_MPTY (cId, MNCC_MPTY_BUILD_SENT);
814 }
815
816 /* Implements Measure # 86 */
817
818
819 /*
820 +-------------------------------------------------------------------+
821 | PROJECT : GSM-PS (6147) MODULE : PSA_CCS |
822 | ROUTINE : psaCC_CountMPTY |
823 +-------------------------------------------------------------------+
824
825 PURPOSE : counts the number of parties in a MPTY
826
827 */
828
829 GLOBAL int psaCC_CountMPTY ( void )
830 {
831 int i = 0;
832 SHORT cId;
833 TRACE_FUNCTION ("psaCC_CountMPTY()");
834
835 for( cId = 0; cId < MAX_CALL_NR; cId++ )
836 {
837 if (ccShrdPrm.ctb[cId] NEQ NULL AND
838 psaCC_ctb(cId)->mptyStat EQ CS_ACT)
839 {
840 i++;
841 }
842 }
843 return i;
844 }
845
846
847
848 /*
849 +-------------------------------------------------------------------+
850 | PROJECT : GSM-PS (6147) MODULE : PSA_CCS |
851 | ROUTINE : psaCC_SplitMPTY |
852 +-------------------------------------------------------------------+
853
854 PURPOSE : split multiparty
855
856 */
857
858 GLOBAL void psaCC_SplitMPTY ( SHORT cId )
859 {
860 TRACE_FUNCTION ("psaCC_SplitMPTY()");
861
862 /* set multiparty status for active call */
863 psaCC_ctb(cId)->mptyStat = CS_DSC_REQ;
864
865 /*
866 *-------------------------------------------------------------------
867 * send facility information element
868 *-------------------------------------------------------------------
869 */
870 psaCC_asmSplitMPTY();
871
872 if( psaCC_SendSS(cId) EQ 0 )
873 {
874 ccShrdPrm.cIdMPTY = cId;
875 TIMERSTART( TMPTY_VALUE, ACI_TMPTY );
876 }
877
878 psaCC_MPTY (cId, MNCC_MPTY_SPLIT_SENT);
879 }
880
881 /*
882 +-------------------------------------------------------------------+
883 | PROJECT : GSM-PS (6147) MODULE : PSA_CCS |
884 | ROUTINE : psaCC_ECT |
885 +-------------------------------------------------------------------+
886
887 PURPOSE : explicit call transfer
888
889 */
890
891 GLOBAL SHORT psaCC_ECT ( SHORT cId )
892 {
893 SHORT psa_ret;
894
895 TRACE_FUNCTION ("psaCC_ECT()");
896
897 /*
898 *-------------------------------------------------------------------
899 * send facility information element
900 *-------------------------------------------------------------------
901 */
902 psaCC_asmECT();
903
904 psa_ret = psaCC_SendSS(cId);
905
906 if( psa_ret EQ 0 )
907 {
908 TIMERSTART( TECT_VALUE, ACI_TECT );
909 }
910
911 return(psa_ret);
912 }
913
914 /*
915 +-------------------------------------------------------------------+
916 | PROJECT : GSM-PS (6147) MODULE : PSA_CCS |
917 | ROUTINE : psaCC_BCapCode |
918 +-------------------------------------------------------------------+
919
920 PURPOSE : code bearer capabilites according GSM 04.08
921
922 */
923
924 GLOBAL SHORT psaCC_BCapCode ( UBYTE reqId, SHORT cId )
925 {
926 TRACE_FUNCTION ("psaCC_BCapCode()");
927
928 /*
929 *-------------------------------------------------------------------
930 * create and send primitive
931 *-------------------------------------------------------------------
932 */
933 {
934 PALLOC (mncc_bearer_cap_req, MNCC_BEARER_CAP_REQ);
935
936 /*
937 * fill in primitive parameter: bearer capability coding request
938 */
939
940 mncc_bearer_cap_req -> req_id = reqId;
941 mncc_bearer_cap_req -> bc_mod = MNCC_BC_MOD_CODE;
942 /*
943 * Bearer Service parameter is used by CC to determine whether coding
944 * has to be done or not. Hence that resetting that alone is sufficient.
945 */
946 mncc_bearer_cap_req -> bcpara.bearer_serv = MNCC_BEARER_SERV_NOT_PRES;
947 mncc_bearer_cap_req -> bcpara2.bearer_serv = MNCC_BEARER_SERV_NOT_PRES;
948
949 if ( ccShrdPrm.BC0_send_flag )
950 {
951 mncc_bearer_cap_req -> bcpara = ccShrdPrm.ctb[cId]->BC[0];
952 }
953 if ( ccShrdPrm.BC1_send_flag )
954 {
955 mncc_bearer_cap_req -> bcpara2 = ccShrdPrm.ctb[cId]->BC[1];
956 }
957
958 PSENDX (CC, mncc_bearer_cap_req);
959 }
960
961 return 0;
962 }
963
964
965 /*
966 +-------------------------------------------------------------------+
967 | PROJECT : GSM-PS (6147) MODULE : PSA_CCS |
968 | ROUTINE : psaCC_BCapDecode |
969 +-------------------------------------------------------------------+
970
971 PURPOSE : decode bearer cpabilities according GSM 04.08 into struct
972 bcpara.
973
974 */
975
976 GLOBAL SHORT psaCC_BCapDecode ( UBYTE reqId, UINT16 bcLen1, UBYTE *bc1, UINT16 bcLen2, UBYTE *bc2 )
977 {
978 TRACE_FUNCTION ("psaCC_BCapDecode()");
979
980 /*
981 *-------------------------------------------------------------------
982 * create and send primitive
983 *-------------------------------------------------------------------
984 */
985 if (( bcLen1 > MNCC_MAX_BC_LEN ) OR ( bcLen2 > MNCC_MAX_BC_LEN )) return -1;
986
987 {
988 PALLOC (mncc_bearer_cap_req, MNCC_BEARER_CAP_REQ);
989
990 /*
991 * fill in primitive parameter: bearer capability decoding request
992 */
993 mncc_bearer_cap_req -> req_id = reqId;
994 mncc_bearer_cap_req -> bc_mod = MNCC_BC_MOD_DECODE;
995 mncc_bearer_cap_req -> bcconf.bc_len = (UBYTE)bcLen1;
996 mncc_bearer_cap_req -> bcconf2.bc_len = (UBYTE)bcLen2;
997
998 if ( bcLen1 )
999 {
1000 memcpy( mncc_bearer_cap_req -> bcconf.bc, bc1, bcLen1 );
1001 }
1002
1003 if ( bcLen2 )
1004 {
1005 memcpy( mncc_bearer_cap_req -> bcconf2.bc, bc2, bcLen2 );
1006 }
1007
1008 PSENDX (CC, mncc_bearer_cap_req);
1009 }
1010
1011 return 0;
1012 }
1013
1014 /*
1015 +-------------------------------------------------------------------+
1016 | PROJECT : GSM-PS (6147) MODULE : PSA_CCS |
1017 | ROUTINE : psaCC_MPTY |
1018 +-------------------------------------------------------------------+
1019
1020 PURPOSE : Inform CC about an event related to a multiparty call
1021 which may change the auxiliary state hold or mpty in CC.
1022
1023 */
1024
1025 GLOBAL SHORT psaCC_MPTY ( SHORT cId, UBYTE mpty_event )
1026 {
1027 TRACE_FUNCTION ("psaCC_MPTY()");
1028
1029 /* Send the synchronization request to CC */
1030 {
1031 PALLOC (mncc_sync_req, MNCC_SYNC_REQ); /* T_MNCC_SYNC_REQ */
1032 mncc_sync_req->synccs = MNCC_SYNCCS_MPTY_EVENT;
1033 mncc_sync_req->ti = psaCC_ctb(cId)->ti;
1034 mncc_sync_req->mpty_event = mpty_event;
1035 PSENDX (CC, mncc_sync_req);
1036 }
1037 return 0;
1038 }
1039
1040 /* Implements Measure # 86 */
1041 /*
1042 +-------------------------------------------------------------------+
1043 | PROJECT : GSM-PS (6147) MODULE : PSA_CCS |
1044 | ROUTINE : psaCC_HoldMPTY |
1045 +-------------------------------------------------------------------+
1046
1047 PURPOSE : Hold OR Retrieve multiparty
1048
1049 */
1050
1051 GLOBAL void psaCC_Hold_RetrieveMPTY ( SHORT cId,
1052 T_CC_CLST call_stat,
1053 T_CC_CLST call_stat_new,
1054 UBYTE cId_new,
1055 UBYTE opc)
1056 {
1057 SHORT ctbIdx; /* holds call table index */
1058
1059 TRACE_FUNCTION ("psaCC_Hold_RetrieveMPTY()");
1060
1061 /*
1062 *-----------------------------------------------------------------
1063 * set call status for multiparty members
1064 *-----------------------------------------------------------------
1065 */
1066 for( ctbIdx = 0; ctbIdx < MAX_CALL_NR; ctbIdx++ )
1067 {
1068 if (ccShrdPrm.ctb[ctbIdx] NEQ NULL AND
1069 ccShrdPrm.ctb[ctbIdx]->calStat EQ call_stat AND
1070 ccShrdPrm.ctb[ctbIdx]->mptyStat EQ CS_ACT)
1071 {
1072 ccShrdPrm.ctb[ctbIdx]->calStat = call_stat_new;
1073 }
1074 }
1075
1076 /* set multiparty status for active call */
1077 ccShrdPrm.ctb[cId]->calStat = call_stat_new;
1078
1079 /*
1080 *-----------------------------------------------------------------
1081 * send facility information element
1082 *-----------------------------------------------------------------
1083 */
1084
1085 /*
1086 *-----------------------------------------------------------------
1087 * assemble the hold multiparty SS facility
1088 * information element, invoke id
1089 *-----------------------------------------------------------------
1090 */
1091
1092 memset( &ssFIECodeBuf, 0, sizeof( ssFIECodeBuf ));
1093
1094 ssFIECodeBuf.l_buf = 8;
1095 ssFIECodeBuf.o_buf = 0;
1096 ssFIECodeBuf.buf[0] = opc;
1097
1098 ccShrdPrm.cmpType = CT_INV;
1099
1100 if( psaCC_SendSS(cId) EQ 0 )
1101 {
1102 ccShrdPrm.cIdMPTY = cId;
1103 TIMERSTART( TMPTY_VALUE, ACI_TMPTY );
1104 }
1105 psaCC_MPTY (cId, cId_new);
1106 }
1107
1108 /*==== EOF ========================================================*/
1109