public MediaManager(ICall call) { mediaConnector = new MediaConnector(); phoneCallAudioReceiver = new AudioMixerMediaHandler(); phoneCallAudioSender = new AudioMixerMediaHandler(); incomingAudioMixer = new AudioMixerMediaHandler(); outgoingAudioMixer = new AudioMixerMediaHandler(); call.ConnectAudioSender(outgoingAudioMixer); call.ConnectAudioReceiver(incomingAudioMixer); //mediaConnector.Connect(phoneCallAudioReceiver, incomingAudioMixer); //mediaConnector.Connect(outgoingAudioMixer, phoneCallAudioSender); //phoneCallAudioReceiver.AttachToCall(call); //phoneCallAudioSender.AttachToCall(call); }
public CallHandler() { _guid = Guid.NewGuid().ToString(); // Setup logging _logFileName = String.Format("{0}{1}.log", _dataDirectory, _guid); GlobalContext.Properties["LogFileName"] = _logFileName; GlobalContext.Properties["CallGUID"] = _guid; log4net.Config.XmlConfigurator.Configure(); _log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); _wavFileName = String.Format("{0}{1}.wav", _dataDirectory, _guid); _mixer = new AudioMixerMediaHandler(); _audioReceiver = new PhoneCallAudioReceiver(); _wavRecorder = new WaveStreamRecorder(_wavFileName, new WaveFormat()); _connector = new MediaConnector(); _connector.Connect(_audioReceiver, _mixer); _connector.Connect(_mixer, _wavRecorder); }
void ConnectOrDisconnectAudioReceiver(AudioHandler receiver, bool connect) { if (receiver == null) { return; } if (connect) { var media_connector = new MediaConnector(); var mixer = new AudioMixerMediaHandler(); lock (sync) { Connectors.Add(this, new ConnectorContext(media_connector, mixer)); } media_connector.Connect(mixer, receiver); session.ConnectAudioReceiver(CallParty.Callee, mixer); session.ConnectAudioReceiver(CallParty.Caller, mixer); } else { ConnectorContext connector_context; lock (sync) { connector_context = Connectors[this]; Connectors.Remove(this); } session.DisconnectAudioReceiver(CallParty.Callee, connector_context.Mixer); session.DisconnectAudioReceiver(CallParty.Caller, connector_context.Mixer); connector_context.Connector.Disconnect(connector_context.Mixer, receiver); connector_context.Connector.Dispose(); connector_context.Mixer.Dispose(); } }
/// <summary> /// Occurs when the phone call state has changed. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void call_CallStateChanged1(object sender, VoIPEventArgs<CallState> e) { this.InvokeGUIThread(() => { if (e.Item == CallState.Ringing) { m_TimeStart = DateTime.Now.TimeOfDay; m_StartTimeOutCounter = true; m_MediaUtility.Start(MediaUtility.ePhoneCallSoundType.Ring); } else if (e.Item == CallState.InCall) { try { m_StartTimeOutCounter = false; mixer = new AudioMixerMediaHandler(); mixerMic = new AudioMixerMediaHandler(); mixerReceiver = new AudioMixerMediaHandler(); AudioId = Guid.NewGuid(); CommonApplicationData commonData = new CommonApplicationData("BrightVision", "BrightSales", true); if (m_UserMicrophone != null) m_UserMicrophone.Start(); if (m_UserSpeaker != null) m_UserSpeaker.Start(); connector.Connect(m_UserMicrophone, mediaSender); connector.Connect(mediaReceiver, m_UserSpeaker); m_MediaUtility.Stop(); //m_MediaUtility.Start(MediaUtility.ePhoneCallSoundType.HangUp); mediaSender.AttachToCall(call); mediaReceiver.AttachToCall(call); #region combine mic and receiver in record string fileName = String.Format(@"{0}\\tmpwav\\{1}_.wav", commonData.ApplicationFolderPath, AudioId); recorder = new WaveStreamRecorder(fileName); recorder.Stopped += new EventHandler<EventArgs>(recorder_Stopped); connector.Connect(m_UserMicrophone, mixer); connector.Connect(mediaReceiver, mixer); connector.Connect(mixer, recorder); #endregion #region record mic fileName = String.Format(@"{0}\\tmpwav\\{1}_mic.wav", commonData.ApplicationFolderPath, AudioId); recorderMic = new WaveStreamRecorder(fileName); recorderMic.Stopped += new EventHandler<EventArgs>(recorder_Stopped1); connector.Connect(m_UserMicrophone, mixerMic); connector.Connect(mixerMic, recorderMic); #endregion #region record receiver fileName = String.Format(@"{0}\\tmpwav\\{1}_receiver.wav", commonData.ApplicationFolderPath, AudioId); recorderReceiver = new WaveStreamRecorder(fileName); recorderReceiver.Stopped += new EventHandler<EventArgs>(recorder_Stopped2); connector.Connect(mediaReceiver, mixerReceiver); connector.Connect(mixerReceiver, recorderReceiver); #endregion recorder.StartStreaming(); //recorder.IsStreaming = true; recorderReceiver.StartStreaming(); //recorderReceiver.IsStreaming = true; recorderMic.StartStreaming(); //recorderMic.IsStreaming = true; } catch(Ozeki.Common.Exceptions.MediaException me) { if (CallState_Changed != null) { CallState_Changed(this, new CallStateChangedArgs() { PhoneCallState = CallState.Rejected }); } if (call != null) call.HangUp(); //softPhone.UnregisterPhoneLine(phoneLine); softPhone.Close(); this.WireDownCallEvents(); call = null; m_MediaUtility.Start(MediaUtility.ePhoneCallSoundType.HangUp); MessageBox.Show("Your mic or speaker is not working. Please change your mic or speaker in the Phone Settings.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } else if (e.Item == CallState.Completed) { try { if (m_UserMicrophone != null) m_UserMicrophone.Stop(); if (m_UserSpeaker != null) m_UserSpeaker.Stop(); connector.Disconnect(m_UserMicrophone, mediaSender); connector.Disconnect(mediaReceiver, m_UserSpeaker); if (recorder != null) { recorder.StopStreaming(); //recorder.IsStreaming = false; } if (recorderMic != null) { recorderMic.StopStreaming(); //recorderMic.IsStreaming = false; } if (recorderReceiver != null) { recorderReceiver.StopStreaming(); //recorderReceiver.IsStreaming = false; } connector.Disconnect(m_UserMicrophone, mixer); connector.Disconnect(mediaReceiver, mixer); connector.Disconnect(mixer, recorder); connector.Disconnect(m_UserSpeaker, mixerMic); connector.Disconnect(mixerMic, recorderMic); connector.Disconnect(mixerMic, recorderMic); connector.Disconnect(mixerReceiver, recorderReceiver); mediaSender.Detach(); mediaReceiver.Detach(); if (m_RingTimeOut) return; //softPhone.UnregisterPhoneLine(phoneLine); softPhone.Close(); this.WireDownCallEvents(); //call.HangUp(); call = null; m_MediaUtility.Start(MediaUtility.ePhoneCallSoundType.HangUp); recorder.Dispose(); mixer.Dispose(); recorder = null; mixer = null; recorderMic.Dispose(); mixerMic.Dispose(); recorderMic = null; mixerMic = null; mixerReceiver.Dispose(); recorderReceiver.Dispose(); mixerReceiver = null; recorderReceiver = null; WaitUntilTheRecordEndProcess(); } catch { //softPhone.UnregisterPhoneLine(phoneLine); softPhone.Close(); this.WireDownCallEvents(); call = null; } } else if (e.Item == CallState.Cancelled) { if (m_RingTimeOut) return; m_StartTimeOutCounter = false; //softPhone.UnregisterPhoneLine(phoneLine); softPhone.Close(); this.WireDownCallEvents(); call = null; m_MediaUtility.Start(MediaUtility.ePhoneCallSoundType.HangUp); } else if (e.Item == CallState.Rejected) { m_StartTimeOutCounter = false; //softPhone.UnregisterPhoneLine(phoneLine); softPhone.Close(); this.WireDownCallEvents(); call = null; m_MediaUtility.Start(MediaUtility.ePhoneCallSoundType.HangUp); } else if (e.Item == CallState.Busy || e.Item == CallState.Error) { m_RingTimeOut = true; m_StartTimeOutCounter = false; m_MediaUtility.Start(MediaUtility.ePhoneCallSoundType.Busy); //softPhone.UnregisterPhoneLine(phoneLine); softPhone.Close(); call.HangUp(); call = null; //MessageBox.Show("Error encountered. Please check the format of the number you are calling.", "Bright Sales", MessageBoxButtons.OK, MessageBoxIcon.Information); //this.WireDownCallEvents(); //call = null; } if (CallState_Changed != null) CallState_Changed(this, new CallStateChangedArgs() { PhoneCallState = e.Item, AudioId = AudioId }); }); }
public ConnectorContext(MediaConnector connector, AudioMixerMediaHandler mixer) { Connector = connector; Mixer = mixer; }
/// <summary> /// Initializes the audio handlers (microphone, speaker, DTMF player etc.). /// </summary> private void InitAudio() { // ----- CREATE ----- // devices Microphone = Microphone.GetDefaultDevice(); Speaker = Speaker.GetDefaultDevice(); // audio processors AudioEnhancer = new AudioQualityEnhancer(); AudioEnhancer.SetEchoSource(Speaker); dtmfPlayer = new DtmfEventWavePlayer(); // ringtones var ringbackStream = LoadRingbackStream(); var ringtoneStream = LoadRingtoneStream(); ringtonePlayer = new WaveStreamPlayback(ringtoneStream, true, false); ringbackPlayer = new WaveStreamPlayback(ringbackStream, true, false); // mixers outgoingDataMixer = new AudioMixerMediaHandler(); speakerMixer = new AudioMixerMediaHandler(); recordDataMixer = new AudioMixerMediaHandler(); // phone handlers phoneCallAudioSender = new PhoneCallAudioSender(); phoneCallAudioReceiver = new PhoneCallAudioReceiver(); // ----- CONNECT ----- // connect outgoing audioConnector.Connect(AudioEnhancer, outgoingDataMixer); audioConnector.Connect(outgoingDataMixer, phoneCallAudioSender); audioConnector.Connect(outgoingDataMixer, recordDataMixer); if (Microphone != null) { Microphone.LevelChanged += (Microphone_LevelChanged); audioConnector.Connect(Microphone, AudioEnhancer); } // connect incoming audioConnector.Connect(phoneCallAudioReceiver, speakerMixer); audioConnector.Connect(phoneCallAudioReceiver, recordDataMixer); audioConnector.Connect(ringtonePlayer, speakerMixer); audioConnector.Connect(ringbackPlayer, speakerMixer); audioConnector.Connect(dtmfPlayer, speakerMixer); if (Speaker != null) { Speaker.LevelChanged += (Speaker_LevelChanged); audioConnector.Connect(speakerMixer, Speaker); } // add to collection Dictionary<string, VoIPMediaHandler> collection = new Dictionary<string, VoIPMediaHandler>(); collection.Add("AudioEnhancer", AudioEnhancer); collection.Add("DTMFPlayer", dtmfPlayer); collection.Add("OutgoingDataMixer", outgoingDataMixer); collection.Add("SpeakerMixer", speakerMixer); collection.Add("PhoneCallAudioSender", phoneCallAudioSender); collection.Add("PhoneCallAudioReceiver", phoneCallAudioReceiver); audioCollection = new MediaHandlerCollection(audioConnector, collection); }
/// <summary> /// Initializes the audio handlers (microphone, speaker, DTMF player etc.). /// </summary> private void InitAudio() { // ----- CREATE ----- // devices Microphone = Microphone.GetDefaultDevice(); Speaker = Speaker.GetDefaultDevice(); // audio processors AudioEnhancer = new AudioQualityEnhancer(); AudioEnhancer.SetEchoSource(Speaker); dtmfPlayer = new DtmfEventWavePlayer(); // ringtones var ringbackStream = LoadRingbackStream(); var ringtoneStream = LoadRingtoneStream(); ringtonePlayer = new WaveStreamPlayback(ringtoneStream, true, false); ringbackPlayer = new WaveStreamPlayback(ringbackStream, true, false); // mixers outgoingDataMixer = new AudioMixerMediaHandler(); speakerMixer = new AudioMixerMediaHandler(); recordDataMixer = new AudioMixerMediaHandler(); // phone handlers phoneCallAudioSender = new PhoneCallAudioSender(); phoneCallAudioReceiver = new PhoneCallAudioReceiver(); // ----- CONNECT ----- // connect outgoing audioConnector.Connect(AudioEnhancer, outgoingDataMixer); audioConnector.Connect(outgoingDataMixer, phoneCallAudioSender); audioConnector.Connect(outgoingDataMixer, recordDataMixer); if (Microphone != null) { Microphone.LevelChanged += (Microphone_LevelChanged); audioConnector.Connect(Microphone, AudioEnhancer); } // connect incoming audioConnector.Connect(phoneCallAudioReceiver, speakerMixer); audioConnector.Connect(phoneCallAudioReceiver, recordDataMixer); audioConnector.Connect(ringtonePlayer, speakerMixer); audioConnector.Connect(ringbackPlayer, speakerMixer); audioConnector.Connect(dtmfPlayer, speakerMixer); if (Speaker != null) { Speaker.LevelChanged += (Speaker_LevelChanged); audioConnector.Connect(speakerMixer, Speaker); } // add to collection Dictionary <string, VoIPMediaHandler> collection = new Dictionary <string, VoIPMediaHandler>(); collection.Add("AudioEnhancer", AudioEnhancer); collection.Add("DTMFPlayer", dtmfPlayer); collection.Add("OutgoingDataMixer", outgoingDataMixer); collection.Add("SpeakerMixer", speakerMixer); collection.Add("PhoneCallAudioSender", phoneCallAudioSender); collection.Add("PhoneCallAudioReceiver", phoneCallAudioReceiver); audioCollection = new MediaHandlerCollection(audioConnector, collection); }
/// <summary> /// Creates a complex phone call listener, built up from microphone, speaker, waverecorder, waveplayer, dtmf and ringtone sounds. /// </summary> /// <returns>The media handler collection that represent the phone call listener.</returns> public MediaHandlerCollection CreateSoftPhoneCallListener() { var phoneCallAudioReceiver = new PhoneCallAudioReceiver(); var phoneCallAudioSender = new PhoneCallAudioSender(); var microphone = Microphone.GetDefaultDevice(); var speaker = Speaker.GetDefaultDevice(); var audioProcessor = new AudioQualityEnhancer(); audioProcessor.SetEchoSource(speaker); // Handles the audio that comes from the PhoneCallListener var outgoingDataMixer = new AudioMixerMediaHandler(); var recordDataMixer = new AudioMixerMediaHandler(); var speakerMixer = new AudioMixerMediaHandler(); var dtmf = new DtmfEventWavePlayer(); var ringtones = new PhoneCallStateWavePlayer( commonWaveFormat, outGoingToneStreams, incomingToneStreams ); if (microphone != null) { mediaConnector.Connect(microphone, audioProcessor); } mediaConnector.Connect(audioProcessor, outgoingDataMixer); mediaConnector.Connect(outgoingDataMixer, phoneCallAudioSender); // No WaveStreamPlayback (see CreateWaveStreamPlayback method) //mediaConnector.Connect(phoneCallAudioReceiver, speaker); mediaConnector.Connect(phoneCallAudioReceiver, speakerMixer); mediaConnector.Connect(dtmf, speakerMixer); mediaConnector.Connect(ringtones, speakerMixer); if (speaker != null) { mediaConnector.Connect(speakerMixer, speaker); } mediaConnector.Connect(phoneCallAudioReceiver, recordDataMixer); mediaConnector.Connect(outgoingDataMixer, recordDataMixer); // No WaveStreamRecorder (see CreateWaveStreamRecorder method) /* * Media Connections: * * +---------------------------------------------------------------+ * | PhoneCall |************** * +---------------------------------------------------------------+ * * * ^^ VV * * * +--------------------+ +----------------------+ +----+ +---------+ * |PhoneCallAudioSender| |PhoneCallAudioReceiver| |DMTF| |Ringtones| * +--------------------+ +----------------------+ +----+ +---------+ * ^^ V V V | * +-----------------+ +---------------+ +------------+ | * |OutgoingDataMixer|----- >> -----|RecordDataMixer| |SpeakerMixer|--<<--/ * +-----------------+ +---------------+ +------------+ * ^^ ^^ V | *+--------------+ +------------------+ +------------------+ | *|AudioProcessor| |WaveStreamPlayback| |WaveStreamRecorder| V *+--------------+ +------------------+ +------------------+ V * ^^ | * +----------+ +-------+ * |Microphone| |Speaker| * +----------+ +-------+ */ var mediaHandlers = new Dictionary <string, VoIPMediaHandler> { { "AudioProcessor", audioProcessor }, { "OutGoingDataMixer", outgoingDataMixer }, { "RecordDataMixer", recordDataMixer }, { "SpeakerMixer", speakerMixer }, { "DTMF", dtmf }, { "Ringtones", ringtones }, { "AudioSender", phoneCallAudioSender }, { "AudiReceiver", phoneCallAudioReceiver }, }; if (microphone != null) { mediaHandlers.Add("Microphone", microphone); } if (speaker != null) { mediaHandlers.Add("Speaker", speaker); } return(new MediaHandlerCollection(mediaConnector, mediaHandlers)); }
/// <summary> /// Initializes the audio handlers (microphone, speaker, DTMF player etc.). /// </summary> private void InitAudio() { // ----- CREATE ----- // devices Microphone = Microphone.GetDefaultDevice(); Speaker = Speaker.GetDefaultDevice(); // audio processors if (Microphone == null) { AudioEnhancer = new AudioQualityEnhancer(new AudioFormat()); } else { AudioEnhancer = new AudioQualityEnhancer(Microphone.MediaFormat); } AudioEnhancer.SetEchoSource(Speaker); _dtmfPlayer = new DtmfEventWavePlayer(); // ringtones var ringbackStream = LoadRingbackStream(); var ringtoneStream = LoadRingtoneStream(); _ringtonePlayer = new WaveStreamPlayback(ringtoneStream, true, false); _ringbackPlayer = new WaveStreamPlayback(ringbackStream, true, false); // mixers //outgoingDataMixer = new AudioMixerMediaHandler(); //speakerMixer = new AudioMixerMediaHandler(); recordDataMixer = new AudioMixerMediaHandler(); // phone handlers _phoneCallAudioSender = new PhoneCallAudioSender(); _phoneCallAudioReceiver = new PhoneCallAudioReceiver(); // ----- CONNECT ----- // connect outgoing //audioConnector.Connect(AudioEnhancer, outgoingDataMixer); //audioConnector.Connect(outgoingDataMixer, phoneCallAudioSender); //audioConnector.Connect(outgoingDataMixer, recordDataMixer); _audioConnector.Connect(AudioEnhancer, _phoneCallAudioSender); _audioConnector.Connect(AudioEnhancer, recordDataMixer); _audioConnector.Connect(_phoneCallAudioReceiver, recordDataMixer); if (Microphone != null) { Microphone.LevelChanged += (Microphone_LevelChanged); _audioConnector.Connect(Microphone, AudioEnhancer); } // connect incoming if (Speaker != null) { Speaker.LevelChanged += (Speaker_LevelChanged); _audioConnector.Connect(_phoneCallAudioReceiver, Speaker); _audioConnector.Connect(_ringtonePlayer, Speaker); _audioConnector.Connect(_ringbackPlayer, Speaker); _audioConnector.Connect(_dtmfPlayer, Speaker); } }
/// <summary> /// Creates a complex phone call listener, built up from microphone, speaker, waverecorder, waveplayer, dtmf and ringtone sounds. /// </summary> /// <returns>The media handler collection that represent the phone call listener.</returns> public MediaHandlerCollection CreateSoftPhoneCallListener() { var phoneCallAudioReceiver = new PhoneCallAudioReceiver(); var phoneCallAudioSender = new PhoneCallAudioSender(); var microphone = Microphone.GetDefaultDevice(); var speaker = Speaker.GetDefaultDevice(); var audioProcessor = new AudioQualityEnhancer(); audioProcessor.SetEchoSource(speaker); // Handles the audio that comes from the PhoneCallListener var outgoingDataMixer = new AudioMixerMediaHandler(); var recordDataMixer = new AudioMixerMediaHandler(); var speakerMixer = new AudioMixerMediaHandler(); var dtmf = new DtmfEventWavePlayer(); var ringtones = new PhoneCallStateWavePlayer( commonWaveFormat, outGoingToneStreams, incomingToneStreams ); if (microphone != null) mediaConnector.Connect(microphone, audioProcessor); mediaConnector.Connect(audioProcessor, outgoingDataMixer); mediaConnector.Connect(outgoingDataMixer, phoneCallAudioSender); // No WaveStreamPlayback (see CreateWaveStreamPlayback method) //mediaConnector.Connect(phoneCallAudioReceiver, speaker); mediaConnector.Connect(phoneCallAudioReceiver, speakerMixer); mediaConnector.Connect(dtmf, speakerMixer); mediaConnector.Connect(ringtones, speakerMixer); if (speaker != null) mediaConnector.Connect(speakerMixer, speaker); mediaConnector.Connect(phoneCallAudioReceiver, recordDataMixer); mediaConnector.Connect(outgoingDataMixer, recordDataMixer); // No WaveStreamRecorder (see CreateWaveStreamRecorder method) /* * Media Connections: * * +---------------------------------------------------------------+ * | PhoneCall |************** * +---------------------------------------------------------------+ * * * ^^ VV * * * +--------------------+ +----------------------+ +----+ +---------+ * |PhoneCallAudioSender| |PhoneCallAudioReceiver| |DMTF| |Ringtones| * +--------------------+ +----------------------+ +----+ +---------+ * ^^ V V V | * +-----------------+ +---------------+ +------------+ | * |OutgoingDataMixer|----- >> -----|RecordDataMixer| |SpeakerMixer|--<<--/ * +-----------------+ +---------------+ +------------+ * ^^ ^^ V | *+--------------+ +------------------+ +------------------+ | *|AudioProcessor| |WaveStreamPlayback| |WaveStreamRecorder| V *+--------------+ +------------------+ +------------------+ V * ^^ | * +----------+ +-------+ * |Microphone| |Speaker| * +----------+ +-------+ */ var mediaHandlers = new Dictionary<string, VoIPMediaHandler> { {"AudioProcessor", audioProcessor}, {"OutGoingDataMixer", outgoingDataMixer}, {"RecordDataMixer", recordDataMixer}, {"SpeakerMixer", speakerMixer}, {"DTMF", dtmf}, {"Ringtones", ringtones}, {"AudioSender",phoneCallAudioSender}, {"AudiReceiver",phoneCallAudioReceiver}, }; if(microphone != null) mediaHandlers.Add("Microphone", microphone); if (speaker != null) mediaHandlers.Add("Speaker", speaker); return new MediaHandlerCollection(mediaConnector,mediaHandlers); }
/// <summary> /// Creates the incoming and outgoing media handlers such as microphone or speaker /// </summary> private void CreateMediaHandlers() { MediaHandlerFactory factory = new MediaHandlerFactory(); activeAudioCallListener = factory.CreateSoftPhoneCallListener(); activeVideoCallListener = factory.CreateSoftPhoneVideoCallListener(); phoneCallAudioReceiver = activeAudioCallListener.GetComponent("AudiReceiver") as PhoneCallAudioReceiver; phoneCallAudioSender = activeAudioCallListener.GetComponent("AudioSender") as PhoneCallAudioSender; phonecallVideoSender = activeVideoCallListener.GetComponent("VideoSender") as PhoneCallVideoSender; phonecallVideoReceiver = activeVideoCallListener.GetComponent("VideoReceiver") as PhoneCallVideoReceiver; mediaConnector = activeAudioCallListener.MediaConnector; microphone = activeAudioCallListener.GetComponent("Microphone") as Microphone; if (microphone != null) { microphone.LevelChanged += (Microphone_LevelChanged); } speaker = activeAudioCallListener.GetComponent("Speaker") as Speaker; if (speaker != null) { speaker.LevelChanged += (Speaker_LevelChanged); } incomingDataMixer = activeAudioCallListener.GetComponent("SpeakerMixer") as AudioMixerMediaHandler; camera = activeVideoCallListener.GetComponent("WebCamera") as WebCamera; remoteImageHandler = activeVideoCallListener.GetComponent("RemoteImageHandler") as ImageProvider<Image>; localImageHandler = activeVideoCallListener.GetComponent("LocalImageHandler") as ImageProvider<Image>; AudioProcessor = activeAudioCallListener.GetComponent("AudioProcessor") as AudioQualityEnhancer; outgoingDataMixer = activeAudioCallListener.GetComponent("OutGoingDataMixer") as AudioMixerMediaHandler; RecordDataMixer = activeAudioCallListener.GetComponent("RecordDataMixer") as AudioMixerMediaHandler; dtmfEventWavePlayer = activeAudioCallListener.GetComponent("DTMF") as DtmfEventWavePlayer; ringtoneWavePlayer = activeAudioCallListener.GetComponent("Ringtones") as PhoneCallStateWavePlayer; Stream basicRing = Assembly.GetExecutingAssembly().GetManifestResourceStream( "OzekiDemoSoftphone.Resources.basic_ring.wav" ); ringtoneWavePlayer.UpdateIncomingStateStream(CallState.Ringing, @"..\..\Resources\basic_ring.wav"); ringtoneWavePlayer.UpdateOutgoingStateStream(CallState.Ringing, @"..\..\Resources\ringback.wav"); }