[Freeswitch-dev] switch_core_media_bug_add and some related questions

Anthony Minessale anthony.minessale at gmail.com
Thu Oct 1 14:39:36 PDT 2009

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.
> - 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 <MSN%3Aanthony_minessale at hotmail.com>
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<PAYPAL%3Aanthony.minessale at gmail.com>
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org <sip%3A888 at conference.freeswitch.org>
iax:guest at conference.freeswitch.org/888
googletalk:conf+888 at conference.freeswitch.org<googletalk%3Aconf%2B888 at conference.freeswitch.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20091001/665ffb0d/attachment-0001.html 

More information about the FreeSWITCH-dev mailing list