The name of the header is.

Unique-ID

On Fri, Jan 30, 2009 at 7:48 AM, Apostolos Pantsiopoulos <regs@kinetix.gr> wrote:

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@kinetix.gr
-------------------------------------------


_______________________________________________
Freeswitch-dev mailing list
Freeswitch-dev@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
http://www.freeswitch.org



--
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/

AIM: anthm
MSN:anthony_minessale@hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org
pstn:213-799-1400