annotate mncc/call_setup.c @ 267:81958b35f74d

NANP validation: allow made-up area codes of N9X form
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 13 Nov 2023 15:28:09 -0800
parents 59a166c50d0e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * In this module we implement setup of new calls: either new MO calls
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * coming from GSM or new MT calls coming from a ThemWi call socket.
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <sys/types.h>
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <sys/socket.h>
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <stdio.h>
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <stdint.h>
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <stdlib.h>
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include <string.h>
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include <strings.h>
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 #include <syslog.h>
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 #include "../include/mncc.h"
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 #include "../include/gsm48_const.h"
243
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
16 #include "../include/number_db_v2.h"
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
17 #include "../libnumdb2/lookup_func.h"
15
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 #include "struct.h"
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 #include "gsm_call.h"
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 preen_msc_provided_number(nums)
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 struct gsm_mncc_number *nums;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 {
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 int len;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 len = grok_number_string(nums->number, 0);
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 switch (len) {
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 case 4:
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 nums->type = GSM48_TON_NET_SPEC;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 nums->plan = GSM48_NPI_PRIVATE;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 break;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 case 11:
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 if (nums->number[0] != '1')
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 return(0);
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 nums->type = GSM48_TON_INTERNATIONAL;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 nums->plan = GSM48_NPI_ISDN_E164;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 break;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 default:
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 return(0);
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 }
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 nums->screen = GSM48_SCRN_NETWORK;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 return(1);
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 }
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 void
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 reject_mo_call(callref, cause_loc, cause_val)
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 uint32_t callref;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 {
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 struct gsm_mncc msg;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 bzero(&msg, sizeof(struct gsm_mncc));
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 msg.msg_type = MNCC_REJ_REQ;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 msg.callref = callref;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 mncc_set_cause(&msg, cause_loc, cause_val);
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc));
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 }
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 void
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 process_mo_call_setup(msg)
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 struct gsm_mncc *msg;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 {
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 struct gsm_call *call;
243
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
63 struct owned_number_rec *own;
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
64 struct short_number_rec *snum;
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
65 int is_nanp, is_itn, is_local;
15
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 if (preen_msc_provided_number(&msg->calling))
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 msg->fields |= MNCC_F_CALLING;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 else
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 msg->fields &= ~MNCC_F_CALLING;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 if (!(msg->fields & MNCC_F_CALLED)) {
28
660126bd5f59 themwi-mncc: fix one bug, add debug syslog output
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
72 syslog(LOG_ERR, "rejecting MO call 0x%x: no called number",
660126bd5f59 themwi-mncc: fix one bug, add debug syslog output
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
73 msg->callref);
15
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 reject_mo_call(msg->callref, GSM48_CAUSE_LOC_PRN_S_LU,
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 GSM48_CC_CAUSE_INVAL_MAND_INF);
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 return;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 }
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 call = create_gsm_call(msg->callref);
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 if (!call) {
28
660126bd5f59 themwi-mncc: fix one bug, add debug syslog output
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
80 syslog(LOG_ERR, "rejecting MO call 0x%x: no memory for call",
660126bd5f59 themwi-mncc: fix one bug, add debug syslog output
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
81 msg->callref);
15
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 reject_mo_call(msg->callref, GSM48_CAUSE_LOC_PRN_S_LU,
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 GSM48_CC_CAUSE_RESOURCE_UNAVAIL);
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 return;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 }
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 /* route based on destination address */
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 refresh_number_db();
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 is_nanp = is_itn = 0;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 switch (grok_number_string(msg->called.number, 0)) {
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 case 4:
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 if (msg->called.type != GSM48_TON_UNKNOWN &&
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 msg->called.type != GSM48_TON_NET_SPEC &&
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 msg->called.type != GSM48_TON_SHORT_CODE)
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 break;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 if (msg->called.plan != GSM48_NPI_UNKNOWN &&
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 msg->called.plan != GSM48_NPI_ISDN_E164 &&
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 msg->called.plan != GSM48_NPI_PRIVATE)
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 break;
243
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
99 snum = numdb_lookup_short(msg->called.number);
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
100 if (!snum) {
28
660126bd5f59 themwi-mncc: fix one bug, add debug syslog output
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
101 syslog(LOG_ERR,
243
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
102 "rejecting MO call 0x%x: unassigned short number",
28
660126bd5f59 themwi-mncc: fix one bug, add debug syslog output
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
103 msg->callref);
15
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104 reject_mo_call(msg->callref, GSM48_CAUSE_LOC_PRN_S_LU,
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 GSM48_CC_CAUSE_UNASSIGNED_NR);
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 call->gc_flag = 1;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 return;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 }
243
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
109 switch (snum->short_num_type) {
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
110 case SHORT_NUM_TYPE_ABBREV:
15
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 is_nanp = 1;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 msg->called.type = GSM48_TON_INTERNATIONAL;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113 msg->called.plan = GSM48_NPI_ISDN_E164;
243
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
114 sprintf(msg->called.number, "1%03u%03u%04u",
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
115 snum->fullnum_prefix[0],
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
116 snum->fullnum_prefix[1], snum->short_num);
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
117 break;
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
118 case SHORT_NUM_TYPE_ITN:
15
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 is_itn = 1;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120 msg->called.type = GSM48_TON_NET_SPEC;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121 msg->called.plan = GSM48_NPI_PRIVATE;
243
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
122 break;
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
123 case SHORT_NUM_TYPE_TEST_SINK:
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
124 syslog(LOG_ERR,
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
125 "rejecting MO call 0x%x: test sink not implemented",
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
126 msg->callref);
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
127 reject_mo_call(msg->callref, GSM48_CAUSE_LOC_PRN_S_LU,
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
128 GSM48_CC_CAUSE_DEST_OOO);
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
129 call->gc_flag = 1;
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
130 return;
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
131 default:
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
132 syslog(LOG_ERR,
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
133 "rejecting MO call 0x%x: unknown short number type 0x%02X",
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
134 msg->callref, snum->short_num_type);
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
135 reject_mo_call(msg->callref, GSM48_CAUSE_LOC_PRN_S_LU,
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
136 GSM48_CC_CAUSE_DEST_OOO);
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
137 call->gc_flag = 1;
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
138 return;
15
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139 }
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
140 break;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
141 case 10:
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
142 if (msg->called.type != GSM48_TON_UNKNOWN &&
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143 msg->called.type != GSM48_TON_NATIONAL)
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144 break;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 if (msg->called.plan != GSM48_NPI_UNKNOWN &&
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
146 msg->called.plan != GSM48_NPI_ISDN_E164 &&
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147 msg->called.plan != GSM48_NPI_NATIONAL)
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148 break;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
149 if (!is_nanp_valid_prefix(msg->called.number)) {
28
660126bd5f59 themwi-mncc: fix one bug, add debug syslog output
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
150 syslog(LOG_ERR,
660126bd5f59 themwi-mncc: fix one bug, add debug syslog output
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
151 "rejecting MO call 0x%x: invalid NANP number",
660126bd5f59 themwi-mncc: fix one bug, add debug syslog output
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
152 msg->callref);
15
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
153 reject_mo_call(msg->callref, GSM48_CAUSE_LOC_PRN_S_LU,
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
154 GSM48_CC_CAUSE_INV_NR_FORMAT);
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155 call->gc_flag = 1;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
156 return;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
157 }
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
158 is_nanp = 1;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
159 /* canonicalize to international format */
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
160 bcopy(msg->called.number, msg->called.number+1, 11);
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
161 msg->called.number[0] = '1';
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
162 msg->called.type = GSM48_TON_INTERNATIONAL;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
163 msg->called.plan = GSM48_NPI_ISDN_E164;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
164 break;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
165 case 11:
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
166 if (msg->called.type != GSM48_TON_UNKNOWN &&
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
167 msg->called.type != GSM48_TON_INTERNATIONAL)
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
168 break;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
169 if (msg->called.plan != GSM48_NPI_UNKNOWN &&
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
170 msg->called.plan != GSM48_NPI_ISDN_E164)
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
171 break;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
172 if (msg->called.number[0] != '1')
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
173 break;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
174 if (!is_nanp_valid_prefix(msg->called.number+1)) {
28
660126bd5f59 themwi-mncc: fix one bug, add debug syslog output
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
175 syslog(LOG_ERR,
660126bd5f59 themwi-mncc: fix one bug, add debug syslog output
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
176 "rejecting MO call 0x%x: invalid NANP number",
660126bd5f59 themwi-mncc: fix one bug, add debug syslog output
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
177 msg->callref);
15
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
178 reject_mo_call(msg->callref, GSM48_CAUSE_LOC_PRN_S_LU,
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
179 GSM48_CC_CAUSE_INV_NR_FORMAT);
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
180 call->gc_flag = 1;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
181 return;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
182 }
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
183 is_nanp = 1;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
184 /* canonicalize to international format */
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
185 msg->called.type = GSM48_TON_INTERNATIONAL;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
186 msg->called.plan = GSM48_NPI_ISDN_E164;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
187 break;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
188 }
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
189 is_local = is_itn;
243
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
190 if (is_nanp && (own = numdb_lookup_nanp(msg->called.number+1))) {
15
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
191 is_local = 1;
243
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
192 switch (own->usage & NUMBER_USAGE_MASK) {
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
193 case NUMBER_USAGE_TYPE_GSM_SUB:
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
194 break;
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
195 case NUMBER_USAGE_TYPE_ALIAS:
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
196 sprintf(msg->called.number, "1%03u%03u%04u",
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
197 own->remap[0], own->remap[1], own->remap[2]);
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
198 break;
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
199 default:
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
200 syslog(LOG_ERR,
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
201 "rejecting MO call 0x%x: unassigned owned NANP",
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
202 msg->callref);
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
203 reject_mo_call(msg->callref, GSM48_CAUSE_LOC_PRN_S_LU,
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
204 GSM48_CC_CAUSE_UNASSIGNED_NR);
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
205 call->gc_flag = 1;
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
206 return;
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
207 }
59a166c50d0e themwi-mncc: convert to libnumdb2
Mychaela Falconia <falcon@freecalypso.org>
parents: 167
diff changeset
208 }
15
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
209 /* weed out attempts to call yourself */
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
210 if (is_local && !strcmp(msg->calling.number, msg->called.number)) {
28
660126bd5f59 themwi-mncc: fix one bug, add debug syslog output
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
211 syslog(LOG_ERR, "rejecting MO call 0x%x: call to self",
660126bd5f59 themwi-mncc: fix one bug, add debug syslog output
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
212 msg->callref);
15
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
213 reject_mo_call(msg->callref, GSM48_CAUSE_LOC_PRN_S_LU,
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
214 GSM48_CC_CAUSE_INCOMPAT_DEST);
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
215 call->gc_flag = 1;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
216 return;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
217 }
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
218 /* actually route the call */
167
2ebad02adbe5 themwi-mncc: route outbound calls to themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents: 28
diff changeset
219 if (is_local)
15
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
220 internal_switch_mo_setup(call, msg);
167
2ebad02adbe5 themwi-mncc: route outbound calls to themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents: 28
diff changeset
221 else
2ebad02adbe5 themwi-mncc: route outbound calls to themwi-sip-out
Mychaela Falconia <falcon@freecalypso.org>
parents: 28
diff changeset
222 outbound_mo_setup(call, msg);
15
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
223 }
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
224
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
225 static void
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
226 reject_mt_call(conn, callref, cause_loc, cause_val)
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
227 struct socket_conn *conn;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
228 uint32_t callref;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
229 {
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
230 struct gsm_mncc msg;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
231
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
232 bzero(&msg, sizeof(struct gsm_mncc));
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
233 msg.msg_type = MNCC_REJ_REQ;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
234 msg.callref = callref;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
235 mncc_set_cause(&msg, cause_loc, cause_val);
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
236 mncc_signal_to_socket_nocall(conn, &msg);
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
237 }
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
238
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
239 void
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
240 process_ext_mtcall_setup(conn, msg)
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
241 struct socket_conn *conn;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
242 struct gsm_mncc *msg;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
243 {
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
244 struct gsm_call *call;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
245
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
246 if (!(msg->fields & MNCC_F_CALLED) && !msg->imsi[0]) {
28
660126bd5f59 themwi-mncc: fix one bug, add debug syslog output
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
247 syslog(LOG_ERR, "rejecting ext MT: no called number");
15
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
248 reject_mt_call(conn, msg->callref, GSM48_CAUSE_LOC_PRN_S_LU,
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
249 GSM48_CC_CAUSE_INVAL_MAND_INF);
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
250 return;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
251 }
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
252 call = create_new_mt_call();
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
253 if (!call) {
28
660126bd5f59 themwi-mncc: fix one bug, add debug syslog output
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
254 syslog(LOG_ERR, "rejecting ext MT: no memory for call");
15
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
255 reject_mt_call(conn, msg->callref, GSM48_CAUSE_LOC_PRN_S_LU,
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
256 GSM48_CC_CAUSE_RESOURCE_UNAVAIL);
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
257 return;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
258 }
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
259 call->socket = conn;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
260 call->socket_ref = msg->callref;
28
660126bd5f59 themwi-mncc: fix one bug, add debug syslog output
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
261 conn->ncalls++;
660126bd5f59 themwi-mncc: fix one bug, add debug syslog output
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
262 syslog(LOG_DEBUG, "mapped socket callref 0x%x to GSM callref 0x%x",
660126bd5f59 themwi-mncc: fix one bug, add debug syslog output
Mychaela Falconia <falcon@freecalypso.org>
parents: 27
diff changeset
263 msg->callref, call->callref);
15
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
264 /* forward to GSM MNCC interface */
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
265 msg->callref = call->callref;
27
c6572f4c31d2 themwi-mncc: fix bug in forwarding from call socket to GSM
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
266 send_mncc_to_gsm(msg, sizeof(struct gsm_mncc));
15
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
267 }
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
268
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
269 preen_connected_number(msg)
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
270 struct gsm_mncc *msg;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
271 {
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
272 if (preen_msc_provided_number(&msg->connected))
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
273 msg->fields |= MNCC_F_CONNECTED;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
274 else
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
275 msg->fields &= ~MNCC_F_CONNECTED;
ccc5ab6d8388 first version of themwi-mncc for ThemWi2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
276 }