FreeCalypso > hg > themwi-interim
diff 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 |
line wrap: on
line diff
--- a/mtctest/setup.c Tue Oct 29 00:06:28 2024 +0000 +++ b/mtctest/setup.c Thu Nov 28 20:37:23 2024 +0000 @@ -233,6 +233,62 @@ } } +static void +bearer_cap_extras(arg) + char *arg; +{ + int s = 0; + + for (;;) { + while (*arg == ',') + arg++; + if (!*arg) + return; + if (*arg >= '0' && *arg <= '5') { + if (s >= 7) { + fprintf(stderr, + "error: too many speech versions listed\n"); + exit(1); + } + setup_msg.bearer_cap.speech_ver[s++] = *arg - '0'; + setup_msg.bearer_cap.speech_ver[s] = -1; + arg++; + } else if (!strncmp(arg, "dual-fr", 7)) { + arg += 7; + setup_msg.bearer_cap.radio = GSM48_BCAP_RRQ_DUAL_FR; + } else if (!strncmp(arg, "dual-hr", 7)) { + arg += 7; + setup_msg.bearer_cap.radio = GSM48_BCAP_RRQ_DUAL_HR; + } else if (!strncmp(arg, "ctm", 3)) { + arg += 3; + setup_msg.bearer_cap.speech_ctm = 1; + } else { +inv_param: fprintf(stderr, + "error: bearer cap argument contains invalid parameter\n"); + exit(1); + } + if (!*arg) + return; + if (*arg != ',') + goto inv_param; + } +} + +void +set_bearer_cap(extra_arg) + char *extra_arg; +{ + setup_msg.fields |= MNCC_F_BEARER_CAP; + setup_msg.bearer_cap.transfer = GSM48_BCAP_ITCAP_SPEECH; + setup_msg.bearer_cap.mode = GSM48_BCAP_TMOD_CIRCUIT; + setup_msg.bearer_cap.coding = GSM48_BCAP_CODING_GSM_STD; + setup_msg.bearer_cap.radio = GSM48_BCAP_RRQ_FR_ONLY; + setup_msg.bearer_cap.speech_ctm = 0; + setup_msg.bearer_cap.speech_ver[0] = -1; + if (extra_arg) + bearer_cap_extras(extra_arg); +} + void send_setup_msg() {