Disabled NUTAG_AUTO100, Entering PROCEEDING state after sending INVITE
[lcr.git] / mISDN.cpp
index 002f83f..ed2b4eb 100644 (file)
--- a/mISDN.cpp
+++ b/mISDN.cpp
@@ -138,6 +138,7 @@ PmISDN::PmISDN(int type, mISDNport *mISDNport, char *portname, struct port_setti
        p_m_mute = 0;
        p_m_txdata = 0;
        p_m_delay = 0;
+       p_m_tx_dejitter = 0;
        p_m_echo = 0;
        p_m_tone = 0;
        p_m_rxoff = 0;
@@ -487,6 +488,8 @@ static void _bchannel_configure(struct mISDNport *mISDNport, int i)
                ph_control(mISDNport, port, handle, (port->p_m_txdata)?DSP_TXDATA_ON:DSP_TXDATA_OFF, 0, "DSP-TXDATA", port->p_m_txdata);
        if (port->p_m_delay && mode == B_MODE_TRANSPARENT)
                ph_control(mISDNport, port, handle, DSP_DELAY, port->p_m_delay, "DSP-DELAY", port->p_m_delay);
+       if (port->p_m_tx_dejitter && mode == B_MODE_TRANSPARENT)
+               ph_control(mISDNport, port, handle, DSP_TX_DEJITTER, port->p_m_tx_dejitter, "DSP-TX_DEJITTER", port->p_m_tx_dejitter);
        if (port->p_m_tx_gain && mode == B_MODE_TRANSPARENT)
                ph_control(mISDNport, port, handle, DSP_VOL_CHANGE_TX, port->p_m_tx_gain, "DSP-TX_GAIN", port->p_m_tx_gain);
        if (port->p_m_rx_gain && mode == B_MODE_TRANSPARENT)
@@ -1447,6 +1450,9 @@ void PmISDN::bchannel_receive(struct mISDNhead *hh, unsigned char *data, int len
        if (p_m_inband_receive_on)
                inband_receive(data, len);
 
+       /* send to remote, if bridged */
+       bridge_tx(data, len);
+
        /* calls will not process any audio data unless
         * the call is connected OR tones feature is enabled.
         */
@@ -1484,9 +1490,6 @@ void PmISDN::bchannel_receive(struct mISDNhead *hh, unsigned char *data, int len
 
                cryptman_listen_bch(data, len);
        }
-
-       /* send to remote, if bridged */
-       bridge_tx(data, len);
 }
 
 
@@ -1763,6 +1766,8 @@ int PmISDN::message_epoint(unsigned int epoint_id, int message_id, union paramet
 
 void PmISDN::update_rxoff(void)
 {
+       int tx_dejitter = 0;
+
        /* call bridges in user space OR crypto OR recording */
        if (p_bridge || p_m_crypt_msg_loops || p_m_crypt_listen || p_record || p_m_inband_receive_on) {
                /* rx IS required */
@@ -1807,6 +1812,16 @@ void PmISDN::update_rxoff(void)
                                        ph_control(p_m_mISDNport, this, p_m_mISDNport->b_sock[p_m_b_index].fd, DSP_TXDATA_OFF, 0, "DSP-TXDATA", 0);
                }
        }
+       /* dejitter on bridge */
+       if (p_bridge)
+               tx_dejitter = 1;
+       if (p_m_tx_dejitter != tx_dejitter) {
+               p_m_tx_dejitter = tx_dejitter;
+               PDEBUG(DEBUG_BCHANNEL, "we change dejitter mode to delay=%d.\n", p_m_tx_dejitter);
+               if (p_m_b_index > -1)
+                       if (p_m_mISDNport->b_state[p_m_b_index] == B_STATE_ACTIVE && p_m_mISDNport->b_mode[p_m_b_index] == B_MODE_TRANSPARENT)
+                               ph_control(p_m_mISDNport, this, p_m_mISDNport->b_sock[p_m_b_index].fd, DSP_TX_DEJITTER, p_m_tx_dejitter, "DSP-TX_DEJITTER", p_m_tx_dejitter);
+       }
 }
 
 static int mISDN_upqueue(struct lcr_fd *fd, unsigned int what, void *instance, int i)
@@ -2001,7 +2016,6 @@ static int b_sock_callback(struct lcr_fd *fd, unsigned int what, void *instance,
 static int b_timer_timeout(struct lcr_timer *timer, void *instance, int i)
 {
        struct mISDNport *mISDNport = (struct mISDNport *)instance;
-puts("fires");
 
        bchannel_event(mISDNport, i, B_EVENT_TIMEOUT);
 
@@ -2103,15 +2117,6 @@ struct mISDNport *mISDNport_open(struct interface_port *ifport)
        unsigned int protocol, prop;
 
        loop = 0;
-#ifdef WITH_GSM_BS
-       loop |= ifport->gsm_bs;
-#endif
-#ifdef WITH_GSM_MS
-       loop |= ifport->gsm_ms;
-#endif
-#ifdef WITH_SIP
-       loop |= ifport->interface->sip;
-#endif
 //printf("%s == %s\n", ifport->portname, options.loopback_int);
        if (!strcmp(ifport->portname, options.loopback_lcr))
                loop = 1;
@@ -2260,12 +2265,6 @@ struct mISDNport *mISDNport_open(struct interface_port *ifport)
                mISDNport->l1link = -1;
                mISDNport->l2link = -1;
        }
-#ifdef WITH_GSM_BS
-       mISDNport->gsm_bs = ifport->gsm_bs;
-#endif
-#ifdef WITH_GSM_MS
-       mISDNport->gsm_ms = ifport->gsm_ms;
-#endif
        mISDNport->isloopback = loop;
        pmemuse++;
        *mISDNportp = mISDNport;