#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>
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)
#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__
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;
#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
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;
}
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) {
switch_mutex_t *mutex;
switch_thread_cond_t *cond;
+ char uuid_str[SWITCH_UUID_FORMATTED_LENGTH+1];
void *private;
};
#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);
{
switch_memory_pool *usepool;
switch_core_session *session;
+ switch_uuid_t uuid;
assert(endpoint_interface != NULL);
/* 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;
};
-#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;