FreeCalypso > hg > themwi-system-sw
comparison sip-in/disconnect.c @ 64:1f863c63f96b
sip-in: beginning of disconnect handling
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 18 Sep 2022 15:29:30 -0800 |
parents | |
children | 5beb51de1bae |
comparison
equal
deleted
inserted
replaced
63:e5aee661e3b2 | 64:1f863c63f96b |
---|---|
1 /* | |
2 * In this module we implement call disconnection and clearing procedures. | |
3 */ | |
4 | |
5 #include <sys/types.h> | |
6 #include <sys/socket.h> | |
7 #include <netinet/in.h> | |
8 #include <stdio.h> | |
9 #include <stdint.h> | |
10 #include <stdlib.h> | |
11 #include <string.h> | |
12 #include <strings.h> | |
13 #include <syslog.h> | |
14 #include "../include/mncc.h" | |
15 #include "../include/gsm48_const.h" | |
16 #include "call.h" | |
17 | |
18 void | |
19 disconnect_mncc(call, cause_loc, cause_val) | |
20 struct call *call; | |
21 { | |
22 struct gsm_mncc msg; | |
23 | |
24 switch (call->mncc_state) { | |
25 case MNCC_STATE_NO_EXIST: | |
26 case MNCC_STATE_DISCONNECT: | |
27 case MNCC_STATE_RELEASE: | |
28 return; | |
29 } | |
30 bzero(&msg, sizeof(struct gsm_mncc)); | |
31 msg.msg_type = MNCC_DISC_REQ; | |
32 msg.callref = call->mncc_callref; | |
33 mncc_set_cause(&msg, cause_loc, cause_val); | |
34 send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc)); | |
35 call->mncc_state = MNCC_STATE_DISCONNECT; | |
36 } | |
37 | |
38 void | |
39 disconnect_tmgw(call) | |
40 struct call *call; | |
41 { | |
42 switch (call->mgw_state) { | |
43 case MGW_STATE_NO_EXIST: | |
44 case MGW_STATE_CONNECTING: | |
45 case MGW_STATE_DELETING: | |
46 return; | |
47 case MGW_STATE_ALLOCATED: | |
48 case MGW_STATE_COMPLETE: | |
49 tmgw_send_dlcx(call); | |
50 return; | |
51 default: | |
52 syslog(LOG_CRIT, | |
53 "FATAL: invalid MGW state 0x%x in disconnect_tmgw()", | |
54 call->mgw_state); | |
55 exit(1); | |
56 } | |
57 } |