[Freeswitch-dev] hooked functions are not called while using one single session

Francisco Scaramanga scaram at hotmail.de
Tue Mar 16 04:47:38 PDT 2010


Hello,
I am writing my own freeswitch module and have implemented 2 hooks for reading and writing audio (I did not implement the endpoint interface).
My problem is that the channel_write_frame and channel_read_frame callback-functions are only called if I make an intercept with another session (switch_ivr_intercept_session), but my usecase has only one single Session for getting and putting audio data in my module. 

How can I achieve this? 
scaram

/* on channel init I answer the session and set hooks */
static switch_status_t channel_on_init(switch_core_session_t *session)
{
    switch_channel_t *channel = switch_core_session_get_channel(session);
    switch_channel_answer(channel);

    switch_channel_set_state(channel, CS_EXCHANGE_MEDIA);
    switch_set_flag(tech_pvt, TFLAG_IO);

    switch_core_event_hook_add_write_frame(session, &channel_write_frame);
    switch_core_event_hook_add_read_frame(session, &channel_read_frame);
}

static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id)
{
    /* is only called when I intercept 2 Sessions */
}
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id)
{
    /* is only called when I intercept 2 Sessions */
}


 		 	   		  
_________________________________________________________________
http://redirect.gimas.net/?n=M1003xHM5Adressen2
Ein Postfach für Alles –  bei Hotmail 5 E-Mail-Adressen online verwalten!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20100316/f7c6970d/attachment.html 


More information about the FreeSWITCH-dev mailing list