FreeCalypso > hg > themwi-system-sw
annotate mtctest/disconnect.c @ 52:ffb563a17f23
wrote sip-out-test program
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 08 Sep 2022 00:27:48 -0800 |
parents | cc0e1c6e33c3 |
children |
rev | line source |
---|---|
21
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * In this module we implement the sending of MNCC_DISC_REQ, |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * signaling a caller-requested disconnect aka hang-up. |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * It is the graceful way of signaling disconnect, |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 * as opposed to simply killing the test call process with ^C |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 * and letting themwi-mncc handle the broken socket. |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 */ |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <sys/types.h> |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <sys/socket.h> |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include <stdio.h> |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include <stdint.h> |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 #include <stdlib.h> |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 #include <string.h> |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 #include <strings.h> |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 #include "../include/mncc.h" |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 #include "../include/gsm48_const.h" |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 int disconnect_mode; |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 send_disconnect_req() |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 { |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 struct gsm_mncc msg; |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 printf("Sending disconnect request\n"); |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 bzero(&msg, sizeof(struct gsm_mncc)); |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 msg.msg_type = MNCC_DISC_REQ; |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 msg.callref = 1; |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 mncc_set_cause(&msg, GSM48_CAUSE_LOC_USER, |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 GSM48_CC_CAUSE_NORM_CALL_CLEAR); |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc)); |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 disconnect_mode = 1; |
cc0e1c6e33c3
themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 } |