- while(mISDNport)
- {
- /* process all bchannels */
- i = 0;
- while(i < mISDNport->b_num)
- {
- /* process timer events for bchannel handling */
- if (mISDNport->b_timer[i])
- {
- if (mISDNport->b_timer[i] <= now_d)
- bchannel_event(mISDNport, i, B_EVENT_TIMEOUT);
- }
- /* handle port of bchannel */
- isdnport=mISDNport->b_port[i];
- if (isdnport)
- {
- /* call bridges in user space OR crypto OR recording */
- if (isdnport->p_m_joindata || isdnport->p_m_crypt_msg_loops || isdnport->p_m_crypt_listen || isdnport->p_record)
- {
- /* rx IS required */
- if (isdnport->p_m_rxoff)
- {
- /* turn on RX */
- isdnport->p_m_rxoff = 0;
- PDEBUG(DEBUG_BCHANNEL, "%s: receive data is required, so we turn them on\n", __FUNCTION__);
- if (mISDNport->b_port[i] && mISDNport->b_state[i] == B_STATE_ACTIVE)
- ph_control(mISDNport, isdnport, mISDNport->b_socket[i], DSP_RECEIVE_ON, 0, "DSP-RXOFF", 0);
- return(1);
- }
- } else
- {
- /* rx NOT required */
- if (!isdnport->p_m_rxoff)
- {
- /* turn off RX */
- isdnport->p_m_rxoff = 1;
- PDEBUG(DEBUG_BCHANNEL, "%s: receive data is not required, so we turn them off\n", __FUNCTION__);
- if (mISDNport->b_port[i] && mISDNport->b_state[i] == B_STATE_ACTIVE)
- ph_control(mISDNport, isdnport, mISDNport->b_socket[i], DSP_RECEIVE_OFF, 0, "DSP-RXOFF", 1);
- return(1);
- }
- }
- /* recording */
- if (isdnport->p_record)
- {
- /* txdata IS required */
- if (!isdnport->p_m_txdata)
- {
- /* turn on RX */
- isdnport->p_m_txdata = 1;
- PDEBUG(DEBUG_BCHANNEL, "%s: transmit data is required, so we turn them on\n", __FUNCTION__);
- if (mISDNport->b_port[i] && mISDNport->b_state[i] == B_STATE_ACTIVE)
- ph_control(mISDNport, isdnport, mISDNport->b_socket[i], DSP_TXDATA_ON, 0, "DSP-TXDATA", 1);
- return(1);