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