From a04f6e025ff2b440dcca23d5909ef17d81da6941 Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Sun, 31 Mar 2013 12:52:04 +0200 Subject: [PATCH] Add essential option to enable and prefer half rate calls to mobile Without it might not be possible to use TCH/H, unless OpenBSC would support late assignment. --- default/interface.conf | 1 + gsm_bs.cpp | 15 +++++++++++++++ interface.c | 13 +++++++++++++ interface.h | 1 + 4 files changed, 30 insertions(+) diff --git a/default/interface.conf b/default/interface.conf index 698e98c..19c7a34 100644 --- a/default/interface.conf +++ b/default/interface.conf @@ -162,6 +162,7 @@ # The MSN numbers will equal the subscriber number. #[GSM] #gsm-bs +#hr #tones yes #earlyb no diff --git a/gsm_bs.cpp b/gsm_bs.cpp index e9b6be8..97be942 100644 --- a/gsm_bs.cpp +++ b/gsm_bs.cpp @@ -807,6 +807,13 @@ void Pgsm_bs::message_setup(unsigned int epoint_id, int message_id, union parame struct lcr_msg *message; struct epoint_list *epointlist; struct gsm_mncc *mncc; + struct interface *interface; + + interface = getinterfacebyname(p_interface_name); + if (!interface) { + PERROR("Cannot find interface %s.\n", p_interface_name); + return; + } /* copy setup infos to port */ memcpy(&p_callerinfo, ¶m->setup.callerinfo, sizeof(p_callerinfo)); @@ -1010,6 +1017,14 @@ void Pgsm_bs::message_setup(unsigned int epoint_id, int message_id, union parame add_trace("redir", "number", "%s", mncc->redirecting.number); } + if (interface->gsm_bs_hr) { + add_trace("lchan", "type", "TCH/H or TCH/F"); + mncc->lchan_type = GSM_LCHAN_TCH_H; + } else { + add_trace("lchan", "type", "TCH/F"); + mncc->lchan_type = GSM_LCHAN_TCH_F; + } + end_trace(); send_and_free_mncc(p_g_lcr_gsm, mncc->msg_type, mncc); diff --git a/interface.c b/interface.c index 33f0c10..d66bbe8 100644 --- a/interface.c +++ b/interface.c @@ -922,6 +922,17 @@ static int inter_gsm_bs(struct interface *interface, char *filename, int line, c return(0); #endif } +static int inter_gsm_bs_hr(struct interface *interface, char *filename, int line, char *parameter, char *value) +{ +#ifndef WITH_GSM_BS + SPRINT(interface_error, "Error in %s (line %d): GSM BS side not compiled in.\n", filename, line); + return(-1); +#else + interface->gsm_bs_hr = 1; + + return(0); +#endif +} static int inter_gsm_ms(struct interface *interface, char *filename, int line, char *parameter, char *value) { #ifndef WITH_GSM_MS @@ -1331,6 +1342,8 @@ struct interface_param interface_param[] = { ""}, {"gsm-bs", &inter_gsm_bs, "", "Sets up GSM base station interface for using OpenBSC."}, + {"hr", &inter_gsm_bs_hr, "", + "Enable and prefer half rate for mobile terminating calls."}, {"gsm-ms", &inter_gsm_ms, "", "Sets up GSM mobile station interface for using Osmocom-BB.\n" "The name of the MS folows the interface name.\n" diff --git a/interface.h b/interface.h index 1f9b4b0..a4b4baa 100644 --- a/interface.h +++ b/interface.h @@ -113,6 +113,7 @@ struct interface { char remote_context[128]; /* context feld to use for remote application */ #ifdef WITH_GSM_BS int gsm_bs; /* interface is an GSM BS interface */ + int gsm_bs_hr; /* prefer half rate for MOT calls */ #if 0 int gsm_bs_payloads; unsigned char gsm_bs_payload_types[8]; -- 2.13.6