DP-11
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16061 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
6b004d9cc6
commit
0e2fe14aa6
|
@ -74,6 +74,8 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "uuid.h"
|
||||||
|
|
||||||
/* #define DEBUG_ALLOC */
|
/* #define DEBUG_ALLOC */
|
||||||
#define DO_EVENTS
|
#define DO_EVENTS
|
||||||
|
|
||||||
|
@ -192,6 +194,7 @@ struct switch_runtime {
|
||||||
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
|
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
switch_time_t timestamp;
|
switch_time_t timestamp;
|
||||||
|
switch_mutex_t *uuid_mutex;
|
||||||
switch_mutex_t *throttle_mutex;
|
switch_mutex_t *throttle_mutex;
|
||||||
switch_mutex_t *session_hash_mutex;
|
switch_mutex_t *session_hash_mutex;
|
||||||
switch_mutex_t *global_mutex;
|
switch_mutex_t *global_mutex;
|
||||||
|
@ -212,6 +215,7 @@ struct switch_runtime {
|
||||||
char *odbc_user;
|
char *odbc_user;
|
||||||
char *odbc_pass;
|
char *odbc_pass;
|
||||||
uint32_t debug_level;
|
uint32_t debug_level;
|
||||||
|
uuid_t *uuid;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct switch_runtime runtime;
|
extern struct switch_runtime runtime;
|
||||||
|
|
|
@ -2049,6 +2049,7 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans(switch_
|
||||||
SWITCH_DECLARE(void) switch_cache_db_detach(void);
|
SWITCH_DECLARE(void) switch_cache_db_detach(void);
|
||||||
SWITCH_DECLARE(uint32_t) switch_core_debug_level(void);
|
SWITCH_DECLARE(uint32_t) switch_core_debug_level(void);
|
||||||
SWITCH_DECLARE(void) switch_cache_db_flush_handles(void);
|
SWITCH_DECLARE(void) switch_cache_db_flush_handles(void);
|
||||||
|
SWITCH_DECLARE(void) switch_core_uuid_get(switch_uuid_t *uuid);
|
||||||
|
|
||||||
SWITCH_END_EXTERN_C
|
SWITCH_END_EXTERN_C
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -883,7 +883,8 @@ SWITCH_DECLARE(void) switch_uuid_format(char *buffer, const switch_uuid_t *uuid)
|
||||||
SWITCH_DECLARE(void) switch_uuid_get(switch_uuid_t *uuid)
|
SWITCH_DECLARE(void) switch_uuid_get(switch_uuid_t *uuid)
|
||||||
{
|
{
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
apr_uuid_get((apr_uuid_t *) uuid);
|
//apr_uuid_get((apr_uuid_t *) uuid);
|
||||||
|
switch_core_uuid_get(uuid);
|
||||||
#else
|
#else
|
||||||
UuidCreate((UUID*)uuid);
|
UuidCreate((UUID*)uuid);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1166,6 +1166,22 @@ static void switch_core_set_serial(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SWITCH_DECLARE(void) switch_core_uuid_get(switch_uuid_t *uuid)
|
||||||
|
{
|
||||||
|
size_t n;
|
||||||
|
void *vp;
|
||||||
|
uuid_t *xuuid;
|
||||||
|
|
||||||
|
uuid_create(&xuuid);
|
||||||
|
|
||||||
|
switch_mutex_lock(runtime.uuid_mutex);
|
||||||
|
uuid_make(xuuid, UUID_MAKE_V4);
|
||||||
|
uuid_export(xuuid, UUID_FMT_BIN, &vp, &n);
|
||||||
|
//memcpy(xuuid, vp, n);
|
||||||
|
switch_mutex_unlock(runtime.uuid_mutex);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switch_bool_t console, const char **err)
|
SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switch_bool_t console, const char **err)
|
||||||
{
|
{
|
||||||
switch_uuid_t uuid;
|
switch_uuid_t uuid;
|
||||||
|
@ -1176,7 +1192,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
|
||||||
char hostname[256] = "";
|
char hostname[256] = "";
|
||||||
|
|
||||||
memset(&runtime, 0, sizeof(runtime));
|
memset(&runtime, 0, sizeof(runtime));
|
||||||
|
|
||||||
runtime.dummy_cng_frame.data = runtime.dummy_data;
|
runtime.dummy_cng_frame.data = runtime.dummy_data;
|
||||||
runtime.dummy_cng_frame.datalen = sizeof(runtime.dummy_data);
|
runtime.dummy_cng_frame.datalen = sizeof(runtime.dummy_data);
|
||||||
runtime.dummy_cng_frame.buflen = sizeof(runtime.dummy_data);
|
runtime.dummy_cng_frame.buflen = sizeof(runtime.dummy_data);
|
||||||
|
@ -1202,6 +1218,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
|
||||||
}
|
}
|
||||||
switch_assert(runtime.memory_pool != NULL);
|
switch_assert(runtime.memory_pool != NULL);
|
||||||
|
|
||||||
|
|
||||||
dir_path = switch_mprintf("%s%ssounds", SWITCH_GLOBAL_dirs.base_dir, SWITCH_PATH_SEPARATOR);
|
dir_path = switch_mprintf("%s%ssounds", SWITCH_GLOBAL_dirs.base_dir, SWITCH_PATH_SEPARATOR);
|
||||||
switch_dir_make_recursive(dir_path, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
|
switch_dir_make_recursive(dir_path, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
|
||||||
switch_safe_free(dir_path);
|
switch_safe_free(dir_path);
|
||||||
|
@ -1216,6 +1233,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
|
||||||
switch_dir_make_recursive(SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
|
switch_dir_make_recursive(SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
|
||||||
switch_dir_make_recursive(SWITCH_GLOBAL_dirs.temp_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
|
switch_dir_make_recursive(SWITCH_GLOBAL_dirs.temp_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
|
||||||
|
|
||||||
|
switch_mutex_init(&runtime.uuid_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool);
|
||||||
|
uuid_create(&runtime.uuid);
|
||||||
|
|
||||||
switch_mutex_init(&runtime.throttle_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool);
|
switch_mutex_init(&runtime.throttle_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool);
|
||||||
switch_mutex_init(&runtime.session_hash_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool);
|
switch_mutex_init(&runtime.session_hash_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool);
|
||||||
|
|
|
@ -198,7 +198,10 @@ static void *SWITCH_THREAD_FUNC collect_thread_run(switch_thread_t *thread, void
|
||||||
switch_input_args_t args = { 0 };
|
switch_input_args_t args = { 0 };
|
||||||
args.buf = buf;
|
args.buf = buf;
|
||||||
args.buflen = sizeof(buf);
|
args.buflen = sizeof(buf);
|
||||||
switch_ivr_play_file(collect->session, NULL, collect->file, &args);
|
if (switch_ivr_play_file(collect->session, NULL, collect->file, &args) != SWITCH_STATUS_SUCCESS) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(collect->session), SWITCH_LOG_ERROR, "%s Error Playing File!", switch_channel_get_name(channel));
|
||||||
|
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
switch_ivr_collect_digits_count(collect->session, buf, sizeof(buf), 1, SWITCH_BLANK_STRING, &term, 0, 0, 0);
|
switch_ivr_collect_digits_count(collect->session, buf, sizeof(buf), 1, SWITCH_BLANK_STRING, &term, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue