Merge branch 'master' into v1.2.stable
Conflicts: configure.in
This commit is contained in:
commit
3b607284f2
|
@ -1 +1 @@
|
|||
Fri Mar 1 15:47:13 CST 2013
|
||||
Wed Mar 6 12:57:17 CST 2013
|
||||
|
|
|
@ -303,6 +303,7 @@ int tls_init_context(tls_t *tls, tls_issues_t const *ti)
|
|||
meth = SSLv23_method();
|
||||
|
||||
tls->ctx = SSL_CTX_new((SSL_METHOD*)meth);
|
||||
SSL_CTX_sess_set_remove_cb(tls->ctx, NULL);
|
||||
}
|
||||
|
||||
if (tls->ctx == NULL) {
|
||||
|
@ -399,14 +400,14 @@ void tls_free(tls_t *tls)
|
|||
if (!tls)
|
||||
return;
|
||||
|
||||
if (tls->con != NULL)
|
||||
SSL_shutdown(tls->con);
|
||||
if (tls->con != NULL) {
|
||||
SSL_shutdown(tls->con);
|
||||
SSL_free(tls->con), tls->con = NULL;
|
||||
}
|
||||
|
||||
if (tls->ctx != NULL && tls->type != tls_slave)
|
||||
if (tls->ctx != NULL && tls->type != tls_slave) {
|
||||
SSL_CTX_free(tls->ctx);
|
||||
|
||||
if (tls->bio_con != NULL)
|
||||
BIO_free(tls->bio_con);
|
||||
}
|
||||
|
||||
su_home_unref(tls->home);
|
||||
}
|
||||
|
@ -475,7 +476,6 @@ tls_t *tls_init_secondary(tls_t *master, int sock, int accept)
|
|||
|
||||
if (tls) {
|
||||
tls->ctx = master->ctx;
|
||||
tls->type = master->type;
|
||||
tls->accept = accept ? 1 : 0;
|
||||
tls->verify_outgoing = master->verify_outgoing;
|
||||
tls->verify_incoming = master->verify_incoming;
|
||||
|
|
106
src/fs_encode.c
106
src/fs_encode.c
|
@ -64,12 +64,16 @@ int main(int argc, char *argv[])
|
|||
int rate = 8000;
|
||||
switch_file_handle_t fh_input = { 0 }, fh_output = { 0 };
|
||||
switch_codec_t codec = { 0 };
|
||||
switch_codec_t raw_codec = { 0 };
|
||||
char buf[2048];
|
||||
switch_size_t len = sizeof(buf)/2;
|
||||
switch_memory_pool_t *pool = NULL;
|
||||
int bitrate = 0;
|
||||
int blocksize;
|
||||
|
||||
int in_asis = 0;
|
||||
int out_asis = 0;
|
||||
int out_flags = SWITCH_FILE_FLAG_WRITE;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (argv[i][0] == '-') {
|
||||
switch(argv[i][1]) {
|
||||
|
@ -142,6 +146,11 @@ int main(int argc, char *argv[])
|
|||
fprintf(stderr, "Cannot init mod_native_file [%s]\n", err);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) "mod_spandsp", SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) {
|
||||
fprintf(stderr, "Cannot init mod_spandsp [%s]\n", err);
|
||||
goto end;
|
||||
}
|
||||
|
||||
switch_core_new_memory_pool(&pool);
|
||||
if (verbose) {
|
||||
|
@ -156,22 +165,53 @@ int main(int argc, char *argv[])
|
|||
if (verbose) {
|
||||
fprintf(stderr, "Opening file %s\n", output);
|
||||
}
|
||||
if (switch_core_file_open(&fh_output, output, channels, rate, SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_NATIVE, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
|
||||
if (switch_stristr(".wav", output)) {
|
||||
out_asis = 0;
|
||||
out_flags |= SWITCH_FILE_DATA_SHORT;
|
||||
} else {
|
||||
out_asis = 1;
|
||||
out_flags |= SWITCH_FILE_NATIVE;
|
||||
}
|
||||
|
||||
|
||||
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)) {
|
||||
fprintf(stderr, "Input as native file is not implemented\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
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);
|
||||
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);
|
||||
goto end;
|
||||
}
|
||||
} else {
|
||||
char *p;
|
||||
|
||||
if ((p = strchr(input, '.'))) {
|
||||
p++;
|
||||
}
|
||||
if (!p || switch_core_codec_init_with_bitrate(&codec, p, fmtp, rate, ptime, channels, bitrate, SWITCH_CODEC_FLAG_ENCODE|SWITCH_CODEC_FLAG_DECODE, NULL, pool) != SWITCH_STATUS_SUCCESS) {
|
||||
fprintf(stderr, "Couldn't initialize codec for %s@%dh@%di\n", p, rate, ptime);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (switch_core_codec_init_with_bitrate(&raw_codec, "L16", fmtp, rate, ptime, channels, bitrate, SWITCH_CODEC_FLAG_ENCODE|SWITCH_CODEC_FLAG_DECODE, NULL, pool) != SWITCH_STATUS_SUCCESS) {
|
||||
fprintf(stderr, "Couldn't initialize codec for %s@%dh@%di\n", "L16", rate, ptime);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (in_asis) {
|
||||
blocksize = len = codec.implementation->encoded_bytes_per_packet;
|
||||
} else {
|
||||
blocksize = len = (rate*ptime)/1000;
|
||||
}
|
||||
|
||||
blocksize = len = (rate*ptime)/1000;
|
||||
switch_assert(sizeof(buf) >= len * 2);
|
||||
|
||||
if (verbose) {
|
||||
|
@ -183,13 +223,34 @@ int main(int argc, char *argv[])
|
|||
uint32_t encoded_len = sizeof(buf);
|
||||
uint32_t encoded_rate = rate;
|
||||
unsigned int flags = 0;
|
||||
|
||||
if (switch_core_codec_encode(&codec, NULL, buf, len*2, rate, encode_buf, &encoded_len, &encoded_rate, &flags) != SWITCH_STATUS_SUCCESS) {
|
||||
fprintf(stderr, "Codec encoder error\n");
|
||||
goto end;
|
||||
|
||||
if (out_asis) {
|
||||
if (switch_core_codec_encode(&codec, NULL, buf, len*2, rate, encode_buf, &encoded_len, &encoded_rate, &flags) != SWITCH_STATUS_SUCCESS) {
|
||||
fprintf(stderr, "Codec encoder error\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
len = encoded_len;
|
||||
} else {
|
||||
if (!in_asis) {
|
||||
encoded_len = len;
|
||||
} else if (in_asis) {
|
||||
|
||||
switch_core_codec_decode(&codec,
|
||||
&raw_codec,
|
||||
buf,
|
||||
len,
|
||||
rate,
|
||||
encode_buf,
|
||||
&encoded_len,
|
||||
&encoded_rate,
|
||||
&flags);
|
||||
encoded_len /= 2;
|
||||
printf("WTF %ld %d %d\n", len, encoded_rate, encoded_len);
|
||||
len = encoded_len;
|
||||
}
|
||||
}
|
||||
|
||||
len = encoded_len;
|
||||
|
||||
|
||||
if (switch_core_file_write(&fh_output, encode_buf, &len) != SWITCH_STATUS_SUCCESS) {
|
||||
fprintf(stderr, "Write error\n");
|
||||
|
@ -206,9 +267,12 @@ int main(int argc, char *argv[])
|
|||
r = 0;
|
||||
|
||||
end:
|
||||
|
||||
|
||||
|
||||
switch_core_codec_destroy(&codec);
|
||||
|
||||
switch_core_codec_destroy(&raw_codec);
|
||||
|
||||
|
||||
if (fh_input.file_interface) {
|
||||
switch_core_file_close(&fh_input);
|
||||
}
|
||||
|
@ -220,7 +284,9 @@ end:
|
|||
if (pool) {
|
||||
switch_core_destroy_memory_pool(&pool);
|
||||
}
|
||||
switch_core_destroy();
|
||||
|
||||
//switch_core_destroy();
|
||||
|
||||
return r;
|
||||
usage:
|
||||
printf("Usage: %s [options] input output\n\n", argv[0]);
|
||||
|
|
|
@ -3271,14 +3271,6 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p
|
|||
switch_channel_set_variable(channel, "skip_greeting", NULL);
|
||||
switch_channel_set_variable(channel, "skip_instructions", NULL);
|
||||
|
||||
if (!(caller_id_name = switch_channel_get_variable(channel, "effective_caller_id_name"))) {
|
||||
caller_id_name = caller_profile->caller_id_name;
|
||||
}
|
||||
|
||||
if (!(caller_id_number = switch_channel_get_variable(channel, "effective_caller_id_number"))) {
|
||||
caller_id_number = caller_profile->caller_id_number;
|
||||
}
|
||||
|
||||
memset(&cbt, 0, sizeof(cbt));
|
||||
|
||||
if (id) {
|
||||
|
@ -3505,6 +3497,14 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p
|
|||
cc.noexit = 1;
|
||||
args.buf = &cc;
|
||||
|
||||
if (!(caller_id_name = switch_channel_get_variable(channel, "effective_caller_id_name"))) {
|
||||
caller_id_name = caller_profile->caller_id_name;
|
||||
}
|
||||
|
||||
if (!(caller_id_number = switch_channel_get_variable(channel, "effective_caller_id_number"))) {
|
||||
caller_id_number = caller_profile->caller_id_number;
|
||||
}
|
||||
|
||||
switch_channel_set_variable_printf(channel, "RECORD_ARTIST", "%s (%s)", caller_id_name, caller_id_number);
|
||||
|
||||
switch_time_exp_lt(&tm, ts);
|
||||
|
|
|
@ -1758,18 +1758,18 @@ void sofia_event_callback(nua_event_t event,
|
|||
case nua_i_info:
|
||||
|
||||
if (sess_count >= sess_max || !sofia_test_pflag(profile, PFLAG_RUNNING) || !switch_core_ready_inbound()) {
|
||||
nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END());
|
||||
nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), NUTAG_WITH_THIS(nua), TAG_END());
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
if (switch_queue_size(mod_sofia_globals.msg_queue) > critical) {
|
||||
nua_respond(nh, 503, "System Busy", SIPTAG_RETRY_AFTER_STR("300"), TAG_END());
|
||||
nua_respond(nh, 503, "System Busy", SIPTAG_RETRY_AFTER_STR("300"), NUTAG_WITH_THIS(nua), TAG_END());
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (sofia_test_pflag(profile, PFLAG_STANDBY)) {
|
||||
nua_respond(nh, 503, "System Paused", TAG_END());
|
||||
nua_respond(nh, 503, "System Paused", NUTAG_WITH_THIS(nua), TAG_END());
|
||||
goto end;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -6467,7 +6467,8 @@ void sofia_glue_actually_execute_sql_trans(sofia_profile_t *profile, char *sql,
|
|||
|
||||
if (!(dbh = sofia_glue_get_db_handle(profile))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n");
|
||||
return;
|
||||
|
||||
goto end;
|
||||
}
|
||||
|
||||
switch_cache_db_persistant_execute_trans_full(dbh, sql, 1,
|
||||
|
@ -6479,6 +6480,8 @@ void sofia_glue_actually_execute_sql_trans(sofia_profile_t *profile, char *sql,
|
|||
|
||||
switch_cache_db_release_db_handle(&dbh);
|
||||
|
||||
end:
|
||||
|
||||
if (mutex) {
|
||||
switch_mutex_unlock(mutex);
|
||||
}
|
||||
|
@ -6495,6 +6498,11 @@ void sofia_glue_actually_execute_sql(sofia_profile_t *profile, char *sql, switch
|
|||
|
||||
if (!(dbh = sofia_glue_get_db_handle(profile))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n");
|
||||
|
||||
if (mutex) {
|
||||
switch_mutex_unlock(mutex);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -6525,6 +6533,11 @@ switch_bool_t sofia_glue_execute_sql_callback(sofia_profile_t *profile,
|
|||
|
||||
if (!(dbh = sofia_glue_get_db_handle(profile))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n");
|
||||
|
||||
if (mutex) {
|
||||
switch_mutex_unlock(mutex);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -6559,6 +6572,11 @@ char *sofia_glue_execute_sql2str(sofia_profile_t *profile, switch_mutex_t *mutex
|
|||
|
||||
if (!(dbh = sofia_glue_get_db_handle(profile))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n");
|
||||
|
||||
if (mutex) {
|
||||
switch_mutex_unlock(mutex);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue