How to record my phone voice when it is answered

Aug 27, 2013 at 3:46 PM
Hi i am using __ATAPI__2.0 through DIALOGIC CARD, i have some simple application it can able to connecting call and answering call , but in this dll i didn't find record method any where. can you suggest me is there any option to record voice.

Regards with,
A.Ashok kumar,
SST Soft pvt l,
Aug 27, 2013 at 3:53 PM
TAPI 2.0 (upon which ATAPI is based) does not support media control. It was call control only. The media was performed using the .wav device driver (which had to be written by the h/w manufacturer). You can query for the proper Id using the GetWaveDeviceId() method on the call and then use P/Invoke to talk to the appropriate multimedia APIs. I am not aware of any really good samples out there as TAPI2 was never really used much for this purpose.

Instead, Microsoft pushed out TAPI 3.0 which had media control built-in, but it was much harder to use - there are several samples out there and there is a thin wrapper library over the COM interfaces on codeplex - which you can use to program against it with C#. For a starting point try:

Good luck!

Aug 28, 2013 at 6:53 AM
Thank you for replying Mr.Mark Smith,
I am using simple auto attendant application. This application is running fine but the phone playing voice is not clear some distraction is coming along with voice. Recording phone voice is worse is not clear. How can i overcome this give me some suggestions. is there any way to change audio properties. In default properties are configured as PCM 8-bit,11025Hz,88kbps,mono, but i want to change PCM 16-bit,8000Hz
Aug 28, 2013 at 5:23 PM
Set the MediaFormat property on the TTerminal. It takes an AM_MEDIA_TYPE which has all the properties you are looking for. Here's the MSDN documentation on the structure:

So, create one of these, set all the properties and then assign it to the TTerminal you are using to manage the stream.

good luck,

Aug 29, 2013 at 9:39 AM
Thank you mark i feel happy to see your reply, i need one more help from you

In OnFileTerminal event

If i am assigning the properties after requesting to the terminal it is
throwing the following exception

ActiveCall.RecordTerminal = ActiveCall.CallOn.RequestTerminal(TTerminal.FileRecordingTerminal, TAPIMEDIATYPES.MULTITRACK, TERMINAL_DIRECTION.TD_RENDER);
ActiveCall.RecordTerminal.MediaFormat.SubType = SubType.MEDIASUBTYPE_PCM;
The operation is not supported at this time.

if in case i am assigning the properties before requesting the terminal then terminal is
null so it is raising this exception

Object reference not set to an instance of an object.
ActiveCall.RecordTerminal.MediaFormat.SubType = SubType.MEDIASUBTYPE_PCM;
ActiveCall.RecordTerminal = ActiveCall.CallOn.RequestTerminal(TTerminal.FileRecordingTerminal, TAPIMEDIATYPES.AUDIO, TERMINAL_DIRECTION.TD_RENDER);

i am having big confusion what is right to assigning the media properties for the record terminal
Aug 29, 2013 at 8:02 PM
I'm not sure honestly - it's not something I've ever tried to do. The underlying API comes from the ITAMMediaFormat interface which is documented here:

It's optional - i.e. the media service provider doesn't have to support it, so it's possible that it's not available for you. I'd look at some of the native API samples and see when it gets invoked.