get uuid from apr-utils for channel events

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@190 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2005-12-22 01:57:32 +00:00
parent 98a797a2f2
commit e60fbc2267
6 changed files with 23 additions and 18 deletions

View File

@ -59,6 +59,8 @@ extern "C" {
#include <apr_strings.h>
#include <apr_network_io.h>
#include <apr_poll.h>
#include <apr_queue.h>
#include <apr_uuid.h>
#include <assert.h>
#include <sqlite3.h>

View File

@ -122,6 +122,7 @@ SWITCH_DECLARE(switch_memory_pool *) switch_core_session_get_pool(switch_core_se
SWITCH_DECLARE(void) pbx_core_session_signal_state_change(switch_core_session *session);
SWITCH_DECLARE(char *) switch_core_strdup(switch_memory_pool *pool, char *todup);
SWITCH_DECLARE(switch_core_db *) switch_core_db_open_file(char *filename);
SWITCH_DECLARE(char *) switch_core_session_get_uuid(switch_core_session *session);
#define SWITCH_CORE_DB "core"
#define switch_core_db_handle() switch_core_db_open_file(SWITCH_CORE_DB)

View File

@ -65,7 +65,7 @@ typedef enum {
#endif
#endif
#define SWITCH_UUID_FORMATTED_LENGTH APR_UUID_FORMATTED_LENGTH
#define SWITCH_CHANNEL_CONSOLE SWITCH_CHANNEL_ID_CONSOLE, __FILE__, __FUNCTION__, __LINE__
#define SWITCH_CHANNEL_CONSOLE_CLEAN SWITCH_CHANNEL_ID_CONSOLE_CLEAN, __FILE__, __FUNCTION__, __LINE__
#define SWITCH_CHANNEL_EVENT SWITCH_CHANNEL_ID_EVENT, __FILE__, __FUNCTION__, __LINE__
@ -193,6 +193,8 @@ typedef switch_status (*switch_api_function)(char *in, char *out, size_t outlen)
The pieces of apr we allow ppl to pass around between modules we typedef into our namespace and wrap all the functions
any other apr code should be as hidden as possible.
*/
typedef apr_uuid_t switch_uuid_t;
typedef apr_queue_t switch_queue_t;
typedef apr_hash_t switch_hash;
typedef apr_pool_t switch_memory_pool;
typedef apr_thread_t switch_thread;
@ -226,6 +228,9 @@ typedef apr_hash_index_t switch_hash_index_t;
#define switch_thread_cond_broadcast apr_thread_cond_broadcast
#define switch_thread_cond_destroy apr_thread_cond_destroy
#define switch_uuid_format apr_uuid_format
#define switch_uuid_get apr_uuid_get
#define switch_uuid_parse apr_uuid_parse
#define switch_queue_create apr_queue_create
#define switch_queue_interrupt_all apr_queue_interrupt_all
#define switch_queue_pop apr_queue_pop

View File

@ -65,7 +65,8 @@ SWITCH_DECLARE(switch_status) switch_channel_alloc(switch_channel **channel, swi
switch_core_hash_init(&(*channel)->variables, pool);
switch_buffer_create(pool, &(*channel)->dtmf_buffer, 128);
switch_mutex_init(&(*channel)->dtmf_mutex, SWITCH_MUTEX_NESTED, pool);
return SWITCH_STATUS_SUCCESS;
}
@ -406,6 +407,8 @@ SWITCH_DECLARE(void) switch_channel_event_set_data(switch_channel *channel, swit
switch_event_add_header(event, "channel_state", (char *) switch_channel_state_name(channel->state));
switch_event_add_header(event, "channel_name", switch_channel_get_name(channel));
switch_event_add_header(event, "unique_id", switch_core_session_get_uuid(channel->session));
/* Index Caller's Profile */
if (caller_profile) {

View File

@ -74,6 +74,7 @@ struct switch_core_session {
switch_mutex_t *mutex;
switch_thread_cond_t *cond;
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH+1];
void *private;
};
@ -179,6 +180,11 @@ SWITCH_DECLARE(switch_status) switch_core_do_perl(char *txt)
#endif
SWITCH_DECLARE(char *) switch_core_session_get_uuid(switch_core_session *session)
{
return session->uuid_str;
}
SWITCH_DECLARE(switch_status) switch_core_session_set_read_codec(switch_core_session *session, switch_codec *codec)
{
assert(session != NULL);
@ -1490,6 +1496,7 @@ SWITCH_DECLARE(switch_core_session *) switch_core_session_request(const switch_e
{
switch_memory_pool *usepool;
switch_core_session *session;
switch_uuid_t uuid;
assert(endpoint_interface != NULL);
@ -1517,6 +1524,9 @@ SWITCH_DECLARE(switch_core_session *) switch_core_session_request(const switch_e
/* The session *IS* the pool you may not alter it because you have no idea how
its all private it will be passed to the thread run function */
switch_uuid_get(&uuid);
switch_uuid_format(session->uuid_str, &uuid);
session->pool = usepool;
session->endpoint_interface = endpoint_interface;

View File

@ -60,22 +60,6 @@ static char *EVENT_NAMES[] = {
};
#if 0
static void debug_hash(void) {
switch_hash_index_t* hi;
void *val;
const void *var;
for (hi = switch_hash_first(EPOOL, CUSTOM_HASH); hi; hi = switch_hash_next(hi)) {
switch_event_subclass *subclass;
switch_hash_this(hi, &var, NULL, &val);
subclass = val;
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "***WTF %s=%s\n", (char *) var, subclass->name);
}
}
#endif
static int switch_events_match(switch_event *event, switch_event_node *node)
{
int match = 0;