Send two B-channel frames when first frame is received
The size of both frames match the receive size.
This commit is contained in:
parent
de611e513d
commit
72043327b9
|
@ -21,7 +21,7 @@
|
|||
*
|
||||
* Transmit data is taken from jitter buffer.
|
||||
*
|
||||
* When data is received from b-channel the first time, two chunks of data are transmitted to ISDN interface in one block.
|
||||
* When data is received from b-channel the first time, two chunks of data are transmitted to ISDN interface.
|
||||
*
|
||||
* When more data is received from b-channel, this extra chunk is transmitted to ISDN interface.
|
||||
*
|
||||
|
@ -1615,34 +1615,36 @@ static void bchannel_rx_tx(isdn_t *isdn_ep, int index, struct mISDNhead *hh, uns
|
|||
}
|
||||
|
||||
/* prepare ISDN TX buffer */
|
||||
unsigned char buf[MISDN_HEADER_LEN + len + len];
|
||||
unsigned char buf[MISDN_HEADER_LEN + len];
|
||||
struct mISDNhead *frm = (struct mISDNhead *)buf;
|
||||
int offset;
|
||||
int rc = 0;
|
||||
frm->prim = PH_DATA_REQ;
|
||||
frm->id = 0;
|
||||
if (!call->b_transmitting) {
|
||||
PDEBUG(DISDN, DEBUG_DEBUG, "First received b-channel data, filling FIFO with double data of %d bytes.\n", len * 2);
|
||||
memset(buf + MISDN_HEADER_LEN, 0xff, len);
|
||||
offset = len;
|
||||
} else {
|
||||
// PDEBUG(DISDN, DEBUG_DEBUG, "More received b-channel data, filling FIFO with data of %d bytes.\n", len);
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
/* load from TX jitter buffer and optionally overload with tones */
|
||||
jitter_load(&call->tx_dejitter, buf + MISDN_HEADER_LEN + offset, len);
|
||||
isdn_tone_copy(&call->isdn_tone, buf + MISDN_HEADER_LEN + offset, len);
|
||||
jitter_load(&call->tx_dejitter, buf + MISDN_HEADER_LEN, len);
|
||||
isdn_tone_copy(&call->isdn_tone, buf + MISDN_HEADER_LEN, len);
|
||||
|
||||
if (!call->b_transmitting) {
|
||||
unsigned char init_buf[MISDN_HEADER_LEN + len];
|
||||
PDEBUG(DISDN, DEBUG_DEBUG, "First received b-channel data, filling FIFO with two chunks of %d bytes.\n", len);
|
||||
memcpy(init_buf, frm, MISDN_HEADER_LEN);
|
||||
memset(init_buf + MISDN_HEADER_LEN, 0xff, len);
|
||||
/* forward to interface */
|
||||
if (call->isdn_ep->ph_socket)
|
||||
ph_socket_tx_msg(call->isdn_ep->ph_socket, call->b_channel, PH_PRIM_DATA_REQ, init_buf + MISDN_HEADER_LEN, len);
|
||||
else
|
||||
rc = send(call->isdn_ep->b_sock[call->b_index].ofd.fd, init_buf, MISDN_HEADER_LEN + len, 0);
|
||||
call->b_transmitting = 1;
|
||||
}
|
||||
|
||||
/* forward to interface */
|
||||
if (call->isdn_ep->ph_socket)
|
||||
ph_socket_tx_msg(call->isdn_ep->ph_socket, call->b_channel, PH_PRIM_DATA_REQ, buf + MISDN_HEADER_LEN, offset + len);
|
||||
ph_socket_tx_msg(call->isdn_ep->ph_socket, call->b_channel, PH_PRIM_DATA_REQ, buf + MISDN_HEADER_LEN, len);
|
||||
else
|
||||
rc = send(call->isdn_ep->b_sock[call->b_index].ofd.fd, buf, MISDN_HEADER_LEN + offset + len, 0);
|
||||
rc = send(call->isdn_ep->b_sock[call->b_index].ofd.fd, buf, MISDN_HEADER_LEN + len, 0);
|
||||
if (rc < 0)
|
||||
PDEBUG(DISDN, DEBUG_ERROR, "Write error B-channel data (socket #%d errno=%d:%s)\n", call->isdn_ep->b_sock[call->b_index].ofd.fd, errno, strerror(errno));
|
||||
else
|
||||
call->b_transmitting = 1;
|
||||
}
|
||||
|
||||
/* receive confirm from bchannel */
|
||||
|
|
Loading…
Reference in New Issue