A few years ago I wrote a small program to transform a pcap into a wav file - the codec in use was SILK.
These days I'm dealing with Opus, and I have to say things are greatly simplified, in particular if you consider opus-tools, a set of utilities to handle opus files and traces.
One of those tools, opusrtp, can do live captures and write the interpreted payload into a .opus file.
Still, what I needed was to achieve the same result but from a pcap already existing, i.e. "offline".
So I come up with a small - quite shamlessly copy&pasted - patch to opusrtc, which is now in this fork.
Once you have a pcap with an RTP stream with opus (say in input.pcap) you can retrieve the .opus equivalent (in rtpdump.opus) with:
./opusrtp --extract input.pcap
Then you can generate an audible wav file with:
./opusdec --rate 8000 rtpdump.opus output.wav