This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/9284 )
Change subject: use libosmocore's gsm0808_permitted_speech(), gsm0808_chosen_channel()
......................................................................
use libosmocore's gsm0808_permitted_speech(), gsm0808_chosen_channel()
The guts of bssap_speech_from_lchan() and lchan_to_chosen_channel() have been
moved to libosmocore; call those instead.
The return value of bssap_speech_from_lchan() used to be -1 on error, now the
error value is 0. The only caller did not handle -1 properly, but fed it
directly to a uint8_t.
On gsm0808_chosen_channel() error, log the error. Proper handling is missing.
Fixing the error handling in send_ass_compl() is a separate issue: currently it
is limited to logging, there is no way to return an error yet, nor any actions
to take on error.
Depends: Icca23940791f97fa64dbc3f2734270b99f9550c1 (libosmocore)
Change-Id: Ib5c940a9dae11c5e26d4b47fa9d95fef889ad2f6
---
M src/osmo-bsc/bsc_subscr_conn_fsm.c
1 file changed, 7 insertions(+), 84 deletions(-)
Approvals:
Harald Welte: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c b/src/osmo-bsc/bsc_subscr_conn_fsm.c
index 1172a78..b46eb94 100644
--- a/src/osmo-bsc/bsc_subscr_conn_fsm.c
+++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c
@@ -143,88 +143,6 @@
LOGPFSML(fi, LOGL_ERROR, "Unable to deliver SCCP message!\n");
}
-
-/* See TS 48.008 3.2.2.11 Channel Type Octet 5 */
-static int bssap_speech_from_lchan(const struct gsm_lchan *lchan)
-{
- switch (lchan->type) {
- case GSM_LCHAN_TCH_H:
- switch (lchan->tch_mode) {
- case GSM48_CMODE_SPEECH_V1:
- return 0x05;
- case GSM48_CMODE_SPEECH_AMR:
- return 0x25;
- default:
- return -1;
- }
- break;
- case GSM_LCHAN_TCH_F:
- switch (lchan->tch_mode) {
- case GSM48_CMODE_SPEECH_V1:
- return 0x01;
- case GSM48_CMODE_SPEECH_EFR:
- return 0x11;
- case GSM48_CMODE_SPEECH_AMR:
- return 0x21;
- default:
- return -1;
- }
- break;
- default:
- return -1;
- }
-}
-
-/* GSM 08.08 3.2.2.33 */
-static uint8_t lchan_to_chosen_channel(struct gsm_lchan *lchan)
-{
- uint8_t channel_mode = 0, channel = 0;
-
- switch (lchan->tch_mode) {
- case GSM48_CMODE_SPEECH_V1:
- case GSM48_CMODE_SPEECH_EFR:
- case GSM48_CMODE_SPEECH_AMR:
- channel_mode = 0x9;
- break;
- case GSM48_CMODE_SIGN:
- channel_mode = 0x8;
- break;
- case GSM48_CMODE_DATA_14k5:
- channel_mode = 0xe;
- break;
- case GSM48_CMODE_DATA_12k0:
- channel_mode = 0xb;
- break;
- case GSM48_CMODE_DATA_6k0:
- channel_mode = 0xc;
- break;
- case GSM48_CMODE_DATA_3k6:
- channel_mode = 0xd;
- break;
- }
-
- switch (lchan->type) {
- case GSM_LCHAN_NONE:
- channel = 0x0;
- break;
- case GSM_LCHAN_SDCCH:
- channel = 0x1;
- break;
- case GSM_LCHAN_TCH_F:
- channel = 0x8;
- break;
- case GSM_LCHAN_TCH_H:
- channel = 0x9;
- break;
- case GSM_LCHAN_UNKNOWN:
- default:
- LOGP(DMSC, LOGL_ERROR, "Unknown lchan type: %p\n", lchan);
- break;
- }
-
- return channel_mode << 4 | channel;
-}
-
/* Add the LCLS BSS Status IE to a BSSMAP message. We assume this is
* called on a msgb that was returned by gsm0808_create_ass_compl() */
static void bssmap_add_lcls_status(struct msgb *msg, enum gsm0808_lcls_status status)
@@ -265,6 +183,7 @@
struct gsm_subscriber_connection *conn;
struct sockaddr_storage *addr_local = NULL;
int perm_spch = 0;
+ uint8_t chosen_channel;
conn = lchan->conn;
OSMO_ASSERT(conn);
@@ -276,7 +195,7 @@
/* Generate voice related fields */
if (voice) {
- perm_spch = bssap_speech_from_lchan(lchan);
+ perm_spch = gsm0808_permitted_speech(lchan->type, lchan->tch_mode);
switch (conn->sccp.msc->a.asp_proto) {
case OSMO_SS7_ASP_PROT_IPA:
/* don't add any AoIP specific fields. CIC allocated by MSC */
@@ -293,9 +212,13 @@
/* FIXME: AMR codec configuration must be derived from lchan1! */
}
+ chosen_channel = gsm0808_chosen_channel(lchan->tch_mode, lchan->type);
+ if (!chosen_channel)
+ LOGP(DMSC, LOGL_ERROR, "Unknown lchan type or TCH mode: %s\n", gsm_lchan_name(lchan));
+
/* Generate message */
resp = gsm0808_create_ass_compl(lchan->abis_ip.ass_compl.rr_cause,
- lchan_to_chosen_channel(lchan),
+ chosen_channel,
lchan->encr.alg_id, perm_spch,
addr_local, sc_ptr, NULL);
--
To view, visit https://gerrit.osmocom.org/9284
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib5c940a9dae11c5e26d4b47fa9d95fef889ad2f6
Gerrit-Change-Number: 9284
Gerrit-PatchSet: 8
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180608/280001f2/attachment.htm>