Skip to content

Instantly share code, notes, and snippets.

@siniypin
Created February 15, 2015 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save siniypin/47326a9fd78af95a3ff7 to your computer and use it in GitHub Desktop.
Save siniypin/47326a9fd78af95a3ff7 to your computer and use it in GitHub Desktop.
public class PlayFileCommand : ICommand
{
private readonly ISipUserAgent _userAgent;
private readonly IContainer _container;
public PlayFileCommand(ISipUserAgent userAgent, IContainer container)
{
_userAgent = userAgent;
_container = container;
}
public void Execute()
{
var player = _container.Get<IWavPlayer>();
player.Completed += (sender, args) =>
{
System.Console.WriteLine("Player {0} has reached the end of file {1}", player.Id, player.File);
player.Dispose();
};
player.Start("NeroSoundTrax_test8_PCM_Mono_VBR_16SS_48000Hz.wav", false) ;
_userAgent.MediaManager.ConferenceBridge.ConnectToSoundDevice(player.ConferenceSlot.SlotId);
_userAgent.MediaManager.ConferenceBridge.Connect(player.ConferenceSlot.SlotId, _userAgent.CallManager.Calls.First.ConferenceSlotId);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment