Merge branch 'master' of git.freeswitch.org:freeswitch

This commit is contained in:
Steve Underwood 2013-03-23 22:22:05 +08:00
commit 3807dcb129
7 changed files with 68 additions and 34 deletions

View File

@ -137,6 +137,11 @@ int main(int argc, char *argv[])
}
}
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;
}
if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) "mod_sndfile", SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) {
fprintf(stderr, "Cannot init mod_sndfile [%s]\n", err);
goto end;
@ -147,11 +152,6 @@ int main(int argc, char *argv[])
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) {
fprintf(stderr, "Opening file %s\n", input);

View File

@ -940,7 +940,13 @@ SWITCH_STANDARD_APP(ring_ready_function)
SWITCH_STANDARD_APP(remove_bugs_function)
{
switch_core_media_bug_remove_all(session);
const char *function = NULL;
if (!zstr((char *)data)) {
function = data;
}
switch_core_media_bug_remove_all_function(session, function);
}
SWITCH_STANDARD_APP(break_function)
@ -5605,7 +5611,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
SWITCH_ADD_APP(app_interface, "unset", "Unset a channel variable", UNSET_LONG_DESC, unset_function, "<varname>",
SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC);
SWITCH_ADD_APP(app_interface, "ring_ready", "Indicate Ring_Ready", "Indicate Ring_Ready on a channel.", ring_ready_function, "", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "remove_bugs", "Remove media bugs", "Remove all media bugs from a channel.", remove_bugs_function, "", SAF_NONE);
SWITCH_ADD_APP(app_interface, "remove_bugs", "Remove media bugs", "Remove all media bugs from a channel.", remove_bugs_function, "[<function>]", SAF_NONE);
SWITCH_ADD_APP(app_interface, "break", "Break", "Set the break flag.", break_function, "", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "detect_speech", "Detect speech", "Detect speech on a channel.", detect_speech_function, DETECT_SPEECH_SYNTAX, SAF_NONE);
SWITCH_ADD_APP(app_interface, "play_and_detect_speech", "Play and do speech recognition", "Play and do speech recognition", play_and_detect_speech_function, PLAY_AND_DETECT_SPEECH_SYNTAX, SAF_NONE);

View File

@ -197,6 +197,11 @@ static switch_status_t nibblebill_load_config(void)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "odbc_dsn is %s\n", val);
switch_safe_free(globals.odbc_dsn);
globals.odbc_dsn = strdup(val);
} else if (!strcasecmp(var, "db_dsn") && !zstr(val)) {
/* For backwards-compatibility */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "this nibblebill param(db_dsn) is deprecated and will be removed in 1.4 - odbc_dsn is %s\n", val);
switch_safe_free(globals.odbc_dsn);
globals.odbc_dsn = strdup(val);
} else if (!strcasecmp(var, "db_table")) {
set_global_db_table(val);
} else if (!strcasecmp(var, "db_column_cash")) {

View File

@ -3869,37 +3869,31 @@ static void actual_message_query_handler(switch_event_t *event)
char *id, *domain;
dup = strdup(account);
id = dup;
if (!strncasecmp(account, "sip:", 4)) {
id += 4;
}
switch_split_user_domain(dup, &id, &domain);
if (!id) {
if (!id || !domain) {
free(dup);
return;
}
if ((domain = strchr(id, '@'))) {
*domain++ = '\0';
profile = NULL;
profile = NULL;
if (globals.message_query_exact_match) {
if ((profile = (vm_profile_t *) switch_core_hash_find(globals.profile_hash, domain))) {
parse_profile();
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
"Cound not find a profile for domain: [%s] Returning 0 messages\nWhen message-query-exact-match is enabled you must have a dedicated vm profile per distinct domain name you wish to use.\n", domain);
}
if (globals.message_query_exact_match) {
if ((profile = (vm_profile_t *) switch_core_hash_find(globals.profile_hash, domain))) {
parse_profile();
} else {
for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
profile = (vm_profile_t *) val;
parse_profile();
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
"Cound not find a profile for domain: [%s] Returning 0 messages\nWhen message-query-exact-match is enabled you must have a dedicated vm profile per distinct domain name you wish to use.\n", domain);
}
} else {
for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
profile = (vm_profile_t *) val;
parse_profile();
if (new_event) {
break;
}
if (new_event) {
break;
}
}
}

View File

@ -1541,7 +1541,11 @@ switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt, co
}
if ((p = (char *) switch_stristr("m=image ", sdp_str))) {
port_ptr = p + 8;
char *tmp = p + 8;
if (tmp && atoi(tmp)) {
port_ptr = tmp;
}
}
if ((p = (char *) switch_stristr("m=video ", sdp_str))) {

View File

@ -366,8 +366,8 @@ Dbh::~Dbh()
bool Dbh::release()
{
if (dbh) {
switch_cache_db_release_db_handle(&dbh);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DBH handle %p released.\n", (void *) dbh);
switch_cache_db_release_db_handle(&dbh);
return true;
}

View File

@ -269,6 +269,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
if (bp->ready) {
if (switch_test_flag(bp, SMBF_TAP_NATIVE_READ)) {
if ((*frame)->codec && (*frame)->codec->implementation &&
(*frame)->codec->implementation->encoded_bytes_per_packet &&
(*frame)->datalen != (*frame)->codec->implementation->encoded_bytes_per_packet) {
switch_set_flag((*frame), SFF_CNG);
break;
}
if (bp->callback) {
bp->native_read_frame = *frame;
ok = bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_TAP_NATIVE_READ);
@ -308,7 +314,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
do_resample = 0;
do_bugs = 0;
if (session->bugs && switch_test_flag(*frame, SFF_CNG)) {
if (session->bugs && switch_test_flag((*frame), SFF_CNG)) {
switch_thread_rwlock_rdlock(session->bug_rwlock);
for (bp = session->bugs; bp; bp = bp->next) {
if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) {
@ -328,12 +334,32 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
if (bp->callback) {
switch_frame_t tmp_frame = {0};
unsigned char data[SWITCH_RECOMMENDED_BUFFER_SIZE] = {0};
unsigned char g729_filler[] = {
114, 170, 250, 103, 54, 211, 203, 194, 94, 64,
229, 127, 79, 96, 207, 82, 216, 110, 245, 81,
114, 170, 250, 103, 54, 211, 203, 194, 94, 64,
229, 127, 79, 96, 207, 82, 216, 110, 245, 81,
114, 170, 250, 103, 54, 211, 203, 194, 94, 64,
229, 127, 79, 96, 207, 82, 216, 110, 245, 81,
114, 170, 250, 103, 54, 211, 203, 194, 94, 64,
229, 127, 79, 96, 207, 82, 216, 110, 245, 81,
114, 170, 250, 103, 54, 211, 203, 194, 94, 64,
229, 127, 79, 96, 207, 82, 216, 110, 245, 81,
114, 170, 250, 103, 54, 211, 203, 194, 94, 64,
229, 127, 79, 96, 207, 82, 216, 110, 245, 81,
114, 170, 250, 103, 54, 211, 203, 194, 94, 64,
229, 127, 79, 96, 207, 82, 216, 110, 245, 81
};
tmp_frame.codec = (*frame)->codec;
tmp_frame.datalen = (*frame)->codec->implementation->encoded_bytes_per_packet;
tmp_frame.samples = (*frame)->codec->implementation->samples_per_packet;
tmp_frame.data = data;
if ((*frame)->codec->implementation->ianacode == 18 || switch_stristr("g729", (*frame)->codec->implementation->iananame)) {
memcpy(tmp_frame.data, g729_filler, tmp_frame.datalen);
}
bp->native_read_frame = &tmp_frame;
ok = bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_TAP_NATIVE_READ);
bp->native_read_frame = NULL;
@ -923,7 +949,6 @@ static switch_status_t perform_write(switch_core_session_t *session, switch_fram
if (session->endpoint_interface->io_routines->write_frame) {
if ((status = session->endpoint_interface->io_routines->write_frame(session, frame, flags, stream_id)) == SWITCH_STATUS_SUCCESS) {
for (ptr = session->event_hooks.write_frame; ptr; ptr = ptr->next) {
if ((status = ptr->write_frame(session, frame, flags, stream_id)) != SWITCH_STATUS_SUCCESS) {