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
7daaa65487
commit
da2abace4f
|
@ -723,18 +723,9 @@ static void bchannel_rx_tx(pstn_t *pstn, uint8_t *data, int len)
|
|||
}
|
||||
}
|
||||
|
||||
uint8_t init_data[len * 2];
|
||||
int offset = 0;
|
||||
if (!pstn->b_transmitting) {
|
||||
PDEBUG(DTEL, DEBUG_DEBUG, "First received b-channel data, filling FIFO with double data of %d bytes.\n", len * 2);
|
||||
memset(init_data, 0xff, len);
|
||||
data = init_data;
|
||||
offset = len;
|
||||
}
|
||||
|
||||
/* load from TX jitter buffer and optionally overload with tones an with caller ID */
|
||||
jitter_load(&pstn->tx_dejitter, data + offset, len);
|
||||
isdn_tone_copy(&pstn->isdn_tone, data + offset, len);
|
||||
jitter_load(&pstn->tx_dejitter, data, len);
|
||||
isdn_tone_copy(&pstn->isdn_tone, data, len);
|
||||
|
||||
switch (pstn->callerid_state) {
|
||||
case PSTN_CID_STATE_OFF:
|
||||
|
@ -766,7 +757,7 @@ static void bchannel_rx_tx(pstn_t *pstn, uint8_t *data, int len)
|
|||
g711_encode_alaw_flipped((uint8_t *)spl, rc * 2, &data_cid, &len_cid, NULL);
|
||||
else
|
||||
g711_encode_ulaw_flipped((uint8_t *)spl, rc * 2, &data_cid, &len_cid, NULL);
|
||||
memcpy(data + offset, data_cid, len_cid);
|
||||
memcpy(data, data_cid, len_cid);
|
||||
free(data_cid);
|
||||
}
|
||||
if (rc < len) {
|
||||
|
@ -798,10 +789,18 @@ static void bchannel_rx_tx(pstn_t *pstn, uint8_t *data, int len)
|
|||
break;
|
||||
}
|
||||
|
||||
/* forward to interface */
|
||||
ph_socket_tx_msg(&pstn->ph_socket, 1, PH_PRIM_DATA_REQ, data, len + offset);
|
||||
if (!pstn->b_transmitting) {
|
||||
uint8_t init_data[len];
|
||||
PDEBUG(DTEL, DEBUG_DEBUG, "First received b-channel data, sending two frames, to preload FIFO with %d extra bytes.\n", len);
|
||||
memset(init_data, 0xff, len);
|
||||
/* forward to interface */
|
||||
ph_socket_tx_msg(&pstn->ph_socket, 1, PH_PRIM_DATA_REQ, init_data, len);
|
||||
pstn->b_transmitting = 1;
|
||||
}
|
||||
|
||||
/* forward to interface */
|
||||
ph_socket_tx_msg(&pstn->ph_socket, 1, PH_PRIM_DATA_REQ, data, len);
|
||||
|
||||
pstn->b_transmitting = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue