コード例 #1
0
 internal void Register()
 {
     if (App.CurrentAccount != null && !string.IsNullOrEmpty(App.CurrentAccount.Username))
     {
         LinphoneService.Register();
     }
 }
コード例 #2
0
 internal void ApplyDtmfInbandChanges()
 {
     // ToDo VATRP-3039 enable RFC2833/4733
     //bool val = this.ConfigurationService.Get(Configuration.ConfSection.GENERAL,
     //    Configuration.ConfEntry.DTMF_INBAND, false);
     LinphoneService.SendDtmfAsTelephoneEvent(true);
 }
コード例 #3
0
        internal void ApplyAVPFChanges()
        {
            // VATRP-1507: Tie RTCP and AVPF together:
            string rtcpFeedback = this.ConfigurationService.Get(Configuration.ConfSection.GENERAL,
                                                                Configuration.ConfEntry.RTCP_FEEDBACK, "Implicit");

            // if RTCPFeedback = Off then RTCP and AVPF are both off
            // if RTCPFeedback = Implicit then RTCP is on, AVPF is off
            // if RTCPFeedback = Explicit then RTCP is on, AVPF = on
            //LinphoneAVPFMode avpfMode = LinphoneAVPFMode.LinphoneAVPFEnabled;
            // Note: we could make the RTCP also be a bool, but using this method in case we need to handle something differently in the future.
            //    eg - is there something that happens if we want rtcp off and avpf on?

            LinphoneService.SetRTCPFeedback(rtcpFeedback);


            // commenting this in case we need somethinghere from the compiler debug statement

            //            var mode = LinphoneAVPFMode.LinphoneAVPFEnabled;
            //#if DEBUG
            //            if (!this.ConfigurationService.Get(Configuration.ConfSection.GENERAL,
            //                Configuration.ConfEntry.AVPF_ON, true))
            //            {
            //                mode = LinphoneAVPFMode.LinphoneAVPFDisabled;
            //            }
            //#endif
            //            LinphoneService.SetAVPFMode(mode);
        }
コード例 #4
0
        internal void ApplyDtmfOnSIPInfoChanges()
        {
            bool val = this.ConfigurationService.Get(Configuration.ConfSection.GENERAL,
                                                     Configuration.ConfEntry.DTMF_SIP_INFO, false);

            LinphoneService.SendDtmfAsSipInfo(val);
        }
コード例 #5
0
 private void LoadPrivateData()
 {
     //****************************************************************************************************************************************************
     // Getting the contacts, starting contact service, chat service etc.
     //****************************************************************************************************************************************************
     LinphoneService.UpdatePrivateDataPath();
     HistoryService.Start();
     ContactService.Start();
     ChatService.Start();
 }
コード例 #6
0
        internal void ApplyCodecChanges()
        {
            var retValue = LinphoneService.UpdateCodecsAccessibility(App.CurrentAccount,
                                                                     CodecType.Audio);

            retValue &= LinphoneService.UpdateCodecsAccessibility(App.CurrentAccount, CodecType.Video);

            if (!retValue)
            {
                SaveAccountSettings();
            }
        }
コード例 #7
0
        internal bool StartLinphoneService()
        {
            //**************************************************************************************************************************
            // Starting Linephone Service
            //**************************************************************************************************************************
            if (App.CurrentAccount == null)
            {
                return(false);
            }
            if (!LinphoneService.Start(true))
            {
                return(false);
            }

            LinphoneService.UpdateAdvancedParameters(App.CurrentAccount);
            if (App.CurrentAccount.AudioCodecsList.Count > 0)
            {
                LinphoneService.UpdateNativeCodecs(App.CurrentAccount, CodecType.Audio);
            }
            else
            {
                LinphoneService.FillCodecsList(App.CurrentAccount, CodecType.Audio);
            }

            if (App.CurrentAccount.VideoCodecsList.Count > 0)
            {
                LinphoneService.UpdateNativeCodecs(App.CurrentAccount, CodecType.Video);
            }
            else
            {
                LinphoneService.FillCodecsList(App.CurrentAccount, CodecType.Video);
            }

            LinphoneService.UpdateNetworkingParameters(App.CurrentAccount);
            LinphoneService.configureFmtpCodec();
            ApplyAVPFChanges();
            ApplyDtmfOnSIPInfoChanges();
            ApplyDtmfInbandChanges();
            ApplyMediaSettingsChanges();
            ApplyCallSettingsChanges();
            return(true);
        }
コード例 #8
0
 internal void Stop()
 {
     LOG.Info("Stopping services...");
     HistoryService.Stop();
     ConfigurationService.Stop();
     LinphoneService.Unregister(true);
     LinphoneService.Stop();
     AccountService.Stop();
     ProviderService.Stop();
     try
     {
         if (_locationRequestTimer != null)
         {
             _locationRequestTimer.Dispose();
         }
     }
     catch
     {
     }
 }
