How to Write incoming stream of call to Pipe or socket?


I am developing an IVR using Asterisks and need a help regarding that…:

I need to write the incoming call stream to Pipe or a Socket instead of recording the incoming call to .wav or .gsm file. Has anyone done this sort of thing before…? Which part of the code i have to modify in asterisk in order to achieve this task ? Plz help

Thanks in advance,

Waiting for your positive and quick response as always…