BogheApp.Services.Impl.Win32ServiceManager.Start C# (CSharp) Method

Start() public method

Starts the manager
public Start ( ) : bool
return bool
        public bool Start()
        {
            bool ret = true;

            LOG.Debug("Start Service Manager");

            ret &= this.LogService.Start();
            ret &= this.ConfigurationService.Start();

            ret &= this.Win32ScreenService.Start();
            ret &= this.SipService.Start();
            ret &= this.XcapService.Start();
            ret &= this.ContactService.Start();
            ret &= this.HistoryService.Start();
            ret &= this.SoundService.Start();
            ret &= this.StateMonitorService.Start();

            // Register plugins
            // MediaSessionMgr.registerAudioPluginFromFile("audio_webrtc.dll");

            // Set user preferences (global defaults)
            // could be changed per session
            MediaSessionMgr.defaultsSetAgcEnabled(true);
            MediaSessionMgr.defaultsSetEchoSuppEnabled(true);
            MediaSessionMgr.defaultsSetEchoTail(100);
            MediaSessionMgr.defaultsSetEchoSkew(0);
            MediaSessionMgr.defaultsSetNoiseSuppEnabled(true);
            MediaSessionMgr.defaultsSetVadEnabled(false);
            MediaSessionMgr.defaultsSetJbMaxLateRate(1);
            MediaSessionMgr.defaultsSetRtcpEnabled(true);
            MediaSessionMgr.defaultsSetRtcpMuxEnabled(true);
            MediaSessionMgr.defaultsSetOpusMaxCaptureRate(16000); /* Because of WebRTC AEC only 8000 and 16000 are supported */
            MediaSessionMgr.defaultsSetOpusMaxPlaybackRate(48000);
            MediaSessionMgr.defaultsSetAudioChannels(1, 1); // mono for both
            MediaSessionMgr.defaultsSetAudioPtime(20);
            MediaSessionMgr.defaultsSetVideoFps(15); // default video FPS. Will be updated using the SDP.
            MediaSessionMgr.defaultsSetAvpfMode(tmedia_mode_t.tmedia_mode_optional);
            MediaSessionMgr.defaultsSetBandwidthVideoDownloadMax(-1);
            MediaSessionMgr.defaultsSetBandwidthVideoUploadMax(-1);
            MediaSessionMgr.defaultsSetCongestionCtrlEnabled(true);

            tmedia_bandwidth_level_t bandwidthLevel = (tmedia_bandwidth_level_t)Enum.Parse(typeof(tmedia_bandwidth_level_t), this.configurationService.Get(Configuration.ConfFolder.QOS, Configuration.ConfEntry.BANDWIDTH, Configuration.DEFAULT_QOS_BANDWIDTH));
            MediaSessionMgr.defaultsSetVideoMotionRank(Configuration.QoSMotionRankFromBandwidth(bandwidthLevel));

            MediaSessionMgr.defaultsSetVolume(this.ConfigurationService.Get(Configuration.ConfFolder.GENERAL, Configuration.ConfEntry.AUDIO_VOLUME, Configuration.DEFAULT_GENERAL_AUDIO_VOLUME));
            if (this.configurationService.Get(Configuration.ConfFolder.QOS, Configuration.ConfEntry.SESSION_TIMERS, Configuration.DEFAULT_QOS_SESSION_TIMERS))
            {
                MediaSessionMgr.defaultsSetInviteSessionTimers(
                    this.configurationService.Get(Configuration.ConfFolder.QOS, Configuration.ConfEntry.SESSION_TIMERS_TIMEOUT, Configuration.DEFAULT_QOS_SESSION_TIMERS_TIMEOUT),
                    this.configurationService.Get(Configuration.ConfFolder.QOS, Configuration.ConfEntry.SESSION_TIMERS_REFRESHER, Configuration.DEFAULT_QOS_SESSION_TIMERS_REFRESHER));
            }
            else
            {
                MediaSessionMgr.defaultsSetInviteSessionTimers(0, null);
            }
            MediaSessionMgr.defaultsSetVideoZeroArtifactsEnabled(this.configurationService.Get(Configuration.ConfFolder.QOS, Configuration.ConfEntry.USE_ZERO_VIDEO_ARTIFACTS, Configuration.DEFAULT_QOS_USE_ZERO_VIDEO_ARTIFACTS));
            MediaSessionMgr.defaultsSetPrefVideoSize(
                (tmedia_pref_video_size_t)Enum.Parse(typeof(tmedia_pref_video_size_t), this.configurationService.Get(Configuration.ConfFolder.QOS, Configuration.ConfEntry.PREF_VIDEO_SIZE, Configuration.DEFAULT_QOS_PREF_VIDEO_SIZE), true)
                );

            MediaSessionMgr.defaultsSetSRtpMode(
                (tmedia_srtp_mode_t)Enum.Parse(typeof(tmedia_srtp_mode_t), this.configurationService.Get(Configuration.ConfFolder.SECURITY, Configuration.ConfEntry.SRTP_MODE, Configuration.DEFAULT_SECURITY_SRTP_MODE), true)
                );

            MediaSessionMgr.defaultsSetSRtpType(
                (tmedia_srtp_type_t)Enum.Parse(typeof(tmedia_srtp_type_t), this.configurationService.Get(Configuration.ConfFolder.SECURITY, Configuration.ConfEntry.SRTP_TYPE, Configuration.DEFAULT_SECURITY_SRTP_TYPE), true)
                );

            MediaSessionMgr.defaultsSetProfile(
                (tmedia_profile_t)Enum.Parse(typeof(tmedia_profile_t), this.configurationService.Get(Configuration.ConfFolder.MEDIA, Configuration.ConfEntry.PROFILE, Configuration.DEFAULT_MEDIA_PROFILE), true)
                );

            MediaSessionMgr.defaultsSetRtpSymetricEnabled(
                this.configurationService.Get(Configuration.ConfFolder.NATT, Configuration.ConfEntry.USE_SYMETRIC_RTP, Configuration.DEFAULT_NATT_USE_SYMETRIC_RTP)
                );
            MediaSessionMgr.defaultsSetIceEnabled(
                this.configurationService.Get(Configuration.ConfFolder.NATT, Configuration.ConfEntry.USE_ICE, Configuration.DEFAULT_NATT_USE_ICE)
                );
            MediaSessionMgr.defaultsSetStunEnabled(
                this.configurationService.Get(Configuration.ConfFolder.NATT, Configuration.ConfEntry.USE_STUN_FOR_SIP, Configuration.DEFAULT_NATT_USE_STUN_FOR_SIP)
                );
            MediaSessionMgr.defaultsSetIceStunEnabled(
                this.configurationService.Get(Configuration.ConfFolder.NATT, Configuration.ConfEntry.USE_STUN_FOR_ICE, Configuration.DEFAULT_NATT_USE_STUN_FOR_ICE)
                );
            MediaSessionMgr.defaultsSetIceTurnEnabled(
                this.configurationService.Get(Configuration.ConfFolder.NATT, Configuration.ConfEntry.USE_TURN_FOR_ICE, Configuration.DEFAULT_NATT_USE_TURN_FOR_ICE)
                );
            MediaSessionMgr.defaultsSetStunServer(
                this.configurationService.Get(Configuration.ConfFolder.NATT, Configuration.ConfEntry.STUN_SERVER, Configuration.DEFAULT_NATT_STUN_SERVER),
                (ushort)this.configurationService.Get(Configuration.ConfFolder.NATT, Configuration.ConfEntry.STUN_PORT, Configuration.DEFAULT_NATT_STUN_PORT)
                );
            MediaSessionMgr.defaultsSetStunCred(
                this.configurationService.Get(Configuration.ConfFolder.NATT, Configuration.ConfEntry.STUN_USERNAME, Configuration.DEFAULT_NATT_STUN_USERNAME),
                this.configurationService.Get(Configuration.ConfFolder.NATT, Configuration.ConfEntry.STUN_PASSWORD, Configuration.DEFAULT_NATT_STUN_PASSWORD)
                );

            return ret;
        }