diff options
author | Harald Welte <laforge@gnumonks.org> | 2012-08-24 15:21:35 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2012-08-29 16:33:54 +0200 |
commit | bb53e3577afc3d0dde139bd6d394d37be4a1ac29 (patch) | |
tree | 00abcfaba6f75e778face68352da47683e2c75e1 /openbsc/src/libbsc/bsc_api.c | |
parent | 9fc70f365ab372ed34655afd961a19cdfe5311ed (diff) |
reimplement chan_compat_with_mode() to take care of CSD
Diffstat (limited to 'openbsc/src/libbsc/bsc_api.c')
-rw-r--r-- | openbsc/src/libbsc/bsc_api.c | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/openbsc/src/libbsc/bsc_api.c b/openbsc/src/libbsc/bsc_api.c index f660be906..e0ba6063f 100644 --- a/openbsc/src/libbsc/bsc_api.c +++ b/openbsc/src/libbsc/bsc_api.c @@ -313,19 +313,44 @@ 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, etc. This also assumes that the - * type of the lchan is either a TCH or a SDCCH. */ static int chan_compat_with_mode(struct gsm_lchan *lchan, int chan_mode, int full_rate) { - if (lchan->type == GSM_LCHAN_SDCCH) - return 0; - if (full_rate && lchan->type != GSM_LCHAN_TCH_F) - return 0; + switch (chan_mode) { + case GSM48_CMODE_SIGN: + /* signalling is always possible */ + return 1; + case GSM48_CMODE_SPEECH_V1: + case GSM48_CMODE_SPEECH_AMR: + case GSM48_CMODE_DATA_3k6: + case GSM48_CMODE_DATA_6k0: + /* these services can all run on TCH/H, but we may have + * an explicit override by the 'full_rate' argument */ + switch (lchan->type) { + case GSM_LCHAN_TCH_F: + return 1; + case GSM_LCHAN_TCH_H: + if (full_rate) + return 0; + else + return 1; + break; + default: + return 0; + } + break; + case GSM48_CMODE_DATA_12k0: + case GSM48_CMODE_DATA_14k5: + case GSM48_CMODE_SPEECH_EFR: + /* these services all explicitly require a TCH/F */ + if (lchan->type == GSM_LCHAN_TCH_F) + return 1; + else + return 0; + break; + } - return 1; + return 0; } /** |