[Freeswitch-dev] switch_core_media_bug_add and some related questions

Leon de Rooij leon at scarlet-internet.nl
Thu Oct 1 14:48:19 PDT 2009


Thanks, that's precisely the info I need :)

On Thu, 2009-10-01 at 16:39 -0500, Anthony Minessale wrote:
> READ_STREAM and WRITE_STREAM give you muxed stream of both directions
> at once by buffering it.
> 
> READ_REPLACE and WRITE_REPLACE give you the packets as they happen in
> that particular direction with added capability that you can write new
> data into the frame to take it's place.
> 
> The format in a media bug is always raw signed linear.
> 
> datalen is the size in bytes of the decoded payload.
> 
> g711 decodes to 320 bytes per 20ms packet
> g722 decodes to twice that, 640, since it's 16lhz audio.
> 
> 
> 
> On Thu, Oct 1, 2009 at 4:45 AM, Leon de Rooij
> <leon at scarlet-internet.nl> wrote:
>         Hi all,
>         
>         I'm trying to make a legal intercept module. My first attempt
>         was to
>         get the raw RTP packets from switch_frame_t, but they don't
>         seem to be
>         available. My second attempt is to get the raw pcm data from
>         the
>         frames, which seems to work. I still have a few questions
>         though:
>         
>         - On setting the mediabug (switch_core_media_bug_add), I can
>         pass an
>         enum. Is there a difference between SMBF_BOTH (0) or
>         SMBF_READ_STREAM
>         | SMBF_WRITE_STREAM (1+2=3) ?
>         
>         - In the callback function passed to the bug, what does each
>         of the
>         following switch_abc_type_t mean ? At first I assumed that
>         READ and
>         WRITE state the direction of the media, but some recording
>         functions
>         only use the READ so that can't be true.
>         
>         SWITCH_ABC_TYPE_INIT
>         SWITCH_ABC_TYPE_READ_PING
>         SWITCH_ABC_TYPE_CLOSE
>         SWITCH_ABC_TYPE_READ
>         SWITCH_ABC_TYPE_WRITE
>         SWITCH_ABC_TYPE_READ_REPLACE
>         SWITCH_ABC_TYPE_WRITE_REPLACE
>         
>         - When the callback function is called with
>         SWITCH_ABC_TYPE_READ, I'm
>         doing a switch_core_media_bug_read to copy all media to a
>         switch_frame_t. To then get the raw data, I see in many
>         examples that
>         the size of the frame is retrieved by "(switch_size_t)
>         frame.datalen /
>         2". Why the division by two ?
>         
>         - I thought that frame.data contained a un-encoded version of
>         the RTP
>         packet, but the datalen seems to differ when I'm calling in
>         over g711
>         or g722. What format is frame.data ?
>         
>         Thanks a lot !
>         
>         regards,
>         
>         Leon
>         
>         _______________________________________________
>         FreeSWITCH-dev mailing list
>         FreeSWITCH-dev at lists.freeswitch.org
>         http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>         UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
>         http://www.freeswitch.org
> 
> 
> 
> -- 
> Anthony Minessale II
> 
> FreeSWITCH http://www.freeswitch.org/
> ClueCon http://www.cluecon.com/
> Twitter: http://twitter.com/FreeSWITCH_wire
> 
> AIM: anthm
> MSN:anthony_minessale at hotmail.com
> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
> IRC: irc.freenode.net #freeswitch
> 
> FreeSWITCH Developer Conference
> sip:888 at conference.freeswitch.org
> iax:guest at conference.freeswitch.org/888
> googletalk:conf+888 at conference.freeswitch.org
> pstn:213-799-1400
> _______________________________________________
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org




More information about the FreeSWITCH-dev mailing list