[Freeswitch-dev] switch_core_media_bug_add and some related questions

Leon de Rooij leon at scarlet-internet.nl
Thu Oct 1 02:45:34 PDT 2009

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  

- 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 !



More information about the FreeSWITCH-dev mailing list