[Freeswitch-dev] getting a session pointer within an event handler
Apostolos Pantsiopoulos
regs at kinetix.gr
Fri Jan 30 05:48:21 PST 2009
How can I get a session pointer within an event handler?
I tried to extract the uuid from the event header and then I tried to
locate the session using the uuid :
static void my_event_handler(switch_event_t *event)
{
switch_assert(event);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
"channel name : %s\n",switch_event_get_header_nil(event, "channel-name"));
char* uuid = switch_event_get_header(event, "session-id");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "uuid :
%s\n",uuid);
switch_core_session_t *session;
session = switch_core_session_locate(uuid);
switch_assert(session);
...
}
But the uuid is always null. The events that I am binding my routine is
for CHANNEL_CREATE (I tried CHANNEL_EXECUTE too, same result)
--
-------------------------------------------
Apostolos Pantsiopoulos
Kinetix Tele.com R & D
email: regs at kinetix.gr
-------------------------------------------
More information about the Freeswitch-dev
mailing list