aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libbsc/bsc_api.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2012-04-07 13:25:47 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2012-05-02 20:13:42 +0200
commit249130c6b2ce253ee035908efb396643eb47a9d9 (patch)
treee18f95c8d361ac8fbf459629bda88440e3fde497 /openbsc/src/libbsc/bsc_api.c
parent8c2591d95e17eb6fa868e4d886a63ac62f3ca8af (diff)
bsc: Allow to run a mixed TCH/H, TCH/F configuration
In case the call handling starts on a TCH/H switch to a TCH/F if fullrate is requested. Add a method that is used to determine if the mode and current channel are compatible with each other.
Diffstat (limited to 'openbsc/src/libbsc/bsc_api.c')
-rw-r--r--openbsc/src/libbsc/bsc_api.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/openbsc/src/libbsc/bsc_api.c b/openbsc/src/libbsc/bsc_api.c
index db79eb6bc..72d5fbe8f 100644
--- a/openbsc/src/libbsc/bsc_api.c
+++ b/openbsc/src/libbsc/bsc_api.c
@@ -313,19 +313,37 @@ int gsm0808_submit_dtap(struct gsm_subscriber_connection *conn,
}
}
+/*
+ * \brief Check if the given channel is compatible with the mode/fullrate
+ *
+ * NOTE: This code is only written with TCH/F and TCH/H in mind. This means
+ * that it will not work for CSD, handover. This also assume that the lchan
+ * is either TCH or SDCCH.
+ */
+static int chan_compat_with_mode(struct gsm_lchan *lchan, int chan_mode, int full_rate)
+{
+ if (lchan->type == GSM_LCHAN_SDCCH)
+ return 1;
+ if (full_rate && lchan->type != GSM_LCHAN_TCH_F)
+ return 1;
+
+ return 0;
+}
+
/**
* Send a GSM08.08 Assignment Request. Right now this does not contain the
* audio codec type or the allowed rates for the config. It is assumed that
- * this is for audio handling and that when we have a TCH it is capable of
- * handling the audio codec. In case AMR is used we will leave the multi
- * rate configuration to someone else.
+ * this is for audio handling only. In case the current channel does not allow
+ * the selected mode a new one will be allocated.
+ *
+ * TODO: add multirate configuration, work for more than audio.
*/
int gsm0808_assign_req(struct gsm_subscriber_connection *conn, int chan_mode, int full_rate)
{
struct bsc_api *api;
api = conn->bts->network->bsc_api;
- if (conn->lchan->type == GSM_LCHAN_SDCCH) {
+ if (chan_compat_with_mode(conn->lchan, chan_mode, full_rate) != 0) {
if (handle_new_assignment(conn, chan_mode, full_rate) != 0)
goto error;
} else {