you probably want to use the application interface and a while loop while reading a frame.<br><br>see most of the functions in switch_ivr_play_say<br><br><br><div class="gmail_quote">On Tue, Mar 16, 2010 at 8:51 AM, Francisco Scaramanga <span dir="ltr">&lt;<a href="mailto:scaram@hotmail.de">scaram@hotmail.de</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">



<div>
The module I am writing should be an endpoint VOIP-interface for another program. The module should answer a call and transport incoming audio into a 3rd party application. Furthermore the 3rd party application sends audio data back to the caller. This is why I hooked channel_read_frame and channel_write_frame. <br>
<br>How can I trigger the channel to do something that requires reading or writing audio? Does it make a difference to use the endpoint interface instead of the hooks? <br><br><br><hr>Date: Tue, 16 Mar 2010 08:34:18 -0500<br>
From: <a href="mailto:anthony.minessale@gmail.com" target="_blank">anthony.minessale@gmail.com</a><br>To: <a href="mailto:freeswitch-dev@lists.freeswitch.org" target="_blank">freeswitch-dev@lists.freeswitch.org</a><br>Subject: Re: [Freeswitch-dev] hooked functions are not called while using        one single session<div>
<div></div><div class="h5"><br><br>What exactly is your goal?<br><br>those hooks will probably only be called if you send the channel to do something that <br>requires reading and writing audio.<br><br><br><div>On Tue, Mar 16, 2010 at 6:47 AM, Francisco Scaramanga <span dir="ltr">&lt;<a href="mailto:scaram@hotmail.de" target="_blank">scaram@hotmail.de</a>&gt;</span> wrote:<br>

<blockquote style="padding-left: 1ex;">



<div>
Hello,<br>I am writing my own freeswitch module and have implemented 2 hooks for reading and writing audio (I did not implement the endpoint interface).<br>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. <br>

<br>How can I achieve this? <br>scaram<br><br>/* on channel init I answer the session and set hooks */<br>static switch_status_t channel_on_init(switch_core_session_t *session)<br>{<br>    switch_channel_t *channel = switch_core_session_get_channel(session);<br>

    switch_channel_answer(channel);<br><br>    switch_channel_set_state(channel, CS_EXCHANGE_MEDIA);<br>    switch_set_flag(tech_pvt, TFLAG_IO);<br><br>    switch_core_event_hook_add_write_frame(session, &amp;channel_write_frame);<br>

    switch_core_event_hook_add_read_frame(session, &amp;channel_read_frame);<br>}<br><br>static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id)<br>

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

}<br><div><br><br>                                               <br><hr>Ein Postfach für Alles –   <a href="http://redirect.gimas.net/?n=M1003HM5Adressen" target="_blank">bei Hotmail 5 E-Mail-Adressen online verwalten!</a></div></div>
<br>_______________________________________________<br>
FreeSWITCH-dev mailing list<br>
<a href="mailto:FreeSWITCH-dev@lists.freeswitch.org" target="_blank">FreeSWITCH-dev@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-dev</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/" target="_blank">http://www.cluecon.com/</a><br>

Twitter: <a href="http://twitter.com/FreeSWITCH_wire" target="_blank">http://twitter.com/FreeSWITCH_wire</a><br><br>AIM: anthm<br><a href="mailto:MSN:anthony_minessale@hotmail.com" target="_blank">MSN:anthony_minessale@hotmail.com</a><br>
GTALK/JABBER/<a href="mailto:PAYPAL:anthony.minessale@gmail.com" target="_blank">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net" target="_blank">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip:888@conference.freeswitch.org" target="_blank">sip:888@conference.freeswitch.org</a><br>
<a href="http://conference.freeswitch.org/888" target="_blank">iax:guest@conference.freeswitch.org/888</a><br>
<a href="mailto:googletalk:conf%2B888@conference.freeswitch.org" target="_blank">googletalk:conf+888@conference.freeswitch.org</a><br>pstn:+19193869900<br>                                               <br></div></div><div class="hm"><hr>Alles in einem Postfach  –   <a href="http://redirect.gimas.net/?n=M1003Hotmail" target="_blank">Ich will Hotmail!</a></div>
</div>
<br>_______________________________________________<br>
FreeSWITCH-dev mailing list<br>
<a href="mailto:FreeSWITCH-dev@lists.freeswitch.org">FreeSWITCH-dev@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-dev</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/">http://www.cluecon.com/</a><br>
Twitter: <a href="http://twitter.com/FreeSWITCH_wire">http://twitter.com/FreeSWITCH_wire</a><br><br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br><a href="http://iax:guest@conference.freeswitch.org/888">iax:guest@conference.freeswitch.org/888</a><br>
<a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>pstn:+19193869900<br>