提交 dfe5b94b authored 作者: Anthony Minessale's avatar Anthony Minessale

update

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1374 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 05441e62
差异被折叠。
...@@ -703,7 +703,6 @@ static switch_status_t channel_waitfor_write(switch_core_session_t *session, int ...@@ -703,7 +703,6 @@ static switch_status_t channel_waitfor_write(switch_core_session_t *session, int
static switch_status_t channel_send_dtmf(switch_core_session_t *session, char *dtmf) static switch_status_t channel_send_dtmf(switch_core_session_t *session, char *dtmf)
{ {
struct private_object *tech_pvt = NULL; struct private_object *tech_pvt = NULL;
char digits[80] = "";
tech_pvt = switch_core_session_get_private(session); tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL); assert(tech_pvt != NULL);
...@@ -713,7 +712,7 @@ static switch_status_t channel_send_dtmf(switch_core_session_t *session, char *d ...@@ -713,7 +712,7 @@ static switch_status_t channel_send_dtmf(switch_core_session_t *session, char *d
//ldl_handle_send_msg(tech_pvt->profile->handle, tech_pvt->recip, NULL, digits); //ldl_handle_send_msg(tech_pvt->profile->handle, tech_pvt->recip, NULL, digits);
return switch_rtp_queue_rfc2833(tech_pvt->rtp_session, return switch_rtp_queue_rfc2833(tech_pvt->rtp_session,
digits, dtmf,
100 * (tech_pvt->read_codec.implementation->samples_per_second / 1000)); 100 * (tech_pvt->read_codec.implementation->samples_per_second / 1000));
//return SWITCH_STATUS_SUCCESS; //return SWITCH_STATUS_SUCCESS;
......
...@@ -643,7 +643,7 @@ static void do_2833(switch_rtp_t *rtp_session) ...@@ -643,7 +643,7 @@ static void do_2833(switch_rtp_t *rtp_session)
if (switch_queue_trypop(rtp_session->dtmf_data.dtmf_queue, &pop) == SWITCH_STATUS_SUCCESS) { if (switch_queue_trypop(rtp_session->dtmf_data.dtmf_queue, &pop) == SWITCH_STATUS_SUCCESS) {
int x, ts; int x, ts;
struct rfc2833_digit *rdigit = pop; struct rfc2833_digit *rdigit = pop;
memset(rtp_session->dtmf_data.out_digit_packet, 0, 4); memset(rtp_session->dtmf_data.out_digit_packet, 0, 4);
rtp_session->dtmf_data.out_digit_sofar = 0; rtp_session->dtmf_data.out_digit_sofar = 0;
rtp_session->dtmf_data.out_digit_dur = rdigit->duration; rtp_session->dtmf_data.out_digit_dur = rdigit->duration;
...@@ -744,29 +744,34 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ ...@@ -744,29 +744,34 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
} }
} }
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER)) { if ((switch_time_now() - rtp_session->next_read) > 1000) {
if ((switch_time_now() - rtp_session->next_read) > 1000) { do_2833(rtp_session);
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER)) {
/* We're late! We're Late!*/ /* We're late! We're Late!*/
memset(&rtp_session->recv_msg, 0, SWITCH_RTP_CNG_PAYLOAD); memset(&rtp_session->recv_msg, 0, SWITCH_RTP_CNG_PAYLOAD);
rtp_session->recv_msg.header.pt = SWITCH_RTP_CNG_PAYLOAD; rtp_session->recv_msg.header.pt = SWITCH_RTP_CNG_PAYLOAD;
*flags |= SFF_CNG; *flags |= SFF_CNG;
/* Set the next waypoint and return a CNG frame */ /* Return a CNG frame */
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_TIMER_RECLOCK)) {
rtp_session->next_read = switch_time_now() + rtp_session->ms_per_packet;
} else {
rtp_session->next_read += rtp_session->ms_per_packet;
}
*payload_type = SWITCH_RTP_CNG_PAYLOAD; *payload_type = SWITCH_RTP_CNG_PAYLOAD;
do_2833(rtp_session);
return SWITCH_RTP_CNG_PAYLOAD; return SWITCH_RTP_CNG_PAYLOAD;
} }
if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_NOBLOCK) && status == SWITCH_STATUS_BREAK) { /* Set the next waypoint */
switch_yield(1000); if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_TIMER_RECLOCK)) {
continue; rtp_session->next_read = switch_time_now() + rtp_session->ms_per_packet;
} else {
rtp_session->next_read += rtp_session->ms_per_packet;
} }
}
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER)) {
if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_NOBLOCK) && status == SWITCH_STATUS_BREAK) {
switch_yield(1000);
continue;
}
}
}
if (status == SWITCH_STATUS_BREAK || bytes == 0) { if (status == SWITCH_STATUS_BREAK || bytes == 0) {
return 0; return 0;
} }
...@@ -1065,14 +1070,16 @@ static int rtp_common_write(switch_rtp_t *rtp_session, void *data, uint32_t data ...@@ -1065,14 +1070,16 @@ static int rtp_common_write(switch_rtp_t *rtp_session, void *data, uint32_t data
rtp_session->recv_msg.header.pt = 102; rtp_session->recv_msg.header.pt = 102;
} }
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VAD)) { if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VAD) &&
rtp_session->recv_msg.header.pt == rtp_session->vad_data.read_codec->codec_interface->ianacode &&
datalen == rtp_session->vad_data.read_codec->implementation->encoded_bytes_per_frame) {
int16_t decoded[SWITCH_RECCOMMENDED_BUFFER_SIZE/sizeof(int16_t)]; int16_t decoded[SWITCH_RECCOMMENDED_BUFFER_SIZE/sizeof(int16_t)];
uint32_t rate; uint32_t rate;
uint32_t flags; uint32_t flags;
uint32_t len = sizeof(decoded); uint32_t len = sizeof(decoded);
time_t now = time(NULL); time_t now = time(NULL);
send = 0; send = 0;
if (rtp_session->vad_data.scan_freq && rtp_session->vad_data.next_scan <= now) { 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.bg_count = rtp_session->vad_data.bg_level = 0;
rtp_session->vad_data.next_scan = now + rtp_session->vad_data.scan_freq; rtp_session->vad_data.next_scan = now + rtp_session->vad_data.scan_freq;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论