Add essential option to enable and prefer half rate calls to mobile
authorAndreas Eversberg <jolly@eversberg.eu>
Sun, 31 Mar 2013 10:52:04 +0000 (12:52 +0200)
committerAndreas Eversberg <jolly@eversberg.eu>
Sun, 31 Mar 2013 10:52:04 +0000 (12:52 +0200)
Without it might not be possible to use TCH/H, unless OpenBSC would
support late assignment.

default/interface.conf
gsm_bs.cpp
interface.c
interface.h

index 698e98c..19c7a34 100644 (file)
 # The MSN numbers will equal the subscriber number.
 #[GSM]
 #gsm-bs
 # The MSN numbers will equal the subscriber number.
 #[GSM]
 #gsm-bs
+#hr
 #tones yes
 #earlyb no
 
 #tones yes
 #earlyb no
 
index e9b6be8..97be942 100644 (file)
@@ -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 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, &param->setup.callerinfo, sizeof(p_callerinfo));
 
        /* copy setup infos to port */
        memcpy(&p_callerinfo, &param->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);
        }
 
                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);
 
        end_trace();
        send_and_free_mncc(p_g_lcr_gsm, mncc->msg_type, mncc);
 
index 33f0c10..d66bbe8 100644 (file)
@@ -922,6 +922,17 @@ static int inter_gsm_bs(struct interface *interface, char *filename, int line, c
        return(0);
 #endif
 }
        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
 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."},
        ""},
        {"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, "<socket>",
        "Sets up GSM mobile station interface for using Osmocom-BB.\n"
        "The name of the MS folows the interface name.\n"
        {"gsm-ms", &inter_gsm_ms, "<socket>",
        "Sets up GSM mobile station interface for using Osmocom-BB.\n"
        "The name of the MS folows the interface name.\n"
index 1f9b4b0..a4b4baa 100644 (file)
@@ -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 */
        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];
 #if 0
        int                     gsm_bs_payloads;
        unsigned char           gsm_bs_payload_types[8];