annotate mtctest/sig_handler.c @ 192:f8a33603288f

sip-manual-out: generate outgoing RTP stream with PCM silence
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 17 Mar 2023 13:45:31 -0800
parents c8e9b295e88f
children 55ad0f4bb33c
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>
159
c8e9b295e88f mtctest: add time reporting for DTMF events
Mychaela Falconia <falcon@freecalypso.org>
parents: 139
diff changeset
8 #include <sys/time.h>
21
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <sys/socket.h>
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <stdio.h>
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include <stdint.h>
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include <stdlib.h>
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 #include <string.h>
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 #include <strings.h>
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 #include "../include/mncc.h"
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 #include "../include/gsm48_const.h"
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 extern int disconnect_mode;
36
e8e82a4bf12b themwi-test-mtc: implement dummy RTP via themwi-mgw
Mychaela Falconia <falcon@freecalypso.org>
parents: 21
diff changeset
19 extern struct sockaddr_storage dummy_rtp_endp;
159
c8e9b295e88f mtctest: add time reporting for DTMF events
Mychaela Falconia <falcon@freecalypso.org>
parents: 139
diff changeset
20 extern struct timeval cur_event_time;
21
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 static void
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 print_bearer_cap(bcap)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 struct gsm_mncc_bearer_cap *bcap;
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 int i, sv;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 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
29 bcap->transfer, bcap->mode, bcap->coding, bcap->radio);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 printf(" speech: CTM=%d sv", bcap->speech_ctm);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 for (i = 0; i < 8; i++) {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 sv = bcap->speech_ver[i];
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 if (sv < 0)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 break;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 printf(" %d", sv);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 putchar('\n');
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 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
39 bcap->data.rate_adaption, bcap->data.sig_access,
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 bcap->data.async, bcap->data.nr_stop_bits,
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 bcap->data.nr_data_bits);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 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
43 bcap->data.user_rate, bcap->data.parity,
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 bcap->data.interm_rate, bcap->data.transp,
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 bcap->data.modem_type);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 static void
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 print_cc_cap(cc)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 struct gsm_mncc_cccap *cc;
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 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
53 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 static void
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 print_cause(cause)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 struct gsm_mncc_cause *cause;
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 int i;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 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
62 cause->coding, cause->value);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 if (cause->rec)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 printf(" rec=0x%02X", cause->rec_val);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 for (i = 0; i < cause->diag_len; i++) {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 if (!(i & 15)) {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 putchar('\n');
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 putchar(' ');
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 printf(" %02X", cause->diag[i] & 0xFF);
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 putchar('\n');
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 static void
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 print_progress(prog)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 struct gsm_mncc_progress *prog;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 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
80 prog->coding, prog->descr);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 static void
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 print_useruser(uu)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 struct gsm_mncc_useruser *uu;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 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
88 /* 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
89 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 static void
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 print_keypad(kp)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 int kp;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 if (kp >= '!' && kp <= '~')
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 printf("Keypad code: %c\n", kp);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 else
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 printf("Keypad code: 0x%02X\n", kp);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 static void
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 print_facility(fac)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 struct gsm_mncc_facility *fac;
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 int i;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 printf("Facility IE: %d byte(s)", fac->len);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 for (i = 0; i < fac->len; i++) {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109 if (!(i & 15)) {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 putchar('\n');
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 putchar(' ');
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 printf(" %02X", fac->info[i] & 0xFF);
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 putchar('\n');
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
118 static void
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 print_ssver(ssv)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120 struct gsm_mncc_ssversion *ssv;
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 int i;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
123
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
124 printf("SS version IE: %d byte(s)", ssv->len);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
125 for (i = 0; i < ssv->len; i++) {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126 if (!(i & 15)) {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127 putchar('\n');
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128 putchar(' ');
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 printf(" %02X", ssv->info[i] & 0xFF);
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 putchar('\n');
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
135 static void
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
136 print_fields(msg)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137 struct gsm_mncc *msg;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
138 {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139 if (msg->fields & MNCC_F_BEARER_CAP)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
140 print_bearer_cap(&msg->bearer_cap);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
141 if (msg->fields & MNCC_F_CCCAP)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
142 print_cc_cap(&msg->cccap);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143 if (msg->fields & MNCC_F_CAUSE)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144 print_cause(&msg->cause);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 if (msg->fields & MNCC_F_PROGRESS)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
146 print_progress(&msg->progress);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147 if (msg->fields & MNCC_F_USERUSER)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148 print_useruser(&msg->useruser);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
149 if (msg->more)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
150 printf("More data flag set\n");
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
151 if (msg->fields & MNCC_F_KEYPAD)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
152 print_keypad(msg->keypad);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
153 if (msg->fields & MNCC_F_FACILITY)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
154 print_facility(&msg->facility);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155 if (msg->fields & MNCC_F_SSVERSION)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
156 print_ssver(&msg->ssversion);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
157 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
158
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
159 static void
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
160 send_connect_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 struct gsm_mncc ack;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
163
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
164 printf("Sending connect ack\n");
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
165 bzero(&ack, sizeof(struct gsm_mncc));
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
166 ack.msg_type = MNCC_SETUP_COMPL_REQ;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
167 ack.callref = 1;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
168 send_mncc_to_gsm(&ack, sizeof(struct gsm_mncc));
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
169 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
170
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
171 static void
139
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
172 send_rtp_connect()
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
173 {
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
174 struct gsm_mncc_rtp rtp;
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
175
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
176 printf("Sending MNCC_RTP_CONNECT\n");
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
177 bzero(&rtp, sizeof(struct gsm_mncc_rtp));
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
178 rtp.msg_type = MNCC_RTP_CONNECT;
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
179 rtp.callref = 1;
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
180 bcopy(&dummy_rtp_endp, &rtp.addr, sizeof(struct sockaddr_storage));
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
181 send_mncc_to_gsm(&rtp, sizeof(struct gsm_mncc_rtp));
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
182 }
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
183
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
184 static void
159
c8e9b295e88f mtctest: add time reporting for DTMF events
Mychaela Falconia <falcon@freecalypso.org>
parents: 139
diff changeset
185 handle_dtmf_time()
c8e9b295e88f mtctest: add time reporting for DTMF events
Mychaela Falconia <falcon@freecalypso.org>
parents: 139
diff changeset
186 {
c8e9b295e88f mtctest: add time reporting for DTMF events
Mychaela Falconia <falcon@freecalypso.org>
parents: 139
diff changeset
187 static struct timeval last_dtmf_time;
c8e9b295e88f mtctest: add time reporting for DTMF events
Mychaela Falconia <falcon@freecalypso.org>
parents: 139
diff changeset
188 struct timeval delta;
c8e9b295e88f mtctest: add time reporting for DTMF events
Mychaela Falconia <falcon@freecalypso.org>
parents: 139
diff changeset
189 unsigned ms;
c8e9b295e88f mtctest: add time reporting for DTMF events
Mychaela Falconia <falcon@freecalypso.org>
parents: 139
diff changeset
190
c8e9b295e88f mtctest: add time reporting for DTMF events
Mychaela Falconia <falcon@freecalypso.org>
parents: 139
diff changeset
191 if (timerisset(&last_dtmf_time) &&
c8e9b295e88f mtctest: add time reporting for DTMF events
Mychaela Falconia <falcon@freecalypso.org>
parents: 139
diff changeset
192 timercmp(&cur_event_time, &last_dtmf_time, >)) {
c8e9b295e88f mtctest: add time reporting for DTMF events
Mychaela Falconia <falcon@freecalypso.org>
parents: 139
diff changeset
193 timersub(&cur_event_time, &last_dtmf_time, &delta);
c8e9b295e88f mtctest: add time reporting for DTMF events
Mychaela Falconia <falcon@freecalypso.org>
parents: 139
diff changeset
194 if (delta.tv_sec >= 2)
c8e9b295e88f mtctest: add time reporting for DTMF events
Mychaela Falconia <falcon@freecalypso.org>
parents: 139
diff changeset
195 printf("Time since last DTMF event: %u s\n",
c8e9b295e88f mtctest: add time reporting for DTMF events
Mychaela Falconia <falcon@freecalypso.org>
parents: 139
diff changeset
196 (unsigned) delta.tv_sec);
c8e9b295e88f mtctest: add time reporting for DTMF events
Mychaela Falconia <falcon@freecalypso.org>
parents: 139
diff changeset
197 else {
c8e9b295e88f mtctest: add time reporting for DTMF events
Mychaela Falconia <falcon@freecalypso.org>
parents: 139
diff changeset
198 ms = delta.tv_sec * 1000 + delta.tv_usec / 1000;
c8e9b295e88f mtctest: add time reporting for DTMF events
Mychaela Falconia <falcon@freecalypso.org>
parents: 139
diff changeset
199 printf("Time since last DTMF event: %u ms\n", ms);
c8e9b295e88f mtctest: add time reporting for DTMF events
Mychaela Falconia <falcon@freecalypso.org>
parents: 139
diff changeset
200 }
c8e9b295e88f mtctest: add time reporting for DTMF events
Mychaela Falconia <falcon@freecalypso.org>
parents: 139
diff changeset
201 }
c8e9b295e88f mtctest: add time reporting for DTMF events
Mychaela Falconia <falcon@freecalypso.org>
parents: 139
diff changeset
202 bcopy(&cur_event_time, &last_dtmf_time, sizeof(struct timeval));
c8e9b295e88f mtctest: add time reporting for DTMF events
Mychaela Falconia <falcon@freecalypso.org>
parents: 139
diff changeset
203 }
c8e9b295e88f mtctest: add time reporting for DTMF events
Mychaela Falconia <falcon@freecalypso.org>
parents: 139
diff changeset
204
c8e9b295e88f mtctest: add time reporting for DTMF events
Mychaela Falconia <falcon@freecalypso.org>
parents: 139
diff changeset
205 static void
21
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
206 handle_signaling_msg(msg, msglen)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
207 struct gsm_mncc *msg;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
208 unsigned msglen;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
209 {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
210 if (msglen != sizeof(struct gsm_mncc)) {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
211 fprintf(stderr,
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
212 "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
213 msg->msg_type);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
214 exit(1);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
215 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
216 if (msg->callref != 1) {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
217 fprintf(stderr,
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
218 "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
219 msg->msg_type, msg->callref);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
220 exit(1);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
221 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
222 switch (msg->msg_type) {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
223 case MNCC_SETUP_CNF:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
224 printf("MNCC_SETUP_CNF: call is answered\n");
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
225 print_fields(msg);
139
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
226 send_rtp_connect();
21
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
227 send_connect_ack();
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
228 return;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
229 case MNCC_CALL_CONF_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
230 printf("MNCC_CALL_CONF_IND: call is confirmed\n");
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
231 print_fields(msg);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
232 return;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
233 case MNCC_ALERT_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
234 printf("MNCC_ALERT_IND: call is alerting\n");
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
235 print_fields(msg);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
236 return;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
237 case MNCC_NOTIFY_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
238 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
239 msg->notify);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
240 return;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
241 case MNCC_DISC_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
242 printf("MNCC_DISC_IND: MS initiates disconnect\n");
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
243 print_fields(msg);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
244 disconnect_mode = 1;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
245 printf("Responding with release request\n");
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
246 msg->msg_type = MNCC_REL_REQ;
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_FACILITY_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
250 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
251 print_fields(msg);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
252 return;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
253 case MNCC_START_DTMF_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
254 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
255 print_fields(msg);
159
c8e9b295e88f mtctest: add time reporting for DTMF events
Mychaela Falconia <falcon@freecalypso.org>
parents: 139
diff changeset
256 handle_dtmf_time();
39
64b9f0f90726 themwi-test-mtc: handle DTMF from MS
Mychaela Falconia <falcon@freecalypso.org>
parents: 36
diff changeset
257 if (msg->fields & MNCC_F_KEYPAD &&
64b9f0f90726 themwi-test-mtc: handle DTMF from MS
Mychaela Falconia <falcon@freecalypso.org>
parents: 36
diff changeset
258 is_valid_dtmf_digit(msg->keypad)) {
64b9f0f90726 themwi-test-mtc: handle DTMF from MS
Mychaela Falconia <falcon@freecalypso.org>
parents: 36
diff changeset
259 printf("Responding with ACK\n");
64b9f0f90726 themwi-test-mtc: handle DTMF from MS
Mychaela Falconia <falcon@freecalypso.org>
parents: 36
diff changeset
260 msg->msg_type = MNCC_START_DTMF_RSP;
64b9f0f90726 themwi-test-mtc: handle DTMF from MS
Mychaela Falconia <falcon@freecalypso.org>
parents: 36
diff changeset
261 } else {
64b9f0f90726 themwi-test-mtc: handle DTMF from MS
Mychaela Falconia <falcon@freecalypso.org>
parents: 36
diff changeset
262 printf("Responding with Reject\n");
64b9f0f90726 themwi-test-mtc: handle DTMF from MS
Mychaela Falconia <falcon@freecalypso.org>
parents: 36
diff changeset
263 msg->msg_type = MNCC_START_DTMF_REJ;
64b9f0f90726 themwi-test-mtc: handle DTMF from MS
Mychaela Falconia <falcon@freecalypso.org>
parents: 36
diff changeset
264 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
265 GSM48_CC_CAUSE_INVAL_MAND_INF);
64b9f0f90726 themwi-test-mtc: handle DTMF from MS
Mychaela Falconia <falcon@freecalypso.org>
parents: 36
diff changeset
266 }
21
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
267 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc));
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
268 return;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
269 case MNCC_STOP_DTMF_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
270 printf("MNCC_STOP_DTMF_IND: MS sending DTMF stop\n");
159
c8e9b295e88f mtctest: add time reporting for DTMF events
Mychaela Falconia <falcon@freecalypso.org>
parents: 139
diff changeset
271 handle_dtmf_time();
21
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
272 msg->msg_type = MNCC_STOP_DTMF_RSP;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
273 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc));
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
274 return;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
275 case MNCC_MODIFY_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
276 printf("MNCC_MODIFY_IND: MS requests call modification\n");
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
277 print_fields(msg);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
278 msg->msg_type = MNCC_MODIFY_REJ;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
279 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
280 GSM48_CC_CAUSE_SERV_OPT_UNIMPL);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
281 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc));
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
282 return;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
283 case MNCC_HOLD_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
284 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
285 msg->msg_type = MNCC_HOLD_CNF;
21
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
286 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc));
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
287 return;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
288 case MNCC_RETRIEVE_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
289 printf("MNCC_RETRIEVE_IND: MS requests call retrieve\n");
139
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
290 send_rtp_connect();
138
0967f67c6ac3 mtctest: accept call hold and retrieve requests
Mychaela Falconia <falcon@freecalypso.org>
parents: 39
diff changeset
291 msg->msg_type = MNCC_RETRIEVE_CNF;
21
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
292 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc));
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
293 return;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
294 case MNCC_USERINFO_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
295 printf("MNCC_USERINFO_IND: user-user info\n");
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
296 print_fields(msg);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
297 return;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
298 case MNCC_REL_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
299 printf("MNCC_REL_IND: final release\n");
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
300 print_fields(msg);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
301 exit(0);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
302 case MNCC_REL_CNF:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
303 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
304 print_fields(msg);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
305 exit(0);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
306 case MNCC_REJ_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
307 printf("MNCC_REJ_IND: MT call rejected\n");
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
308 print_fields(msg);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
309 exit(0);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
310 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
311 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
312
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
313 static void
139
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
314 handle_rtp_msg(msg, msglen)
21
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
315 struct gsm_mncc_rtp *msg;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
316 unsigned msglen;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
317 {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
318 if (msglen != sizeof(struct gsm_mncc_rtp)) {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
319 fprintf(stderr,
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
320 "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
321 msg->msg_type);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
322 exit(1);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
323 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
324 if (msg->callref != 1) {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
325 fprintf(stderr,
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
326 "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
327 msg->msg_type, msg->callref);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
328 exit(1);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
329 }
139
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
330 switch (msg->msg_type) {
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
331 case MNCC_RTP_CREATE:
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
332 printf("MNCC_RTP_CREATE: RTP info from MSC\n");
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
333 printf("payload_type=0x%x payload_msg_type=0x%x\n",
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
334 msg->payload_type, msg->payload_msg_type);
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
335 return;
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
336 case MNCC_RTP_CONNECT:
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
337 printf("MNCC_RTP_CONNECT: error response\n");
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
338 return;
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
339 case MNCC_RTP_FREE:
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
340 printf("MNCC_RTP_FREE: bogon\n");
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
341 return;
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
342 }
21
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
343 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
344
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
345 void
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
346 msg_from_mncc(msg, msglen)
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
347 union mncc_msg *msg;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
348 unsigned msglen;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
349 {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
350 switch (msg->msg_type) {
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
351 case MNCC_SETUP_CNF:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
352 case MNCC_CALL_CONF_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
353 case MNCC_ALERT_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
354 case MNCC_NOTIFY_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
355 case MNCC_DISC_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
356 case MNCC_FACILITY_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
357 case MNCC_START_DTMF_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
358 case MNCC_STOP_DTMF_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
359 case MNCC_MODIFY_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
360 case MNCC_HOLD_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
361 case MNCC_RETRIEVE_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
362 case MNCC_USERINFO_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
363 case MNCC_REL_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
364 case MNCC_REL_CNF:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
365 case MNCC_REJ_IND:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
366 handle_signaling_msg(msg, msglen);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
367 return;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
368 case MNCC_RTP_CREATE:
139
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
369 case MNCC_RTP_CONNECT:
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
370 case MNCC_RTP_FREE:
c731ec342ba0 mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
371 handle_rtp_msg(msg, msglen);
21
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
372 return;
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
373 default:
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
374 fprintf(stderr,
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
375 "error: received unexpected MNCC message type 0x%x\n",
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
376 msg->msg_type);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
377 exit(1);
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
378 }
cc0e1c6e33c3 themwi-test-mtc utility written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
379 }