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

Apostolos Pantsiopoulos regs at kinetix.gr
Fri Jan 30 06:24:29 PST 2009


Thanks! I copied the lower-case version from another module while
searching the code. I wonder how that module works (?!) (mod_event_socket.c)

Anthony Minessale wrote:
> The name of the header is.
>
> Unique-ID
>
> On Fri, Jan 30, 2009 at 7:48 AM, Apostolos Pantsiopoulos 
> <regs at kinetix.gr <mailto: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 <mailto:regs at kinetix.gr>
>     -------------------------------------------
>
>
>     _______________________________________________
>     Freeswitch-dev mailing list
>     Freeswitch-dev at lists.freeswitch.org
>     <mailto: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 
> <mailto:MSN%3Aanthony_minessale at hotmail.com>
> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com 
> <mailto:PAYPAL%3Aanthony.minessale at gmail.com>
> IRC: irc.freenode.net <http://irc.freenode.net> #freeswitch
>
> FreeSWITCH Developer Conference
> sip:888 at conference.freeswitch.org 
> <mailto:sip%3A888 at conference.freeswitch.org>
> iax:guest at conference.freeswitch.org/888 
> <http://iax:guest@conference.freeswitch.org/888>
> googletalk:conf+888 at conference.freeswitch.org 
> <mailto:googletalk%3Aconf%2B888 at conference.freeswitch.org>
> pstn:213-799-1400
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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
>   


-- 
-------------------------------------------
Apostolos Pantsiopoulos
Kinetix Tele.com R & D
email: regs at kinetix.gr
------------------------------------------- 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20090130/753a094e/attachment.html 


More information about the Freeswitch-dev mailing list