C# .NET - How to play an mp3 file into a voice call

Asked By Barry Jones on 14-May-12 08:54 AM
Hello everyone,

I've been cruising around the net for some help, then I found this forum. Hope some developer guys can help me on this.
I'm working on my own softphone application, but kind of bumping into some trouble when I try to play a sound file (mp3)
into the call. For seeing it more exactly, you can check the website I used as a guideline: google ---> How to play an mp3 file into a voice call Ozeki VoIP SIP SDK

Is this the best way for sound playing? Or do you have other suggestions?

Shan P replied to Barry Jones on 14-May-12 01:24 PM
According to the Ozeki Documentation, it seems that their API only mentions that wav files can be played. If you're not having any luck with your MP3 files, it may be due to that. Try converting your MP3 to a WAV and see if that helps. 

Unfortunately I'm not able to provide a direct link to the demo in this forum tool because the forum tool is giving me this error: "Inappropriate content found. Please use family friendly wording". So here is a link to a Google search in case that works: https://www.google.ca/search?sourceid=chrome&ie=UTF-8&q=How+to+make+a+Voice+Call+(and+play+a+wav)+with+Ozeki+VoIP+SIP+SDK 
[)ia6l0 iii replied to Barry Jones on 14-May-12 09:17 PM
I am unsure about mp3, but definitely wav looks a possibility.  And also I am not sure why you did not find any info when you searched. I tried the "voip-sdk" and found some good information. 

The Ozeki VOIP SIP SDK provides an inbuilt method to play some wave files to keep your customers informed that they would have to wait for some time. 

You will have to do the following:
a) Initialize the main device
b) Call the WaveStreamPlayback object with the path to the file.

The code should look similar to this. 
WaveStreamPlayback wsp = new WaveStreamPlayback("path to the file");  
connector.Connect(wsp, speaker);  

Hope this helps.