Bearer Capability is mandatory in CALL CONF. message, if not in SETUP.
[lcr.git] / gsm_ms.cpp
index bb2ad67..7c43232 100644 (file)
@@ -23,6 +23,8 @@ static int dtmf_timeout(struct lcr_timer *timer, void *instance, int index);
 #define DTMF_ST_STOP           3       /* DTMF stopped, waiting for resp. */
 #define DTMF_ST_SPACE          4       /* wait space between tones */
 
+#define RTP_PT_GSM_FULL                3
+
 /*
  * constructor
  */
@@ -67,7 +69,7 @@ void Pgsm_ms::setup_ind(unsigned int msg_type, unsigned int callref, struct gsm_
 {
        class Endpoint *epoint;
        struct lcr_msg *message;
-       struct gsm_mncc *mode, *proceeding, *frame;
+       struct gsm_mncc *proceeding, *frame;
        struct interface *interface;
 
        interface = getinterfacebyname(p_g_interface_name);
@@ -275,18 +277,22 @@ void Pgsm_ms::setup_ind(unsigned int msg_type, unsigned int callref, struct gsm_
        epointlist_new(epoint->ep_serial);
 
        /* modify lchan to GSM codec V1 */
-       gsm_trace_header(p_g_interface_name, this, MNCC_LCHAN_MODIFY, DIRECTION_OUT);
-       mode = create_mncc(MNCC_LCHAN_MODIFY, p_g_callref);
-       mode->lchan_mode = 0x01; /* GSM V1 */
-       mode->lchan_type = 0x02;
-       add_trace("mode", NULL, "0x%02x", mode->lchan_mode);
-       end_trace();
-       send_and_free_mncc(p_g_lcr_gsm, mode->msg_type, mode);
+       modify_lchan(RTP_PT_GSM_FULL);
 
        /* send call proceeding */
        gsm_trace_header(p_g_interface_name, this, MNCC_CALL_CONF_REQ, DIRECTION_OUT);
        proceeding = create_mncc(MNCC_CALL_CONF_REQ, p_g_callref);
-       // FIXME: bearer
+       /* bearer capability (mandatory, if not present in setup message) */
+       if (!(mncc->fields & MNCC_F_BEARER_CAP)) {
+               proceeding->fields |= MNCC_F_BEARER_CAP;
+               proceeding->bearer_cap.coding = 0;
+               proceeding->bearer_cap.radio = 1;
+               proceeding->bearer_cap.speech_ctm = 0;
+               proceeding->bearer_cap.speech_ver[0] = 0;
+               proceeding->bearer_cap.speech_ver[1] = -1; /* end of list */
+               proceeding->bearer_cap.transfer = 0;
+               proceeding->bearer_cap.mode = 0;
+       }
        /* DTMF supported */
        proceeding->fields |= MNCC_F_CCCAP;
        proceeding->cccap.dtmf = 1;
@@ -346,7 +352,7 @@ int message_ms(struct lcr_gsm *gsm_ms, int msg_type, void *arg)
        }
 
        if (msg_type == GSM_TCHF_FRAME
-        || msg_type == GSM_TCHF_BAD_FRAME) {
+        || msg_type == GSM_BAD_FRAME) {
                if (port)
                        pgsm_ms->frame_receive(arg);
                return 0;