uint32_t autoadj_tally;
uint16_t seq;
- uint16_t rseq;
uint8_t sending_dtmf;
switch_payload_t payload;
switch_payload_t rpayload;
rtp_session->recv_msg.header.pt = 97;
}
- rtp_session->rseq = ntohs((uint16_t) rtp_session->recv_msg.header.seq);
rtp_session->rpayload = (switch_payload_t) rtp_session->recv_msg.header.pt;
/* RFC2833 ... TBD try harder to honor the duration etc. */
rtp_session->send_msg.header.ts = htonl(rtp_session->ts);
-
if ((rtp_session->ts > (rtp_session->last_write_ts + (rtp_session->samples_per_interval * 10)))
|| rtp_session->ts == rtp_session->samples_per_interval) {
m++;
m++;
}
send_msg->header.m = m ? 1 : 0;
-
-
+
memcpy(send_msg->body, data, datalen);
bytes = datalen + rtp_header_len;
}
time_t now = switch_timestamp(NULL);
send = 0;
-
if (rtp_session->vad_data.scan_freq && rtp_session->vad_data.next_scan <= now) {
rtp_session->vad_data.bg_count = rtp_session->vad_data.bg_level = 0;
rtp_session->vad_data.next_scan = now + rtp_session->vad_data.scan_freq;
datalen,
rtp_session->vad_data.read_codec->implementation->actual_samples_per_second,
decoded, &len, &rate, &codec_flags) == SWITCH_STATUS_SUCCESS) {
-
uint32_t energy = 0;
uint32_t x, y = 0, z = len / sizeof(int16_t);
}
}
- if (rtp_session->sending_dtmf) {
- send = 0;
- }
-
this_ts = ntohl(send_msg->header.ts);
- if (!this_ts) {
+ if (rtp_session->sending_dtmf || !this_ts) {
send = 0;
}
if (send) {
- rtp_session->seq++;
- rtp_session->send_msg.header.seq = htons(rtp_session->seq);
+ send_msg->header.seq = htons(++rtp_session->seq);
if (switch_socket_sendto(rtp_session->sock, rtp_session->remote_addr, 0, (void *) send_msg, &bytes) != SWITCH_STATUS_SUCCESS) {
rtp_session->seq--;
switch_core_timer_check(&rtp_session->timer);
rtp_session->last_write_samplecount = rtp_session->timer.samplecount;
}
-
rtp_session->last_write_ts = this_ts;
}
-
if (rtp_session->ice_user) {
if (ice_out(rtp_session) != SWITCH_STATUS_SUCCESS) {
return -1;
if (switch_test_flag(frame, SFF_RTP_HEADER)) {
return switch_rtp_write_manual(rtp_session, frame->data, frame->datalen, frame->m, frame->payload,
(uint32_t)(frame->timestamp), &frame->flags);
-
}
if (fwd) {
uint8_t m, switch_payload_t payload, uint32_t ts, switch_frame_flag_t *flags)
{
switch_size_t bytes;
- uint16_t mseq;
if (!switch_rtp_ready(rtp_session)) {
return -1;
return -1;
}
- rtp_session->seq++;
- mseq = rtp_session->seq;
rtp_session->write_msg = rtp_session->send_msg;
- rtp_session->write_msg.header.seq = htons(mseq);
+ rtp_session->write_msg.header.seq = htons(++rtp_session->seq);
rtp_session->write_msg.header.ts = htonl(ts);
rtp_session->write_msg.header.pt = payload;
rtp_session->write_msg.header.m = m ? 1 : 0;
bytes = rtp_header_len + datalen;
-
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE)) {
int sbytes = (int) bytes;
err_status_t stat;
if (stat) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error: srtp protection failed with code %d\n", stat);
}
-
bytes = sbytes;
}
return -1;
}
- //rtp_session->last_write_ts = ts;
-
+ rtp_session->last_write_ts = ts;
return (int) bytes;
}