\param m set mark bit or not
\param payload the IANA payload number
\param ts then number of bytes to increment the timestamp by
- \param mseq the specific sequence number to use
\param ssrc the ssrc
\param flags frame flags
\return the number of bytes written
SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session,
void *data,
uint32_t datalen,
- uint8_t m, switch_payload_t payload, uint32_t ts, uint16_t mseq, uint32_t ssrc, switch_frame_flag_t *flags);
+ uint8_t m, switch_payload_t payload, uint32_t ts, uint32_t ssrc, switch_frame_flag_t *flags);
/*!
\brief Retrieve the SSRC from a given RTP session
for (x = 0; x < loops; x++) {
- rtp_session->seq++;
-
switch_rtp_write_manual(rtp_session,
rtp_session->dtmf_data.out_digit_packet,
4,
0,
rtp_session->te,
- rtp_session->dtmf_data.timestamp_dtmf, rtp_session->seq, rtp_session->dtmf_data.out_digit_ssrc,
+ rtp_session->dtmf_data.timestamp_dtmf, rtp_session->dtmf_data.out_digit_ssrc,
&flags);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send %s packet for [%c] ts=%d dur=%d seq=%d\n",
loops == 1 ? "middle" : "end", rtp_session->dtmf_data.out_digit, rtp_session->dtmf_data.timestamp_dtmf,
rtp_session->dtmf_data.out_digit_packet[1] = 7;
rtp_session->dtmf_data.timestamp_dtmf = rtp_session->last_write_ts + samples;
+ rtp_session->dtmf_data.out_digit_ssrc = rtp_session->last_write_ssrc;
- rtp_session->seq++;
switch_rtp_write_manual(rtp_session,
rtp_session->dtmf_data.out_digit_packet,
4,
switch_test_flag(rtp_session, SWITCH_RTP_FLAG_BUGGY_2833) ? 0 : 1,
rtp_session->te,
rtp_session->dtmf_data.timestamp_dtmf,
- rtp_session->seq,
rtp_session->dtmf_data.out_digit_ssrc, &flags);
switch_log_printf(SWITCH_CHANNEL_LOG,
if (flags && *flags & SFF_RFC2833) {
send_msg->header.pt = rtp_session->te;
}
+ rtp_session->seq++;
+ send_msg->header.seq = htons(rtp_session->seq);
} else {
uint8_t m = 0;
rtp_session->last_write_samplecount = rtp_session->timer.samplecount;
}
switch_socket_sendto(rtp_session->sock, rtp_session->remote_addr, 0, (void *) send_msg, &bytes);
- } else if (!fwd) {
+ } else {
/* nevermind save this seq inc for next time */
rtp_session->seq--;
rtp_session->send_msg.header.seq = htons(rtp_session->seq);
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->seq, frame->ssrc, &frame->flags);
+ (uint32_t)(frame->timestamp), frame->ssrc, &frame->flags);
}
if (fwd) {
SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session,
void *data,
uint32_t datalen,
- uint8_t m, switch_payload_t payload, uint32_t ts, uint16_t mseq, uint32_t ssrc, switch_frame_flag_t *flags)
+ uint8_t m, switch_payload_t payload, uint32_t ts, uint32_t ssrc, 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.ts = htonl(ts);
}
if (switch_socket_sendto(rtp_session->sock, rtp_session->remote_addr, 0, (void *) &rtp_session->write_msg, &bytes) != SWITCH_STATUS_SUCCESS) {
+ rtp_session->seq--;
return -1;
}
+
+ rtp_session->last_write_seq = rtp_session->seq;
+
return (int) bytes;
}