annotate mtctest/sig_handler.c @ 138:0967f67c6ac3

mtctest: accept call hold and retrieve requests
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 07 Oct 2022 16:00:26 -0800
parents 64b9f0f90726
children c731ec342ba0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 handle all incoming messages from MNCC,
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * printing all of them and generating protocol-required responses
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * for some.
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 */
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <sys/types.h>
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <sys/socket.h>
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <stdio.h>
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <stdint.h>
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include <stdlib.h>
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include <string.h>
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 #include <strings.h>
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 #include "../include/mncc.h"
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 #include "../include/gsm48_const.h"
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 extern int disconnect_mode;
36
e8e82a4bf12b themwi-test-mtc: implement dummy RTP via themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 21
diff changeset
18 extern struct sockaddr_storage dummy_rtp_endp;
21
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 static void
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 print_bearer_cap(bcap)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 struct gsm_mncc_bearer_cap *bcap;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 int i, sv;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 printf("Bearer cap: itcap=%d tmod=%d coding=%d rrq=%d\n",
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 bcap->transfer, bcap->mode, bcap->coding, bcap->radio);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 printf(" speech: CTM=%d sv", bcap->speech_ctm);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 for (i = 0; i < 8; i++) {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 sv = bcap->speech_ver[i];
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 if (sv < 0)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 break;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 printf(" %d", sv);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 putchar('\n');
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 printf(" data: ra=%d sig=%d async=%d nstop=%d ndata=%d\n",
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 bcap->data.rate_adaption, bcap->data.sig_access,
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 bcap->data.async, bcap->data.nr_stop_bits,
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 bcap->data.nr_data_bits);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 printf(" urate=%d par=%d irate=%d transp=%d mtype=%d\n",
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 bcap->data.user_rate, bcap->data.parity,
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 bcap->data.interm_rate, bcap->data.transp,
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 bcap->data.modem_type);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 static void
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 print_cc_cap(cc)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 struct gsm_mncc_cccap *cc;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 printf("CC capabilities: DTMF=%d PCP=%d\n", cc->dtmf, cc->pcp);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 static void
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 print_cause(cause)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 struct gsm_mncc_cause *cause;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 int i;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 printf("Cause: loc=%d coding=%d value=%d", cause->location,
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 cause->coding, cause->value);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 if (cause->rec)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 printf(" rec=0x%02X", cause->rec_val);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 for (i = 0; i < cause->diag_len; i++) {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 if (!(i & 15)) {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 putchar('\n');
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 putchar(' ');
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 printf(" %02X", cause->diag[i] & 0xFF);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 putchar('\n');
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 static void
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 print_progress(prog)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 struct gsm_mncc_progress *prog;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 printf("Progress: loc=%d coding=%d descr=0x%02X", prog->location,
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 prog->coding, prog->descr);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 static void
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 print_useruser(uu)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 struct gsm_mncc_useruser *uu;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 printf("User-User IE: proto=0x%02X\n", uu->proto);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 /* dump to be implemented if and when we actually get a UU somewhere */
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 static void
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 print_keypad(kp)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 int kp;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 if (kp >= '!' && kp <= '~')
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 printf("Keypad code: %c\n", kp);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 else
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 printf("Keypad code: 0x%02X\n", kp);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 static void
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100 print_facility(fac)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 struct gsm_mncc_facility *fac;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 int i;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 printf("Facility IE: %d byte(s)", fac->len);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 for (i = 0; i < fac->len; i++) {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 if (!(i & 15)) {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 putchar('\n');
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109 putchar(' ');
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 printf(" %02X", fac->info[i] & 0xFF);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113 putchar('\n');
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116 static void
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117 print_ssver(ssv)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
118 struct gsm_mncc_ssversion *ssv;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120 int i;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
122 printf("SS version IE: %d byte(s)", ssv->len);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
123 for (i = 0; i < ssv->len; i++) {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
124 if (!(i & 15)) {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
125 putchar('\n');
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126 putchar(' ');
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128 printf(" %02X", ssv->info[i] & 0xFF);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
129 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
130 putchar('\n');
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
131 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
132
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133 static void
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134 print_fields(msg)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
135 struct gsm_mncc *msg;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
136 {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137 if (msg->fields & MNCC_F_BEARER_CAP)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
138 print_bearer_cap(&msg->bearer_cap);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139 if (msg->fields & MNCC_F_CCCAP)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
140 print_cc_cap(&msg->cccap);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
141 if (msg->fields & MNCC_F_CAUSE)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
142 print_cause(&msg->cause);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143 if (msg->fields & MNCC_F_PROGRESS)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144 print_progress(&msg->progress);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 if (msg->fields & MNCC_F_USERUSER)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
146 print_useruser(&msg->useruser);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147 if (msg->more)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148 printf("More data flag set\n");
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
149 if (msg->fields & MNCC_F_KEYPAD)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
150 print_keypad(msg->keypad);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
151 if (msg->fields & MNCC_F_FACILITY)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
152 print_facility(&msg->facility);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
153 if (msg->fields & MNCC_F_SSVERSION)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
154 print_ssver(&msg->ssversion);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
156
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
157 static void
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
158 send_connect_ack()
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
159 {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
160 struct gsm_mncc ack;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
161
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
162 printf("Sending connect ack\n");
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
163 bzero(&ack, sizeof(struct gsm_mncc));
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
164 ack.msg_type = MNCC_SETUP_COMPL_REQ;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
165 ack.callref = 1;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
166 send_mncc_to_gsm(&ack, sizeof(struct gsm_mncc));
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
167 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
168
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
169 static void
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
170 handle_signaling_msg(msg, msglen)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
171 struct gsm_mncc *msg;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
172 unsigned msglen;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
173 {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
174 if (msglen != sizeof(struct gsm_mncc)) {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
175 fprintf(stderr,
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
176 "error: Rx MNCC message type 0x%x has wrong length\n",
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
177 msg->msg_type);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
178 exit(1);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
179 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
180 if (msg->callref != 1) {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
181 fprintf(stderr,
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
182 "error: Rx MNCC message type 0x%x has unexpected callref 0x%x\n",
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
183 msg->msg_type, msg->callref);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
184 exit(1);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
185 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
186 switch (msg->msg_type) {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
187 case MNCC_SETUP_CNF:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
188 printf("MNCC_SETUP_CNF: call is answered\n");
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
189 print_fields(msg);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
190 send_connect_ack();
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
191 return;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
192 case MNCC_CALL_CONF_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
193 printf("MNCC_CALL_CONF_IND: call is confirmed\n");
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
194 print_fields(msg);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
195 return;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
196 case MNCC_ALERT_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
197 printf("MNCC_ALERT_IND: call is alerting\n");
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
198 print_fields(msg);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
199 return;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
200 case MNCC_NOTIFY_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
201 printf("NNCC_NOTIFY_IND: NOTIFY byte from MS: 0x%02X\n",
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
202 msg->notify);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
203 return;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
204 case MNCC_DISC_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
205 printf("MNCC_DISC_IND: MS initiates disconnect\n");
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
206 print_fields(msg);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
207 disconnect_mode = 1;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
208 printf("Responding with release request\n");
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
209 msg->msg_type = MNCC_REL_REQ;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
210 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc));
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
211 return;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
212 case MNCC_FACILITY_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
213 printf("MNCC_FACILITY_IND: call-related SS from MS\n");
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
214 print_fields(msg);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
215 return;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
216 case MNCC_START_DTMF_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
217 printf("MNCC_START_DTMF_IND: MS sending DTMF start\n");
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
218 print_fields(msg);
39
64b9f0f90726 themwi-test-mtc: handle DTMF from MS
Mychaela Falconia <falcon@freecalypso.org>
parents: 36
diff changeset
219 if (msg->fields & MNCC_F_KEYPAD &&
64b9f0f90726 themwi-test-mtc: handle DTMF from MS
Mychaela Falconia <falcon@freecalypso.org>
parents: 36
diff changeset
220 is_valid_dtmf_digit(msg->keypad)) {
64b9f0f90726 themwi-test-mtc: handle DTMF from MS
Mychaela Falconia <falcon@freecalypso.org>
parents: 36
diff changeset
221 printf("Responding with ACK\n");
64b9f0f90726 themwi-test-mtc: handle DTMF from MS
Mychaela Falconia <falcon@freecalypso.org>
parents: 36
diff changeset
222 msg->msg_type = MNCC_START_DTMF_RSP;
64b9f0f90726 themwi-test-mtc: handle DTMF from MS
Mychaela Falconia <falcon@freecalypso.org>
parents: 36
diff changeset
223 } else {
64b9f0f90726 themwi-test-mtc: handle DTMF from MS
Mychaela Falconia <falcon@freecalypso.org>
parents: 36
diff changeset
224 printf("Responding with Reject\n");
64b9f0f90726 themwi-test-mtc: handle DTMF from MS
Mychaela Falconia <falcon@freecalypso.org>
parents: 36
diff changeset
225 msg->msg_type = MNCC_START_DTMF_REJ;
64b9f0f90726 themwi-test-mtc: handle DTMF from MS
Mychaela Falconia <falcon@freecalypso.org>
parents: 36
diff changeset
226 mncc_set_cause(msg, GSM48_CAUSE_LOC_PRN_S_LU,
64b9f0f90726 themwi-test-mtc: handle DTMF from MS
Mychaela Falconia <falcon@freecalypso.org>
parents: 36
diff changeset
227 GSM48_CC_CAUSE_INVAL_MAND_INF);
64b9f0f90726 themwi-test-mtc: handle DTMF from MS
Mychaela Falconia <falcon@freecalypso.org>
parents: 36
diff changeset
228 }
21
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
229 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc));
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
230 return;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
231 case MNCC_STOP_DTMF_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
232 printf("MNCC_STOP_DTMF_IND: MS sending DTMF stop\n");
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
233 msg->msg_type = MNCC_STOP_DTMF_RSP;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
234 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc));
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
235 return;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
236 case MNCC_MODIFY_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
237 printf("MNCC_MODIFY_IND: MS requests call modification\n");
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
238 print_fields(msg);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
239 msg->msg_type = MNCC_MODIFY_REJ;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
240 mncc_set_cause(msg, GSM48_CAUSE_LOC_PRN_S_LU,
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
241 GSM48_CC_CAUSE_SERV_OPT_UNIMPL);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
242 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc));
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
243 return;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
244 case MNCC_HOLD_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
245 printf("MNCC_HOLD_IND: MS requests call hold\n");
138
0967f67c6ac3 mtctest: accept call hold and retrieve requests
Mychaela Falconia <falcon@freecalypso.org>
parents: 39
diff changeset
246 msg->msg_type = MNCC_HOLD_CNF;
21
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
247 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc));
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
248 return;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
249 case MNCC_RETRIEVE_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
250 printf("MNCC_RETRIEVE_IND: MS requests call retrieve\n");
138
0967f67c6ac3 mtctest: accept call hold and retrieve requests
Mychaela Falconia <falcon@freecalypso.org>
parents: 39
diff changeset
251 msg->msg_type = MNCC_RETRIEVE_CNF;
21
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
252 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc));
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
253 return;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
254 case MNCC_USERINFO_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
255 printf("MNCC_USERINFO_IND: user-user info\n");
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
256 print_fields(msg);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
257 return;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
258 case MNCC_REL_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
259 printf("MNCC_REL_IND: final release\n");
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
260 print_fields(msg);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
261 exit(0);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
262 case MNCC_REL_CNF:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
263 printf("MNCC_REL_CNF: final release in response to request\n");
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
264 print_fields(msg);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
265 exit(0);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
266 case MNCC_REJ_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
267 printf("MNCC_REJ_IND: MT call rejected\n");
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
268 print_fields(msg);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
269 exit(0);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
270 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
271 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
272
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
273 static void
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
274 handle_rtp_create(msg, msglen)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
275 struct gsm_mncc_rtp *msg;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
276 unsigned msglen;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
277 {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
278 if (msglen != sizeof(struct gsm_mncc_rtp)) {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
279 fprintf(stderr,
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
280 "error: Rx MNCC message type 0x%x has wrong length\n",
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
281 msg->msg_type);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
282 exit(1);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
283 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
284 if (msg->callref != 1) {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
285 fprintf(stderr,
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
286 "error: Rx MNCC message type 0x%x has unexpected callref 0x%x\n",
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
287 msg->msg_type, msg->callref);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
288 exit(1);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
289 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
290 printf("MNCC_RTP_CREATE: RTP info from MSC\n");
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
291 printf("payload_type=0x%x payload_msg_type=0x%x\n", msg->payload_type,
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
292 msg->payload_msg_type);
36
e8e82a4bf12b themwi-test-mtc: implement dummy RTP via themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 21
diff changeset
293 printf("Responding with MNCC_RTP_CONNECT (dummy RTP endpoint)\n");
e8e82a4bf12b themwi-test-mtc: implement dummy RTP via themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 21
diff changeset
294 msg->msg_type = MNCC_RTP_CONNECT;
e8e82a4bf12b themwi-test-mtc: implement dummy RTP via themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 21
diff changeset
295 bcopy(&dummy_rtp_endp, &msg->addr, sizeof(struct sockaddr_storage));
e8e82a4bf12b themwi-test-mtc: implement dummy RTP via themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 21
diff changeset
296 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc_rtp));
21
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
297 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
298
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
299 void
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
300 msg_from_mncc(msg, msglen)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
301 union mncc_msg *msg;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
302 unsigned msglen;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
303 {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
304 switch (msg->msg_type) {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
305 case MNCC_SETUP_CNF:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
306 case MNCC_CALL_CONF_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
307 case MNCC_ALERT_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
308 case MNCC_NOTIFY_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
309 case MNCC_DISC_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
310 case MNCC_FACILITY_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
311 case MNCC_START_DTMF_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
312 case MNCC_STOP_DTMF_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
313 case MNCC_MODIFY_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
314 case MNCC_HOLD_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
315 case MNCC_RETRIEVE_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
316 case MNCC_USERINFO_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
317 case MNCC_REL_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
318 case MNCC_REL_CNF:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
319 case MNCC_REJ_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
320 handle_signaling_msg(msg, msglen);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
321 return;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
322 case MNCC_RTP_CREATE:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
323 handle_rtp_create(msg, msglen);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
324 return;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
325 default:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
326 fprintf(stderr,
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
327 "error: received unexpected MNCC message type 0x%x\n",
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
328 msg->msg_type);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
329 exit(1);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
330 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
331 }