hooked functions are not called while using one single session
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!
What exactly is your goal? those hooks will probably only be called if you send the channel to do something that requires reading and writing audio. On Tue, Mar 16, 2010 at 6:47 AM, Francisco Scaramanga <scaram@hotmail.de>wrote:
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 */ }
------------------------------ Ein Postfach für Alles – bei Hotmail 5 E-Mail-Adressen online verwalten!<http://redirect.gimas.net/?n=M1003HM5Adressen>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:+19193869900
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. 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? Date: Tue, 16 Mar 2010 08:34:18 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session What exactly is your goal? those hooks will probably only be called if you send the channel to do something that requires reading and writing audio. On Tue, Mar 16, 2010 at 6:47 AM, Francisco Scaramanga <scaram@hotmail.de> wrote: 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 */ } Ein Postfach für Alles – bei Hotmail 5 E-Mail-Adressen online verwalten! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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:+19193869900 _________________________________________________________________ http://redirect.gimas.net/?n=M1003xHotmail2 Alles in einem Postfach – Ich will Hotmail!
you probably want to use the application interface and a while loop while reading a frame. see most of the functions in switch_ivr_play_say On Tue, Mar 16, 2010 at 8:51 AM, Francisco Scaramanga <scaram@hotmail.de>wrote:
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.
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?
------------------------------ Date: Tue, 16 Mar 2010 08:34:18 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session
What exactly is your goal?
those hooks will probably only be called if you send the channel to do something that requires reading and writing audio.
On Tue, Mar 16, 2010 at 6:47 AM, Francisco Scaramanga <scaram@hotmail.de>wrote:
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 */ }
------------------------------ Ein Postfach für Alles – bei Hotmail 5 E-Mail-Adressen online verwalten!<http://redirect.gimas.net/?n=M1003HM5Adressen>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire
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<http://conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org<googletalk:conf%2B888@conference.freeswitch.org> pstn:+19193869900
------------------------------ Alles in einem Postfach – Ich will Hotmail!<http://redirect.gimas.net/?n=M1003Hotmail>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:+19193869900
Does anyone have a esljni.dll already built they can send me. I do not have the background to build it on Windows, but want to run it from Windows. I have it working on Linux, but need the dll for Windows. Thanks
I suspect its in the JDK/JNI dev kit you get from sun/oracle. Also DO NOT HIJACK threads. If you compose an email to this list please click NEW then input the address and send it. What you did was take an existing message and click reply, change the subject and delete the body. Please don't do that moving forward if you can keep from it. /b On Mar 16, 2010, at 4:03 PM, Gledhill, James wrote:
Does anyone have a esljni.dll already built they can send me. I do not have the background to build it on Windows, but want to run it from Windows. I have it working on Linux, but need the dll for Windows.
Thanks
What I am looking for is someone that has compiled the FreeSwitch Event Socket Library for Windows (fs_src/libs/esl/java -- and created the windows dll required to use with Java). To make JNI stuff work you need the java classes (independent of OS) and the JNI library (OS dependant). I can make and use the linux library, but not the Windows version. I was hoping someone had built it on Windows and could share. The VC++ 2008 stuff in that directory (src/libs/esl/) does not compile/link in the library for Windows. Sorry about the HIJACK. I was not aware. I will do differently (new vs reply) going forward. ________________________________ From: freeswitch-dev-bounces@lists.freeswitch.org [mailto:freeswitch-dev-bounces@lists.freeswitch.org] On Behalf Of Brian West Sent: Tuesday, March 16, 2010 4:11 PM To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] esljni.dll I suspect its in the JDK/JNI dev kit you get from sun/oracle. Also DO NOT HIJACK threads. If you compose an email to this list please click NEW then input the address and send it. What you did was take an existing message and click reply, change the subject and delete the body. Please don't do that moving forward if you can keep from it. /b On Mar 16, 2010, at 4:03 PM, Gledhill, James wrote: Does anyone have a esljni.dll already built they can send me. I do not have the background to build it on Windows, but want to run it from Windows. I have it working on Linux, but need the dll for Windows. Thanks
I am now using the application interface and play a file after answering the call. The call is not connected to a another session, it's just a single session. SWITCH_STANDARD_APP(mod_my_function) { /* play audio file */ switch_ivr_play_file(session, NULL, "C:\\freeswitch1.0.4\\debug\\sounds\\music\\8000\\danza-espanola-op-37-h-142-xii-arabesca.wav", NULL); } Now the hooks for channel_write_frame and channel_read_frame are called! I write the audio frames into a file for testing if everything is correct. The data written in channel_write_frame seems to be perfect, but audio written in channel_read_frame only seems to be good at first sight. If I record 20 seconds of audio and listen to the audiofile I hear that 2 or 3 times short parts are missing. static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id) { // Audio from danza-espanola-op-37-h-142-xii-arabesca.wav is written into a file fwrite((short *)frame->data, 2, frame->datalen/2 ,tmp); } static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id) { // Spoken audio samples from my microphone are written, but sometimes samples are missing fwrite((short *)frame->data, 2, frame->datalen/2 ,tmp); } Is it possible that I don't get all audio samples by hooked functions? why audio recorded in channel_write_frame is brilliant and in channel_read_frame not? Date: Tue, 16 Mar 2010 13:59:28 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session you probably want to use the application interface and a while loop while reading a frame. see most of the functions in switch_ivr_play_say On Tue, Mar 16, 2010 at 8:51 AM, Francisco Scaramanga <scaram@hotmail.de> wrote: 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. 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? Date: Tue, 16 Mar 2010 08:34:18 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session What exactly is your goal? those hooks will probably only be called if you send the channel to do something that requires reading and writing audio. On Tue, Mar 16, 2010 at 6:47 AM, Francisco Scaramanga <scaram@hotmail.de> wrote: 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 */ } Ein Postfach für Alles – bei Hotmail 5 E-Mail-Adressen online verwalten! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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:+19193869900 Alles in einem Postfach – Ich will Hotmail! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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:+19193869900 _________________________________________________________________ http://redirect.gimas.net/?n=M1003xIMVideochat2 Treffe Freunde im Messenger Videochat!
Why do you even need the hooks? What exactly are you trying to do? Maybe you should explain it. On Mon, Mar 22, 2010 at 5:33 AM, Francisco Scaramanga <scaram@hotmail.de>wrote:
I am now using the application interface and play a file after answering the call. The call is not connected to a another session, it's just a single session.
SWITCH_STANDARD_APP(mod_my_function) { /* play audio file */ switch_ivr_play_file(session, NULL, "C:\\freeswitch1.0.4\\debug\\sounds\\music\\8000\\danza-espanola-op-37-h-142-xii-arabesca.wav", NULL); }
Now the hooks for channel_write_frame and channel_read_frame are called! I write the audio frames into a file for testing if everything is correct. The data written in channel_write_frame seems to be perfect, but audio written in channel_read_frame only seems to be good at first sight. If I record 20 seconds of audio and listen to the audiofile I hear that 2 or 3 times short parts are missing.
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id) { // Audio from danza-espanola-op-37-h-142-xii-arabesca.wav is written into a file fwrite((short *)frame->data, 2, frame->datalen/2 ,tmp);
} static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id) { // Spoken audio samples from my microphone are written, but sometimes samples are missing fwrite((short *)frame->data, 2, frame->datalen/2 ,tmp); }
Is it possible that I don't get all audio samples by hooked functions? why audio recorded in channel_write_frame is brilliant and in channel_read_frame not?
------------------------------ Date: Tue, 16 Mar 2010 13:59:28 -0500
From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session
you probably want to use the application interface and a while loop while reading a frame.
see most of the functions in switch_ivr_play_say
On Tue, Mar 16, 2010 at 8:51 AM, Francisco Scaramanga <scaram@hotmail.de>wrote:
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.
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?
------------------------------ Date: Tue, 16 Mar 2010 08:34:18 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session
What exactly is your goal?
those hooks will probably only be called if you send the channel to do something that requires reading and writing audio.
On Tue, Mar 16, 2010 at 6:47 AM, Francisco Scaramanga <scaram@hotmail.de>wrote:
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 */ }
------------------------------ Ein Postfach für Alles – bei Hotmail 5 E-Mail-Adressen online verwalten!<http://redirect.gimas.net/?n=M1003HM5Adressen>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire
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<http://conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org<googletalk:conf%2B888@conference.freeswitch.org> pstn:+19193869900
------------------------------ Alles in einem Postfach – Ich will Hotmail!<http://redirect.gimas.net/?n=M1003Hotmail>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire
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<http://conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org<googletalk:conf%2B888@conference.freeswitch.org> pstn:+19193869900
------------------------------ Treffe Freunde im Messenger Videochat!<http://redirect.gimas.net/?n=M1003IMVideochat>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:+19193869900
I have an selfmade software which is controlled by a telephone call (ISDN/CAPI). The user calls with his phone, gets connected and can speak commands which are detected by an internal speech recognizer. Furthermore the user can accept or hangup incoming calls just by his voice command. It is also possible to dial out. Now I am adding VOIP functionality to my system and decided to use FreeSwitch. Therefore I wrote a FreeSwitch module which should be the VOIP interface for my software. The module must be able to: 1. recognize an incoming call which is the users control session (single session) I do this in statehandler function channel_on_init. 2. pick up another incoming call and intercept with my users control session. 3. Get the audio data from voip session (user control session) and send it to my application (by own tcp-socket) My idea is to use channel_write_frame to receive audio. 3. Send audio data from my application to voip user control session so the user can hear audio. My idea is to use channel_read_frame. explanation for using hooks: ---------------------------- The endpoint interface callback functions where never called in my module, even I tried to adapt the way it is done in mod_portaudio. So my workaround was to set hook functions channel_read_frame/channel_write_frame to handle audio. My problems: ------------ The hook functions are working fine if I have 2 sessions (put together by switch_ivr_intercept_session), but if I only have the single user control session no hooked function is called. In this case the only way to achieve that hooks are called, is to play audio with switch_ivr_play_file. But then, audio samples got lost sometimes. Maybe there is a better way to solve my requirements? Date: Mon, 22 Mar 2010 11:55:42 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session Why do you even need the hooks? What exactly are you trying to do? Maybe you should explain it. On Mon, Mar 22, 2010 at 5:33 AM, Francisco Scaramanga <scaram@hotmail.de> wrote: I am now using the application interface and play a file after answering the call. The call is not connected to a another session, it's just a single session. SWITCH_STANDARD_APP(mod_my_function) { /* play audio file */ switch_ivr_play_file(session, NULL, "C:\\freeswitch1.0.4\\debug\\sounds\\music\\8000\\danza-espanola-op-37-h-142-xii-arabesca.wav", NULL); } Now the hooks for channel_write_frame and channel_read_frame are called! I write the audio frames into a file for testing if everything is correct. The data written in channel_write_frame seems to be perfect, but audio written in channel_read_frame only seems to be good at first sight. If I record 20 seconds of audio and listen to the audiofile I hear that 2 or 3 times short parts are missing. static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id) { // Audio from danza-espanola-op-37-h-142-xii-arabesca.wav is written into a file fwrite((short *)frame->data, 2, frame->datalen/2 ,tmp); } static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id) { // Spoken audio samples from my microphone are written, but sometimes samples are missing fwrite((short *)frame->data, 2, frame->datalen/2 ,tmp); } Is it possible that I don't get all audio samples by hooked functions? why audio recorded in channel_write_frame is brilliant and in channel_read_frame not? Date: Tue, 16 Mar 2010 13:59:28 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session you probably want to use the application interface and a while loop while reading a frame. see most of the functions in switch_ivr_play_say On Tue, Mar 16, 2010 at 8:51 AM, Francisco Scaramanga <scaram@hotmail.de> wrote: 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. 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? Date: Tue, 16 Mar 2010 08:34:18 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session What exactly is your goal? those hooks will probably only be called if you send the channel to do something that requires reading and writing audio. On Tue, Mar 16, 2010 at 6:47 AM, Francisco Scaramanga <scaram@hotmail.de> wrote: 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 */ } Ein Postfach für Alles – bei Hotmail 5 E-Mail-Adressen online verwalten! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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:+19193869900 Alles in einem Postfach – Ich will Hotmail! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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:+19193869900 Treffe Freunde im Messenger Videochat! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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:+19193869900 _________________________________________________________________ http://redirect.gimas.net/?n=M1003xHotmail2 Alles in einem Postfach – Ich will Hotmail!
you don't use the hook functions you use a frame pointer switch_frame_t *read_frame; switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); when i said to look at the stream file example i meant in the function itself to see how to read and write audio from a channel in a foreground loop. On Mon, Mar 22, 2010 at 6:23 PM, Francisco Scaramanga <scaram@hotmail.de>wrote:
I have an selfmade software which is controlled by a telephone call (ISDN/CAPI). The user calls with his phone, gets connected and can speak commands which are detected by an internal speech recognizer. Furthermore the user can accept or hangup incoming calls just by his voice command. It is also possible to dial out.
Now I am adding VOIP functionality to my system and decided to use FreeSwitch. Therefore I wrote a FreeSwitch module which should be the VOIP interface for my software. The module must be able to:
1. recognize an incoming call which is the users control session (single session) I do this in statehandler function channel_on_init. 2. pick up another incoming call and intercept with my users control session. 3. Get the audio data from voip session (user control session) and send it to my application (by own tcp-socket) My idea is to use channel_write_frame to receive audio. 3. Send audio data from my application to voip user control session so the user can hear audio. My idea is to use channel_read_frame.
explanation for using hooks: ---------------------------- The endpoint interface callback functions where never called in my module, even I tried to adapt the way it is done in mod_portaudio. So my workaround was to set hook functions channel_read_frame/channel_write_frame to handle audio.
My problems: ------------ The hook functions are working fine if I have 2 sessions (put together by switch_ivr_intercept_session), but if I only have the single user control session no hooked function is called. In this case the only way to achieve that hooks are called, is to play audio with switch_ivr_play_file. But then, audio samples got lost sometimes.
Maybe there is a better way to solve my requirements?
------------------------------ Date: Mon, 22 Mar 2010 11:55:42 -0500
From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session
Why do you even need the hooks? What exactly are you trying to do? Maybe you should explain it.
On Mon, Mar 22, 2010 at 5:33 AM, Francisco Scaramanga <scaram@hotmail.de>wrote:
I am now using the application interface and play a file after answering the call. The call is not connected to a another session, it's just a single session.
SWITCH_STANDARD_APP(mod_my_function) { /* play audio file */ switch_ivr_play_file(session, NULL, "C:\\freeswitch1.0.4\\debug\\sounds\\music\\8000\\danza-espanola-op-37-h-142-xii-arabesca.wav", NULL); }
Now the hooks for channel_write_frame and channel_read_frame are called! I write the audio frames into a file for testing if everything is correct. The data written in channel_write_frame seems to be perfect, but audio written in channel_read_frame only seems to be good at first sight. If I record 20 seconds of audio and listen to the audiofile I hear that 2 or 3 times short parts are missing.
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id) { // Audio from danza-espanola-op-37-h-142-xii-arabesca.wav is written into a file fwrite((short *)frame->data, 2, frame->datalen/2 ,tmp);
} static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id) { // Spoken audio samples from my microphone are written, but sometimes samples are missing fwrite((short *)frame->data, 2, frame->datalen/2 ,tmp); }
Is it possible that I don't get all audio samples by hooked functions? why audio recorded in channel_write_frame is brilliant and in channel_read_frame not?
------------------------------ Date: Tue, 16 Mar 2010 13:59:28 -0500
From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session
you probably want to use the application interface and a while loop while reading a frame.
see most of the functions in switch_ivr_play_say
On Tue, Mar 16, 2010 at 8:51 AM, Francisco Scaramanga <scaram@hotmail.de>wrote:
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.
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?
------------------------------ Date: Tue, 16 Mar 2010 08:34:18 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session
What exactly is your goal?
those hooks will probably only be called if you send the channel to do something that requires reading and writing audio.
On Tue, Mar 16, 2010 at 6:47 AM, Francisco Scaramanga <scaram@hotmail.de>wrote:
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 */ }
------------------------------ Ein Postfach für Alles – bei Hotmail 5 E-Mail-Adressen online verwalten!<http://redirect.gimas.net/?n=M1003HM5Adressen>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire
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<http://conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org<googletalk:conf%2B888@conference.freeswitch.org> pstn:+19193869900
------------------------------ Alles in einem Postfach – Ich will Hotmail!<http://redirect.gimas.net/?n=M1003Hotmail>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire
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<http://conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org<googletalk:conf%2B888@conference.freeswitch.org> pstn:+19193869900
------------------------------ Treffe Freunde im Messenger Videochat!<http://redirect.gimas.net/?n=M1003IMVideochat>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire
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<http://conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org<googletalk:conf%2B888@conference.freeswitch.org> pstn:+19193869900
------------------------------ Alles in einem Postfach – Ich will Hotmail!<http://redirect.gimas.net/?n=M1003Hotmail>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:+19193869900
Now I call switch_core_session_read_frame and switch_core_session_write_frame in the same foreground loop. Then I write audio into a file and as a result I see that there are many audio gaps. There seems to be a cross effect by using switch_core_session_write_frame and switch_core_session_read_frame together. If I only use switch_core_session_read_frame in the loop, there are no gaps and everything sounds perfect! What could be the problem? while (1) { // READ tstatus = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); if (tstatus==SWITCH_STATUS_SUCCESS) { // write audio in a testfile fwrite((short *)(read_frame)->data, 2, ((read_frame)->datalen)/2 ,tmp); switch_size_t ts_rf=read_frame->timestamp; } // WRITE vector<unsigned char> vucIn; if (getAudio(&vucAudio)) // get next audio and send it back { memcpy( write_frame.data, &vucIn[0], vucIn.size()); write_frame.datalen=vucIn.size(); tstatus = switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0); } //Sleep(1);//? } Date: Mon, 22 Mar 2010 18:34:46 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session you don't use the hook functions you use a frame pointer switch_frame_t *read_frame; switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); when i said to look at the stream file example i meant in the function itself to see how to read and write audio from a channel in a foreground loop. On Mon, Mar 22, 2010 at 6:23 PM, Francisco Scaramanga <scaram@hotmail.de> wrote: I have an selfmade software which is controlled by a telephone call (ISDN/CAPI). The user calls with his phone, gets connected and can speak commands which are detected by an internal speech recognizer. Furthermore the user can accept or hangup incoming calls just by his voice command. It is also possible to dial out. Now I am adding VOIP functionality to my system and decided to use FreeSwitch. Therefore I wrote a FreeSwitch module which should be the VOIP interface for my software. The module must be able to: 1. recognize an incoming call which is the users control session (single session) I do this in statehandler function channel_on_init. 2. pick up another incoming call and intercept with my users control session. 3. Get the audio data from voip session (user control session) and send it to my application (by own tcp-socket) My idea is to use channel_write_frame to receive audio. 3. Send audio data from my application to voip user control session so the user can hear audio. My idea is to use channel_read_frame. explanation for using hooks: ---------------------------- The endpoint interface callback functions where never called in my module, even I tried to adapt the way it is done in mod_portaudio. So my workaround was to set hook functions channel_read_frame/channel_write_frame to handle audio. My problems: ------------ The hook functions are working fine if I have 2 sessions (put together by switch_ivr_intercept_session), but if I only have the single user control session no hooked function is called. In this case the only way to achieve that hooks are called, is to play audio with switch_ivr_play_file. But then, audio samples got lost sometimes. Maybe there is a better way to solve my requirements? Date: Mon, 22 Mar 2010 11:55:42 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session Why do you even need the hooks? What exactly are you trying to do? Maybe you should explain it. On Mon, Mar 22, 2010 at 5:33 AM, Francisco Scaramanga <scaram@hotmail.de> wrote: I am now using the application interface and play a file after answering the call. The call is not connected to a another session, it's just a single session. SWITCH_STANDARD_APP(mod_my_function) { /* play audio file */ switch_ivr_play_file(session, NULL, "C:\\freeswitch1.0.4\\debug\\sounds\\music\\8000\\danza-espanola-op-37-h-142-xii-arabesca.wav", NULL); } Now the hooks for channel_write_frame and channel_read_frame are called! I write the audio frames into a file for testing if everything is correct. The data written in channel_write_frame seems to be perfect, but audio written in channel_read_frame only seems to be good at first sight. If I record 20 seconds of audio and listen to the audiofile I hear that 2 or 3 times short parts are missing. static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id) { // Audio from danza-espanola-op-37-h-142-xii-arabesca.wav is written into a file fwrite((short *)frame->data, 2, frame->datalen/2 ,tmp); } static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id) { // Spoken audio samples from my microphone are written, but sometimes samples are missing fwrite((short *)frame->data, 2, frame->datalen/2 ,tmp); } Is it possible that I don't get all audio samples by hooked functions? why audio recorded in channel_write_frame is brilliant and in channel_read_frame not? Date: Tue, 16 Mar 2010 13:59:28 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session you probably want to use the application interface and a while loop while reading a frame. see most of the functions in switch_ivr_play_say On Tue, Mar 16, 2010 at 8:51 AM, Francisco Scaramanga <scaram@hotmail.de> wrote: 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. 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? Date: Tue, 16 Mar 2010 08:34:18 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session What exactly is your goal? those hooks will probably only be called if you send the channel to do something that requires reading and writing audio. On Tue, Mar 16, 2010 at 6:47 AM, Francisco Scaramanga <scaram@hotmail.de> wrote: 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 */ } Ein Postfach für Alles – bei Hotmail 5 E-Mail-Adressen online verwalten! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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:+19193869900 Alles in einem Postfach – Ich will Hotmail! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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:+19193869900 Treffe Freunde im Messenger Videochat! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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:+19193869900 Alles in einem Postfach – Ich will Hotmail! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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 googletalk:conf+888@conference.freeswitch.org pstn:+19193869900 _________________________________________________________________ http://redirect.gimas.net/?n=M1003xIMVideochat2 Treffe Freunde im Messenger Videochat!
you can only write back the exact number of bytes you negotiated per interval. On Fri, Mar 26, 2010 at 7:27 AM, Francisco Scaramanga <scaram@hotmail.de>wrote:
Now I call switch_core_session_read_frame and switch_core_session_write_frame in the same foreground loop. Then I write audio into a file and as a result I see that there are many audio gaps.
There seems to be a cross effect by using switch_core_session_write_frame and switch_core_session_read_frame together. If I only use switch_core_session_read_frame in the loop, there are no gaps and everything sounds perfect!
What could be the problem?
while (1) { // READ tstatus = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); if (tstatus==SWITCH_STATUS_SUCCESS) { // write audio in a testfile fwrite((short *)(read_frame)->data, 2, ((read_frame)->datalen)/2 ,tmp); switch_size_t ts_rf=read_frame->timestamp; }
// WRITE vector<unsigned char> vucIn; if (getAudio(&vucAudio)) // get next audio and send it back { memcpy( write_frame.data, &vucIn[0], vucIn.size()); write_frame.datalen=vucIn.size(); tstatus = switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0); } //Sleep(1);//? }
------------------------------ Date: Mon, 22 Mar 2010 18:34:46 -0500
From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session
you don't use the hook functions you use a frame pointer
switch_frame_t *read_frame;
switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
when i said to look at the stream file example i meant in the function itself to see how to read and write audio from a channel in a foreground loop.
On Mon, Mar 22, 2010 at 6:23 PM, Francisco Scaramanga <scaram@hotmail.de>wrote:
I have an selfmade software which is controlled by a telephone call (ISDN/CAPI). The user calls with his phone, gets connected and can speak commands which are detected by an internal speech recognizer. Furthermore the user can accept or hangup incoming calls just by his voice command. It is also possible to dial out.
Now I am adding VOIP functionality to my system and decided to use FreeSwitch. Therefore I wrote a FreeSwitch module which should be the VOIP interface for my software. The module must be able to:
1. recognize an incoming call which is the users control session (single session) I do this in statehandler function channel_on_init. 2. pick up another incoming call and intercept with my users control session. 3. Get the audio data from voip session (user control session) and send it to my application (by own tcp-socket) My idea is to use channel_write_frame to receive audio. 3. Send audio data from my application to voip user control session so the user can hear audio. My idea is to use channel_read_frame.
explanation for using hooks: ---------------------------- The endpoint interface callback functions where never called in my module, even I tried to adapt the way it is done in mod_portaudio. So my workaround was to set hook functions channel_read_frame/channel_write_frame to handle audio.
My problems: ------------ The hook functions are working fine if I have 2 sessions (put together by switch_ivr_intercept_session), but if I only have the single user control session no hooked function is called. In this case the only way to achieve that hooks are called, is to play audio with switch_ivr_play_file. But then, audio samples got lost sometimes.
Maybe there is a better way to solve my requirements?
------------------------------ Date: Mon, 22 Mar 2010 11:55:42 -0500
From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session
Why do you even need the hooks? What exactly are you trying to do? Maybe you should explain it.
On Mon, Mar 22, 2010 at 5:33 AM, Francisco Scaramanga <scaram@hotmail.de>wrote:
I am now using the application interface and play a file after answering the call. The call is not connected to a another session, it's just a single session.
SWITCH_STANDARD_APP(mod_my_function) { /* play audio file */ switch_ivr_play_file(session, NULL, "C:\\freeswitch1.0.4\\debug\\sounds\\music\\8000\\danza-espanola-op-37-h-142-xii-arabesca.wav", NULL); }
Now the hooks for channel_write_frame and channel_read_frame are called! I write the audio frames into a file for testing if everything is correct. The data written in channel_write_frame seems to be perfect, but audio written in channel_read_frame only seems to be good at first sight. If I record 20 seconds of audio and listen to the audiofile I hear that 2 or 3 times short parts are missing.
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id) { // Audio from danza-espanola-op-37-h-142-xii-arabesca.wav is written into a file fwrite((short *)frame->data, 2, frame->datalen/2 ,tmp);
} static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id) { // Spoken audio samples from my microphone are written, but sometimes samples are missing fwrite((short *)frame->data, 2, frame->datalen/2 ,tmp); }
Is it possible that I don't get all audio samples by hooked functions? why audio recorded in channel_write_frame is brilliant and in channel_read_frame not?
------------------------------ Date: Tue, 16 Mar 2010 13:59:28 -0500
From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session
you probably want to use the application interface and a while loop while reading a frame.
see most of the functions in switch_ivr_play_say
On Tue, Mar 16, 2010 at 8:51 AM, Francisco Scaramanga <scaram@hotmail.de>wrote:
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.
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?
------------------------------ Date: Tue, 16 Mar 2010 08:34:18 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session
What exactly is your goal?
those hooks will probably only be called if you send the channel to do something that requires reading and writing audio.
On Tue, Mar 16, 2010 at 6:47 AM, Francisco Scaramanga <scaram@hotmail.de>wrote:
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 */ }
------------------------------ Ein Postfach für Alles – bei Hotmail 5 E-Mail-Adressen online verwalten!<http://redirect.gimas.net/?n=M1003HM5Adressen>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire
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<http://conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org<googletalk:conf%2B888@conference.freeswitch.org> pstn:+19193869900
------------------------------ Alles in einem Postfach – Ich will Hotmail!<http://redirect.gimas.net/?n=M1003Hotmail>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire
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<http://conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org<googletalk:conf%2B888@conference.freeswitch.org> pstn:+19193869900
------------------------------ Treffe Freunde im Messenger Videochat!<http://redirect.gimas.net/?n=M1003IMVideochat>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire
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<http://conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org<googletalk:conf%2B888@conference.freeswitch.org> pstn:+19193869900
------------------------------ Alles in einem Postfach – Ich will Hotmail!<http://redirect.gimas.net/?n=M1003Hotmail>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire
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 googletalk:conf+888@conference.freeswitch.org<googletalk:conf%2B888@conference.freeswitch.org> pstn:+19193869900
------------------------------ Treffe Freunde im Messenger Videochat!<http://redirect.gimas.net/?n=M1003IMVideochat>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:+19193869900
ok, which is the best mechanism to controll the amount of data. Can you recommend a timer? I use PCMA codec with 20 msec intervall. Date: Fri, 26 Mar 2010 11:31:43 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session you can only write back the exact number of bytes you negotiated per interval. On Fri, Mar 26, 2010 at 7:27 AM, Francisco Scaramanga <scaram@hotmail.de> wrote: Now I call switch_core_session_read_frame and switch_core_session_write_frame in the same foreground loop. Then I write audio into a file and as a result I see that there are many audio gaps. There seems to be a cross effect by using switch_core_session_write_frame and switch_core_session_read_frame together. If I only use switch_core_session_read_frame in the loop, there are no gaps and everything sounds perfect! What could be the problem? while (1) { // READ tstatus = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); if (tstatus==SWITCH_STATUS_SUCCESS) { // write audio in a testfile fwrite((short *)(read_frame)->data, 2, ((read_frame)->datalen)/2 ,tmp); switch_size_t ts_rf=read_frame->timestamp; } // WRITE vector<unsigned char> vucIn; if (getAudio(&vucAudio)) // get next audio and send it back { memcpy( write_frame.data, &vucIn[0], vucIn.size()); write_frame.datalen=vucIn.size(); tstatus = switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0); } //Sleep(1);//? } Date: Mon, 22 Mar 2010 18:34:46 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session you don't use the hook functions you use a frame pointer switch_frame_t *read_frame; switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); when i said to look at the stream file example i meant in the function itself to see how to read and write audio from a channel in a foreground loop. On Mon, Mar 22, 2010 at 6:23 PM, Francisco Scaramanga <scaram@hotmail.de> wrote: I have an selfmade software which is controlled by a telephone call (ISDN/CAPI). The user calls with his phone, gets connected and can speak commands which are detected by an internal speech recognizer. Furthermore the user can accept or hangup incoming calls just by his voice command. It is also possible to dial out. Now I am adding VOIP functionality to my system and decided to use FreeSwitch. Therefore I wrote a FreeSwitch module which should be the VOIP interface for my software. The module must be able to: 1. recognize an incoming call which is the users control session (single session) I do this in statehandler function channel_on_init. 2. pick up another incoming call and intercept with my users control session. 3. Get the audio data from voip session (user control session) and send it to my application (by own tcp-socket) My idea is to use channel_write_frame to receive audio. 3. Send audio data from my application to voip user control session so the user can hear audio. My idea is to use channel_read_frame. explanation for using hooks: ---------------------------- The endpoint interface callback functions where never called in my module, even I tried to adapt the way it is done in mod_portaudio. So my workaround was to set hook functions channel_read_frame/channel_write_frame to handle audio. My problems: ------------ The hook functions are working fine if I have 2 sessions (put together by switch_ivr_intercept_session), but if I only have the single user control session no hooked function is called. In this case the only way to achieve that hooks are called, is to play audio with switch_ivr_play_file. But then, audio samples got lost sometimes. Maybe there is a better way to solve my requirements? Date: Mon, 22 Mar 2010 11:55:42 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session Why do you even need the hooks? What exactly are you trying to do? Maybe you should explain it. On Mon, Mar 22, 2010 at 5:33 AM, Francisco Scaramanga <scaram@hotmail.de> wrote: I am now using the application interface and play a file after answering the call. The call is not connected to a another session, it's just a single session. SWITCH_STANDARD_APP(mod_my_function) { /* play audio file */ switch_ivr_play_file(session, NULL, "C:\\freeswitch1.0.4\\debug\\sounds\\music\\8000\\danza-espanola-op-37-h-142-xii-arabesca.wav", NULL); } Now the hooks for channel_write_frame and channel_read_frame are called! I write the audio frames into a file for testing if everything is correct. The data written in channel_write_frame seems to be perfect, but audio written in channel_read_frame only seems to be good at first sight. If I record 20 seconds of audio and listen to the audiofile I hear that 2 or 3 times short parts are missing. static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id) { // Audio from danza-espanola-op-37-h-142-xii-arabesca.wav is written into a file fwrite((short *)frame->data, 2, frame->datalen/2 ,tmp); } static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id) { // Spoken audio samples from my microphone are written, but sometimes samples are missing fwrite((short *)frame->data, 2, frame->datalen/2 ,tmp); } Is it possible that I don't get all audio samples by hooked functions? why audio recorded in channel_write_frame is brilliant and in channel_read_frame not? Date: Tue, 16 Mar 2010 13:59:28 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session you probably want to use the application interface and a while loop while reading a frame. see most of the functions in switch_ivr_play_say On Tue, Mar 16, 2010 at 8:51 AM, Francisco Scaramanga <scaram@hotmail.de> wrote: 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. 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? Date: Tue, 16 Mar 2010 08:34:18 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session What exactly is your goal? those hooks will probably only be called if you send the channel to do something that requires reading and writing audio. On Tue, Mar 16, 2010 at 6:47 AM, Francisco Scaramanga <scaram@hotmail.de> wrote: 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 */ } Ein Postfach für Alles – bei Hotmail 5 E-Mail-Adressen online verwalten! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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:+19193869900 Alles in einem Postfach – Ich will Hotmail! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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:+19193869900 Treffe Freunde im Messenger Videochat! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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:+19193869900 Alles in einem Postfach – Ich will Hotmail! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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 googletalk:conf+888@conference.freeswitch.org pstn:+19193869900 Treffe Freunde im Messenger Videochat! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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 googletalk:conf+888@conference.freeswitch.org pstn:+19193869900 _________________________________________________________________ http://redirect.gimas.net/?n=M1003xHotmail2 Alles in einem Postfach – Ich will Hotmail!
You can use the data you have, the read will already be timed right when you get a frame that has flag SFF_CNG you know that there was not a real frame to read but you should still write the size id determined from getting the read_impl and using read_impl->encoded_bytes_per_frame On Fri, Mar 26, 2010 at 12:23 PM, Francisco Scaramanga <scaram@hotmail.de>wrote:
ok, which is the best mechanism to controll the amount of data. Can you recommend a timer? I use PCMA codec with 20 msec intervall.
------------------------------ Date: Fri, 26 Mar 2010 11:31:43 -0500
From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session
you can only write back the exact number of bytes you negotiated per interval.
On Fri, Mar 26, 2010 at 7:27 AM, Francisco Scaramanga <scaram@hotmail.de>wrote:
Now I call switch_core_session_read_frame and switch_core_session_write_frame in the same foreground loop. Then I write audio into a file and as a result I see that there are many audio gaps.
There seems to be a cross effect by using switch_core_session_write_frame and switch_core_session_read_frame together. If I only use switch_core_session_read_frame in the loop, there are no gaps and everything sounds perfect!
What could be the problem?
while (1) { // READ tstatus = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); if (tstatus==SWITCH_STATUS_SUCCESS) { // write audio in a testfile fwrite((short *)(read_frame)->data, 2, ((read_frame)->datalen)/2 ,tmp); switch_size_t ts_rf=read_frame->timestamp; }
// WRITE vector<unsigned char> vucIn; if (getAudio(&vucAudio)) // get next audio and send it back { memcpy( write_frame.data, &vucIn[0], vucIn.size()); write_frame.datalen=vucIn.size(); tstatus = switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0); } //Sleep(1);//? }
------------------------------ Date: Mon, 22 Mar 2010 18:34:46 -0500
From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session
you don't use the hook functions you use a frame pointer
switch_frame_t *read_frame;
switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
when i said to look at the stream file example i meant in the function itself to see how to read and write audio from a channel in a foreground loop.
On Mon, Mar 22, 2010 at 6:23 PM, Francisco Scaramanga <scaram@hotmail.de>wrote:
I have an selfmade software which is controlled by a telephone call (ISDN/CAPI). The user calls with his phone, gets connected and can speak commands which are detected by an internal speech recognizer. Furthermore the user can accept or hangup incoming calls just by his voice command. It is also possible to dial out.
Now I am adding VOIP functionality to my system and decided to use FreeSwitch. Therefore I wrote a FreeSwitch module which should be the VOIP interface for my software. The module must be able to:
1. recognize an incoming call which is the users control session (single session) I do this in statehandler function channel_on_init. 2. pick up another incoming call and intercept with my users control session. 3. Get the audio data from voip session (user control session) and send it to my application (by own tcp-socket) My idea is to use channel_write_frame to receive audio. 3. Send audio data from my application to voip user control session so the user can hear audio. My idea is to use channel_read_frame.
explanation for using hooks: ---------------------------- The endpoint interface callback functions where never called in my module, even I tried to adapt the way it is done in mod_portaudio. So my workaround was to set hook functions channel_read_frame/channel_write_frame to handle audio.
My problems: ------------ The hook functions are working fine if I have 2 sessions (put together by switch_ivr_intercept_session), but if I only have the single user control session no hooked function is called. In this case the only way to achieve that hooks are called, is to play audio with switch_ivr_play_file. But then, audio samples got lost sometimes.
Maybe there is a better way to solve my requirements?
------------------------------ Date: Mon, 22 Mar 2010 11:55:42 -0500
From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session
Why do you even need the hooks? What exactly are you trying to do? Maybe you should explain it.
On Mon, Mar 22, 2010 at 5:33 AM, Francisco Scaramanga <scaram@hotmail.de>wrote:
I am now using the application interface and play a file after answering the call. The call is not connected to a another session, it's just a single session.
SWITCH_STANDARD_APP(mod_my_function) { /* play audio file */ switch_ivr_play_file(session, NULL, "C:\\freeswitch1.0.4\\debug\\sounds\\music\\8000\\danza-espanola-op-37-h-142-xii-arabesca.wav", NULL); }
Now the hooks for channel_write_frame and channel_read_frame are called! I write the audio frames into a file for testing if everything is correct. The data written in channel_write_frame seems to be perfect, but audio written in channel_read_frame only seems to be good at first sight. If I record 20 seconds of audio and listen to the audiofile I hear that 2 or 3 times short parts are missing.
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id) { // Audio from danza-espanola-op-37-h-142-xii-arabesca.wav is written into a file fwrite((short *)frame->data, 2, frame->datalen/2 ,tmp);
} static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id) { // Spoken audio samples from my microphone are written, but sometimes samples are missing fwrite((short *)frame->data, 2, frame->datalen/2 ,tmp); }
Is it possible that I don't get all audio samples by hooked functions? why audio recorded in channel_write_frame is brilliant and in channel_read_frame not?
------------------------------ Date: Tue, 16 Mar 2010 13:59:28 -0500
From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session
you probably want to use the application interface and a while loop while reading a frame.
see most of the functions in switch_ivr_play_say
On Tue, Mar 16, 2010 at 8:51 AM, Francisco Scaramanga <scaram@hotmail.de>wrote:
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.
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?
------------------------------ Date: Tue, 16 Mar 2010 08:34:18 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session
What exactly is your goal?
those hooks will probably only be called if you send the channel to do something that requires reading and writing audio.
On Tue, Mar 16, 2010 at 6:47 AM, Francisco Scaramanga <scaram@hotmail.de>wrote:
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 */ }
------------------------------ Ein Postfach für Alles – bei Hotmail 5 E-Mail-Adressen online verwalten!<http://redirect.gimas.net/?n=M1003HM5Adressen>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire
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<http://conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org<googletalk:conf%2B888@conference.freeswitch.org> pstn:+19193869900
------------------------------ Alles in einem Postfach – Ich will Hotmail!<http://redirect.gimas.net/?n=M1003Hotmail>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire
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<http://conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org<googletalk:conf%2B888@conference.freeswitch.org> pstn:+19193869900
------------------------------ Treffe Freunde im Messenger Videochat!<http://redirect.gimas.net/?n=M1003IMVideochat>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire
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<http://conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org<googletalk:conf%2B888@conference.freeswitch.org> pstn:+19193869900
------------------------------ Alles in einem Postfach – Ich will Hotmail!<http://redirect.gimas.net/?n=M1003Hotmail>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire
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 googletalk:conf+888@conference.freeswitch.org<googletalk:conf%2B888@conference.freeswitch.org> pstn:+19193869900
------------------------------ Treffe Freunde im Messenger Videochat!<http://redirect.gimas.net/?n=M1003IMVideochat>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire
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 googletalk:conf+888@conference.freeswitch.org<googletalk:conf%2B888@conference.freeswitch.org> pstn:+19193869900
------------------------------ Alles in einem Postfach – Ich will Hotmail!<http://redirect.gimas.net/?n=M1003Hotmail>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:+19193869900
yes, switch_core_session_read_frame will be timed right. This is working for me, but my troubles are in switch_core_session_write_frame. Is this function timed write too when I put data into this function? Date: Fri, 26 Mar 2010 12:37:04 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session You can use the data you have, yes the the read will already be timed right when you get a frame that has flag SFF_CNG you know that there was not a real frame to read but you should still write the size id determined from getting the read_impl and using read_impl->encoded_bytes_per_frame On Fri, Mar 26, 2010 at 12:23 PM, Francisco Scaramanga <scaram@hotmail.de> wrote: ok, which is the best mechanism to controll the amount of data. Can you recommend a timer? I use PCMA codec with 20 msec intervall. Date: Fri, 26 Mar 2010 11:31:43 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session you can only write back the exact number of bytes you negotiated per interval. On Fri, Mar 26, 2010 at 7:27 AM, Francisco Scaramanga <scaram@hotmail.de> wrote: Now I call switch_core_session_read_frame and switch_core_session_write_frame in the same foreground loop. Then I write audio into a file and as a result I see that there are many audio gaps. There seems to be a cross effect by using switch_core_session_write_frame and switch_core_session_read_frame together. If I only use switch_core_session_read_frame in the loop, there are no gaps and everything sounds perfect! What could be the problem? while (1) { // READ tstatus = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); if (tstatus==SWITCH_STATUS_SUCCESS) { // write audio in a testfile fwrite((short *)(read_frame)->data, 2, ((read_frame)->datalen)/2 ,tmp); switch_size_t ts_rf=read_frame->timestamp; } // WRITE vector<unsigned char> vucIn; if (getAudio(&vucAudio)) // get next audio and send it back { memcpy( write_frame.data, &vucIn[0], vucIn.size()); write_frame.datalen=vucIn.size(); tstatus = switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0); } //Sleep(1);//? } Date: Mon, 22 Mar 2010 18:34:46 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session you don't use the hook functions you use a frame pointer switch_frame_t *read_frame; switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); when i said to look at the stream file example i meant in the function itself to see how to read and write audio from a channel in a foreground loop. On Mon, Mar 22, 2010 at 6:23 PM, Francisco Scaramanga <scaram@hotmail.de> wrote: I have an selfmade software which is controlled by a telephone call (ISDN/CAPI). The user calls with his phone, gets connected and can speak commands which are detected by an internal speech recognizer. Furthermore the user can accept or hangup incoming calls just by his voice command. It is also possible to dial out. Now I am adding VOIP functionality to my system and decided to use FreeSwitch. Therefore I wrote a FreeSwitch module which should be the VOIP interface for my software. The module must be able to: 1. recognize an incoming call which is the users control session (single session) I do this in statehandler function channel_on_init. 2. pick up another incoming call and intercept with my users control session. 3. Get the audio data from voip session (user control session) and send it to my application (by own tcp-socket) My idea is to use channel_write_frame to receive audio. 3. Send audio data from my application to voip user control session so the user can hear audio. My idea is to use channel_read_frame. explanation for using hooks: ---------------------------- The endpoint interface callback functions where never called in my module, even I tried to adapt the way it is done in mod_portaudio. So my workaround was to set hook functions channel_read_frame/channel_write_frame to handle audio. My problems: ------------ The hook functions are working fine if I have 2 sessions (put together by switch_ivr_intercept_session), but if I only have the single user control session no hooked function is called. In this case the only way to achieve that hooks are called, is to play audio with switch_ivr_play_file. But then, audio samples got lost sometimes. Maybe there is a better way to solve my requirements? Date: Mon, 22 Mar 2010 11:55:42 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session Why do you even need the hooks? What exactly are you trying to do? Maybe you should explain it. On Mon, Mar 22, 2010 at 5:33 AM, Francisco Scaramanga <scaram@hotmail.de> wrote: I am now using the application interface and play a file after answering the call. The call is not connected to a another session, it's just a single session. SWITCH_STANDARD_APP(mod_my_function) { /* play audio file */ switch_ivr_play_file(session, NULL, "C:\\freeswitch1.0.4\\debug\\sounds\\music\\8000\\danza-espanola-op-37-h-142-xii-arabesca.wav", NULL); } Now the hooks for channel_write_frame and channel_read_frame are called! I write the audio frames into a file for testing if everything is correct. The data written in channel_write_frame seems to be perfect, but audio written in channel_read_frame only seems to be good at first sight. If I record 20 seconds of audio and listen to the audiofile I hear that 2 or 3 times short parts are missing. static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id) { // Audio from danza-espanola-op-37-h-142-xii-arabesca.wav is written into a file fwrite((short *)frame->data, 2, frame->datalen/2 ,tmp); } static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id) { // Spoken audio samples from my microphone are written, but sometimes samples are missing fwrite((short *)frame->data, 2, frame->datalen/2 ,tmp); } Is it possible that I don't get all audio samples by hooked functions? why audio recorded in channel_write_frame is brilliant and in channel_read_frame not? Date: Tue, 16 Mar 2010 13:59:28 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session you probably want to use the application interface and a while loop while reading a frame. see most of the functions in switch_ivr_play_say On Tue, Mar 16, 2010 at 8:51 AM, Francisco Scaramanga <scaram@hotmail.de> wrote: 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. 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? Date: Tue, 16 Mar 2010 08:34:18 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session What exactly is your goal? those hooks will probably only be called if you send the channel to do something that requires reading and writing audio. On Tue, Mar 16, 2010 at 6:47 AM, Francisco Scaramanga <scaram@hotmail.de> wrote: 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 */ } Ein Postfach für Alles – bei Hotmail 5 E-Mail-Adressen online verwalten! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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:+19193869900 Alles in einem Postfach – Ich will Hotmail! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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:+19193869900 Treffe Freunde im Messenger Videochat! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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:+19193869900 Alles in einem Postfach – Ich will Hotmail! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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 googletalk:conf+888@conference.freeswitch.org pstn:+19193869900 Treffe Freunde im Messenger Videochat! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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 googletalk:conf+888@conference.freeswitch.org pstn:+19193869900 Alles in einem Postfach – Ich will Hotmail! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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 googletalk:conf+888@conference.freeswitch.org pstn:+19193869900 _________________________________________________________________ http://redirect.gimas.net/?n=M1003xIE82 Damit Privates privat bleibt! Internet Explorer 8!
you put 1 frame in write for each read with the data size i told you about in the last email On Fri, Mar 26, 2010 at 12:55 PM, Francisco Scaramanga <scaram@hotmail.de>wrote:
yes, switch_core_session_read_frame will be timed right. This is working for me, but my troubles are in switch_core_session_write_frame. Is this function timed write too when I put data into this function?
------------------------------ Date: Fri, 26 Mar 2010 12:37:04 -0500
From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session
You can use the data you have,
yes the the read will already be timed right
when you get a frame that has flag SFF_CNG you know that there was not a real frame to read but you should still write the size id determined from getting the read_impl and using read_impl->encoded_bytes_per_frame
On Fri, Mar 26, 2010 at 12:23 PM, Francisco Scaramanga <scaram@hotmail.de>wrote:
ok, which is the best mechanism to controll the amount of data. Can you recommend a timer? I use PCMA codec with 20 msec intervall.
------------------------------ Date: Fri, 26 Mar 2010 11:31:43 -0500
From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session
you can only write back the exact number of bytes you negotiated per interval.
On Fri, Mar 26, 2010 at 7:27 AM, Francisco Scaramanga <scaram@hotmail.de>wrote:
Now I call switch_core_session_read_frame and switch_core_session_write_frame in the same foreground loop. Then I write audio into a file and as a result I see that there are many audio gaps.
There seems to be a cross effect by using switch_core_session_write_frame and switch_core_session_read_frame together. If I only use switch_core_session_read_frame in the loop, there are no gaps and everything sounds perfect!
What could be the problem?
while (1) { // READ tstatus = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); if (tstatus==SWITCH_STATUS_SUCCESS) { // write audio in a testfile fwrite((short *)(read_frame)->data, 2, ((read_frame)->datalen)/2 ,tmp); switch_size_t ts_rf=read_frame->timestamp; }
// WRITE vector<unsigned char> vucIn; if (getAudio(&vucAudio)) // get next audio and send it back { memcpy( write_frame.data, &vucIn[0], vucIn.size()); write_frame.datalen=vucIn.size(); tstatus = switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0); } //Sleep(1);//? }
------------------------------ Date: Mon, 22 Mar 2010 18:34:46 -0500
From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session
you don't use the hook functions you use a frame pointer
switch_frame_t *read_frame;
switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
when i said to look at the stream file example i meant in the function itself to see how to read and write audio from a channel in a foreground loop.
On Mon, Mar 22, 2010 at 6:23 PM, Francisco Scaramanga <scaram@hotmail.de>wrote:
I have an selfmade software which is controlled by a telephone call (ISDN/CAPI). The user calls with his phone, gets connected and can speak commands which are detected by an internal speech recognizer. Furthermore the user can accept or hangup incoming calls just by his voice command. It is also possible to dial out.
Now I am adding VOIP functionality to my system and decided to use FreeSwitch. Therefore I wrote a FreeSwitch module which should be the VOIP interface for my software. The module must be able to:
1. recognize an incoming call which is the users control session (single session) I do this in statehandler function channel_on_init. 2. pick up another incoming call and intercept with my users control session. 3. Get the audio data from voip session (user control session) and send it to my application (by own tcp-socket) My idea is to use channel_write_frame to receive audio. 3. Send audio data from my application to voip user control session so the user can hear audio. My idea is to use channel_read_frame.
explanation for using hooks: ---------------------------- The endpoint interface callback functions where never called in my module, even I tried to adapt the way it is done in mod_portaudio. So my workaround was to set hook functions channel_read_frame/channel_write_frame to handle audio.
My problems: ------------ The hook functions are working fine if I have 2 sessions (put together by switch_ivr_intercept_session), but if I only have the single user control session no hooked function is called. In this case the only way to achieve that hooks are called, is to play audio with switch_ivr_play_file. But then, audio samples got lost sometimes.
Maybe there is a better way to solve my requirements?
------------------------------ Date: Mon, 22 Mar 2010 11:55:42 -0500
From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session
Why do you even need the hooks? What exactly are you trying to do? Maybe you should explain it.
On Mon, Mar 22, 2010 at 5:33 AM, Francisco Scaramanga <scaram@hotmail.de>wrote:
I am now using the application interface and play a file after answering the call. The call is not connected to a another session, it's just a single session.
SWITCH_STANDARD_APP(mod_my_function) { /* play audio file */ switch_ivr_play_file(session, NULL, "C:\\freeswitch1.0.4\\debug\\sounds\\music\\8000\\danza-espanola-op-37-h-142-xii-arabesca.wav", NULL); }
Now the hooks for channel_write_frame and channel_read_frame are called! I write the audio frames into a file for testing if everything is correct. The data written in channel_write_frame seems to be perfect, but audio written in channel_read_frame only seems to be good at first sight. If I record 20 seconds of audio and listen to the audiofile I hear that 2 or 3 times short parts are missing.
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id) { // Audio from danza-espanola-op-37-h-142-xii-arabesca.wav is written into a file fwrite((short *)frame->data, 2, frame->datalen/2 ,tmp);
} static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id) { // Spoken audio samples from my microphone are written, but sometimes samples are missing fwrite((short *)frame->data, 2, frame->datalen/2 ,tmp); }
Is it possible that I don't get all audio samples by hooked functions? why audio recorded in channel_write_frame is brilliant and in channel_read_frame not?
------------------------------ Date: Tue, 16 Mar 2010 13:59:28 -0500
From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session
you probably want to use the application interface and a while loop while reading a frame.
see most of the functions in switch_ivr_play_say
On Tue, Mar 16, 2010 at 8:51 AM, Francisco Scaramanga <scaram@hotmail.de>wrote:
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.
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?
------------------------------ Date: Tue, 16 Mar 2010 08:34:18 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session
What exactly is your goal?
those hooks will probably only be called if you send the channel to do something that requires reading and writing audio.
On Tue, Mar 16, 2010 at 6:47 AM, Francisco Scaramanga <scaram@hotmail.de>wrote:
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 */ }
------------------------------ Ein Postfach für Alles – bei Hotmail 5 E-Mail-Adressen online verwalten!<http://redirect.gimas.net/?n=M1003HM5Adressen>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire
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<http://conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org<googletalk:conf%2B888@conference.freeswitch.org> pstn:+19193869900
------------------------------ Alles in einem Postfach – Ich will Hotmail!<http://redirect.gimas.net/?n=M1003Hotmail>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire
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<http://conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org<googletalk:conf%2B888@conference.freeswitch.org> pstn:+19193869900
------------------------------ Treffe Freunde im Messenger Videochat!<http://redirect.gimas.net/?n=M1003IMVideochat>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire
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<http://conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org<googletalk:conf%2B888@conference.freeswitch.org> pstn:+19193869900
------------------------------ Alles in einem Postfach – Ich will Hotmail!<http://redirect.gimas.net/?n=M1003Hotmail>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire
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 googletalk:conf+888@conference.freeswitch.org<googletalk:conf%2B888@conference.freeswitch.org> pstn:+19193869900
------------------------------ Treffe Freunde im Messenger Videochat!<http://redirect.gimas.net/?n=M1003IMVideochat>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire
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 googletalk:conf+888@conference.freeswitch.org<googletalk:conf%2B888@conference.freeswitch.org> pstn:+19193869900
------------------------------ Alles in einem Postfach – Ich will Hotmail!<http://redirect.gimas.net/?n=M1003Hotmail>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire
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 googletalk:conf+888@conference.freeswitch.org<googletalk:conf%2B888@conference.freeswitch.org> pstn:+19193869900
------------------------------ Damit Privates privat bleibt! Internet Explorer 8!<http://redirect.gimas.net/?n=M1003IE8>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:+19193869900
Function switch_ivr_session_echo is doing the same thing as I do in my test, and it seems that something doesn't work correctly. If you just edit switch_ivr_session_echo and add 3 lines of code for logging audio data into a file, you can listen to the audio gaps. To reproduce the gaps it's the best to read a text for about 60 seconds, then you will hear it. For the test I edited the dialplan: <extension name="testit22"> <condition field="destination_number" expression="47112"> <action application="answer"/> <action application="echo"/> </condition> </extension> .. and the code.. SWITCH_DECLARE(void) switch_ivr_session_echo(switch_core_session_t *session, switch_input_args_t *args) { FILE *tmp = NULL; ... ... status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); if (!SWITCH_READ_ACCEPTABLE(status)) { break; } /*******************************************************************************************************************/ /* TEST CODE FOR WRITING AUDIO INTO FILE , IF RECORD 1 MINUTE AND LISTEN TO THE FILE YOU WILL GET AUDIO GAPS. */ tmp = fopen("C:\\files\\recorded_echo", "ab"); fwrite((short *)(read_frame)->data, 2, ((read_frame)->datalen)/2 ,tmp); fclose(tmp); /*******************************************************************************************************************/ ... ... } Furthermore, If you remove the line "switch_core_session_write_frame(session, read_frame, SWITCH_IO_FLAG_NONE, 0);" in function switch_ivr_session_echo, echo will not be sent back, but then spoken audio will be recorded correctly. This is what I meant with possible cross effect. Date: Fri, 26 Mar 2010 13:07:14 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session you put 1 frame in write for each read with the data size i told you about in the last email On Fri, Mar 26, 2010 at 12:55 PM, Francisco Scaramanga <scaram@hotmail.de> wrote: yes, switch_core_session_read_frame will be timed right. This is working for me, but my troubles are in switch_core_session_write_frame. Is this function timed write too when I put data into this function? Date: Fri, 26 Mar 2010 12:37:04 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session You can use the data you have, yes the the read will already be timed right when you get a frame that has flag SFF_CNG you know that there was not a real frame to read but you should still write the size id determined from getting the read_impl and using read_impl->encoded_bytes_per_frame On Fri, Mar 26, 2010 at 12:23 PM, Francisco Scaramanga <scaram@hotmail.de> wrote: ok, which is the best mechanism to controll the amount of data. Can you recommend a timer? I use PCMA codec with 20 msec intervall. Date: Fri, 26 Mar 2010 11:31:43 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session you can only write back the exact number of bytes you negotiated per interval. On Fri, Mar 26, 2010 at 7:27 AM, Francisco Scaramanga <scaram@hotmail.de> wrote: Now I call switch_core_session_read_frame and switch_core_session_write_frame in the same foreground loop. Then I write audio into a file and as a result I see that there are many audio gaps. There seems to be a cross effect by using switch_core_session_write_frame and switch_core_session_read_frame together. If I only use switch_core_session_read_frame in the loop, there are no gaps and everything sounds perfect! What could be the problem? while (1) { // READ tstatus = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); if (tstatus==SWITCH_STATUS_SUCCESS) { // write audio in a testfile fwrite((short *)(read_frame)->data, 2, ((read_frame)->datalen)/2 ,tmp); switch_size_t ts_rf=read_frame->timestamp; } // WRITE vector<unsigned char> vucIn; if (getAudio(&vucAudio)) // get next audio and send it back { memcpy( write_frame.data, &vucIn[0], vucIn.size()); write_frame.datalen=vucIn.size(); tstatus = switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0); } //Sleep(1);//? } Date: Mon, 22 Mar 2010 18:34:46 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session you don't use the hook functions you use a frame pointer switch_frame_t *read_frame; switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); when i said to look at the stream file example i meant in the function itself to see how to read and write audio from a channel in a foreground loop. On Mon, Mar 22, 2010 at 6:23 PM, Francisco Scaramanga <scaram@hotmail.de> wrote: I have an selfmade software which is controlled by a telephone call (ISDN/CAPI). The user calls with his phone, gets connected and can speak commands which are detected by an internal speech recognizer. Furthermore the user can accept or hangup incoming calls just by his voice command. It is also possible to dial out. Now I am adding VOIP functionality to my system and decided to use FreeSwitch. Therefore I wrote a FreeSwitch module which should be the VOIP interface for my software. The module must be able to: 1. recognize an incoming call which is the users control session (single session) I do this in statehandler function channel_on_init. 2. pick up another incoming call and intercept with my users control session. 3. Get the audio data from voip session (user control session) and send it to my application (by own tcp-socket) My idea is to use channel_write_frame to receive audio. 3. Send audio data from my application to voip user control session so the user can hear audio. My idea is to use channel_read_frame. explanation for using hooks: ---------------------------- The endpoint interface callback functions where never called in my module, even I tried to adapt the way it is done in mod_portaudio. So my workaround was to set hook functions channel_read_frame/channel_write_frame to handle audio. My problems: ------------ The hook functions are working fine if I have 2 sessions (put together by switch_ivr_intercept_session), but if I only have the single user control session no hooked function is called. In this case the only way to achieve that hooks are called, is to play audio with switch_ivr_play_file. But then, audio samples got lost sometimes. Maybe there is a better way to solve my requirements? Date: Mon, 22 Mar 2010 11:55:42 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session Why do you even need the hooks? What exactly are you trying to do? Maybe you should explain it. On Mon, Mar 22, 2010 at 5:33 AM, Francisco Scaramanga <scaram@hotmail.de> wrote: I am now using the application interface and play a file after answering the call. The call is not connected to a another session, it's just a single session. SWITCH_STANDARD_APP(mod_my_function) { /* play audio file */ switch_ivr_play_file(session, NULL, "C:\\freeswitch1.0.4\\debug\\sounds\\music\\8000\\danza-espanola-op-37-h-142-xii-arabesca.wav", NULL); } Now the hooks for channel_write_frame and channel_read_frame are called! I write the audio frames into a file for testing if everything is correct. The data written in channel_write_frame seems to be perfect, but audio written in channel_read_frame only seems to be good at first sight. If I record 20 seconds of audio and listen to the audiofile I hear that 2 or 3 times short parts are missing. static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id) { // Audio from danza-espanola-op-37-h-142-xii-arabesca.wav is written into a file fwrite((short *)frame->data, 2, frame->datalen/2 ,tmp); } static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id) { // Spoken audio samples from my microphone are written, but sometimes samples are missing fwrite((short *)frame->data, 2, frame->datalen/2 ,tmp); } Is it possible that I don't get all audio samples by hooked functions? why audio recorded in channel_write_frame is brilliant and in channel_read_frame not? Date: Tue, 16 Mar 2010 13:59:28 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session you probably want to use the application interface and a while loop while reading a frame. see most of the functions in switch_ivr_play_say On Tue, Mar 16, 2010 at 8:51 AM, Francisco Scaramanga <scaram@hotmail.de> wrote: 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. 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? Date: Tue, 16 Mar 2010 08:34:18 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session What exactly is your goal? those hooks will probably only be called if you send the channel to do something that requires reading and writing audio. On Tue, Mar 16, 2010 at 6:47 AM, Francisco Scaramanga <scaram@hotmail.de> wrote: 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 */ } Ein Postfach für Alles – bei Hotmail 5 E-Mail-Adressen online verwalten! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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:+19193869900 Alles in einem Postfach – Ich will Hotmail! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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:+19193869900 Treffe Freunde im Messenger Videochat! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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:+19193869900 Alles in einem Postfach – Ich will Hotmail! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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 googletalk:conf+888@conference.freeswitch.org pstn:+19193869900 Treffe Freunde im Messenger Videochat! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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 googletalk:conf+888@conference.freeswitch.org pstn:+19193869900 Alles in einem Postfach – Ich will Hotmail! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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 googletalk:conf+888@conference.freeswitch.org pstn:+19193869900 Damit Privates privat bleibt! Internet Explorer 8! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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 googletalk:conf+888@conference.freeswitch.org pstn:+19193869900 _________________________________________________________________ http://redirect.gimas.net/?n=M1003xWin7Geschenk2 Hol dir das Gratis-Geschenkpaket von Windows 7 für deinen PC ab!
The code you are looking at for playback and record has also changed the format of the channel to signed linear before writing, you are tyring to mimic that same thing without setting the read codec. you should be treating the input as unsigned char and writing the full frame->datalen into your file. you also may want to not open and close the file every 20ms since that can't be good on the OS. I hate to break it to you, but if you look around at all the code in FS, it's safe to assume that the code to read and write media is well tested, the more you start understanding that you need to learn more instead of thinking something is wrong with the code, the sooner you will find what you are looking for. You might want to try irc in #freeswitch-dev or #freeswitch on irc.freenode.net for a little more help since most people don't check this list for someone asking to learn how to program audio code with FS. On Fri, Mar 26, 2010 at 7:26 PM, Francisco Scaramanga <scaram@hotmail.de>wrote:
Function switch_ivr_session_echo is doing the same thing as I do in my test, and it seems that something doesn't work correctly. If you just edit switch_ivr_session_echo and add 3 lines of code for logging audio data into a file, you can listen to the audio gaps.
To reproduce the gaps it's the best to read a text for about 60 seconds, then you will hear it.
For the test I edited the dialplan:
<extension name="testit22"> <condition field="destination_number" expression="47112"> <action application="answer"/> <action application="echo"/> </condition> </extension>
.. and the code..
SWITCH_DECLARE(void) switch_ivr_session_echo(switch_core_session_t *session, switch_input_args_t *args) { FILE *tmp = NULL; ... ...
status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); if (!SWITCH_READ_ACCEPTABLE(status)) { break; }
/*******************************************************************************************************************/ /* TEST CODE FOR WRITING AUDIO INTO FILE , IF RECORD 1 MINUTE AND LISTEN TO THE FILE YOU WILL GET AUDIO GAPS. */ tmp = fopen("C:\\files\\recorded_echo", "ab");
fwrite((short *)(read_frame)->data, 2, ((read_frame)->datalen)/2 ,tmp); fclose(tmp);
/*******************************************************************************************************************/ ... ... }
Furthermore, If you remove the line "switch_core_session_write_frame(session, read_frame, SWITCH_IO_FLAG_NONE, 0);" in function switch_ivr_session_echo, echo will not be sent back, but then spoken audio will be recorded correctly. This is what I meant with possible cross effect.
------------------------------ Date: Fri, 26 Mar 2010 13:07:14 -0500
From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session
you put 1 frame in write for each read with the data size i told you about in the last email
On Fri, Mar 26, 2010 at 12:55 PM, Francisco Scaramanga <scaram@hotmail.de>wrote:
yes, switch_core_session_read_frame will be timed right. This is working for me, but my troubles are in switch_core_session_write_frame. Is this function timed write too when I put data into this function?
------------------------------ Date: Fri, 26 Mar 2010 12:37:04 -0500
From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session
You can use the data you have,
yes the the read will already be timed right
when you get a frame that has flag SFF_CNG you know that there was not a real frame to read but you should still write the size id determined from getting the read_impl and using read_impl->encoded_bytes_per_frame
On Fri, Mar 26, 2010 at 12:23 PM, Francisco Scaramanga <scaram@hotmail.de>wrote:
ok, which is the best mechanism to controll the amount of data. Can you recommend a timer? I use PCMA codec with 20 msec intervall.
------------------------------ Date: Fri, 26 Mar 2010 11:31:43 -0500
From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session
you can only write back the exact number of bytes you negotiated per interval.
On Fri, Mar 26, 2010 at 7:27 AM, Francisco Scaramanga <scaram@hotmail.de>wrote:
Now I call switch_core_session_read_frame and switch_core_session_write_frame in the same foreground loop. Then I write audio into a file and as a result I see that there are many audio gaps.
There seems to be a cross effect by using switch_core_session_write_frame and switch_core_session_read_frame together. If I only use switch_core_session_read_frame in the loop, there are no gaps and everything sounds perfect!
What could be the problem?
while (1) { // READ tstatus = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); if (tstatus==SWITCH_STATUS_SUCCESS) { // write audio in a testfile fwrite((short *)(read_frame)->data, 2, ((read_frame)->datalen)/2 ,tmp); switch_size_t ts_rf=read_frame->timestamp; }
// WRITE vector<unsigned char> vucIn; if (getAudio(&vucAudio)) // get next audio and send it back { memcpy( write_frame.data, &vucIn[0], vucIn.size()); write_frame.datalen=vucIn.size(); tstatus = switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0); } //Sleep(1);//? }
------------------------------ Date: Mon, 22 Mar 2010 18:34:46 -0500
From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session
you don't use the hook functions you use a frame pointer
switch_frame_t *read_frame;
switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
when i said to look at the stream file example i meant in the function itself to see how to read and write audio from a channel in a foreground loop.
On Mon, Mar 22, 2010 at 6:23 PM, Francisco Scaramanga <scaram@hotmail.de>wrote:
I have an selfmade software which is controlled by a telephone call (ISDN/CAPI). The user calls with his phone, gets connected and can speak commands which are detected by an internal speech recognizer. Furthermore the user can accept or hangup incoming calls just by his voice command. It is also possible to dial out.
Now I am adding VOIP functionality to my system and decided to use FreeSwitch. Therefore I wrote a FreeSwitch module which should be the VOIP interface for my software. The module must be able to:
1. recognize an incoming call which is the users control session (single session) I do this in statehandler function channel_on_init. 2. pick up another incoming call and intercept with my users control session. 3. Get the audio data from voip session (user control session) and send it to my application (by own tcp-socket) My idea is to use channel_write_frame to receive audio. 3. Send audio data from my application to voip user control session so the user can hear audio. My idea is to use channel_read_frame.
explanation for using hooks: ---------------------------- The endpoint interface callback functions where never called in my module, even I tried to adapt the way it is done in mod_portaudio. So my workaround was to set hook functions channel_read_frame/channel_write_frame to handle audio.
My problems: ------------ The hook functions are working fine if I have 2 sessions (put together by switch_ivr_intercept_session), but if I only have the single user control session no hooked function is called. In this case the only way to achieve that hooks are called, is to play audio with switch_ivr_play_file. But then, audio samples got lost sometimes.
Maybe there is a better way to solve my requirements?
------------------------------ Date: Mon, 22 Mar 2010 11:55:42 -0500
From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session
Why do you even need the hooks? What exactly are you trying to do? Maybe you should explain it.
On Mon, Mar 22, 2010 at 5:33 AM, Francisco Scaramanga <scaram@hotmail.de>wrote:
I am now using the application interface and play a file after answering the call. The call is not connected to a another session, it's just a single session.
SWITCH_STANDARD_APP(mod_my_function) { /* play audio file */ switch_ivr_play_file(session, NULL, "C:\\freeswitch1.0.4\\debug\\sounds\\music\\8000\\danza-espanola-op-37-h-142-xii-arabesca.wav", NULL); }
Now the hooks for channel_write_frame and channel_read_frame are called! I write the audio frames into a file for testing if everything is correct. The data written in channel_write_frame seems to be perfect, but audio written in channel_read_frame only seems to be good at first sight. If I record 20 seconds of audio and listen to the audiofile I hear that 2 or 3 times short parts are missing.
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id) { // Audio from danza-espanola-op-37-h-142-xii-arabesca.wav is written into a file fwrite((short *)frame->data, 2, frame->datalen/2 ,tmp);
} static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id) { // Spoken audio samples from my microphone are written, but sometimes samples are missing fwrite((short *)frame->data, 2, frame->datalen/2 ,tmp); }
Is it possible that I don't get all audio samples by hooked functions? why audio recorded in channel_write_frame is brilliant and in channel_read_frame not?
------------------------------ Date: Tue, 16 Mar 2010 13:59:28 -0500
From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session
you probably want to use the application interface and a while loop while reading a frame.
see most of the functions in switch_ivr_play_say
On Tue, Mar 16, 2010 at 8:51 AM, Francisco Scaramanga <scaram@hotmail.de>wrote:
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.
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?
------------------------------ Date: Tue, 16 Mar 2010 08:34:18 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session
What exactly is your goal?
those hooks will probably only be called if you send the channel to do something that requires reading and writing audio.
On Tue, Mar 16, 2010 at 6:47 AM, Francisco Scaramanga <scaram@hotmail.de>wrote:
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 */ }
------------------------------ Ein Postfach für Alles – bei Hotmail 5 E-Mail-Adressen online verwalten!<http://redirect.gimas.net/?n=M1003HM5Adressen>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire
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<http://conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org<googletalk:conf%2B888@conference.freeswitch.org> pstn:+19193869900
------------------------------ Alles in einem Postfach – Ich will Hotmail!<http://redirect.gimas.net/?n=M1003Hotmail>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire
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<http://conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org<googletalk:conf%2B888@conference.freeswitch.org> pstn:+19193869900
------------------------------ Treffe Freunde im Messenger Videochat!<http://redirect.gimas.net/?n=M1003IMVideochat>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire
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<http://conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org<googletalk:conf%2B888@conference.freeswitch.org> pstn:+19193869900
------------------------------ Alles in einem Postfach – Ich will Hotmail!<http://redirect.gimas.net/?n=M1003Hotmail>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire
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 googletalk:conf+888@conference.freeswitch.org<googletalk:conf%2B888@conference.freeswitch.org> pstn:+19193869900
------------------------------ Treffe Freunde im Messenger Videochat!<http://redirect.gimas.net/?n=M1003IMVideochat>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire
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 googletalk:conf+888@conference.freeswitch.org<googletalk:conf%2B888@conference.freeswitch.org> pstn:+19193869900
------------------------------ Alles in einem Postfach – Ich will Hotmail!<http://redirect.gimas.net/?n=M1003Hotmail>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire
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 googletalk:conf+888@conference.freeswitch.org<googletalk:conf%2B888@conference.freeswitch.org> pstn:+19193869900
------------------------------ Damit Privates privat bleibt! Internet Explorer 8!<http://redirect.gimas.net/?n=M1003IE8>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire
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 googletalk:conf+888@conference.freeswitch.org<googletalk:conf%2B888@conference.freeswitch.org> pstn:+19193869900
------------------------------ Hol dir das Gratis-Geschenkpaket von Windows 7 für deinen PC ab!<http://redirect.gimas.net/?n=M1003Win7Geschenk>
_______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:+19193869900
I solved it. My implementation was not the problem but my softphone had acoustic echo cancellation (AEC) setting enabled which caused the problem (even I use an headset). I didn't know this feature before so it was hard to find out.. Date: Fri, 26 Mar 2010 19:47:01 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session The code you are looking at for playback and record has also changed the format of the channel to signed linear before writing, you are tyring to mimic that same thing without setting the read codec. you should be treating the input as unsigned char and writing the full frame->datalen into your file. you also may want to not open and close the file every 20ms since that can't be good on the OS. I hate to break it to you, but if you look around at all the code in FS, it's safe to assume that the code to read and write media is well tested, the more you start understanding that you need to learn more instead of thinking something is wrong with the code, the sooner you will find what you are looking for. You might want to try irc in #freeswitch-dev or #freeswitch on irc.freenode.net for a little more help since most people don't check this list for someone asking to learn how to program audio code with FS. On Fri, Mar 26, 2010 at 7:26 PM, Francisco Scaramanga <scaram@hotmail.de> wrote: Function switch_ivr_session_echo is doing the same thing as I do in my test, and it seems that something doesn't work correctly. If you just edit switch_ivr_session_echo and add 3 lines of code for logging audio data into a file, you can listen to the audio gaps. To reproduce the gaps it's the best to read a text for about 60 seconds, then you will hear it. For the test I edited the dialplan: <extension name="testit22"> <condition field="destination_number" expression="47112"> <action application="answer"/> <action application="echo"/> </condition> </extension> .. and the code.. SWITCH_DECLARE(void) switch_ivr_session_echo(switch_core_session_t *session, switch_input_args_t *args) { FILE *tmp = NULL; ... ... status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); if (!SWITCH_READ_ACCEPTABLE(status)) { break; } /*******************************************************************************************************************/ /* TEST CODE FOR WRITING AUDIO INTO FILE , IF RECORD 1 MINUTE AND LISTEN TO THE FILE YOU WILL GET AUDIO GAPS. */ tmp = fopen("C:\\files\\recorded_echo", "ab"); fwrite((short *)(read_frame)->data, 2, ((read_frame)->datalen)/2 ,tmp); fclose(tmp); /*******************************************************************************************************************/ ... ... } Furthermore, If you remove the line "switch_core_session_write_frame(session, read_frame, SWITCH_IO_FLAG_NONE, 0);" in function switch_ivr_session_echo, echo will not be sent back, but then spoken audio will be recorded correctly. This is what I meant with possible cross effect. Date: Fri, 26 Mar 2010 13:07:14 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session you put 1 frame in write for each read with the data size i told you about in the last email On Fri, Mar 26, 2010 at 12:55 PM, Francisco Scaramanga <scaram@hotmail.de> wrote: yes, switch_core_session_read_frame will be timed right. This is working for me, but my troubles are in switch_core_session_write_frame. Is this function timed write too when I put data into this function? Date: Fri, 26 Mar 2010 12:37:04 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session You can use the data you have, yes the the read will already be timed right when you get a frame that has flag SFF_CNG you know that there was not a real frame to read but you should still write the size id determined from getting the read_impl and using read_impl->encoded_bytes_per_frame On Fri, Mar 26, 2010 at 12:23 PM, Francisco Scaramanga <scaram@hotmail.de> wrote: ok, which is the best mechanism to controll the amount of data. Can you recommend a timer? I use PCMA codec with 20 msec intervall. Date: Fri, 26 Mar 2010 11:31:43 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session you can only write back the exact number of bytes you negotiated per interval. On Fri, Mar 26, 2010 at 7:27 AM, Francisco Scaramanga <scaram@hotmail.de> wrote: Now I call switch_core_session_read_frame and switch_core_session_write_frame in the same foreground loop. Then I write audio into a file and as a result I see that there are many audio gaps. There seems to be a cross effect by using switch_core_session_write_frame and switch_core_session_read_frame together. If I only use switch_core_session_read_frame in the loop, there are no gaps and everything sounds perfect! What could be the problem? while (1) { // READ tstatus = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); if (tstatus==SWITCH_STATUS_SUCCESS) { // write audio in a testfile fwrite((short *)(read_frame)->data, 2, ((read_frame)->datalen)/2 ,tmp); switch_size_t ts_rf=read_frame->timestamp; } // WRITE vector<unsigned char> vucIn; if (getAudio(&vucAudio)) // get next audio and send it back { memcpy( write_frame.data, &vucIn[0], vucIn.size()); write_frame.datalen=vucIn.size(); tstatus = switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0); } //Sleep(1);//? } Date: Mon, 22 Mar 2010 18:34:46 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session you don't use the hook functions you use a frame pointer switch_frame_t *read_frame; switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); when i said to look at the stream file example i meant in the function itself to see how to read and write audio from a channel in a foreground loop. On Mon, Mar 22, 2010 at 6:23 PM, Francisco Scaramanga <scaram@hotmail.de> wrote: I have an selfmade software which is controlled by a telephone call (ISDN/CAPI). The user calls with his phone, gets connected and can speak commands which are detected by an internal speech recognizer. Furthermore the user can accept or hangup incoming calls just by his voice command. It is also possible to dial out. Now I am adding VOIP functionality to my system and decided to use FreeSwitch. Therefore I wrote a FreeSwitch module which should be the VOIP interface for my software. The module must be able to: 1. recognize an incoming call which is the users control session (single session) I do this in statehandler function channel_on_init. 2. pick up another incoming call and intercept with my users control session. 3. Get the audio data from voip session (user control session) and send it to my application (by own tcp-socket) My idea is to use channel_write_frame to receive audio. 3. Send audio data from my application to voip user control session so the user can hear audio. My idea is to use channel_read_frame. explanation for using hooks: ---------------------------- The endpoint interface callback functions where never called in my module, even I tried to adapt the way it is done in mod_portaudio. So my workaround was to set hook functions channel_read_frame/channel_write_frame to handle audio. My problems: ------------ The hook functions are working fine if I have 2 sessions (put together by switch_ivr_intercept_session), but if I only have the single user control session no hooked function is called. In this case the only way to achieve that hooks are called, is to play audio with switch_ivr_play_file. But then, audio samples got lost sometimes. Maybe there is a better way to solve my requirements? Date: Mon, 22 Mar 2010 11:55:42 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session Why do you even need the hooks? What exactly are you trying to do? Maybe you should explain it. On Mon, Mar 22, 2010 at 5:33 AM, Francisco Scaramanga <scaram@hotmail.de> wrote: I am now using the application interface and play a file after answering the call. The call is not connected to a another session, it's just a single session. SWITCH_STANDARD_APP(mod_my_function) { /* play audio file */ switch_ivr_play_file(session, NULL, "C:\\freeswitch1.0.4\\debug\\sounds\\music\\8000\\danza-espanola-op-37-h-142-xii-arabesca.wav", NULL); } Now the hooks for channel_write_frame and channel_read_frame are called! I write the audio frames into a file for testing if everything is correct. The data written in channel_write_frame seems to be perfect, but audio written in channel_read_frame only seems to be good at first sight. If I record 20 seconds of audio and listen to the audiofile I hear that 2 or 3 times short parts are missing. static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id) { // Audio from danza-espanola-op-37-h-142-xii-arabesca.wav is written into a file fwrite((short *)frame->data, 2, frame->datalen/2 ,tmp); } static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id) { // Spoken audio samples from my microphone are written, but sometimes samples are missing fwrite((short *)frame->data, 2, frame->datalen/2 ,tmp); } Is it possible that I don't get all audio samples by hooked functions? why audio recorded in channel_write_frame is brilliant and in channel_read_frame not? Date: Tue, 16 Mar 2010 13:59:28 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session you probably want to use the application interface and a while loop while reading a frame. see most of the functions in switch_ivr_play_say On Tue, Mar 16, 2010 at 8:51 AM, Francisco Scaramanga <scaram@hotmail.de> wrote: 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. 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? Date: Tue, 16 Mar 2010 08:34:18 -0500 From: anthony.minessale@gmail.com To: freeswitch-dev@lists.freeswitch.org Subject: Re: [Freeswitch-dev] hooked functions are not called while using one single session What exactly is your goal? those hooks will probably only be called if you send the channel to do something that requires reading and writing audio. On Tue, Mar 16, 2010 at 6:47 AM, Francisco Scaramanga <scaram@hotmail.de> wrote: 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 */ } Ein Postfach für Alles – bei Hotmail 5 E-Mail-Adressen online verwalten! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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:+19193869900 Alles in einem Postfach – Ich will Hotmail! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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:+19193869900 Treffe Freunde im Messenger Videochat! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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:+19193869900 Alles in einem Postfach – Ich will Hotmail! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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 googletalk:conf+888@conference.freeswitch.org pstn:+19193869900 Treffe Freunde im Messenger Videochat! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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 googletalk:conf+888@conference.freeswitch.org pstn:+19193869900 Alles in einem Postfach – Ich will Hotmail! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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 googletalk:conf+888@conference.freeswitch.org pstn:+19193869900 Damit Privates privat bleibt! Internet Explorer 8! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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 googletalk:conf+888@conference.freeswitch.org pstn:+19193869900 Hol dir das Gratis-Geschenkpaket von Windows 7 für deinen PC ab! _______________________________________________ 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/ Twitter: http://twitter.com/FreeSWITCH_wire 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 googletalk:conf+888@conference.freeswitch.org pstn:+19193869900 _________________________________________________________________ http://redirect.gimas.net/?n=M1004xWin72 Windows 7 - Alles was Du brauchst und noch viel mehr!
participants (4)
-
Anthony Minessale
-
Brian West
-
Francisco Scaramanga
-
Gledhill, James