static private void m_pRtpSession_NewReceiveStream(object sender, RTP_ReceiveStreamEventArgs e) { try { //for unicast make sure that the stream is from the expected source ip if (!multicast && !e.Stream.SSRC.RtpEP.Address.Equals(source_ip)) { return; } session.Sessions[0].NewReceiveStream -= NewReceiveStream; AudioOutDevice device = AudioOut.Devices.Where(d => d.Name == Settings.Default.AudioDeviceName).FirstOrDefault(); if (device == null) { Message.Error("Could not find audio device: " + Settings.Default.AudioDeviceName); return; } AudioCodec ac = new PCMU(); ao = new AudioOut_RTP( device, e.Stream, new Dictionary <int, AudioCodec> { { payload, ac } } ); Dictionary <AudioCodec, string> acs2of = new Dictionary <AudioCodec, string>(); if (Settings.Default.RecordIncomingRtpStreams) { string wav_file = PathRoutines.CreateDirectory(Settings.Default.RtpStreamStorageFolder) + "\\" + e.Stream.SSRC.RtpEP.Address.ToString() + DateTime.Now.ToString("_yyyy-MM-dd_HH-mm-ss") + ".wav"; acs2of[ac] = wav_file; if (execute != null) { execute.Record = wav_file; } } ao.Start(volume100, acs2of); } catch (Exception ex) { Message.Error(ex); } }