Merge branch 'master' into v1.4

This commit is contained in:
Ken Rice 2014-10-10 14:35:00 -05:00
commit d18c45a5fd
4 changed files with 57 additions and 17 deletions

View File

@ -175,15 +175,6 @@ int main(int argc, char *argv[])
}
if (switch_core_file_open(&fh_output, output, channels, rate, out_flags, NULL) != SWITCH_STATUS_SUCCESS) {
fprintf(stderr, "Couldn't open %s\n", output);
goto end;
}
if (switch_test_flag(&fh_input, SWITCH_FILE_NATIVE)) {
in_asis = 1;
}
if (out_asis) {
if (switch_core_codec_init_with_bitrate(&codec, format, fmtp, rate, ptime, channels, bitrate, SWITCH_CODEC_FLAG_ENCODE, NULL, pool) != SWITCH_STATUS_SUCCESS) {
fprintf(stderr, "Couldn't initialize codec for %s@%dh@%di\n", format, rate, ptime);
@ -206,6 +197,20 @@ int main(int argc, char *argv[])
}
}
if (switch_core_file_open(&fh_output, output, channels, codec.implementation->actual_samples_per_second, out_flags, NULL) != SWITCH_STATUS_SUCCESS) {
fprintf(stderr, "Couldn't open %s\n", output);
goto end;
}
if (switch_test_flag(&fh_input, SWITCH_FILE_NATIVE)) {
in_asis = 1;
}
if (in_asis) {
blocksize = len = codec.implementation->encoded_bytes_per_packet;
} else {

View File

@ -2667,7 +2667,8 @@ switch_status_t sofia_glue_send_notify(sofia_profile_t *profile, const char *use
contact_str = profile->tcp_public_contact;
break;
case SOFIA_TRANSPORT_TCP_TLS:
contact_str = profile->tls_public_contact;
contact_str = sofia_test_pflag(profile, PFLAG_TLS) ?
profile->tls_public_contact : profile->tcp_public_contact;
break;
default:
contact_str = profile->public_url;
@ -2690,7 +2691,8 @@ switch_status_t sofia_glue_send_notify(sofia_profile_t *profile, const char *use
contact_str = profile->tcp_contact;
break;
case SOFIA_TRANSPORT_TCP_TLS:
contact_str = profile->tls_contact;
contact_str = sofia_test_pflag(profile, PFLAG_TLS) ?
profile->tls_contact : profile->tcp_contact;
break;
default:
contact_str = profile->url;

View File

@ -2227,7 +2227,8 @@ static void _send_presence_notify(sofia_profile_t *profile,
contact_str = profile->tcp_public_contact;
break;
case SOFIA_TRANSPORT_TCP_TLS:
contact_str = profile->tls_public_contact;
contact_str = sofia_test_pflag(profile, PFLAG_TLS) ?
profile->tls_public_contact : profile->tcp_public_contact;
break;
default:
contact_str = profile->public_url;
@ -2241,7 +2242,8 @@ static void _send_presence_notify(sofia_profile_t *profile,
contact_str = profile->tcp_contact;
break;
case SOFIA_TRANSPORT_TCP_TLS:
contact_str = profile->tls_contact;
contact_str = sofia_test_pflag(profile, PFLAG_TLS) ?
profile->tls_contact : profile->tcp_contact;
break;
default:
contact_str = profile->url;
@ -2687,7 +2689,8 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
contact_str = profile->tcp_public_contact;
break;
case SOFIA_TRANSPORT_TCP_TLS:
contact_str = profile->tls_public_contact;
contact_str = sofia_test_pflag(profile, PFLAG_TLS) ?
profile->tls_public_contact : profile->tcp_public_contact;
break;
default:
contact_str = profile->public_url;
@ -2706,7 +2709,8 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
contact_str = profile->tcp_contact;
break;
case SOFIA_TRANSPORT_TCP_TLS:
contact_str = profile->tls_contact;
contact_str = sofia_test_pflag(profile, PFLAG_TLS) ?
profile->tls_contact : profile->tcp_contact;
break;
default:
contact_str = profile->url;
@ -4036,9 +4040,11 @@ void sofia_presence_handle_sip_i_subscribe(int status,
}
} else if (switch_stristr("port=tls", contact->m_url->url_params)) {
if (np.is_auto_nat) {
cs = profile->tls_public_contact;
cs = sofia_test_pflag(profile, PFLAG_TLS) ?
profile->tls_public_contact : profile->tcp_public_contact;
} else {
cs = profile->tls_contact;
cs = sofia_test_pflag(profile, PFLAG_TLS) ?
profile->tls_contact : profile->tcp_contact;
}
}

View File

@ -498,6 +498,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
}
}
if (asis && read_impl.encoded_bytes_per_packet == 0) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s cannot play or record native files with variable length data\n", switch_channel_get_name(channel));
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
arg_recursion_check_stop(args);
return SWITCH_STATUS_GENERR;
}
vval = switch_channel_get_variable(channel, "enable_file_write_buffering");
if (!vval || switch_true(vval)) {
fh->pre_buffer_datalen = SWITCH_DEFAULT_FILE_BUFFER_LEN;
@ -1330,6 +1338,20 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
write_frame.codec = switch_core_session_get_read_codec(session);
samples = read_impl.samples_per_packet;
framelen = read_impl.encoded_bytes_per_packet;
if (framelen == 0) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s cannot play or record native files with variable length data\n", switch_channel_get_name(channel));
switch_core_session_io_write_lock(session);
switch_channel_set_private(channel, "__fh", NULL);
switch_core_session_io_rwunlock(session);
switch_core_file_close(fh);
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_FALSE);
status = SWITCH_STATUS_GENERR;
continue;
}
} else {
write_frame.codec = &codec;
samples = codec.implementation->samples_per_packet;
@ -1523,6 +1545,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
write_frame.codec = switch_core_session_get_read_codec(session);
samples = read_impl.samples_per_packet;
framelen = read_impl.encoded_bytes_per_packet;
if (framelen == 0) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s cannot play or record native files with variable length data\n", switch_channel_get_name(channel));
eof++;
continue;
}
} else {
write_frame.codec = &codec;
samples = codec.implementation->samples_per_packet;