Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using tapi3 and MSP for playing wav files on call

Status
Not open for further replies.

khernandez

Systems Engineer
Feb 23, 2021
2
SV
Hi everyone,

I am developing a C# system using tapi3 for playing wav files on a created call, and I would like to know why is it that my code is not working, i can create and answer to calls but when I want to play the audio file there's an error, this is the code snippet for playing the wavs:
TAPI3Lib.ITAddress ln = null;
ln = ia[line]; // ia -> an array of ITAddresses, line -> the array position for the specified line item to make the call
ITBasicCallControl2 basicCallControl2 = (ITBasicCallControl2)bcc;
var terminal = basicCallControl2.RequestTerminal(TapiConstants.CLSID_String_FilePlaybackTerminal,
TapiConstants.TAPIMEDIATYPE_AUDIO, TERMINAL_DIRECTION.TD_CAPTURE);

ITMediaPlayback mediaPlayback = (ITMediaPlayback)terminal;
object[] wavList = new object[2];
wavList[0] = "test.wav";
mediaPlayback.PlayList = wavList;
ITMediaControl mediaControl = (ITMediaControl)mediaPlayback;
MessageBox.Show(mediaControl.MediaState.ToString());
mediaControl.Start();

The red line is where is giving the error "specified cast is not valid", I have tested some examples from internet and they give the same type of error when happens the conversion between ITBasicControl2 interface and ITerminal interface, found a managed code in c++ for handling the tapi3 SDK and when I debugged, the same type of error was occurring giving an HRESULT negative code, when I googled it it was a code of type "no supported interface".
The weird part came when I tested the same code pasted above on a Windows XP virtual machine, the "specified cas is not valid" error didn't jump, but the audio still did not play.

I have configured the Avaya tapi3 driver correctly because the call control works fine, it's only the audio part that is not working. Also the IPO user I use for the tests is a wave user ("user name starts with TAPI:"), and I have a waver user license active.
You can request any resource if needed for solving this problem.

Any help is really appreciated. Thank you.
 
I'm no expert on this subject, but does your WAV file conform to the IP Office requirements for music on hold? The IP Office won't play anything internally that isn't configured as 128 kbps/16 bit/mono/8khz/PCM.

If that doesn't help, then hopefully someone else has an idea!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top