Пример #1
0
        /// <summary>
        /// Dispose of listener (if any), and create a new one on the new venue.
        /// </summary>
        /// <param name="venue"></param>
        /// <param name="isConferencingVenue"></param>
        public bool ChangeVenue(UWVenue venue, bool isConferencingVenue)
        {
            if (venue == null)
            {
                return(false);                //shouldn't ever be.
            }
            if (isConferencingVenue)
            {
                // Make sure it really did change because we could possibly have been using
                // the same address/port as a custom venue.
                if ((confVenue == null) || (!confVenue.Equals(venue)))
                {
                    confVenue = venue;
                    DisposeListener(ref confSession, presenterSession);
                    //Note: long term we don't want to clear them if encoding ..
                    assrcs.Clear();
                    vssrcs.Clear();
                    confSession = CreateListener(presenterSession, confVenue);
                    //confSession.BufferPacketsForUnsubscribedStreams = false;

                    if (confSession == null)
                    {
                        return(false);
                    }

                    // If conference and presenter now use the same venue, we
                    // may have already missed some relevant stream added events.
                    if (confSession == presenterSession)
                    {
                        AddConferenceStreams();
                    }
                }
            }
            else
            {
                if ((presenterVenue == null) || (!presenterVenue.Equals(venue)))
                {
                    presenterVenue = venue;
                    DisposeListener(ref presenterSession, confSession);
                    presenterSession = CreateListener(confSession, presenterVenue);
                    if (presenterSession == null)
                    {
                        return(false);
                    }

                    // If conference and presenter now use the same venue, we
                    // may have already missed some relevant stream added events.
                    if (confSession == presenterSession)
                    {
                        AddPresenterStreams();
                    }
                }
            }
            return(true);
        }
Пример #2
0
        public bool Equals(UWVenue uwv)
        {
            if (uwv == null)
            {
                return(false);
            }

            if ((this.ipEndpoint.Address.Equals(uwv.IpEndpoint.Address)) &&
                (this.ipEndpoint.Port == uwv.IpEndpoint.Port))
            {
                return(true);
            }
            return(false);
        }
Пример #3
0
        /// <summary>
        /// Start a listener on the venue specified.  If one was already running, dispose it
        /// regardless of the venue, and create a new one.
        /// isConfListener indicates whether this is a conferencing or Presenter listener.
        /// </summary>
        public bool StartListener(UWVenue venue, bool isConfListener)
        {
            if (venue == null)
            {
                return(false);
            }

            if (isConfListener)
            {
                confVenue = venue;
                if (confSession != null)
                {
                    DisposeListener(ref confSession, presenterSession);
                }
                confSession = CreateListener(presenterSession, venue);

                if (confSession == null)
                {
                    return(false);
                }

                // If conference and presenter now use the same venue, we
                // may have already missed some relevant stream added events.
                if (confSession == presenterSession)
                {
                    AddConferenceStreams();
                }
            }
            else
            {
                presenterVenue = venue;
                if (presenterSession != null)
                {
                    DisposeListener(ref presenterSession, confSession);
                }
                presenterSession = CreateListener(confSession, venue);
                if (presenterSession == null)
                {
                    return(false);
                }

                if (confSession == presenterSession)
                {
                    AddPresenterStreams();
                }
            }
            return(true);
        }
Пример #4
0
        /// <summary>
        /// Create a listener if there isn't already one for this endpoint.
        /// If we fail, write eventlog entry and return null.
        /// </summary>
        /// <param name="other">The other (possible) listener</param>
        /// <param name="venue">New IP endpoint to use</param>
        private RtpSession CreateListener(RtpSession other, UWVenue venue)
        {
            if (other != null)
            {
                if (CompareIPEndPoints(other.RtpEndPoint, venue.IpEndpoint))
                {
                    return(other);
                }
            }

            RtpParticipant p = new RtpParticipant(myCname, myFriendlyName);
            RtpSession     s;
            IPEndPoint     refEP;

            if (this.reflectorEnabled)
            {
                try
                {
                    refEP       = new IPEndPoint(System.Net.Dns.GetHostEntry(this.reflectorAddress).AddressList[0], this.reflectorPort);
                    s           = new RtpSession(venue.IpEndpoint, p, true, true, refEP);
                    s.VenueName = venue.Name;
                }
                catch (Exception e)
                {
                    eventLog.WriteEntry("Failed to create RtpSession with Reflector enabled. " + e.ToString(), EventLogEntryType.Error, 1002);
                    s = null;
                }
            }
            else
            {
                try
                {
                    s           = new RtpSession(venue.IpEndpoint, p, true, true);
                    s.VenueName = venue.Name;
                }
                catch (Exception e)
                {
                    eventLog.WriteEntry("Failed to create RtpSession. " + e.ToString(), EventLogEntryType.Error, 1002);
                    s = null;
                }
            }
            return(s);
        }
Пример #5
0
        /// <summary>
        /// Restart Presenter listeners and threads in a new venue.  Called when the Presenter
        /// venue combo selection is changed, or when a custom venue is specified.
        /// </summary>
        /// <param name="venue"></param>
        public bool ChangeVenue(UWVenue venue)
        {
            if ((!presenterEnabled) || (venue == null) || (presenterVenue.Equals(venue)))
            {
                return(false);
            }

            presenterVenue = venue;

            AbortListenerWorkers();

            //Restart listener
            if (!rtpManager.ChangeVenue(venue, false))
            {
                return(false);
            }

            //Reset so that we can pick up a new instructor node in the new venue:
            currentPresenterSSRC = 0;
            return(true);
        }
