FreeCalypso > hg > themwi-interim
comparison mtctest/setup.c @ 14:44c1d4d787e9 default tip
themwi-test-mtc: add option to set bearer cap
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 28 Nov 2024 20:37:23 +0000 |
parents | 33d8b3177540 |
children |
comparison
equal
deleted
inserted
replaced
13:c71801aa0039 | 14:44c1d4d787e9 |
---|---|
231 set_calling_number(from); | 231 set_calling_number(from); |
232 setup_msg.fields |= MNCC_F_CALLING; | 232 setup_msg.fields |= MNCC_F_CALLING; |
233 } | 233 } |
234 } | 234 } |
235 | 235 |
236 static void | |
237 bearer_cap_extras(arg) | |
238 char *arg; | |
239 { | |
240 int s = 0; | |
241 | |
242 for (;;) { | |
243 while (*arg == ',') | |
244 arg++; | |
245 if (!*arg) | |
246 return; | |
247 if (*arg >= '0' && *arg <= '5') { | |
248 if (s >= 7) { | |
249 fprintf(stderr, | |
250 "error: too many speech versions listed\n"); | |
251 exit(1); | |
252 } | |
253 setup_msg.bearer_cap.speech_ver[s++] = *arg - '0'; | |
254 setup_msg.bearer_cap.speech_ver[s] = -1; | |
255 arg++; | |
256 } else if (!strncmp(arg, "dual-fr", 7)) { | |
257 arg += 7; | |
258 setup_msg.bearer_cap.radio = GSM48_BCAP_RRQ_DUAL_FR; | |
259 } else if (!strncmp(arg, "dual-hr", 7)) { | |
260 arg += 7; | |
261 setup_msg.bearer_cap.radio = GSM48_BCAP_RRQ_DUAL_HR; | |
262 } else if (!strncmp(arg, "ctm", 3)) { | |
263 arg += 3; | |
264 setup_msg.bearer_cap.speech_ctm = 1; | |
265 } else { | |
266 inv_param: fprintf(stderr, | |
267 "error: bearer cap argument contains invalid parameter\n"); | |
268 exit(1); | |
269 } | |
270 if (!*arg) | |
271 return; | |
272 if (*arg != ',') | |
273 goto inv_param; | |
274 } | |
275 } | |
276 | |
277 void | |
278 set_bearer_cap(extra_arg) | |
279 char *extra_arg; | |
280 { | |
281 setup_msg.fields |= MNCC_F_BEARER_CAP; | |
282 setup_msg.bearer_cap.transfer = GSM48_BCAP_ITCAP_SPEECH; | |
283 setup_msg.bearer_cap.mode = GSM48_BCAP_TMOD_CIRCUIT; | |
284 setup_msg.bearer_cap.coding = GSM48_BCAP_CODING_GSM_STD; | |
285 setup_msg.bearer_cap.radio = GSM48_BCAP_RRQ_FR_ONLY; | |
286 setup_msg.bearer_cap.speech_ctm = 0; | |
287 setup_msg.bearer_cap.speech_ver[0] = -1; | |
288 if (extra_arg) | |
289 bearer_cap_extras(extra_arg); | |
290 } | |
291 | |
236 void | 292 void |
237 send_setup_msg() | 293 send_setup_msg() |
238 { | 294 { |
239 if (setup_msg.imsi[0]) | 295 if (setup_msg.imsi[0]) |
240 printf("Calling IMSI %s\n", setup_msg.imsi); | 296 printf("Calling IMSI %s\n", setup_msg.imsi); |