FreeCalypso > hg > freecalypso-sw
comparison gsm-fw/g23m-aci/aci/psa_ccp.c @ 775:eedbf248bac0
gsm-fw/g23m-aci subtree: initial import from LoCosto source
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sun, 12 Oct 2014 01:45:14 +0000 |
parents | |
children | 1385f2c30ad8 |
comparison
equal
deleted
inserted
replaced
774:40a721fd9854 | 775:eedbf248bac0 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GSM-PS (6147) | |
4 | Modul : PSA_CCP | |
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 processing functions for the | |
18 | primitives send to the protocol stack adapter by call | |
19 | control. | |
20 +----------------------------------------------------------------------------- | |
21 */ | |
22 | |
23 #ifndef PSA_CCP_C | |
24 #define PSA_CCP_C | |
25 #endif | |
26 | |
27 #include "aci_all.h" | |
28 | |
29 /*==== INCLUDES ===================================================*/ | |
30 #include "ccdapi.h" | |
31 | |
32 #include "aci_cmh.h" | |
33 #include "ati_cmd.h" | |
34 #include "aci_cmd.h" | |
35 #include "aci_mem.h" | |
36 #include "aci_lst.h" | |
37 | |
38 #ifdef FAX_AND_DATA | |
39 #include "aci_fd.h" | |
40 #endif /* of #ifdef FAX_AND_DATA */ | |
41 | |
42 #include "aci.h" | |
43 #include "psa.h" | |
44 #include "psa_cc.h" | |
45 #include "psa_ss.h" | |
46 #include "psa_mmi.h" | |
47 #include "psa_mm.h" | |
48 #include "cmh.h" | |
49 #include "cmh_cc.h" | |
50 | |
51 #ifdef SIM_TOOLKIT | |
52 #include "psa_sat.h" | |
53 #include "cmh_sat.h" | |
54 #endif /* of #ifdef SIM_TOOLKIT */ | |
55 | |
56 #include "aoc.h" | |
57 #include "psa_sim.h" | |
58 | |
59 #if defined (FF_WAP) || defined (FF_SAT_E) | |
60 #include "wap_aci.h" | |
61 #endif /* of FF_WAP */ | |
62 | |
63 #include "l4_tim.h" | |
64 | |
65 /*==== CONSTANTS ==================================================*/ | |
66 | |
67 | |
68 /*==== TYPES ======================================================*/ | |
69 | |
70 | |
71 /*==== EXPORT =====================================================*/ | |
72 | |
73 #ifdef FF_EM_MODE | |
74 EXTERN USHORT em_relcs; | |
75 #endif /* FF_EM_MODE */ | |
76 | |
77 /*==== VARIABLES ==================================================*/ | |
78 | |
79 EXTERN T_PCEER causeMod; | |
80 EXTERN SHORT causeCeer; | |
81 | |
82 /*==== FUNCTIONS ==================================================*/ | |
83 | |
84 | |
85 /* | |
86 +-------------------------------------------------------------------+ | |
87 | PROJECT : GSM-PS (6147) MODULE : PSA_CCP | | |
88 | ROUTINE : psa_mncc_setup_ind | | |
89 +-------------------------------------------------------------------+ | |
90 | |
91 PURPOSE : processes the MNCC_SETUP_IND primitive send by CC. | |
92 this indicates an incoming call. | |
93 | |
94 */ | |
95 | |
96 GLOBAL void psa_mncc_setup_ind | |
97 ( T_MNCC_SETUP_IND *mncc_setup_ind ) | |
98 { | |
99 SHORT cId; /* holds call id */ | |
100 T_CC_CALL_TBL * pCtbNtry; /* holds pointer to call table entry */ | |
101 int i; | |
102 | |
103 TRACE_FUNCTION ("psa_mncc_setup_ind()"); | |
104 | |
105 causeMod = P_CEER_mod; /* Clear module which was set for ceer */ | |
106 causeCeer = CEER_NotPresent; /* Clear extended error cause */ | |
107 | |
108 /* stop redialling timer if necessary */ | |
109 if (rdlPrm.rdlcId NEQ NO_ENTRY) | |
110 { | |
111 TIMERSTOP(ACI_REPEAT_HND); | |
112 | |
113 #ifdef SIM_TOOLKIT | |
114 if( ( ccShrdPrm.ctb[rdlPrm.rdlcId]->SATinv & SAT_REDIAL ) ) | |
115 { /* This is the call invoked by SAT */ | |
116 T_ACI_SAT_TERM_RESP resp_data; | |
117 | |
118 psaSAT_InitTrmResp( &resp_data ); | |
119 psaSAT_SendTrmResp( RSLT_USR_CLR_DWN, &resp_data ); | |
120 } | |
121 #endif /* SIM_TOOLKIT */ | |
122 | |
123 psaCC_FreeCtbNtry (rdlPrm.rdlcId); | |
124 for(i = 0; i < CMD_SRC_MAX; i++) | |
125 { | |
126 R_AT(RAT_RDL, (T_ACI_CMD_SRC)i)(REDIAL_STOP); | |
127 } | |
128 /* reset some redial parameter */ | |
129 rdlPrm.rdlcId = NO_ENTRY; | |
130 } | |
131 | |
132 /* | |
133 *------------------------------------------------------------------- | |
134 * check for new entry in call table | |
135 *------------------------------------------------------------------- | |
136 */ | |
137 cId = psaCC_ctbNewEntry(); | |
138 | |
139 if( cId < 0 ) | |
140 { | |
141 /* | |
142 * disconnect call, due to full call table. | |
143 */ | |
144 { | |
145 UBYTE ti = mncc_setup_ind -> ti; | |
146 PREUSE (mncc_setup_ind, mncc_disconnect_req, MNCC_DISCONNECT_REQ); | |
147 mncc_disconnect_req -> ti = ti; | |
148 mncc_disconnect_req -> cause = MNCC_CAUSE_USER_BUSY; | |
149 mncc_disconnect_req -> fac_inf.l_fac = 0; | |
150 mncc_disconnect_req -> ss_version = MNCC_SS_VER_NOT_PRES; | |
151 PSENDX (CC, mncc_disconnect_req); | |
152 } | |
153 | |
154 TRACE_EVENT ("MTC rejected due to full call table"); | |
155 | |
156 return; | |
157 } | |
158 | |
159 /* | |
160 *------------------------------------------------------------------- | |
161 * update shared parameter and notify ACI | |
162 *------------------------------------------------------------------- | |
163 */ | |
164 pCtbNtry = ccShrdPrm.ctb[cId]; | |
165 pCtbNtry -> curCs = MNCC_CAUSE_NO_MS_CAUSE; | |
166 | |
167 pCtbNtry -> ti = mncc_setup_ind -> ti; | |
168 pCtbNtry -> rptInd = mncc_setup_ind -> ri; | |
169 pCtbNtry -> sigInf = mncc_setup_ind -> sig; | |
170 pCtbNtry -> clgPty = mncc_setup_ind -> calling_party; | |
171 pCtbNtry -> clgPtySub = mncc_setup_ind -> calling_party_sub; | |
172 | |
173 /* | |
174 * Assign called party | |
175 */ | |
176 pCtbNtry -> cldPty.ton = mncc_setup_ind -> called_party.ton; | |
177 pCtbNtry -> cldPty.npi = mncc_setup_ind -> called_party.npi; | |
178 pCtbNtry -> cldPty.c_called_num = | |
179 mncc_setup_ind -> called_party.c_called_num; | |
180 if (pCtbNtry -> cldPty.called_num NEQ NULL) | |
181 { | |
182 ACI_MFREE (pCtbNtry -> cldPty.called_num); | |
183 pCtbNtry -> cldPty.called_num = NULL; | |
184 } | |
185 if (pCtbNtry -> cldPty.c_called_num NEQ 0) | |
186 { | |
187 ACI_MALLOC (pCtbNtry -> cldPty.called_num, | |
188 pCtbNtry -> cldPty.c_called_num); | |
189 memcpy (pCtbNtry -> cldPty.called_num, | |
190 mncc_setup_ind -> called_party.called_num, | |
191 mncc_setup_ind -> called_party.c_called_num); | |
192 } | |
193 | |
194 /* | |
195 * Assign called party subaddress | |
196 */ | |
197 pCtbNtry -> cldPtySub = mncc_setup_ind -> called_party_sub; | |
198 | |
199 /* | |
200 * Assign redirecting party | |
201 */ | |
202 pCtbNtry -> rdrPty.ton = mncc_setup_ind -> redirecting_party.ton; | |
203 pCtbNtry -> rdrPty.npi = mncc_setup_ind -> redirecting_party.npi; | |
204 pCtbNtry -> rdrPty.present = mncc_setup_ind -> redirecting_party.present; | |
205 pCtbNtry -> rdrPty.screen = mncc_setup_ind -> redirecting_party.screen; | |
206 pCtbNtry -> rdrPty.c_redir_num = | |
207 mncc_setup_ind -> redirecting_party.c_redir_num; | |
208 if (pCtbNtry -> rdrPty.redir_num NEQ NULL) | |
209 { | |
210 ACI_MFREE (pCtbNtry -> rdrPty.redir_num); | |
211 pCtbNtry -> rdrPty.redir_num = NULL; | |
212 } | |
213 if (pCtbNtry -> rdrPty.c_redir_num NEQ 0) | |
214 { | |
215 ACI_MALLOC (pCtbNtry -> rdrPty.redir_num, | |
216 pCtbNtry -> rdrPty.c_redir_num); | |
217 memcpy (pCtbNtry -> rdrPty.redir_num, | |
218 mncc_setup_ind -> redirecting_party.redir_num, | |
219 mncc_setup_ind -> redirecting_party.c_redir_num); | |
220 } | |
221 | |
222 /* | |
223 * Assign redirecting party subaddress | |
224 */ | |
225 pCtbNtry -> rdrPtySub.tos = | |
226 mncc_setup_ind -> redirecting_party_sub.tos; | |
227 pCtbNtry -> rdrPtySub.odd_even = | |
228 mncc_setup_ind -> redirecting_party_sub.odd_even; | |
229 pCtbNtry -> rdrPtySub.c_subaddr = | |
230 mncc_setup_ind -> redirecting_party_sub.c_subaddr; | |
231 if (pCtbNtry -> rdrPtySub.subaddr NEQ NULL) | |
232 { | |
233 ACI_MFREE (pCtbNtry -> rdrPtySub.subaddr); | |
234 pCtbNtry -> rdrPtySub.subaddr = NULL; | |
235 } | |
236 if (pCtbNtry -> rdrPtySub.c_subaddr NEQ 0) | |
237 { | |
238 ACI_MALLOC (pCtbNtry -> rdrPtySub.subaddr, | |
239 pCtbNtry -> rdrPtySub.c_subaddr); | |
240 memcpy (pCtbNtry -> rdrPtySub.subaddr, | |
241 mncc_setup_ind -> redirecting_party_sub.subaddr, | |
242 mncc_setup_ind -> redirecting_party_sub.c_subaddr); | |
243 } | |
244 | |
245 /* | |
246 * Assign bearer caps | |
247 */ | |
248 memcpy( &(pCtbNtry->BC[0]),&(mncc_setup_ind->bcpara), | |
249 sizeof( T_MNCC_bcpara) ); | |
250 memcpy( &(pCtbNtry->BC[1]),&(mncc_setup_ind->bcpara2), | |
251 sizeof( T_MNCC_bcpara) ); | |
252 | |
253 psaCC_phbSrchNum( cId, CT_MTC ); | |
254 | |
255 pCtbNtry -> calStat = CS_ACT_REQ; | |
256 pCtbNtry -> calType = CT_MTC; | |
257 | |
258 pCtbNtry -> prio = MNCC_PRIO_NORM_CALL; | |
259 pCtbNtry -> curBC = 0; | |
260 | |
261 psaCC_send_satevent( EVENT_MT_CALL, cId, FAR_END, FALSE ); | |
262 | |
263 /* | |
264 *------------------------------------------------------------------- | |
265 * indicate alerting | |
266 *------------------------------------------------------------------- | |
267 */ | |
268 | |
269 /* replace invalid/unknown sigInf by SIG_NOT_PRES */ | |
270 switch (pCtbNtry -> sigInf) | |
271 { | |
272 case MNCC_SIG_DIAL_TONE_ON: | |
273 case MNCC_SIG_RING_BACK_TONE_ON: | |
274 case MNCC_SIG_INT_TONE_ON: | |
275 case MNCC_SIG_NET_CONG_TONE_ON: | |
276 case MNCC_SIG_BUSY_TONE_ON: | |
277 case MNCC_SIG_CONF_TONE_ON: | |
278 case MNCC_SIG_ANS_TONE_ON: | |
279 case MNCC_SIG_CALL_WAIT_TONE_ON: | |
280 case MNCC_SIG_OFF_HOOK_WARN_TONE_ON: | |
281 case MNCC_SIG_TONES_OFF: | |
282 case MNCC_SIG_ALERT_OFF: | |
283 case MNCC_SIG_NOT_PRES: | |
284 break; /* leave as it is */ | |
285 default: /* replace unknown value by something well known */ | |
286 pCtbNtry -> sigInf = MNCC_SIG_NOT_PRES; | |
287 } | |
288 | |
289 if( pCtbNtry -> sigInf NEQ MNCC_SIG_NOT_PRES OR | |
290 ccShrdPrm.TCHasg EQ TRUE ) | |
291 { | |
292 { | |
293 /* indicate alerting to network */ | |
294 UBYTE ti = mncc_setup_ind -> ti; | |
295 PREUSE (mncc_setup_ind, mncc_alert_req, MNCC_ALERT_REQ); | |
296 mncc_alert_req -> ti = ti; | |
297 PSENDX (CC, mncc_alert_req); | |
298 } | |
299 | |
300 cmhCC_IncomingCall (cId); /* indicate an incoming call */ | |
301 return; | |
302 } | |
303 else | |
304 { | |
305 pCtbNtry -> alrtStat = AS_PND; | |
306 } | |
307 | |
308 /* | |
309 * check for progress descriptions | |
310 */ | |
311 psaCC_chkPrgDesc ( cId, mncc_setup_ind -> progress_desc, MT_SETUP ); | |
312 | |
313 /* | |
314 * start call time measurements | |
315 */ | |
316 aoc_info (cId, AOC_START_TIME); | |
317 /* | |
318 *------------------------------------------------------------------- | |
319 * free the primitive buffer | |
320 *------------------------------------------------------------------- | |
321 */ | |
322 PFREE (mncc_setup_ind); | |
323 } | |
324 | |
325 /* | |
326 +-------------------------------------------------------------------+ | |
327 | PROJECT : GSM-PS (6147) MODULE : PSA_CCP | | |
328 | ROUTINE : psa_mncc_setup_cnf | | |
329 +-------------------------------------------------------------------+ | |
330 | |
331 PURPOSE : processes the MNCC_SETUP_CNF primitive send by CC. | |
332 this terminates the call establishment request. | |
333 | |
334 */ | |
335 | |
336 GLOBAL void psa_mncc_setup_cnf | |
337 ( T_MNCC_SETUP_CNF *mncc_setup_cnf ) | |
338 { | |
339 SHORT cId; /* holds call id */ | |
340 T_CC_CALL_TBL * pCtbNtry; /* holds pointer to call table entry */ | |
341 int i; | |
342 BOOL flag_redial = FALSE; | |
343 | |
344 TRACE_FUNCTION ("psa_mncc_setup_cnf()"); | |
345 | |
346 /* | |
347 *------------------------------------------------------------------- | |
348 * find call in call table | |
349 *------------------------------------------------------------------- | |
350 */ | |
351 cId = psaCC_ctbFindTi( mncc_setup_cnf -> ti ); | |
352 | |
353 if( cId < 0 ) | |
354 { | |
355 /* | |
356 * ignore primitive, due to not found transaction identifier. | |
357 */ | |
358 TRACE_EVENT ("primitive rejected due to unused ti"); | |
359 PFREE(mncc_setup_cnf); | |
360 return; | |
361 } | |
362 | |
363 /* | |
364 *------------------------------------------------------------------- | |
365 * update shared parameter and notify ACI | |
366 *------------------------------------------------------------------- | |
367 */ | |
368 pCtbNtry = ccShrdPrm.ctb[cId]; | |
369 pCtbNtry -> curCs = mncc_setup_cnf -> cause; | |
370 pCtbNtry -> rslt = mncc_setup_cnf -> cause; | |
371 | |
372 | |
373 switch( mncc_setup_cnf -> cause ) | |
374 { | |
375 case( MNCC_CAUSE_SUCCESS ): /* successful establishment, call connected */ | |
376 | |
377 /* | |
378 * MNCC_SETUP_CNF is received in call state other than CS_ACT_REQ | |
379 * so reject the primitive. | |
380 */ | |
381 if( pCtbNtry -> calStat NEQ CS_ACT_REQ) | |
382 { | |
383 TRACE_EVENT ("MNCC_SETUP_CNF is rejected as it is received in call state other than CS_ACT_REQ"); | |
384 break; | |
385 } | |
386 pCtbNtry -> clgPty.ton = mncc_setup_cnf -> connected_number.ton; | |
387 pCtbNtry -> clgPty.npi = mncc_setup_cnf -> connected_number.npi; | |
388 pCtbNtry -> clgPty.present = mncc_setup_cnf -> connected_number.present; | |
389 pCtbNtry -> clgPty.screen = mncc_setup_cnf -> connected_number.screen; | |
390 pCtbNtry -> clgPty.c_num = mncc_setup_cnf -> connected_number.c_num; | |
391 | |
392 memcpy( pCtbNtry -> clgPty.num, | |
393 mncc_setup_cnf -> connected_number.num, MNCC_MAX_CC_CALLING_NUMBER ); | |
394 | |
395 pCtbNtry -> clgPtySub.tos = mncc_setup_cnf -> connected_number_sub.tos; | |
396 pCtbNtry -> clgPtySub.odd_even = mncc_setup_cnf -> connected_number_sub.odd_even; | |
397 pCtbNtry -> clgPtySub.c_subaddr = mncc_setup_cnf -> connected_number_sub.c_subaddr; | |
398 | |
399 memcpy( pCtbNtry -> clgPtySub.subaddr, | |
400 mncc_setup_cnf -> connected_number_sub.subaddr, MNCC_SUB_LENGTH ); | |
401 | |
402 pCtbNtry -> inBndTns = FALSE; | |
403 pCtbNtry -> calStat = CS_ACT; | |
404 | |
405 /* check for progress descriptions */ | |
406 psaCC_chkPrgDesc ( cId, mncc_setup_cnf -> progress_desc, MT_CONN ); | |
407 | |
408 | |
409 if(pCtbNtry->calType EQ CT_MOC_RDL) | |
410 { | |
411 pCtbNtry->calType = CT_MOC; | |
412 flag_redial = TRUE; | |
413 } | |
414 /* if redialling procedure was successful we finish redialling */ | |
415 if((rdlPrm.rdlMod EQ AUTOM_REPEAT_ON) AND flag_redial) | |
416 { | |
417 for(i = 0; i < CMD_SRC_MAX; i++) | |
418 { | |
419 R_AT(RAT_RDL, (T_ACI_CMD_SRC)i)(CALL_ATTEMPT_SUCCESSFUL); | |
420 } | |
421 pCtbNtry->rdlCnt = 0; | |
422 rdlPrm.rdlcId = NO_ENTRY; | |
423 pCtbNtry->rdlTimIndex = RDL_TIM_INDEX_NOT_PRESENT; | |
424 flag_redial = FALSE; | |
425 /* Once we stop the redialling procedure | |
426 * We ahev to stop as well the SAT max | |
427 * duration timer (satshrdprm.dur) | |
428 */ | |
429 #ifdef SIM_TOOLKIT | |
430 if(satShrdPrm.ownSAT) | |
431 { | |
432 TIMERSTOP(ACI_SAT_MAX_DUR_HND); | |
433 satShrdPrm.dur = -1; | |
434 } | |
435 #endif /* SIM_TOOLKIT */ | |
436 } | |
437 | |
438 /* | |
439 * The MO call count is increment in MNCC_SETUP_REQ | |
440 * psaCC_chngCalTypCnt( cId, +1 ); | |
441 */ | |
442 | |
443 cmhCC_CallConnected( cId ); | |
444 | |
445 psaCC_send_satevent( EVENT_CALL_CONN, cId, FAR_END, FALSE ); | |
446 | |
447 aoc_info (cId,AOC_CALL_CONNECTED); | |
448 | |
449 /* check for TTY service */ | |
450 cmhCC_TTY_Control ( cId, TTY_START ); | |
451 | |
452 /* check for DTMF tones to send automatically */ | |
453 psaCC_DTMFSent ( cId ); | |
454 | |
455 #if defined (FF_WAP) || defined (FF_SAT_E) | |
456 /* WAP STACK CALL is activ */ | |
457 if (Wap_Call) | |
458 ccShrdPrm.wapStat = CC_WAP_STACK_UP; | |
459 #endif | |
460 | |
461 break; | |
462 | |
463 default: /* unexpected result, assumed call disconnected */ | |
464 { | |
465 TRACE_EVENT_P1("[ERR] UNEXP CAUSE IN SETUP CNF=%4x", mncc_setup_cnf -> cause); | |
466 } | |
467 /*FALLTHROUGH*/ /*lint -fallthrough*/ | |
468 | |
469 /* unsuccessful establishment, call disconnected */ | |
470 case( MNCC_CAUSE_MS_TIMER ): | |
471 | |
472 pCtbNtry -> nrmCs = CAUSE_MAKE(DEFBY_CONDAT, ORIGSIDE_MS, MNCC_CC_ORIGINATING_ENTITY, NOT_PRESENT_8BIT); | |
473 pCtbNtry -> rejCs = CAUSE_MAKE(DEFBY_CONDAT, ORIGSIDE_MS, MNCC_CC_ORIGINATING_ENTITY, NOT_PRESENT_8BIT); | |
474 #ifdef FF_EM_MODE | |
475 em_relcs = MNCC_CAUSE_MS_TIMER; | |
476 #endif /* FF_EM_MODE */ | |
477 ccShrdPrm.cIdFail = cId; | |
478 | |
479 /* | |
480 * At this point the call has not yet gone completely always. | |
481 * Call Control may not be in state U0, but in state U11, having | |
482 * sent a DISCONNECT to the network, expecting the RELEASE | |
483 * from the network or expiry of T308 in CC. | |
484 * Implementation works, but it is not very nice here, releasing | |
485 * the ti and decrementing the call count too early. | |
486 */ | |
487 pCtbNtry -> calStat = CS_IDL; | |
488 | |
489 psaCC_chngCalTypCnt( cId, -1 ); | |
490 psaCC_retMOCTi( pCtbNtry -> ti ); | |
491 cmhCC_CallDisconnected (cId); | |
492 //TISH, patch for OMAPS00129162 | |
493 //Don't free the ti here, MMI will receive release_ind later and release the ti there. | |
494 //start | |
495 // psaCC_FreeCtbNtry (cId); | |
496 //end | |
497 break; | |
498 } | |
499 /* | |
500 *------------------------------------------------------------------- | |
501 * free the primitive buffer | |
502 *------------------------------------------------------------------- | |
503 */ | |
504 PFREE (mncc_setup_cnf); | |
505 | |
506 } | |
507 | |
508 /* | |
509 +-------------------------------------------------------------------+ | |
510 | PROJECT : GSM-PS (6147) MODULE : PSA_CCP | | |
511 | ROUTINE : psa_mncc_setup_compl_ind| | |
512 +-------------------------------------------------------------------+ | |
513 | |
514 PURPOSE : processes the MNCC_SETUP_COMPL_IND primitive send by CC. | |
515 this terminates the call establishment of an incoming call. | |
516 | |
517 */ | |
518 | |
519 GLOBAL void psa_mncc_setup_compl_ind | |
520 ( T_MNCC_SETUP_COMPL_IND *mncc_setup_compl_ind ) | |
521 { | |
522 SHORT cId; /* holds call id */ | |
523 T_CC_CALL_TBL * pCtbNtry; /* holds pointer to call table entry */ | |
524 | |
525 TRACE_FUNCTION ("psa_mncc_setup_compl_ind()"); | |
526 | |
527 /* | |
528 *------------------------------------------------------------------- | |
529 * find call in call table | |
530 *------------------------------------------------------------------- | |
531 */ | |
532 cId = psaCC_ctbFindTi( mncc_setup_compl_ind -> ti ); | |
533 | |
534 if( cId < 0 ) | |
535 { | |
536 /* | |
537 * ignore primitive, due to not found transaction identifier. | |
538 */ | |
539 TRACE_EVENT ("primitive rejected due to unused ti"); | |
540 PFREE(mncc_setup_compl_ind); | |
541 return; | |
542 } | |
543 | |
544 /* | |
545 *------------------------------------------------------------------- | |
546 * update shared parameter and notify ACI | |
547 *------------------------------------------------------------------- | |
548 */ | |
549 pCtbNtry = ccShrdPrm.ctb[cId]; | |
550 | |
551 pCtbNtry -> rslt = mncc_setup_compl_ind -> cause; | |
552 pCtbNtry -> curCs = mncc_setup_compl_ind -> cause; | |
553 | |
554 switch( mncc_setup_compl_ind -> cause ) | |
555 { | |
556 case( MNCC_CAUSE_SUCCESS ): /* successful establishment, call connected */ | |
557 | |
558 pCtbNtry -> inBndTns = FALSE; | |
559 pCtbNtry -> calStat = CS_ACT; | |
560 | |
561 psaCC_setSpeechMode (); | |
562 | |
563 /* check for TTY service */ | |
564 cmhCC_TTY_Control ( cId, TTY_START ); | |
565 | |
566 /* | |
567 * Inform that a call goes to active state | |
568 */ | |
569 psaCC_chngCalTypCnt( cId, +1 ); | |
570 | |
571 cmhCC_CallConnected( cId ); | |
572 | |
573 aoc_info (cId, AOC_CALL_CONNECTED); | |
574 break; | |
575 | |
576 default: /* unexpected result, assumed call disconnected */ | |
577 { | |
578 TRACE_EVENT_P1("[ERR] UNEXP CAUSE IN SETUP CMPL IND=%4x", mncc_setup_compl_ind -> cause); | |
579 } | |
580 /*FALLTHROUGH*/ /*lint -fallthrough*/ | |
581 | |
582 /* unsuccessful establishment, call disconnected */ | |
583 case( MNCC_CAUSE_MS_TIMER ): | |
584 | |
585 pCtbNtry -> nrmCs = CAUSE_MAKE(DEFBY_CONDAT, ORIGSIDE_MS, MNCC_CC_ORIGINATING_ENTITY, NOT_PRESENT_8BIT); | |
586 pCtbNtry -> rejCs = CAUSE_MAKE(DEFBY_CONDAT, ORIGSIDE_MS, MNCC_CC_ORIGINATING_ENTITY, NOT_PRESENT_8BIT); | |
587 #ifdef FF_EM_MODE | |
588 em_relcs = CAUSE_MAKE(DEFBY_CONDAT, ORIGSIDE_MS, MNCC_CC_ORIGINATING_ENTITY, NOT_PRESENT_8BIT); | |
589 #endif /* FF_EM_MODE */ | |
590 ccShrdPrm.cIdFail = cId; | |
591 | |
592 /* | |
593 * What happens below is somewhat questionable. | |
594 * ACI sets the call to CS_IDL and free the transaction identifier. | |
595 * What happened is that on CC level, in state U8 CONNECT REQUEST the | |
596 * CONNECT message sent by CC has not been answered by the network by a | |
597 * CONNECT ACNOWLEDGE message. | |
598 * In this situation CC sends a DISCONNECT to the network and enters | |
599 * state U11 DISCONNECT REQUEST. This means, the call state in CC is | |
600 * still different from U0 NULL. | |
601 * However, problems in the field are not expected here. | |
602 */ | |
603 pCtbNtry -> calStat = CS_IDL; | |
604 | |
605 psaCC_chngCalTypCnt( cId, -1 ); | |
606 psaCC_retMOCTi( pCtbNtry -> ti ); | |
607 | |
608 cmhCC_CallDisconnected (cId); | |
609 cmhCC_CallReleased (cId); | |
610 | |
611 break; | |
612 } | |
613 | |
614 /* | |
615 *------------------------------------------------------------------- | |
616 * free the primitive buffer | |
617 *------------------------------------------------------------------- | |
618 */ | |
619 PFREE (mncc_setup_compl_ind); | |
620 | |
621 } | |
622 | |
623 /* | |
624 +-------------------------------------------------------------------+ | |
625 | PROJECT : GSM-PS (6147) MODULE : PSA_CCP | | |
626 | ROUTINE : psa_mncc_reject_ind | | |
627 +-------------------------------------------------------------------+ | |
628 | |
629 PURPOSE : processes the MNCC_REJECT_IND primitive send by CC. | |
630 this indicates a cause for rejecting a call establishment. | |
631 | |
632 */ | |
633 | |
634 GLOBAL void psa_mncc_reject_ind | |
635 ( T_MNCC_REJECT_IND *mncc_reject_ind ) | |
636 { | |
637 SHORT cId; /* holds call id */ | |
638 T_CC_CALL_TBL * pCtbNtry; /* holds pointer to call table entry */ | |
639 | |
640 TRACE_FUNCTION ("psa_mncc_reject_ind()"); | |
641 | |
642 /* | |
643 *------------------------------------------------------------------- | |
644 * find call in call table | |
645 *------------------------------------------------------------------- | |
646 */ | |
647 cId = psaCC_ctbFindTi( mncc_reject_ind -> ti ); | |
648 | |
649 if( cId < 0 ) | |
650 { | |
651 /* | |
652 * ignore primitive, due to not found transaction identifier. | |
653 */ | |
654 TRACE_EVENT ("primitive rejected due to unused ti"); | |
655 PFREE(mncc_reject_ind); | |
656 return; | |
657 } | |
658 psaCC_StopDTMF (cId); /* HM 27.07.00*/ | |
659 | |
660 /* | |
661 *------------------------------------------------------------------- | |
662 * update shared parameter and notify ACI | |
663 *------------------------------------------------------------------- | |
664 */ | |
665 pCtbNtry = ccShrdPrm.ctb[cId]; | |
666 pCtbNtry -> curCs = mncc_reject_ind -> cause; | |
667 | |
668 pCtbNtry -> rslt = CAUSE_MAKE(DEFBY_CONDAT, ORIGSIDE_MS, MNCC_CC_ORIGINATING_ENTITY, NOT_PRESENT_8BIT); | |
669 pCtbNtry -> nrmCs = CAUSE_MAKE(DEFBY_CONDAT, ORIGSIDE_MS, MNCC_CC_ORIGINATING_ENTITY, NOT_PRESENT_8BIT); | |
670 pCtbNtry -> rejCs = mncc_reject_ind -> cause; | |
671 /* In this case, the cause values are internal and not sent by network */ | |
672 pCtbNtry -> numRawCauseBytes = 0; | |
673 | |
674 #ifdef FF_EM_MODE | |
675 em_relcs = mncc_reject_ind -> cause; | |
676 #endif /* FF_EM_MODE */ | |
677 | |
678 if( GET_CAUSE_VALUE(pCtbNtry -> rejCs) NEQ NOT_PRESENT_8BIT ) ccShrdPrm.cIdFail = cId; | |
679 | |
680 pCtbNtry -> calStat = CS_IDL; | |
681 | |
682 psaCC_chngCalTypCnt( cId, -1 ); | |
683 psaCC_retMOCTi( pCtbNtry -> ti ); | |
684 | |
685 /* monitoring for SAT radio-link failure */ | |
686 psaCC_send_satevent( EVENT_CALL_DISC, cId, NEAR_END, TRUE ); | |
687 | |
688 /* check conditions for redialling */ | |
689 cmhCC_redialCheck(cId); | |
690 | |
691 #ifdef SIM_TOOLKIT | |
692 if( pCtbNtry->SATinv ) | |
693 { | |
694 cmhSAT_NtwErr( ADD_NO_CAUSE ); | |
695 pCtbNtry->SATinv = FALSE; | |
696 } | |
697 #endif | |
698 /* cmhCC_CallDisconnected(cId);*/ | |
699 cmhCC_CPIrejectMsg(cId); | |
700 cmhCC_CallReleased(cId); | |
701 cmhCC_ChngWaitingToIncoming(); | |
702 | |
703 /* free the primitive buffer */ | |
704 PFREE (mncc_reject_ind); | |
705 | |
706 } | |
707 | |
708 /* | |
709 +-------------------------------------------------------------------+ | |
710 | PROJECT : GSM-PS (6147) MODULE : PSA_CCP | | |
711 | ROUTINE : psa_mncc_release_ind | | |
712 +-------------------------------------------------------------------+ | |
713 | |
714 PURPOSE : processes the MNCC_RELEASE_IND primitive send by CC. | |
715 this indicates the release of a call. | |
716 | |
717 */ | |
718 | |
719 GLOBAL void psa_mncc_release_ind | |
720 ( T_MNCC_RELEASE_IND *mncc_release_ind ) | |
721 { | |
722 SHORT cId; /* holds call id */ | |
723 T_CC_CALL_TBL * pCtbNtry; /* holds pointer to call table entry */ | |
724 | |
725 TRACE_FUNCTION ("psa_mncc_release_ind()"); | |
726 | |
727 /* | |
728 *------------------------------------------------------------------- | |
729 * find call in call table | |
730 *------------------------------------------------------------------- | |
731 */ | |
732 cId = psaCC_ctbFindTi( mncc_release_ind -> ti ); | |
733 | |
734 | |
735 if( cId < 0 ) | |
736 { | |
737 psaCC_retMOCTi( mncc_release_ind -> ti ); | |
738 | |
739 /* | |
740 * ignore primitive, due to not found transaction identifier. | |
741 */ | |
742 TRACE_EVENT ("primitive rejected due to unused ti"); | |
743 PFREE(mncc_release_ind); | |
744 return; | |
745 } | |
746 psaCC_StopDTMF ( cId ); /* HM 27.07.00 */ | |
747 | |
748 /* | |
749 *------------------------------------------------------------------- | |
750 * update shared parameter and notify ACI | |
751 *------------------------------------------------------------------- | |
752 */ | |
753 pCtbNtry = ccShrdPrm.ctb[cId]; | |
754 | |
755 pCtbNtry -> calStat = CS_DSC_REQ; /* Leave active state */ | |
756 pCtbNtry -> curCs = mncc_release_ind -> cause; | |
757 pCtbNtry -> numRawCauseBytes = mncc_release_ind -> c_raw_cause; | |
758 pCtbNtry -> rawCauseBytes = mncc_release_ind -> raw_cause; | |
759 | |
760 psaCC_setSpeechMode (); | |
761 | |
762 /* check for TTY service */ | |
763 /*cmhCC_TTY_Control ( cId );*/ | |
764 | |
765 if (pCtbNtry -> nrmCs EQ MNCC_CAUSE_NO_MS_CAUSE) /* no Disconnect Cause available...*/ | |
766 { | |
767 pCtbNtry -> nrmCs= mncc_release_ind -> cause; /* Check ### */ | |
768 ccShrdPrm.cIdFail = cId; /* Check ### */ | |
769 #ifdef FF_EM_MODE | |
770 em_relcs = mncc_release_ind -> cause; /* Check ### */ | |
771 #endif /* FF_EM_MODE */ | |
772 } | |
773 | |
774 pCtbNtry -> rejCs = CAUSE_MAKE(DEFBY_CONDAT, ORIGSIDE_MS, MNCC_CC_ORIGINATING_ENTITY, NOT_PRESENT_8BIT); | |
775 pCtbNtry -> rslt = CAUSE_MAKE(DEFBY_CONDAT, ORIGSIDE_MS, MNCC_CC_ORIGINATING_ENTITY, NOT_PRESENT_8BIT); | |
776 | |
777 psaCC_chngCalTypCnt( cId, -1 ); | |
778 psaCC_retMOCTi( pCtbNtry -> ti ); | |
779 | |
780 psaCC_send_satevent( EVENT_CALL_DISC, cId, FAR_END, TRUE ); | |
781 | |
782 pCtbNtry -> numRawCauseBytes = 0; /* Reset the cause value after sending the info to SAT */ | |
783 | |
784 cmhCC_redialCheck(cId); | |
785 | |
786 /* | |
787 if( pCtbNtry -> CCBSstat EQ CCBSS_PSSBL OR | |
788 pCtbNtry -> calType EQ CT_NI_MOC ) | |
789 */ | |
790 switch (pCtbNtry->curCmd) | |
791 { | |
792 case( AT_CMD_A ): | |
793 case( AT_CMD_D ): | |
794 case( AT_CMD_NONE ): | |
795 case( AT_CMD_ABRT ): | |
796 { | |
797 cmhCC_CallDisconnected(cId); | |
798 cmhCC_CallReleased( cId ); | |
799 } | |
800 break; | |
801 | |
802 case( AT_CMD_H ): | |
803 case( AT_CMD_Z ): | |
804 case( AT_CMD_CHUP ): | |
805 case( AT_CMD_CHLD ): | |
806 | |
807 #ifdef FF_FAX | |
808 case( AT_CMD_FKS ): | |
809 case( AT_CMD_FDT ): | |
810 case( AT_CMD_FDR ): | |
811 #endif | |
812 { | |
813 cmhCC_CallDisconnected(cId); | |
814 cmhCC_CPIReleaseMsg(cId); | |
815 } | |
816 break; | |
817 } | |
818 | |
819 if (rdlPrm.rdlcId NEQ cId) | |
820 {/* if redialling is active no clean cId entry */ | |
821 /*patch BE 30.06.00 to remove every other call drops*/ | |
822 psaCC_FreeCtbNtry (cId); | |
823 /*end patch BE */ | |
824 } | |
825 cmhCC_ChngWaitingToIncoming(); | |
826 /* free the primitive buffer */ | |
827 PFREE (mncc_release_ind); | |
828 | |
829 } | |
830 | |
831 /* | |
832 +-------------------------------------------------------------------+ | |
833 | PROJECT : GSM-PS (6147) MODULE : PSA_CCP | | |
834 | ROUTINE : psa_mncc_release_cnf | | |
835 +-------------------------------------------------------------------+ | |
836 | |
837 PURPOSE : processes the MNCC_RELEASE_CNF primitive send by CC. | |
838 this confirmates the release request for a call. | |
839 | |
840 */ | |
841 | |
842 GLOBAL void psa_mncc_release_cnf | |
843 ( T_MNCC_RELEASE_CNF *mncc_release_cnf ) | |
844 { | |
845 SHORT cId; /* holds call id */ | |
846 T_CC_CALL_TBL * pCtbNtry; /* holds pointer to call table entry */ | |
847 | |
848 TRACE_FUNCTION ("psa_mncc_release_cnf()"); | |
849 | |
850 /* | |
851 *------------------------------------------------------------------- | |
852 * find call in call table | |
853 *------------------------------------------------------------------- | |
854 */ | |
855 cId = psaCC_ctbFindTi( mncc_release_cnf -> ti ); | |
856 | |
857 if( cId < 0 ) | |
858 { | |
859 psaCC_retMOCTi( mncc_release_cnf -> ti ); | |
860 | |
861 /* | |
862 * ignore primitive, due to not found transaction identifier. | |
863 */ | |
864 TRACE_EVENT ("primitive rejected due to unused ti"); | |
865 PFREE(mncc_release_cnf); | |
866 return; | |
867 } | |
868 | |
869 /* | |
870 *------------------------------------------------------------------- | |
871 * update shared parameter and notify ACI | |
872 *------------------------------------------------------------------- | |
873 */ | |
874 pCtbNtry = ccShrdPrm.ctb[cId]; | |
875 | |
876 /* HM 02-Aug-2002, done while merging SBK code, check again this code*/ | |
877 #if 0 /* Old code */ | |
878 if( mncc_release_cnf -> cause NEQ CAUSE_NOT_PRES ) | |
879 { | |
880 pCtbNtry -> nrmCs = mncc_release_cnf -> cause; | |
881 ccShrdPrm.cIdFail = cId; | |
882 #ifdef FF_EM_MODE | |
883 em_relcs = mncc_release_cnf -> cause; | |
884 #endif /* FF_EM_MODE */ | |
885 } | |
886 #endif /* #if 0 */ | |
887 | |
888 if (pCtbNtry -> nrmCs EQ MNCC_CAUSE_NO_MS_CAUSE) /* no Disconnect Cause available...*/ | |
889 { | |
890 pCtbNtry -> nrmCs = mncc_release_cnf -> cause; /* Recheck ###*/ | |
891 ccShrdPrm.cIdFail = cId; /* This line is considered harmful, only if cause present ### */ | |
892 #ifdef FF_EM_MODE | |
893 em_relcs = mncc_release_cnf -> cause; /* Recheck ### */ | |
894 #endif /* FF_EM_MODE */ | |
895 } | |
896 pCtbNtry -> rslt = CAUSE_MAKE(DEFBY_CONDAT, ORIGSIDE_MS, MNCC_CC_ORIGINATING_ENTITY, NOT_PRESENT_8BIT); | |
897 pCtbNtry -> rejCs = CAUSE_MAKE(DEFBY_CONDAT, ORIGSIDE_MS, MNCC_CC_ORIGINATING_ENTITY, NOT_PRESENT_8BIT); | |
898 pCtbNtry -> curCs = pCtbNtry -> rejCs; | |
899 pCtbNtry -> numRawCauseBytes = mncc_release_cnf -> c_raw_cause; | |
900 pCtbNtry -> rawCauseBytes = mncc_release_cnf -> raw_cause; | |
901 #ifdef SIM_TOOLKIT | |
902 if(!(pCtbNtry -> SATinv & SAT_REDIAL)) | |
903 #endif | |
904 pCtbNtry -> calStat = CS_IDL; | |
905 | |
906 psaCC_chngCalTypCnt( cId, -1 ); | |
907 psaCC_retMOCTi( pCtbNtry -> ti ); | |
908 | |
909 psaCC_send_satevent( EVENT_CALL_DISC, cId , FAR_END, TRUE ); | |
910 | |
911 pCtbNtry -> numRawCauseBytes = 0; /* Reset the cause value after sending the info to SAT */ | |
912 | |
913 cmhCC_redialCheck( cId); | |
914 | |
915 cmhCC_CallReleased (cId); | |
916 | |
917 /*patch BE 30.06.00 to remove every other call drops */ | |
918 { | |
919 #ifdef SIM_TOOLKIT | |
920 if ( (pCtbNtry -> SATinv & SAT_REDIAL) EQ 0 ) | |
921 { | |
922 #endif /* SIM_TOOLKIT */ | |
923 if (rdlPrm.rdlcId NEQ cId) | |
924 { | |
925 psaCC_FreeCtbNtry (cId); | |
926 } | |
927 #ifdef SIM_TOOLKIT | |
928 } | |
929 #endif /* SIM_TOOLKIT */ | |
930 } | |
931 /*end patch BE */ | |
932 | |
933 switch(CHLDaddInfo) | |
934 { | |
935 case (CHLD_ADD_INFO_DIAL_CAL): | |
936 cId = psaCC_ctbFindCall( OWN_SRC_INV, NO_VLD_CS, CT_MOC ); | |
937 if (cId NEQ NO_ENTRY) | |
938 { | |
939 cmhCC_NewCall(cId,(T_ACI_CMD_SRC)psaCC_ctb(cId)->curSrc,AT_CMD_D); | |
940 } | |
941 break; | |
942 default: | |
943 break; | |
944 } | |
945 cmhCC_ChngWaitingToIncoming(); | |
946 /* free the primitive buffer */ | |
947 PFREE (mncc_release_cnf); | |
948 | |
949 } | |
950 | |
951 /* | |
952 +-------------------------------------------------------------------+ | |
953 | PROJECT : GSM-PS (6147) MODULE : PSA_CCP | | |
954 | ROUTINE : psa_mncc_disconnect_ind | | |
955 +-------------------------------------------------------------------+ | |
956 | |
957 PURPOSE : processes the MNCC_DISCONNECT_IND primitive send by CC. | |
958 this indicates the disconnection of a call. | |
959 | |
960 */ | |
961 | |
962 GLOBAL void psa_mncc_disconnect_ind | |
963 ( T_MNCC_DISCONNECT_IND *mncc_disconnect_ind ) | |
964 { | |
965 SHORT cId; /* holds call id */ | |
966 T_CC_CALL_TBL * pCtbNtry; /* holds pointer to call table entry */ | |
967 BOOL held_call = FALSE; | |
968 | |
969 TRACE_FUNCTION ("psa_mncc_disconnect_ind()"); | |
970 | |
971 /* | |
972 *------------------------------------------------------------------- | |
973 * find call in call table | |
974 *------------------------------------------------------------------- | |
975 */ | |
976 cId = psaCC_ctbFindTi( mncc_disconnect_ind -> ti ); | |
977 | |
978 if( cId < 0 ) | |
979 { | |
980 /* | |
981 * ignore primitive, due to not found transaction identifier. | |
982 */ | |
983 TRACE_EVENT ("primitive rejected due to unused ti"); | |
984 PFREE(mncc_disconnect_ind); | |
985 return; | |
986 } | |
987 psaCC_StopDTMF ( cId ); /* HM 27.07.00 */ | |
988 | |
989 /* | |
990 *------------------------------------------------------------------- | |
991 * update shared parameter and notify ACI | |
992 *------------------------------------------------------------------- | |
993 */ | |
994 pCtbNtry = ccShrdPrm.ctb[cId]; | |
995 | |
996 pCtbNtry -> curCs = mncc_disconnect_ind -> cause; | |
997 | |
998 if( mncc_disconnect_ind->diagnostic EQ MNCC_DIAG_CCBS_POSSIBLE ) | |
999 { | |
1000 pCtbNtry -> CCBSstat = CCBSS_PSSBL; | |
1001 } | |
1002 | |
1003 /* CQ 23619: copy ss diagnostic to shared parameters >> */ | |
1004 pCtbNtry->ssDiag = mncc_disconnect_ind->ss_diag; | |
1005 /* CQ 23619 << */ | |
1006 | |
1007 #if 0 | |
1008 if( mncc_disconnect_ind -> cause NEQ CAUSE_NOT_PRES ) | |
1009 { | |
1010 pCtbNtry -> nrmCs = mncc_disconnect_ind -> cause; | |
1011 ccShrdPrm.cIdFail = cId; | |
1012 #ifdef FF_EM_MODE | |
1013 em_relcs = mncc_disconnect_ind -> cause; | |
1014 #endif /* FF_EM_MODE */ | |
1015 } | |
1016 #endif | |
1017 | |
1018 pCtbNtry -> nrmCs = mncc_disconnect_ind -> cause; /* Recheck ### */ | |
1019 ccShrdPrm.cIdFail = cId; /* Recheck ### */ | |
1020 #ifdef FF_EM_MODE | |
1021 em_relcs = mncc_disconnect_ind -> cause; /* Recheck ### */ | |
1022 #endif /* FF_EM_MODE */ | |
1023 | |
1024 /* remember if call is currently on hold */ | |
1025 if (pCtbNtry -> calStat EQ CS_HLD) | |
1026 held_call = TRUE; | |
1027 | |
1028 /* calStat has to be set before calling psaCC_chkPrgDesc, otherwise | |
1029 no CPI event will be send */ | |
1030 pCtbNtry -> calStat = CS_DSC_REQ; | |
1031 | |
1032 /* check for TTY service */ | |
1033 /* cmhCC_TTY_Control ( cId ); */ | |
1034 | |
1035 /* check for progress descriptions */ | |
1036 psaCC_chkPrgDesc ( cId, mncc_disconnect_ind -> progress_desc, MT_DISC ); | |
1037 | |
1038 pCtbNtry -> rslt = CAUSE_MAKE(DEFBY_CONDAT, ORIGSIDE_MS, MNCC_CC_ORIGINATING_ENTITY, NOT_PRESENT_8BIT); | |
1039 pCtbNtry -> rejCs = CAUSE_MAKE(DEFBY_CONDAT, ORIGSIDE_MS, MNCC_CC_ORIGINATING_ENTITY, NOT_PRESENT_8BIT); | |
1040 | |
1041 pCtbNtry -> numRawCauseBytes = mncc_disconnect_ind -> c_raw_cause; | |
1042 pCtbNtry -> rawCauseBytes = mncc_disconnect_ind -> raw_cause; | |
1043 | |
1044 psaCC_send_satevent( EVENT_CALL_DISC, cId , FAR_END, TRUE ); | |
1045 | |
1046 pCtbNtry -> numRawCauseBytes = 0; /* Reset the cause value after sending the info to SAT */ | |
1047 | |
1048 /* If call was held upon mncc_disconnect_ind it is cleared anyway */ | |
1049 if (held_call EQ TRUE) | |
1050 { | |
1051 TRACE_EVENT ("Release a held call"); | |
1052 cmhCC_CallDisconnected (cId); | |
1053 psaCC_ClearCall (cId); | |
1054 } | |
1055 else | |
1056 { | |
1057 switch( cmhCC_getcalltype(cId) ) | |
1058 { | |
1059 case( VOICE_CALL ): | |
1060 { | |
1061 /* | |
1062 * if in-band tones are available and TCH is assigned, request to disconnect the call | |
1063 * GSM 04.08/5.4.4.1.1.1 | |
1064 */ | |
1065 /* | |
1066 TRACE_EVENT("psa_mncc_disconnect_ind(): --> VOICE CALL"); | |
1067 if ((pCtbNtry -> inBndTns EQ TRUE) | |
1068 AND (pCtbNtry -> CCBSstat EQ NO_VLD_CCBSS) | |
1069 AND (ccShrdPrm.TCHasg EQ TRUE)) | |
1070 { | |
1071 cmhCC_DisconnectCall (cId); | |
1072 } | |
1073 else | |
1074 { | |
1075 cmhCC_CallDisconnected (cId); | |
1076 } | |
1077 */ | |
1078 /* check conditions for redialling */ | |
1079 if((pCtbNtry->curCmd NEQ AT_CMD_H) AND | |
1080 (pCtbNtry->curCmd NEQ AT_CMD_CHUP)) | |
1081 { | |
1082 cmhCC_redialCheck(cId); | |
1083 } | |
1084 | |
1085 | |
1086 /* | |
1087 * for CCBS support the "Prolonged Clearing Procedure" | |
1088 * GSM 04.08/5.4.4.2.1 | |
1089 */ | |
1090 cmhCC_CallDisconnected (cId); | |
1091 | |
1092 if ((pCtbNtry->inBndTns EQ TRUE) /* 5.4.4.2.1.1 */ | |
1093 AND (pCtbNtry->CCBSstat EQ NO_VLD_CCBSS)) | |
1094 { | |
1095 if (ccShrdPrm.TCHasg NEQ TRUE) | |
1096 { | |
1097 TRACE_EVENT ("4.08/5.4.4.2.1.1 i)"); | |
1098 psaCC_ClearCall (cId); | |
1099 } | |
1100 else | |
1101 { | |
1102 TRACE_EVENT ("4.08/5.4.4.2.1.1 ii)"); | |
1103 psaCC_setSpeechMode(); | |
1104 } | |
1105 } | |
1106 else if (pCtbNtry->CCBSstat EQ CCBSS_PSSBL) /* 5.4.4.2.2.1 */ | |
1107 { | |
1108 TRACE_EVENT ("4.08/5.4.4.2.2.1"); | |
1109 psaCC_setSpeechMode(); | |
1110 cmhCC_SndDiscRsn( cId ); /* FIXME: to emmit BUSY, but this is not good here | |
1111 since BUSY is final result code and will be | |
1112 emitted on Release again !!!!! */ | |
1113 } | |
1114 else if ((pCtbNtry->inBndTns NEQ TRUE) /* 5.4.4.2.3.1 */ | |
1115 AND (pCtbNtry->CCBSstat EQ NO_VLD_CCBSS)) | |
1116 { | |
1117 TRACE_EVENT ("4.08/5.4.4.2.3.1"); | |
1118 psaCC_ClearCall (cId); | |
1119 } | |
1120 else /* 5.4.4.2.3.2 */ | |
1121 { | |
1122 TRACE_EVENT ("4.08/5.4.4.2.3.2"); | |
1123 psaCC_ClearCall (cId); | |
1124 } | |
1125 break; | |
1126 } | |
1127 default: /* all non voice calls */ | |
1128 { | |
1129 /* | |
1130 * see cmh_cc.h T_CC_CALL_TYPE for all other call types | |
1131 */ | |
1132 TRACE_EVENT("psa_mncc_disconnect_ind(): --> DATA CALL"); | |
1133 cmhCC_CallDisconnected (cId); | |
1134 psaCC_ClearCall (cId); | |
1135 break; | |
1136 } | |
1137 } | |
1138 } /* else */ | |
1139 | |
1140 /* free the primitive buffer */ | |
1141 PFREE (mncc_disconnect_ind); | |
1142 } | |
1143 | |
1144 /* | |
1145 +-------------------------------------------------------------------+ | |
1146 | PROJECT : GSM-PS (6147) MODULE : PSA_CCP | | |
1147 | ROUTINE : psa_mncc_alert_ind | | |
1148 +-------------------------------------------------------------------+ | |
1149 | |
1150 PURPOSE : processes the MNCC_ALERT_IND primitive send by CC. | |
1151 this indicates that the called party is alerted. | |
1152 | |
1153 */ | |
1154 | |
1155 GLOBAL void psa_mncc_alert_ind | |
1156 ( T_MNCC_ALERT_IND *mncc_alert_ind ) | |
1157 { | |
1158 SHORT cId; /* holds call id */ | |
1159 | |
1160 TRACE_FUNCTION ("psa_mncc_alert_ind()"); | |
1161 | |
1162 /* | |
1163 *------------------------------------------------------------------- | |
1164 * find call in call table | |
1165 *------------------------------------------------------------------- | |
1166 */ | |
1167 cId = psaCC_ctbFindTi( mncc_alert_ind -> ti ); | |
1168 | |
1169 if( cId < 0 ) | |
1170 { | |
1171 /* | |
1172 * ignore primitive, due to not found transaction identifier. | |
1173 */ | |
1174 TRACE_EVENT ("primitive rejected due to unused ti"); | |
1175 PFREE(mncc_alert_ind); | |
1176 return; | |
1177 } | |
1178 | |
1179 /* | |
1180 *------------------------------------------------------------------- | |
1181 * update shared parameter and notify ACI | |
1182 *------------------------------------------------------------------- | |
1183 */ | |
1184 psaCC_ctb(cId)->alrtStat = AS_SND; | |
1185 psaCC_ctb(cId)->curCs = MNCC_CAUSE_NO_MS_CAUSE; | |
1186 | |
1187 /* check for progress descriptions */ | |
1188 psaCC_chkPrgDesc ( cId, mncc_alert_ind -> progress_desc, MT_ALRT ); | |
1189 | |
1190 /* check for TTY service */ | |
1191 cmhCC_TTY_Control ( cId, TTY_START ); | |
1192 /* | |
1193 *------------------------------------------------------------------- | |
1194 * free the primitive buffer | |
1195 *------------------------------------------------------------------- | |
1196 */ | |
1197 PFREE (mncc_alert_ind); | |
1198 } | |
1199 | |
1200 /* | |
1201 +-------------------------------------------------------------------+ | |
1202 | PROJECT : GSM-PS (6147) MODULE : PSA_CCP | | |
1203 | ROUTINE : psa_mncc_call_proceed_ind| | |
1204 +-------------------------------------------------------------------+ | |
1205 | |
1206 PURPOSE : processes the MNCC_CALL_PROCEED_IND primitive send by CC. | |
1207 this indicates a call proceeding information for a call. | |
1208 | |
1209 */ | |
1210 | |
1211 GLOBAL void psa_mncc_call_proceed_ind | |
1212 ( T_MNCC_CALL_PROCEED_IND *mncc_call_proceed_ind ) | |
1213 { | |
1214 SHORT cId; /* holds call id */ | |
1215 T_CC_CALL_TBL * pCtbNtry; /* holds pointer to call table entry */ | |
1216 | |
1217 TRACE_FUNCTION ("psa_mncc_call_proceed_ind()"); | |
1218 | |
1219 /* | |
1220 *------------------------------------------------------------------- | |
1221 * find call in call table | |
1222 *------------------------------------------------------------------- | |
1223 */ | |
1224 cId = psaCC_ctbFindTi( mncc_call_proceed_ind -> ti ); | |
1225 | |
1226 if( cId < 0 ) | |
1227 { | |
1228 /* | |
1229 * ignore primitive, due to not found transaction identifier. | |
1230 */ | |
1231 TRACE_EVENT ("primitive rejected due to unused ti"); | |
1232 PFREE(mncc_call_proceed_ind); | |
1233 return; | |
1234 } | |
1235 | |
1236 /* | |
1237 *------------------------------------------------------------------- | |
1238 * update shared parameter and notify ACI | |
1239 *------------------------------------------------------------------- | |
1240 */ | |
1241 pCtbNtry = ccShrdPrm.ctb[cId]; | |
1242 pCtbNtry -> curCs = MNCC_CAUSE_NO_MS_CAUSE; | |
1243 | |
1244 memcpy( &(pCtbNtry->BC[0]),&(mncc_call_proceed_ind->bcpara), | |
1245 sizeof( T_MNCC_bcpara) ); | |
1246 memcpy( &(pCtbNtry->BC[1]),&(mncc_call_proceed_ind->bcpara2), | |
1247 sizeof( T_MNCC_bcpara) ); | |
1248 pCtbNtry -> rptInd = mncc_call_proceed_ind -> ri; | |
1249 | |
1250 /* check for progress descriptions */ | |
1251 psaCC_chkPrgDesc ( cId, mncc_call_proceed_ind -> progress_desc, MT_PROC ); | |
1252 | |
1253 /* check for TTY service */ | |
1254 cmhCC_TTY_Control ( cId, TTY_START ); | |
1255 /* | |
1256 *------------------------------------------------------------------- | |
1257 * free the primitive buffer | |
1258 *------------------------------------------------------------------- | |
1259 */ | |
1260 PFREE (mncc_call_proceed_ind); | |
1261 | |
1262 } | |
1263 | |
1264 /* | |
1265 +-------------------------------------------------------------------+ | |
1266 | PROJECT : GSM-PS (6147) MODULE : PSA_CCP | | |
1267 | ROUTINE : psa_mncc_progress_ind | | |
1268 +-------------------------------------------------------------------+ | |
1269 | |
1270 PURPOSE : processes the MNCC_PROGRESS_IND primitive send by CC. | |
1271 this indicates a progress description for a call. | |
1272 | |
1273 */ | |
1274 | |
1275 GLOBAL void psa_mncc_progress_ind | |
1276 ( T_MNCC_PROGRESS_IND *mncc_progress_ind ) | |
1277 { | |
1278 SHORT cId; /* holds call id */ | |
1279 | |
1280 TRACE_FUNCTION ("psa_mncc_progress_ind()"); | |
1281 | |
1282 /* | |
1283 *------------------------------------------------------------------- | |
1284 * find call in call table | |
1285 *------------------------------------------------------------------- | |
1286 */ | |
1287 cId = psaCC_ctbFindTi( mncc_progress_ind -> ti ); | |
1288 | |
1289 | |
1290 if( cId < 0 ) | |
1291 { | |
1292 /* | |
1293 * ignore primitive, due to not found transaction identifier. | |
1294 */ | |
1295 TRACE_EVENT ("primitive rejected due to unused ti"); | |
1296 PFREE(mncc_progress_ind); | |
1297 return; | |
1298 } | |
1299 psaCC_ctb(cId)->curCs = MNCC_CAUSE_NO_MS_CAUSE; | |
1300 | |
1301 /* | |
1302 * check for progress descriptions | |
1303 */ | |
1304 psaCC_chkPrgDesc ( cId, mncc_progress_ind -> progress_desc, MT_PROGR ); | |
1305 | |
1306 /* | |
1307 *------------------------------------------------------------------- | |
1308 * free the primitive buffer | |
1309 *------------------------------------------------------------------- | |
1310 */ | |
1311 PFREE (mncc_progress_ind); | |
1312 | |
1313 } | |
1314 | |
1315 /* | |
1316 +-------------------------------------------------------------------+ | |
1317 | PROJECT : GSM-PS (6147) MODULE : PSA_CCP | | |
1318 | ROUTINE : psa_mncc_hold_cnf | | |
1319 +-------------------------------------------------------------------+ | |
1320 | |
1321 PURPOSE : processes the MNCC_HOLD_CNF primitive send by CC. | |
1322 this confirmates that a call is being held. | |
1323 | |
1324 */ | |
1325 | |
1326 GLOBAL void psa_mncc_hold_cnf | |
1327 ( T_MNCC_HOLD_CNF *mncc_hold_cnf ) | |
1328 { | |
1329 SHORT cId; /* holds call id */ | |
1330 T_CC_CALL_TBL * pCtbNtry; /* holds pointer to call table entry */ | |
1331 | |
1332 TRACE_FUNCTION ("psa_mncc_hold_cnf()"); | |
1333 | |
1334 /* | |
1335 *------------------------------------------------------------------- | |
1336 * find call in call table | |
1337 *------------------------------------------------------------------- | |
1338 */ | |
1339 cId = psaCC_ctbFindTi( mncc_hold_cnf -> ti ); | |
1340 | |
1341 if( cId < 0 ) | |
1342 { | |
1343 /* | |
1344 * ignore primitive, due to not found transaction identifier. | |
1345 */ | |
1346 TRACE_EVENT ("primitive rejected due to unused ti"); | |
1347 PFREE(mncc_hold_cnf); | |
1348 return; | |
1349 } | |
1350 | |
1351 /* | |
1352 *------------------------------------------------------------------- | |
1353 * update shared parameter and notify ACI | |
1354 *------------------------------------------------------------------- | |
1355 */ | |
1356 pCtbNtry = ccShrdPrm.ctb[cId]; | |
1357 | |
1358 switch( mncc_hold_cnf -> cause ) | |
1359 { | |
1360 case( MNCC_CAUSE_HOLD_SUCCESS ): /* successful, call held */ | |
1361 case( MNCC_CAUSE_SUCCESS ): | |
1362 case( MNCC_CAUSE_NO_MS_CAUSE ): | |
1363 | |
1364 pCtbNtry -> calStat = CS_HLD; | |
1365 | |
1366 psaCC_setSpeechMode (); | |
1367 | |
1368 /* check for TTY service */ | |
1369 cmhCC_TTY_Control ( cId, TTY_PAUSE ); | |
1370 break; | |
1371 | |
1372 default: /* unsuccessful, call state unchanged */ | |
1373 | |
1374 ccShrdPrm.cIdFail = cId; | |
1375 pCtbNtry -> calStat = CS_ACT; | |
1376 break; | |
1377 } | |
1378 | |
1379 pCtbNtry -> rslt = mncc_hold_cnf -> cause; | |
1380 | |
1381 cmhCC_CallHeld(cId); | |
1382 | |
1383 /* | |
1384 *------------------------------------------------------------------- | |
1385 * free the primitive buffer | |
1386 *------------------------------------------------------------------- | |
1387 */ | |
1388 PFREE (mncc_hold_cnf); | |
1389 | |
1390 } | |
1391 | |
1392 /* | |
1393 +-------------------------------------------------------------------+ | |
1394 | PROJECT : GSM-PS (6147) MODULE : PSA_CCP | | |
1395 | ROUTINE : psa_mncc_retrieve_cnf | | |
1396 +-------------------------------------------------------------------+ | |
1397 | |
1398 PURPOSE : processes the MNCC_RETRIEVE_CNF primitive send by CC. | |
1399 this confirmates that a call is retrieved. | |
1400 | |
1401 */ | |
1402 | |
1403 GLOBAL void psa_mncc_retrieve_cnf | |
1404 ( T_MNCC_RETRIEVE_CNF *mncc_retrieve_cnf ) | |
1405 { | |
1406 SHORT cId; /* holds call id */ | |
1407 T_CC_CALL_TBL * pCtbNtry; /* holds pointer to call table entry */ | |
1408 | |
1409 TRACE_FUNCTION ("psa_mncc_retrieve_cnf()"); | |
1410 | |
1411 /* | |
1412 *------------------------------------------------------------------- | |
1413 * find call in call table | |
1414 *------------------------------------------------------------------- | |
1415 */ | |
1416 cId = psaCC_ctbFindTi( mncc_retrieve_cnf -> ti ); | |
1417 | |
1418 if( cId < 0 ) | |
1419 { | |
1420 /* | |
1421 * ignore primitive, due to not found transaction identifier. | |
1422 */ | |
1423 TRACE_EVENT ("primitive rejected due to unused ti"); | |
1424 PFREE(mncc_retrieve_cnf); | |
1425 return; | |
1426 } | |
1427 | |
1428 /* | |
1429 *------------------------------------------------------------------- | |
1430 * update shared parameter and notify ACI | |
1431 *------------------------------------------------------------------- | |
1432 */ | |
1433 pCtbNtry = ccShrdPrm.ctb[cId]; | |
1434 | |
1435 switch( mncc_retrieve_cnf -> cause ) | |
1436 { | |
1437 case( MNCC_CAUSE_RETRIEVE_SUCCESS ): /* successful, call active */ | |
1438 | |
1439 pCtbNtry -> calStat = CS_ACT; | |
1440 | |
1441 /* switch on vocoder */ | |
1442 psaCC_setSpeechMode (); | |
1443 | |
1444 /* check for TTY service */ | |
1445 cmhCC_TTY_Control ( cId, TTY_START ); | |
1446 break; | |
1447 | |
1448 default: /* unsuccessful, call state unchanged */ | |
1449 | |
1450 ccShrdPrm.cIdFail = cId; | |
1451 pCtbNtry -> calStat = CS_HLD; | |
1452 break; | |
1453 } | |
1454 | |
1455 pCtbNtry -> rslt = mncc_retrieve_cnf -> cause; | |
1456 | |
1457 cmhCC_CallRetrieved (cId); | |
1458 | |
1459 /* | |
1460 *------------------------------------------------------------------- | |
1461 * free the primitive buffer | |
1462 *------------------------------------------------------------------- | |
1463 */ | |
1464 PFREE (mncc_retrieve_cnf); | |
1465 | |
1466 } | |
1467 | |
1468 /* | |
1469 +-------------------------------------------------------------------+ | |
1470 | PROJECT : GSM-PS (6147) MODULE : PSA_CCP | | |
1471 | ROUTINE : psa_mncc_sync_ind | | |
1472 +-------------------------------------------------------------------+ | |
1473 | |
1474 PURPOSE : processes the MNCC_SYNC_IND primitive send by CC. | |
1475 this indicates the change of the channel mode. | |
1476 | |
1477 */ | |
1478 | |
1479 GLOBAL void psa_mncc_sync_ind( T_MNCC_SYNC_IND *mncc_sync_ind ) | |
1480 { | |
1481 SHORT cId = 0; /* holds call id */ | |
1482 | |
1483 TRACE_FUNCTION ("psa_mncc_sync_ind()"); | |
1484 | |
1485 /* | |
1486 cause cause 4.6 UBYTE | |
1487 channel mode chm 4.14 STRUCT | |
1488 | |
1489 ch_type 0 CH_SDCCH SDCCH channel | |
1490 1 CH_TCH_F TCH Fullrate | |
1491 2 CH_TCH_H TCH Halfrate | |
1492 | |
1493 ch_mode 0 CHM_SIG_ONLY signalling only | |
1494 1 CHM_SPEECH speech full rate or half rate version 1 | |
1495 33 CHM_SPEECH_V2 speech full rate or half rate version 2 | |
1496 65 CHM_SPEECH_V3 speech full rate or half rate version 3 | |
1497 3 CHM_DATA_9_6 data 9.6 kBit/s | |
1498 11 CHM_DATA_4_8 data 4.8 kBit/s | |
1499 19 CHM_DATA_2_4 data 2.4 kBit/s | |
1500 15 CHM_DATA_14_4 data 14.4 kBit/s | |
1501 */ | |
1502 | |
1503 TRACE_EVENT_P4("MNCC_SYNC_IND ti: %d, cause: %d, ch_type: %d, ch_mode: %d", | |
1504 mncc_sync_ind -> ti, | |
1505 mncc_sync_ind -> cause, | |
1506 mncc_sync_ind -> ch_info.ch_type, | |
1507 mncc_sync_ind -> ch_info.ch_mode); | |
1508 | |
1509 /* update shared parameter */ | |
1510 ccShrdPrm.syncCs = mncc_sync_ind -> cause; | |
1511 #ifdef FF_EM_MODE | |
1512 em_relcs = mncc_sync_ind -> cause; | |
1513 #endif /* FF_EM_MODE */ | |
1514 | |
1515 /* Inform Advice of Charge Module */ | |
1516 switch (mncc_sync_ind->cause) | |
1517 { | |
1518 case MNCC_CAUSE_REEST_STARTED: | |
1519 for( cId = 0; cId < MAX_CALL_NR; cId++ ) | |
1520 aoc_info (cId, AOC_SUSPEND_AOC); | |
1521 break; | |
1522 case MNCC_CAUSE_REEST_FINISHED: | |
1523 ccShrdPrm.aocRsmpPend = 1; | |
1524 break; | |
1525 } | |
1526 | |
1527 /* switch channel mode */ | |
1528 if( mncc_sync_ind -> ch_info.ch_mode NEQ NOT_PRESENT_8BIT ) | |
1529 { | |
1530 ccShrdPrm.chMod = mncc_sync_ind -> ch_info.ch_mode; | |
1531 ccShrdPrm.chType = mncc_sync_ind -> ch_info.ch_type; | |
1532 ccShrdPrm.TCHasg = TRUE; | |
1533 } | |
1534 | |
1535 if ( ccShrdPrm.aocRsmpPend AND | |
1536 (ccShrdPrm.chMod EQ MNCC_CHM_SPEECH) OR | |
1537 (ccShrdPrm.chMod EQ MNCC_CHM_SPEECH_V2) OR | |
1538 (ccShrdPrm.chMod EQ MNCC_CHM_SPEECH_V3) ) | |
1539 { | |
1540 ccShrdPrm.aocRsmpPend = 0; | |
1541 for( cId = 0; cId < MAX_CALL_NR; cId++ ) | |
1542 aoc_info (cId, AOC_RESUME_AOC); | |
1543 } | |
1544 | |
1545 if( mncc_sync_ind -> ch_info.ch_mode NEQ NOT_PRESENT_8BIT ) | |
1546 { | |
1547 /* service a pending alert */ | |
1548 for( cId = 0; cId < MAX_CALL_NR; cId++ ) | |
1549 { | |
1550 if (ccShrdPrm.ctb[cId] NEQ NULL) | |
1551 { | |
1552 psaCC_ctb(cId)->curCs = mncc_sync_ind -> cause; | |
1553 | |
1554 if( psaCC_ctb(cId)->alrtStat EQ AS_PND AND | |
1555 psaCC_ctb(cId)->calStat EQ CS_ACT_REQ ) | |
1556 { | |
1557 { | |
1558 /* indicate alerting to network */ | |
1559 PALLOC (mncc_alert_req, MNCC_ALERT_REQ); | |
1560 mncc_alert_req -> ti = psaCC_ctb(cId)->ti; | |
1561 PSENDX (CC, mncc_alert_req); | |
1562 psaCC_ctb(cId)->alrtStat = AS_SND; | |
1563 } | |
1564 cmhCC_IncomingCall (cId); /* indicate an incoming call */ | |
1565 } | |
1566 if (psaCC_ctb(cId)->calStat NEQ CS_HLD AND | |
1567 psaCC_ctb(cId)->calStat NEQ CS_IDL) | |
1568 { | |
1569 /* check for TTY service */ | |
1570 cmhCC_TTY_Control ( cId, TTY_TCH ); | |
1571 } | |
1572 } | |
1573 } | |
1574 } | |
1575 psaCC_setSpeechMode (); | |
1576 | |
1577 /* Remember cause for Call Reestablishment*/ | |
1578 | |
1579 if (mncc_sync_ind -> cause EQ MNCC_CAUSE_REEST_FINISHED | |
1580 OR mncc_sync_ind -> cause EQ MNCC_CAUSE_REEST_STARTED) | |
1581 { | |
1582 for( cId = 0; cId < MAX_CALL_NR; cId++ ) | |
1583 { | |
1584 if (ccShrdPrm.ctb[cId] NEQ NULL) | |
1585 { | |
1586 psaCC_ctb(cId)->curCs = mncc_sync_ind -> cause; | |
1587 } | |
1588 } | |
1589 } | |
1590 | |
1591 cId = psaCC_ctbFindTi( mncc_sync_ind -> ti ); | |
1592 | |
1593 /* For channel synchronization events the cId needs not to be valid here */ | |
1594 cmhCC_Synchronized( cId ); | |
1595 | |
1596 | |
1597 /* free the primitive buffer */ | |
1598 PFREE (mncc_sync_ind); | |
1599 } | |
1600 | |
1601 /* | |
1602 +-------------------------------------------------------------------+ | |
1603 | PROJECT : GSM-PS (6147) MODULE : PSA_CCP | | |
1604 | ROUTINE : psa_mncc_user_ind | | |
1605 +-------------------------------------------------------------------+ | |
1606 | |
1607 PURPOSE : processes the MNCC_USER_IND primitive send by CC. | |
1608 this indicates the receiving of user data. | |
1609 */ | |
1610 | |
1611 GLOBAL void psa_mncc_user_ind( T_MNCC_USER_IND *mncc_user_ind ) | |
1612 { | |
1613 TRACE_FUNCTION ("psa_mncc_user_ind()"); | |
1614 | |
1615 PFREE (mncc_user_ind); | |
1616 } | |
1617 | |
1618 /* | |
1619 +-------------------------------------------------------------------+ | |
1620 | PROJECT : GSM-PS (6147) MODULE : PSA_CCP | | |
1621 | ROUTINE : psa_mncc_start_dtmf_cnf | | |
1622 +-------------------------------------------------------------------+ | |
1623 | |
1624 PURPOSE : processes the MNCC_START_DTMF_CNF primitive send by CC. | |
1625 this is a confirmation for the sent DTMF tones. | |
1626 | |
1627 */ | |
1628 | |
1629 GLOBAL void psa_mncc_start_dtmf_cnf | |
1630 ( T_MNCC_START_DTMF_CNF *mncc_start_dtmf_cnf ) | |
1631 { | |
1632 SHORT cId; /* holds call id */ | |
1633 | |
1634 TRACE_FUNCTION ("psa_mncc_start_dtmf_cnf()"); | |
1635 | |
1636 /* | |
1637 *------------------------------------------------------------------- | |
1638 * find call in call table | |
1639 *------------------------------------------------------------------- | |
1640 */ | |
1641 cId = psaCC_ctbFindTi( mncc_start_dtmf_cnf -> ti ); | |
1642 | |
1643 if( cId < 0 ) | |
1644 { | |
1645 /* | |
1646 * ignore primitive, due to not found transaction identifier. | |
1647 */ | |
1648 TRACE_EVENT ("primitive rejected due to unused ti"); | |
1649 PFREE(mncc_start_dtmf_cnf); | |
1650 return; | |
1651 } | |
1652 | |
1653 /* | |
1654 *------------------------------------------------------------------- | |
1655 * update shared parameter and notify ACI | |
1656 *------------------------------------------------------------------- | |
1657 */ | |
1658 psaCC_ctb(cId)->nrmCs = mncc_start_dtmf_cnf -> cause; | |
1659 if ((mncc_start_dtmf_cnf->cause EQ MNCC_CAUSE_DTMF_STOP_SUCCESS) AND | |
1660 (mncc_start_dtmf_cnf->dtmf_mod EQ MNCC_DTMF_MOD_MAN_STOP)) | |
1661 { | |
1662 /* Reset the current dtmf digit */ | |
1663 ccShrdPrm.dtmf.cur = 0; | |
1664 } | |
1665 #ifdef FF_EM_MODE | |
1666 em_relcs = mncc_start_dtmf_cnf -> cause; | |
1667 #endif /* FF_EM_MODE */ | |
1668 | |
1669 psaCC_DTMFSent( cId ); | |
1670 | |
1671 /* | |
1672 *------------------------------------------------------------------- | |
1673 * free the primitive buffer | |
1674 *------------------------------------------------------------------- | |
1675 */ | |
1676 PFREE (mncc_start_dtmf_cnf); | |
1677 | |
1678 } | |
1679 | |
1680 /* | |
1681 +-------------------------------------------------------------------+ | |
1682 | PROJECT : GSM-PS (6147) MODULE : PSA_CCP | | |
1683 | ROUTINE : psa_mncc_modify_ind | | |
1684 +-------------------------------------------------------------------+ | |
1685 | |
1686 PURPOSE : processes the MNCC_MODIFY_IND primitive send by CC. | |
1687 this indicates a mobile terminated in-call modification. | |
1688 | |
1689 */ | |
1690 | |
1691 GLOBAL void psa_mncc_modify_ind | |
1692 ( T_MNCC_MODIFY_IND *mncc_modify_ind ) | |
1693 { | |
1694 SHORT cId; /* holds call id */ | |
1695 T_CC_CALL_TBL * pCtbNtry; /* holds pointer to call table entry */ | |
1696 | |
1697 TRACE_FUNCTION ("psa_mncc_modify_ind()"); | |
1698 | |
1699 /* | |
1700 *------------------------------------------------------------------- | |
1701 * find call in call table | |
1702 *------------------------------------------------------------------- | |
1703 */ | |
1704 cId = psaCC_ctbFindTi( mncc_modify_ind -> ti ); | |
1705 | |
1706 if( cId < 0 ) | |
1707 { | |
1708 /* | |
1709 * ignore primitive, due to not found transaction identifier. | |
1710 */ | |
1711 TRACE_EVENT ("primitive rejected due to unused ti"); | |
1712 PFREE(mncc_modify_ind); | |
1713 return; | |
1714 } | |
1715 | |
1716 /* check for TTY service */ | |
1717 cmhCC_TTY_Control ( cId, TTY_PAUSE ); | |
1718 | |
1719 /* | |
1720 *------------------------------------------------------------------- | |
1721 * update shared parameter and notify ACI | |
1722 *------------------------------------------------------------------- | |
1723 */ | |
1724 pCtbNtry = ccShrdPrm.ctb[cId]; | |
1725 | |
1726 pCtbNtry -> curBC = (pCtbNtry -> curBC EQ 0)?1:0; | |
1727 pCtbNtry -> rslt = MNCC_CAUSE_MODIFY_SUCCESS; /* SBK-02-07-30: possibly to be revised as strictly speaking ACI is orignating entity */ | |
1728 | |
1729 cmhCC_CallModified (cId); | |
1730 | |
1731 /* check for TTY service */ | |
1732 cmhCC_TTY_Control ( cId, TTY_START ); | |
1733 | |
1734 psaCC_StopDTMF ( cId ); | |
1735 /* | |
1736 *------------------------------------------------------------------- | |
1737 * free the primitive buffer | |
1738 *------------------------------------------------------------------- | |
1739 */ | |
1740 PFREE (mncc_modify_ind); | |
1741 | |
1742 } | |
1743 | |
1744 /* | |
1745 +-------------------------------------------------------------------+ | |
1746 | PROJECT : GSM-PS (6147) MODULE : PSA_CCP | | |
1747 | ROUTINE : psa_mncc_modify_cnf | | |
1748 +-------------------------------------------------------------------+ | |
1749 | |
1750 PURPOSE : processes the MNCC_MODIFY_CNF primitive send by CC. | |
1751 this indicates the result for a mobile originated in-call | |
1752 modification. | |
1753 | |
1754 */ | |
1755 | |
1756 GLOBAL void psa_mncc_modify_cnf | |
1757 ( T_MNCC_MODIFY_CNF *mncc_modify_cnf ) | |
1758 { | |
1759 SHORT cId; /* holds call id */ | |
1760 T_CC_CALL_TBL * pCtbNtry; /* holds pointer to call table entry */ | |
1761 | |
1762 TRACE_FUNCTION ("psa_mncc_modify_cnf()"); | |
1763 | |
1764 /* | |
1765 *------------------------------------------------------------------- | |
1766 * find call in call table | |
1767 *------------------------------------------------------------------- | |
1768 */ | |
1769 cId = psaCC_ctbFindTi( mncc_modify_cnf -> ti ); | |
1770 | |
1771 if( cId < 0 ) | |
1772 { | |
1773 /* | |
1774 * ignore primitive, due to not found transaction identifier. | |
1775 */ | |
1776 TRACE_EVENT ("primitive rejected due to unused ti"); | |
1777 PFREE(mncc_modify_cnf); | |
1778 return; | |
1779 } | |
1780 | |
1781 /* | |
1782 *------------------------------------------------------------------- | |
1783 * update shared parameter and notify ACI | |
1784 *------------------------------------------------------------------- | |
1785 */ | |
1786 pCtbNtry = ccShrdPrm.ctb[cId]; | |
1787 | |
1788 pCtbNtry -> rslt = mncc_modify_cnf -> cause; | |
1789 | |
1790 switch( mncc_modify_cnf -> cause ) | |
1791 { | |
1792 case( MNCC_CAUSE_MODIFY_SUCCESS ): /* successful modification */ | |
1793 | |
1794 pCtbNtry -> curBC = (pCtbNtry -> curBC EQ 0)?1:0; | |
1795 break; | |
1796 | |
1797 default: /* unsuccessful modification */ | |
1798 | |
1799 ccShrdPrm.cIdFail = cId; | |
1800 break; | |
1801 } | |
1802 psaCC_ctb(cId)->calStat = CS_ACT; | |
1803 | |
1804 cmhCC_CallModified (cId); | |
1805 | |
1806 /* check for TTY service */ | |
1807 cmhCC_TTY_Control ( cId, TTY_START ); | |
1808 | |
1809 /* | |
1810 *------------------------------------------------------------------- | |
1811 * free the primitive buffer | |
1812 *------------------------------------------------------------------- | |
1813 */ | |
1814 PFREE (mncc_modify_cnf); | |
1815 | |
1816 } | |
1817 | |
1818 /* | |
1819 +-------------------------------------------------------------------+ | |
1820 | PROJECT : GSM-PS (6147) MODULE : PSA_CCP | | |
1821 | ROUTINE : psa_mncc_bearer_cap_cnf | | |
1822 +-------------------------------------------------------------------+ | |
1823 | |
1824 PURPOSE : processes the MNCC_BEARER_CAP_CNF primitive send by CC. | |
1825 this is the result of the requested bearer coding/decoding. | |
1826 | |
1827 */ | |
1828 | |
1829 GLOBAL void psa_mncc_bearer_cap_cnf | |
1830 ( T_MNCC_BEARER_CAP_CNF *mncc_bearer_cap_cnf ) | |
1831 { | |
1832 | |
1833 TRACE_FUNCTION ("psa_mncc_bearer_cap_cnf()"); | |
1834 | |
1835 /* | |
1836 *------------------------------------------------------------------- | |
1837 * determine request id | |
1838 *------------------------------------------------------------------- | |
1839 */ | |
1840 switch( mncc_bearer_cap_cnf -> req_id ) | |
1841 { | |
1842 | |
1843 #ifdef SIM_TOOLKIT | |
1844 | |
1845 case( BCRI_SAT ): | |
1846 | |
1847 switch( mncc_bearer_cap_cnf -> bc_mod ) | |
1848 { | |
1849 case( MNCC_BC_MOD_CODE ): | |
1850 | |
1851 cmhSAT_ResCapCode ( mncc_bearer_cap_cnf -> cause, | |
1852 &mncc_bearer_cap_cnf -> bcconf, | |
1853 &mncc_bearer_cap_cnf -> bcconf2); | |
1854 | |
1855 break; | |
1856 | |
1857 case( MNCC_BC_MOD_DECODE ): | |
1858 | |
1859 cmhSAT_ResCapDecode ( mncc_bearer_cap_cnf -> cause, | |
1860 &mncc_bearer_cap_cnf -> bcpara, | |
1861 &mncc_bearer_cap_cnf -> bcpara2 ); | |
1862 | |
1863 break; | |
1864 } | |
1865 break; | |
1866 | |
1867 #endif | |
1868 } | |
1869 | |
1870 /* | |
1871 *------------------------------------------------------------------- | |
1872 * free the primitive buffer | |
1873 *------------------------------------------------------------------- | |
1874 */ | |
1875 PFREE (mncc_bearer_cap_cnf); | |
1876 | |
1877 } | |
1878 | |
1879 /* | |
1880 +-------------------------------------------------------------------+ | |
1881 | PROJECT : GSM-PS (6147) MODULE : PSA_CCP | | |
1882 | ROUTINE : psa_mncc_prompt_ind | | |
1883 +-------------------------------------------------------------------+ | |
1884 | |
1885 PURPOSE : processes the MNCC_PROMPT_IND primitive send by CC. | |
1886 this requests a transaction identifier for a CCBS recall. | |
1887 | |
1888 */ | |
1889 | |
1890 GLOBAL void psa_mncc_prompt_ind | |
1891 ( T_MNCC_PROMPT_IND *mncc_prompt_ind ) | |
1892 { | |
1893 SHORT ti; | |
1894 | |
1895 TRACE_FUNCTION ("psa_mncc_prompt_ind()"); | |
1896 | |
1897 /* | |
1898 *------------------------------------------------------------------- | |
1899 * allocate transaction identifier | |
1900 *------------------------------------------------------------------- | |
1901 */ | |
1902 ti = psaCC_getMOCTi( -1 ); | |
1903 | |
1904 if( ti NEQ -1 ) | |
1905 { | |
1906 PALLOC (mncc_prompt_res, MNCC_PROMPT_RES); | |
1907 mncc_prompt_res -> ti = (UBYTE)ti; | |
1908 PSENDX (CC, mncc_prompt_res); | |
1909 } | |
1910 else | |
1911 { | |
1912 PALLOC (mncc_prompt_rej, MNCC_PROMPT_REJ); | |
1913 PSENDX (CC, mncc_prompt_rej); | |
1914 } | |
1915 | |
1916 /* | |
1917 *------------------------------------------------------------------- | |
1918 * free the primitive buffer | |
1919 *------------------------------------------------------------------- | |
1920 */ | |
1921 PFREE (mncc_prompt_ind); | |
1922 | |
1923 } | |
1924 | |
1925 /* | |
1926 +-------------------------------------------------------------------+ | |
1927 | PROJECT : GSM-PS (6147) MODULE : PSA_CCP | | |
1928 | ROUTINE : psa_mncc_recall_ind | | |
1929 +-------------------------------------------------------------------+ | |
1930 | |
1931 PURPOSE : processes the MNCC_RECALL_IND primitive send by CC. | |
1932 this indicates a recall attempt from the network in case | |
1933 of CCBS. | |
1934 | |
1935 */ | |
1936 | |
1937 GLOBAL void psa_mncc_recall_ind | |
1938 ( T_MNCC_RECALL_IND *mncc_recall_ind ) | |
1939 { | |
1940 SHORT cId; /* holds call table identifier */ | |
1941 T_CC_CALL_TBL * pCtbNtry; /* holds pointer to call table entry */ | |
1942 | |
1943 TRACE_FUNCTION ("psa_mncc_recall_ind()"); | |
1944 | |
1945 /* | |
1946 *------------------------------------------------------------------- | |
1947 * check for K.O. criteria | |
1948 *------------------------------------------------------------------- | |
1949 */ | |
1950 if( aoc_check_moc() EQ FALSE ) | |
1951 { | |
1952 PALLOC (mncc_reject_req, MNCC_REJECT_REQ); | |
1953 | |
1954 mncc_reject_req -> ti = mncc_recall_ind -> ti; | |
1955 mncc_reject_req -> cause = MNCC_CAUSE_ACM_MAX; | |
1956 | |
1957 PSENDX (CC, mncc_reject_req); | |
1958 } | |
1959 | |
1960 else if((cId = psaCC_ctbNewEntry()) < 0 ) | |
1961 { | |
1962 PALLOC (mncc_reject_req, MNCC_REJECT_REQ); | |
1963 | |
1964 mncc_reject_req -> ti = mncc_recall_ind -> ti; | |
1965 mncc_reject_req -> cause = MNCC_CAUSE_USER_BUSY; | |
1966 | |
1967 PSENDX (CC, mncc_reject_req); | |
1968 } | |
1969 | |
1970 /* | |
1971 *------------------------------------------------------------------- | |
1972 * insert recall parameters into call table entry | |
1973 *------------------------------------------------------------------- | |
1974 */ | |
1975 else | |
1976 { | |
1977 pCtbNtry = ccShrdPrm.ctb[cId]; | |
1978 | |
1979 pCtbNtry -> ti = mncc_recall_ind -> ti; | |
1980 pCtbNtry -> rptInd = mncc_recall_ind -> ri; | |
1981 | |
1982 /* | |
1983 * Assign called party | |
1984 */ | |
1985 pCtbNtry -> cldPty.ton = mncc_recall_ind -> called_party.ton; | |
1986 pCtbNtry -> cldPty.npi = mncc_recall_ind -> called_party.npi; | |
1987 pCtbNtry -> cldPty.c_called_num = | |
1988 mncc_recall_ind -> called_party.c_called_num; | |
1989 if (pCtbNtry -> cldPty.called_num NEQ NULL) | |
1990 { | |
1991 ACI_MFREE (pCtbNtry -> cldPty.called_num); | |
1992 pCtbNtry -> cldPty.called_num = NULL; | |
1993 } | |
1994 if (pCtbNtry -> cldPty.c_called_num NEQ 0) | |
1995 { | |
1996 ACI_MALLOC (pCtbNtry -> cldPty.called_num, | |
1997 pCtbNtry -> cldPty.c_called_num); | |
1998 memcpy (pCtbNtry -> cldPty.called_num, | |
1999 mncc_recall_ind -> called_party.called_num, | |
2000 mncc_recall_ind -> called_party.c_called_num); | |
2001 } | |
2002 | |
2003 /* | |
2004 * Assign called party subaddress | |
2005 */ | |
2006 pCtbNtry -> cldPtySub = mncc_recall_ind -> called_party_sub; | |
2007 | |
2008 /* | |
2009 * Assign bearer caps | |
2010 */ | |
2011 memcpy( &(pCtbNtry->BC[0]),&(mncc_recall_ind->bcpara), | |
2012 sizeof( T_MNCC_bcpara) ); | |
2013 memcpy( &(pCtbNtry->BC[1]),&(mncc_recall_ind->bcpara2), | |
2014 sizeof( T_MNCC_bcpara) ); | |
2015 | |
2016 psaCC_phbSrchNum( cId, CT_NI_MOC ); | |
2017 | |
2018 pCtbNtry -> calStat = CS_ACT_REQ; | |
2019 pCtbNtry -> calType = CT_NI_MOC; | |
2020 | |
2021 pCtbNtry -> prio = MNCC_PRIO_NORM_CALL; | |
2022 pCtbNtry -> curBC = 0; | |
2023 | |
2024 } | |
2025 | |
2026 /* | |
2027 *------------------------------------------------------------------- | |
2028 * free the primitive buffer | |
2029 *------------------------------------------------------------------- | |
2030 */ | |
2031 PFREE (mncc_recall_ind); | |
2032 | |
2033 } | |
2034 | |
2035 /* | |
2036 +-------------------------------------------------------------------+ | |
2037 | PROJECT : GSM-PS (6147) MODULE : PSA_CCP | | |
2038 | ROUTINE : psa_mncc_status_ind | | |
2039 +-------------------------------------------------------------------+ | |
2040 | |
2041 PURPOSE : processes the MNCC_STATUS_IND primitive sent by CC. | |
2042 This indicates that a STATUS ENQUIRY message has been | |
2043 received by CC, the network awaits a CC STATUS message. | |
2044 Used to ensure that the auxiliary states between ACI and | |
2045 CC were synchronized before the STATUS message is sent. | |
2046 | |
2047 */ | |
2048 | |
2049 GLOBAL void psa_mncc_status_ind (T_MNCC_STATUS_IND *mncc_status_ind) | |
2050 { | |
2051 UBYTE ti; | |
2052 | |
2053 TRACE_FUNCTION ("psa_mncc_status_ind()"); | |
2054 | |
2055 ti = mncc_status_ind->ti; | |
2056 | |
2057 { | |
2058 PREUSE (mncc_status_ind, mncc_status_res, MNCC_STATUS_RES); | |
2059 mncc_status_res->ti = ti; | |
2060 PSENDX (CC, mncc_status_res); | |
2061 } | |
2062 } | |
2063 | |
2064 /* | |
2065 +-------------------------------------------------------------------+ | |
2066 | PROJECT : GSM-PS (6147) MODULE : PSA_CCP | | |
2067 | ROUTINE : psa_mncc_facility_ind | | |
2068 +-------------------------------------------------------------------+ | |
2069 | |
2070 PURPOSE : processes the MNCC_FACILITY_IND primitive send by CC. | |
2071 this indicates the receiving of a facility information | |
2072 element. Handles multiple components in the facility info. | |
2073 | |
2074 */ | |
2075 | |
2076 GLOBAL void psa_mncc_facility_ind(T_MNCC_FACILITY_IND * mncc_facility_ind) | |
2077 { | |
2078 UBYTE tlen = 0; | |
2079 USHORT offset_comp = 0, total_len = mncc_facility_ind->fac_inf.l_fac/8; | |
2080 UBYTE len_comp = 0; | |
2081 UBYTE *tPtrfac = mncc_facility_ind->fac_inf.fac; | |
2082 | |
2083 TRACE_FUNCTION ("psa_mncc_facility_ind()"); | |
2084 | |
2085 if (tPtrfac[1] > 0x7F)/* For the case, when length is coded in non-standard way (0x80, 0x81, 0x82) we will be able to process only one component */ | |
2086 { | |
2087 psaCC_ProcessCmp((T_MNCC_FACILITY_IND *)mncc_facility_ind); | |
2088 return; | |
2089 } | |
2090 | |
2091 offset_comp = mncc_facility_ind->fac_inf.o_fac; | |
2092 len_comp = tlen = tPtrfac[1] + 2; | |
2093 | |
2094 for ( ; total_len >= len_comp; len_comp+=tlen) | |
2095 { | |
2096 if ((*tPtrfac EQ 0xA1) OR | |
2097 (*tPtrfac EQ 0xA2) OR | |
2098 (*tPtrfac EQ 0xA3) OR | |
2099 (*tPtrfac EQ 0xA4)) | |
2100 { | |
2101 PALLOC(new_mncc_facility_ind, MNCC_FACILITY_IND); | |
2102 | |
2103 new_mncc_facility_ind->ti = mncc_facility_ind->ti; | |
2104 new_mncc_facility_ind->fac_context = mncc_facility_ind->fac_context; | |
2105 new_mncc_facility_ind->fac_inf.l_fac = tlen * 8; | |
2106 new_mncc_facility_ind->fac_inf.o_fac = offset_comp; | |
2107 memcpy(new_mncc_facility_ind->fac_inf.fac, tPtrfac, tlen); | |
2108 | |
2109 psaCC_ProcessCmp((T_MNCC_FACILITY_IND *)new_mncc_facility_ind); | |
2110 | |
2111 tPtrfac = tPtrfac + tlen; | |
2112 tlen = tPtrfac[1] + 2; | |
2113 offset_comp = 0; | |
2114 } | |
2115 } | |
2116 | |
2117 PFREE(mncc_facility_ind); | |
2118 } | |
2119 | |
2120 /*==== EOF =========================================================*/ |