コード例 #9
0
        private void ParseHttpResponse(string response)
        {
            // parse response stream,
            var jss  = new JavaScriptSerializer();
            var dict = jss.Deserialize <Dictionary <string, string> >(response);

            if (dict.ContainsKey("pbx_extension"))
            {
                App.CurrentAccount.RegistrationUser = dict["pbx_extension"];
            }
            if (dict.ContainsKey("auth_token"))
            {
                App.CurrentAccount.RegistrationPassword = dict["auth_token"];
            }

            if (UpdateLinphoneConfig())
            {
                if (LinphoneService.Start(true))
                {
                    LinphoneService.Register();
                }
            }
        }
コード例 #10
0
 internal void AdvancedSettings()
 {
     LinphoneService.UpdateAdvancedParameters(App.CurrentAccount);
 }
コード例 #11
0
 internal void ApplyNetworkingChanges()
 {
     LinphoneService.UpdateNetworkingParameters(App.CurrentAccount);
 }
コード例 #12
0
 public void SetCamera(string deviceId)
 {
     LinphoneService.SetCamera(deviceId);
 }
コード例 #13
0
 private void ApplyCallSettingsChanges()
 {
     LinphoneService.SetIncomingCallRingingTimeout(300);
 }
コード例 #14
0
 public void SetCaptureDevice(string deviceId)
 {
     LinphoneService.SetCaptureDevice(deviceId);
 }
コード例 #15
0
 public void ClearAccountInformation()
 {
     LinphoneService.ClearAccountInformation();
 }
コード例 #16
0
 public VATRPDevice GetSelectedCamera()
 {
     return(LinphoneService.GetSelectedCamera());
 }
コード例 #17
0
 public VATRPDevice GetSelectedSpeakers()
 {
     return(LinphoneService.GetSelectedSpeakers());
 }
コード例 #18
0
 public void SetSpeakers(string deviceId)
 {
     LinphoneService.SetSpeakers(deviceId);
 }
コード例 #19
0
 public List <VATRPDevice> GetAvailableSpeakers()
 {
     return(LinphoneService.GetAvailableSpeakers());
 }
コード例 #20
0
 public VATRPDevice GetSelectedMicrophone()
 {
     return(LinphoneService.GetSelectedMicrophone());
 }
コード例 #21
0
 public List <VATRPDevice> GetAvailableCameras()
 {
     return(LinphoneService.GetAvailableCameras());
 }
コード例 #22
0
        public bool UpdateLinphoneConfig() // cjm-aug17 -- this receives data from app registration data and passes into linphone core for registration process...
        {
            if (App.CurrentAccount == null)
            {
                LOG.Warn("Can't update linphone config. Account is no configured");
                return(false);
            }

            this.LinphoneService.LinphoneConfig.ProxyHost = string.IsNullOrEmpty(App.CurrentAccount.ProxyHostname) ?
                                                            Configuration.LINPHONE_SIP_SERVER : App.CurrentAccount.ProxyHostname;
            LinphoneService.LinphoneConfig.ProxyPort = App.CurrentAccount.HostPort;
            LinphoneService.LinphoneConfig.UserAgent = ConfigurationService.Get(Configuration.ConfSection.LINPHONE, Configuration.ConfEntry.LINPHONE_USERAGENT,
                                                                                Configuration.LINPHONE_USERAGENT);
            LinphoneService.LinphoneConfig.Version       = ConfigurationService.Get(Configuration.ConfSection.LINPHONE, Configuration.ConfEntry.VATRP_VERSION, Configuration.VATRP_VERSION);
            LinphoneService.LinphoneConfig.OutboundProxy = App.CurrentAccount.OutboundProxy;

            LinphoneService.LinphoneConfig.AuthID      = App.CurrentAccount.AuthID;
            LinphoneService.LinphoneConfig.Username    = App.CurrentAccount.RegistrationUser;
            LinphoneService.LinphoneConfig.DisplayName = App.CurrentAccount.DisplayName;
            LinphoneService.LinphoneConfig.Password    = App.CurrentAccount.RegistrationPassword;

            string[] transportList = { "UDP", "TCP", "DTLS", "TLS" };
            if (transportList.All(s => App.CurrentAccount.Transport != s))
            {
                App.CurrentAccount.Transport = "TCP";
                AccountService.Save();
            }

            // set geolocation
            LinphoneService.LinphoneConfig.GeolocationURI = App.CurrentAccount.GeolocationURI;
            LinphoneService.LinphoneConfig.SendLocationWithRegistration = App.CurrentAccount.SendLocationWithRegistration;

            LinphoneService.LinphoneConfig.Transport           = App.CurrentAccount.Transport;
            LinphoneService.LinphoneConfig.EnableSTUN          = App.CurrentAccount.EnableSTUN;
            LinphoneService.LinphoneConfig.EnableTURN          = App.CurrentAccount.EnableTURN;
            LinphoneService.LinphoneConfig.EnableICE           = App.CurrentAccount.EnableICE;
            LinphoneService.LinphoneConfig.STUNAddress         = App.CurrentAccount.STUNAddress;
            LinphoneService.LinphoneConfig.STUNPort            = App.CurrentAccount.STUNPort;
            LinphoneService.LinphoneConfig.MediaEncryption     = GetMediaEncryptionText(App.CurrentAccount.MediaEncryption);
            LinphoneService.LinphoneConfig.EnableAVPF          = App.CurrentAccount.EnableAVPF;
            LinphoneService.LinphoneConfig.DisableUserPhoneTag = App.CurrentAccount.DisableUserPhoneTag;
            // cardDAV
            if (!String.IsNullOrEmpty(App.CurrentAccount.CardDavServerPath))
            {
                LinphoneService.RemoveCardDAVAuthInfo();
                LinphoneService.LinphoneConfig.CardDavRealm = App.CurrentAccount.CardDavRealm;

                LinphoneService.LinphoneConfig.CardDavUser   = App.CurrentAccount.RegistrationUser;
                LinphoneService.LinphoneConfig.CardDavPass   = App.CurrentAccount.RegistrationPassword;
                LinphoneService.LinphoneConfig.CardDavServer = App.CurrentAccount.CardDavServerPath;

                try
                {
                    Uri cardDavServer = new Uri(LinphoneService.LinphoneConfig.CardDavServer);
                    LinphoneService.LinphoneConfig.CardDavDomain = cardDavServer.Host;
                }
                catch (Exception ex)
                {
                    LOG.Error(string.Format("Parse CardDAV server. {0}\n{1}",
                                            LinphoneService.LinphoneConfig.CardDavServer, ex.Message));
                }
            }
            LOG.Info("Linphone service configured for account: " + App.CurrentAccount.RegistrationUser);
            return(true);
        }