Пример #6
0
        // Restore the user's last configuration from the registry.
        private void RestoreConfig()
        {
            // First set defaults
            presenterEnabled = false;                //presenter integration
            String presenterAddr      = "234.5.5.5"; //A default venue
            String presenterPort      = "5004";
            String presenterVenueName = "Local Default";

            presenterVenue = new UWVenue(presenterVenueName, new IPEndPoint(IPAddress.Parse(presenterAddr), Convert.ToInt32(presenterPort)));
            baseURL        = "http://slide/location/";
            imageExtent    = "jpg";
            log_slides     = false;
            log_scripts    = false;

            // now get the previously configured values here, if any:
            try
            {
                RegistryKey BaseKey = Registry.CurrentUser.OpenSubKey("Software\\UWCSE\\WMGateway", true);
                if (BaseKey == null)
                {                 //no configuration yet.. first run.
                    //logger.Write("No registry configuration found.");
                    return;
                }

                presenterEnabled   = Convert.ToBoolean(BaseKey.GetValue("PresenterMode", presenterEnabled));
                presenterAddr      = Convert.ToString(BaseKey.GetValue("PresenterIP", presenterAddr));
                presenterPort      = Convert.ToString(BaseKey.GetValue("PresenterPort", presenterPort));
                presenterVenueName = Convert.ToString(BaseKey.GetValue("PresenterVenueName", presenterVenueName));
                baseURL            = Convert.ToString(BaseKey.GetValue("BaseURL", baseURL));
                imageExtent        = Convert.ToString(BaseKey.GetValue("ImageExtent", imageExtent));
                log_slides         = Convert.ToBoolean(BaseKey.GetValue("LogSlides", log_slides));
                log_scripts        = Convert.ToBoolean(BaseKey.GetValue("LogScripts", log_scripts));
            }
            catch (Exception e)
            {
                eventLog.WriteEntry("Failed to restore Presenter configuration: " + e.ToString(), EventLogEntryType.Error, 1003);
            }
            presenterVenue = new UWVenue(presenterVenueName, new IPEndPoint(IPAddress.Parse(presenterAddr), Convert.ToInt32(presenterPort)));
        }
Пример #7
0
        /// <summary>
        /// Show the config form
        /// </summary>
        /// <returns></returns>
        public UWVenue ConfigPresenter()
        {
            UWVenue     ret       = null;
            String      myAddr    = presenterVenue.IpEndpoint.Address.ToString();
            String      myPort    = presenterVenue.IpEndpoint.Port.ToString();
            PConfigForm frmConfig = new PConfigForm();

            frmConfig.txtAddr.Text          = myAddr;
            frmConfig.txtPort.Text          = myPort;
            frmConfig.txtBaseURL.Text       = baseURL;
            frmConfig.txtExtent.Text        = imageExtent;
            frmConfig.checkBoxPILog.Checked = log_slides;
            frmConfig.checkBoxSLog.Checked  = log_scripts;

            if (frmConfig.ShowDialog(mainform) == DialogResult.OK)
            {
                if (log_slides != frmConfig.checkBoxPILog.Checked)
                {
                    log_slides = frmConfig.checkBoxPILog.Checked;
                    if (log_slides)                     // turn on slide transition logging
                    {
                        CreateOpenPPTLogFile();
                    }
                    else                     //turn off logging
                    {
                        ClosePPTLogFile();
                    }
                }
                if (log_scripts != frmConfig.checkBoxSLog.Checked)
                {
                    log_scripts = frmConfig.checkBoxSLog.Checked;
                    if (log_scripts)                     // turn on script logging
                    {
                        CreateOpenScriptLogFile();
                    }
                    else                     //turn off logging
                    {
                        CloseScriptLogFile();
                    }
                }
                if (baseURL != frmConfig.txtBaseURL.Text)
                {
                    // If the user didn't include a trailing '/', add it.
                    baseURL = frmConfig.txtBaseURL.Text;
                    if (!baseURL.EndsWith("/"))
                    {
                        baseURL = baseURL + "/";
                    }
                    if (scriptQueue != null)
                    {
                        scriptQueue.BaseUrl = baseURL;
                    }
                    //logger.Write("Set BaseURL to: " + baseURL);
                }
                imageExtent = frmConfig.txtExtent.Text;
                //If the user entered with a leading ".", remove it.
                char [] ca = { '.' };
                imageExtent = imageExtent.TrimStart(ca);
                if (scriptQueue != null)
                {
                    scriptQueue.Extent = imageExtent;
                }

                if ((myAddr != frmConfig.txtAddr.Text) ||
                    (myPort != frmConfig.txtPort.Text))
                {
                    myAddr = frmConfig.txtAddr.Text;
                    myPort = frmConfig.txtPort.Text;
                    //Note: these inputs are validated in the form.
                    ret = new UWVenue("Custom Venue", new IPEndPoint(IPAddress.Parse(myAddr), Convert.ToInt32(myPort)));
                }
                //showLoggingStatus(true);
            }
            frmConfig.Dispose();
            return(ret);
        }