title: How can I convert the RTP payload containing SILK-encoded audio into a file?
body: <p>I have the pcap of a VoIP call involving <a href="http://dev.skype.com/silk" rel="nofollow">SILK</a>.
  I'm able to see in Wireshark the RTP payload.
  From the RTP headers I can understand the sample rate (e.g. 24 KHz) and the frame size (e.g. 20 ms).
  What I'd like to do is extract the RTP payload and generate a file containing the SILK-encoded audio.
  From <a href="http://cdn.dev.skype.com/developer/resources/SILK_RTP_PayloadFormat.pdf" rel="nofollow">the RTP payload format</a> description I can see that in the case of storage in a file, each block of audio needs a block header, to specify the sample rate and block size (because the block size is variable and can be different on each frame).</p>
  
  <p>How can I generate a file with the correct file header ("magic number") and add a block header for each block of audio?</p>
  
  <p>I can use a few different programming languages so I'm mainly interested in the required algorithm, but would appreciate references to code implementations (or perhaps some existing tool?).</p>