[Freeswitch-dev] getting a session pointer within an event handler

Anthony Minessale anthony.minessale at gmail.com
Fri Jan 30 05:58:26 PST 2009


The name of the header is.

Unique-ID

On Fri, Jan 30, 2009 at 7:48 AM, Apostolos Pantsiopoulos <regs at 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 at kinetix.gr
> -------------------------------------------
>
>
> _______________________________________________
> Freeswitch-dev mailing list
> Freeswitch-dev at 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 at hotmail.com <MSN%3Aanthony_minessale at hotmail.com>
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<PAYPAL%3Aanthony.minessale at gmail.com>
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org <sip%3A888 at conference.freeswitch.org>
iax:guest at conference.freeswitch.org/888
googletalk:conf+888 at conference.freeswitch.org<googletalk%3Aconf%2B888 at conference.freeswitch.org>
pstn:213-799-1400
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20090130/e2954c18/attachment-0001.html 


More information about the Freeswitch-dev mailing list