コード例 #23
0
 public List <VATRPDevice> GetAvailableMicrophones()
 {
     return(LinphoneService.GetAvailableMicrophones());
 }
コード例 #24
0
        // Note: if the selected device is not available, use the default, and store the default for the current user
        internal void ApplyMediaSettingsChanges()
        {
            // this should never be an issue, but just in case
            if (App.CurrentAccount == null)
            {
                return;
            }
            LinphoneService.LinphoneConfig.MediaEncryption = GetMediaEncryptionText(App.CurrentAccount.MediaEncryption);
            LinphoneService.UpdateMediaSettings(App.CurrentAccount);
            bool accountChanged = false;

            // prior to setting the devices we need to ensure that the selected devices are still options.
            //  for example - did the user unplug the camera since the last run?
            if (!string.IsNullOrEmpty(App.CurrentAccount.SelectedCameraId))
            {
                List <VATRPDevice> availableCameras = GetAvailableCameras();
                if (IsDeviceAvailable(App.CurrentAccount.SelectedCameraId, availableCameras))
                {
                    LinphoneService.SetCamera(App.CurrentAccount.SelectedCameraId);
                }
                else
                {
                    // update the stored setting in the account because the previously selected device is not available
                    VATRPDevice device = GetSelectedCamera();
                    if (device != null)
                    {
                        App.CurrentAccount.SelectedCameraId = device.deviceId;
                        accountChanged = true;
                    }
                }
            }
            if (!string.IsNullOrEmpty(App.CurrentAccount.SelectedMicrophoneId))
            {
                List <VATRPDevice> availableMicrophones = GetAvailableMicrophones();
                if (IsDeviceAvailable(App.CurrentAccount.SelectedMicrophoneId, availableMicrophones))
                {
                    LinphoneService.SetCaptureDevice(App.CurrentAccount.SelectedMicrophoneId);
                }
                else
                {
                    // update the stored setting in the account because the previously selected device is not available
                    VATRPDevice device = GetSelectedMicrophone();
                    if (device != null)
                    {
                        App.CurrentAccount.SelectedMicrophoneId = device.deviceId;
                        accountChanged = true;
                    }
                }
            }
            if (!string.IsNullOrEmpty(App.CurrentAccount.SelectedSpeakerId))
            {
                List <VATRPDevice> availableSpeakers = GetAvailableSpeakers();
                if (IsDeviceAvailable(App.CurrentAccount.SelectedSpeakerId, availableSpeakers))
                {
                    LinphoneService.SetSpeakers(App.CurrentAccount.SelectedSpeakerId);
                }
                else
                {
                    // update the stored setting in the account because the previously selected device is not available
                    VATRPDevice device = GetSelectedSpeakers();
                    if (device != null)
                    {
                        App.CurrentAccount.SelectedSpeakerId = device.deviceId;
                        accountChanged = true;
                    }
                }
            }
            // if there was a change to the account, save it
            if (accountChanged)
            {
                SaveAccountSettings();
            }
        }
コード例 #25
0
 public void ClearProxyInformation()
 {
     LinphoneService.ClearProxyInformation();
 }