blob: 316b71bffcb3fcafe2b1b63b35888cfe20de155d [file] [log] [blame]
Vadim Yanitskiy4019ec92018-05-29 05:36:29 +07001module SS_Templates {
2
3/* SS/USSD Facility IE templates, building on top of SS_Types.
4 *
5 * (C) 2018 by Vadim Yanitskiy <axilirator@gmail.com>
6 * All rights reserved.
7 *
8 * Released under the terms of GNU General Public License, Version 2 or
9 * (at your option) any later version.
10 */
11
12import from General_Types all;
13import from SS_Types all;
14
15/* GSM TS 04.80, section 4.5, SS operation code */
16type enumerated SS_Op_Code {
17 SS_OP_CODE_REGISTER_SS ('0A'O),
18 SS_OP_CODE_ERASE_SS ('0B'O),
19 SS_OP_CODE_ACTIVATE_SS ('0C'O),
20 SS_OP_CODE_DEACTIVATE_SS ('0D'O),
21 SS_OP_CODE_INTERROGATE_SS ('0E'O),
22 SS_OP_CODE_NOTIFY_SS ('10'O),
23 SS_OP_CODE_REGISTER_PASSWORD ('11'O),
24 SS_OP_CODE_GET_PASSWORD ('12'O),
25 SS_OP_CODE_PROCESS_USS_DATA ('13'O),
26 SS_OP_CODE_FORWARD_CHECK_SS_IND ('26'O),
27 SS_OP_CODE_PROCESS_USS_REQ ('3B'O),
28 SS_OP_CODE_USS_REQUEST ('3C'O),
29 SS_OP_CODE_USS_NOTIFY ('3D'O),
30 SS_OP_CODE_FORWARD_CUG_INFO ('78'O),
31 SS_OP_CODE_SPLIT_MPTY ('79'O),
32 SS_OP_CODE_RETRIEVE_MPTY ('7A'O),
33 SS_OP_CODE_HOLD_MPTY ('7B'O),
34 SS_OP_CODE_BUILD_MPTY ('7C'O),
35 SS_OP_CODE_FORWARD_CHARGE_ADVICE ('7D'O)
36}
37
38/* GSM TS 04.80, section 4.5, SS error code */
39type enumerated SS_Err_Code {
40 SS_ERR_CODE_UNKNOWN_SUBSCRIBER ('01'O),
41 SS_ERR_CODE_ILLEGAL_SUBSCRIBER ('09'O),
42 SS_ERR_CODE_BEARER_SERVICE_NOT_PROVISIONED ('0A'O),
43 SS_ERR_CODE_TELESERVICE_NOT_PROVISIONED ('0B'O),
44 SS_ERR_CODE_ILLEGAL_EQUIPMENT ('0C'O),
45 SS_ERR_CODE_CALL_BARRED ('0D'O),
46 SS_ERR_CODE_ILLEGAL_SS_OPERATION ('10'O),
47 SS_ERR_CODE_SS_ERROR_STATUS ('11'O),
48 SS_ERR_CODE_SS_NOT_AVAILABLE ('12'O),
49 SS_ERR_CODE_SS_SUBSCRIPTION_VIOLATION ('13'O),
50 SS_ERR_CODE_SS_INCOMPATIBILITY ('14'O),
51 SS_ERR_CODE_FACILITY_NOT_SUPPORTED ('15'O),
52 SS_ERR_CODE_ABSENT_SUBSCRIBER ('1B'O),
53 SS_ERR_CODE_SYSTEM_FAILURE ('22'O),
54 SS_ERR_CODE_DATA_MISSING ('23'O),
55 SS_ERR_CODE_UNEXPECTED_DATA_VALUE ('24'O),
56 SS_ERR_CODE_PW_REGISTRATION_FAILURE ('25'O),
57 SS_ERR_CODE_NEGATIVE_PW_CHECK ('26'O),
58 SS_ERR_CODE_NUM_PW_ATTEMPTS_VIOLATION ('2B'O),
59 SS_ERR_CODE_UNKNOWN_ALPHABET ('47'O),
60 SS_ERR_CODE_USSD_BUSY ('48'O),
61 SS_ERR_CODE_MAX_MPTY_PARTICIPANTS ('7E'O),
62 SS_ERR_CODE_RESOURCES_NOT_AVAILABLE ('7F'O)
63}
64
65/**
66 * According to GSM TS 02.90, section 4.1.1,
67 * the mobile initiated USSD request shall contain
68 * an alphabet indicator set to "SMS default alphabet"
69 * and language indicator set to "language unspecified".
70 *
71 * This DCS value is used quite often, so it makes
72 * sense to define it here as a constant.
73 */
74const octetstring SS_USSD_DEFAULT_DCS := '0F'O;
75
76template (value) SS_FacilityInformation ts_SS_USSD_FACILITY_INVOKE(
77 integer invoke_id := 1,
78 SS_Op_Code op_code := SS_OP_CODE_PROCESS_USS_REQ,
79 octetstring ussd_dcs := SS_USSD_DEFAULT_DCS,
80 octetstring ussd_string := 'AA180C3602'O // *#100#
81) := {
82 {
83 invoke := {
84 invokeId := { present_ := invoke_id },
85 linkedId := omit,
86 opcode := {
87 local := enum2int(op_code)
88 },
89 argument := {
90 uSSD_Arg := {
91 ussd_DataCodingScheme := ussd_dcs,
92 ussd_String := ussd_string,
93 alertingPattern := omit,
94 msisdn := omit
95 }
96 }
97 }
98 }
99}
100template SS_FacilityInformation tr_SS_USSD_FACILITY_INVOKE(
101 template integer invoke_id := ?,
102 template integer op_code := ?,
103 template octetstring ussd_dcs := ?,
104 template octetstring ussd_string := ?
105) := {
106 {
107 invoke := {
108 invokeId := { present_ := invoke_id },
109 linkedId := omit,
110 opcode := {
111 local := op_code
112 },
113 argument := {
114 uSSD_Arg := {
115 ussd_DataCodingScheme := ussd_dcs,
116 ussd_String := ussd_string,
117 alertingPattern := omit,
118 msisdn := omit
119 }
120 }
121 }
122 }
123}
124
125template (value) SS_FacilityInformation ts_SS_USSD_FACILITY_RETURN_RESULT(
126 integer invoke_id := 1,
127 SS_Op_Code op_code := SS_OP_CODE_PROCESS_USS_REQ,
128 octetstring ussd_dcs,
129 octetstring ussd_string
130) := {
131 {
132 returnResult := {
133 invokeId := { present_ := invoke_id },
134 result := {
135 opcode := {
136 local := enum2int(op_code)
137 },
138 result := {
139 uSSD_Res := {
140 ussd_DataCodingScheme := ussd_dcs,
141 ussd_String := ussd_string
142 }
143 }
144 }
145 }
146 }
147}
148template SS_FacilityInformation tr_SS_USSD_FACILITY_RETURN_RESULT(
149 template integer invoke_id := ?,
150 template integer op_code := ?,
151 template octetstring ussd_dcs := ?,
152 template octetstring ussd_string := ?
153) := {
154 {
155 returnResult := {
156 invokeId := { present_ := invoke_id },
157 result := {
158 opcode := {
159 local := op_code
160 },
161 result := {
162 uSSD_Res := {
163 ussd_DataCodingScheme := ussd_dcs,
164 ussd_String := ussd_string
165 }
166 }
167 }
168 }
169 }
170}
171
172/* Common for both structured and unstructured SS */
173template (value) SS_FacilityInformation ts_SS_FACILITY_RETURN_ERROR(
174 integer invoke_id := 1,
175 SS_Err_Code err_code
176) := {
177 {
178 returnError := {
179 invokeId := { present_ := invoke_id },
180 errcode := {
181 local := enum2int(err_code)
182 },
183 parameter := omit
184 }
185 }
186}
187template SS_FacilityInformation tr_SS_FACILITY_RETURN_ERROR(
188 template integer invoke_id := ?,
189 template integer err_code := ?
190) := {
191 {
192 returnError := {
193 invokeId := { present_ := invoke_id },
194 errcode := {
195 local := err_code
196 },
197 parameter := omit
198 }
199 }
200}
201
202}