FreeCalypso > hg > themwi-system-sw
comparison sip-out/shutdown.c @ 154:e54b0a9e322f
beginning of themwi-sip-out
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 11 Oct 2022 23:04:01 -0800 |
parents | sip-in/shutdown.c@c1c94b7fc2e2 |
children | baaa6c1a3d3b |
comparison
equal
deleted
inserted
replaced
153:99fd4ae573ae | 154:e54b0a9e322f |
---|---|
1 /* | |
2 * In this module we handle the scenarios of themwi-mncc and/or themwi-mgw | |
3 * shutting down while we are connected to them. In both scenarios we | |
4 * terminate all active calls (in the case of MNCC socket closing, only | |
5 * those calls that came on that socket), but our themwi-sip-out process | |
6 * itself stays running. This way once the other required processes restart, | |
7 * outbound calls will start working once again, without needing to restart | |
8 * themwi-sip-out. | |
9 */ | |
10 | |
11 #include <sys/types.h> | |
12 #include <sys/socket.h> | |
13 #include <sys/time.h> | |
14 #include <netinet/in.h> | |
15 #include <stdio.h> | |
16 #include <stdint.h> | |
17 #include <stdlib.h> | |
18 #include <string.h> | |
19 #include <strings.h> | |
20 #include <syslog.h> | |
21 #include "../include/mncc.h" | |
22 #include "../include/gsm48_const.h" | |
23 #include "../include/out_routes.h" | |
24 #include "call.h" | |
25 | |
26 extern struct call *call_list; | |
27 | |
28 void | |
29 shutdown_mncc_socket(mncc) | |
30 struct mncc_conn *mncc; | |
31 { | |
32 struct call *call; | |
33 | |
34 for (call = call_list; call; call = call->next) { | |
35 if (call->mncc != mncc) | |
36 continue; | |
37 call->mncc = 0; | |
38 if (call->overall_state < OVERALL_STATE_TEARDOWN) { | |
39 call->overall_state = OVERALL_STATE_TEARDOWN; | |
40 disconnect_tmgw(call); | |
41 disconnect_sip(call); | |
42 check_dead_call(call); | |
43 } | |
44 } | |
45 } | |
46 | |
47 void | |
48 shutdown_mgw_conn() | |
49 { | |
50 struct call *call; | |
51 | |
52 for (call = call_list; call; call = call->next) { | |
53 call->mgw_state = MGW_STATE_NO_EXIST; | |
54 call->mgw_xact = 0; | |
55 if (call->overall_state < OVERALL_STATE_TEARDOWN) { | |
56 call->overall_state = OVERALL_STATE_TEARDOWN; | |
57 disconnect_mncc(call, GSM48_CAUSE_LOC_PRN_S_LU, | |
58 GSM48_CC_CAUSE_NETWORK_OOO); | |
59 disconnect_sip(call); | |
60 check_dead_call(call); | |
61 } | |
62 } | |
63 } |