public void sendCode()
        {
            string deviceId   = CrossDeviceInfo.Current.Id;
            string deviceInfo = CrossDeviceInfo.Current.Manufacturer + " " + CrossDeviceInfo.Current.Model + " " + CrossDeviceInfo.Current.Platform + " " + CrossDeviceInfo.Current.Version;

            HttpControler.register(Phone, CodeSms, deviceId, deviceInfo);
        }
        public void accCall()
        {
            //IsAccept = true;
            // IsIncoming = false;
            try
            {
                if (curCall != null)
                {
                    // playSoundService.StopSystemSound();
                    curCall.Accept();

                    IsAccept   = true;
                    IsIncoming = false;
                }
                else
                {
                    MessagingCenter.Send <string, string>("Call", "CallState", "End");
                }
            }
            catch (Exception ex)
            {
                string _login     = CrossSettings.Current.GetValueOrDefault("sipPhoneLogin", "");
                string deviceId   = CrossDeviceInfo.Current.Id;
                string deviceInfo = CrossDeviceInfo.Current.Manufacturer + " " + CrossDeviceInfo.Current.Model + " " + CrossDeviceInfo.Current.Platform + " " + CrossDeviceInfo.Current.Version;
                HttpControler.ErrorLogSend(_login, deviceInfo, deviceId, "Current call dont exist. CallPage. accCall " + ex.Message);
                MessagingCenter.Send <string, string>("Call", "CallState", "End");
            }
        }
 public void sendMessage()
 {
     if (UserEmail.Length > 0 && UserMessage.Length > 0)
     {
         string deviceId = CrossDeviceInfo.Current.Id;
         HttpControler.feedbackSend(UserEmail, UserMessage, deviceId, fileName);
     }
     else
     {
         UserDialogs.Instance.Alert("Требуется заполнить поля Почта и Сообщение");
     }
 }
Beispiel #4
0
        public void startPage()
        {
            MessagingCenter.Subscribe <string, string>("HttpControler", "History", (sender, arg) =>
            {
                historyResult(arg.Trim());
            });
            MessagingCenter.Subscribe <string, string>("HttpControler", "Error", (sender, arg) =>
            {
                showError(arg.Trim());
            });
            string deviceId = CrossDeviceInfo.Current.Id;
            string phone    = CrossSettings.Current.GetValueOrDefault("sipPhoneLogin", "");

            HttpControler.history(phone, deviceId);
        }
 public void cancelCall()
 {
     // IsAccept = false;
     // IsIncoming = true;
     try
     {
         Core.TerminateAllCalls();
         MessagingCenter.Send <string, string>("Call", "CallState", "End");
     }
     catch (Exception ex)
     {
         string _login     = CrossSettings.Current.GetValueOrDefault("sipPhoneLogin", "");
         string deviceId   = CrossDeviceInfo.Current.Id;
         string deviceInfo = CrossDeviceInfo.Current.Manufacturer + " " + CrossDeviceInfo.Current.Model + " " + CrossDeviceInfo.Current.Platform + " " + CrossDeviceInfo.Current.Version;
         HttpControler.ErrorLogSend(_login, deviceInfo, deviceId, "Current call dont exist. CallPage. cancelCall " + ex.Message);
         MessagingCenter.Send <string, string>("Call", "CallState", "End");
     }
 }
        public void startPage()
        {
            //Name = "ИК2-Иркутская область";
            curCall = Core.CurrentCall;

            Name = "";

            if (curCall != null)
            {
                Name = curCall.RemoteAddress.DisplayName;
            }
            else
            {
                string _login     = CrossSettings.Current.GetValueOrDefault("sipPhoneLogin", "");
                string deviceId   = CrossDeviceInfo.Current.Id;
                string deviceInfo = CrossDeviceInfo.Current.Manufacturer + " " + CrossDeviceInfo.Current.Model + " " + CrossDeviceInfo.Current.Platform + " " + CrossDeviceInfo.Current.Version;
                HttpControler.ErrorLogSend(_login, deviceInfo, deviceId, "Current call dont exist. CallPage. StartPage");
                MessagingCenter.Send <string, string>("Call", "CallState", "End");
            }

            if (!IsAccept)
            {
                Device.StartTimer(TimeSpan.FromSeconds(1), OnTimerTick);
            }

            if (firstOpen)
            {
                Duration         = 0;
                IsAccept         = false;
                IsIncoming       = true;
                IsSpeakerPhoneOn = false;
                IsMicOn          = true;
                firstOpen        = false;
                IsPaused         = false;
                MicrofonIcon     = "MicrofonWhite.png";
                MicrofonTC       = "#FFFFFF";
                SpeakerIcon      = "SpeakerWhite.png";
                SpeakerTC        = "#FFFFFF";
            }

            // playSoundService.InitSystemSound();
            // playSoundService.PlaySystemSound();
        }
Beispiel #7
0
        public void reconnect()
        {
            try
            {
                Core.ClearAllAuthInfo();
                Core.ClearProxyConfig();
                RegStatus     = "Оффлайн";
                RegStatusIcon = "StatusOffline.png";

                var authInfo   = Factory.Instance.CreateAuthInfo(Phone, null, _pass, null, null, "ic.pismo-fsin.ru");
                var transports = Core.Transports;
                transports.UdpPort = 0;
                transports.TlsPort = 5061;
                transports.TcpPort = 0;
                Core.Transports    = transports;
                Core.AddAuthInfo(authInfo);

                var proxyConfig = Core.CreateProxyConfig();
                var identity    = Factory.Instance.CreateAddress("sip:" + Phone + "@ic.pismo-fsin.ru");
                identity.Username  = Phone;
                identity.Domain    = "ic.pismo-fsin.ru";
                identity.Transport = Linphone.TransportType.Tls;
                proxyConfig.Edit();
                proxyConfig.IdentityAddress = identity;
                proxyConfig.ServerAddr      = "ic.pismo-fsin.ru";
                proxyConfig.Route           = "ic.pismo-fsin.ru";
                proxyConfig.RegisterEnabled = true;
                proxyConfig.Done();
                Core.AddProxyConfig(proxyConfig);
                Core.DefaultProxyConfig = proxyConfig;

                Core.RefreshRegisters();
            }
            catch (Exception ex)
            {
                string _login     = CrossSettings.Current.GetValueOrDefault("sipPhoneLogin", "");
                string deviceId   = CrossDeviceInfo.Current.Id;
                string deviceInfo = CrossDeviceInfo.Current.Manufacturer + " " + CrossDeviceInfo.Current.Model + " " + CrossDeviceInfo.Current.Platform + " " + CrossDeviceInfo.Current.Version;
                HttpControler.ErrorLogSend(_login, deviceInfo, deviceId, "Core init error. MainPage. reconnect " + ex.Message);
            }

            // notificationManager.ScheduleNotification("Своя Связь", "тест");
        }
 public void muteCall()
 {
     /*IsMicOn = !IsMicOn;
      * if (IsMicOn)
      * {
      *  MicrofonIcon = "MicrofonWhite.png";
      *  MicrofonTC = "#FFFFFF";
      * }
      * else
      * {
      *  MicrofonIcon = "MicrofonBlue.png";
      *  MicrofonTC = "#00A3FF";
      * }*/
     try
     {
         if (curCall != null)
         {
             curCall.MicrophoneMuted = !curCall.MicrophoneMuted;
             IsMicOn = !IsMicOn;
             if (IsMicOn)
             {
                 MicrofonIcon = "MicrofonWhite.png";
                 MicrofonTC   = "#FFFFFF";
             }
             else
             {
                 MicrofonIcon = "MicrofonBlue.png";
                 MicrofonTC   = "#00A3FF";
             }
         }
     }
     catch (Exception ex)
     {
         string _login     = CrossSettings.Current.GetValueOrDefault("sipPhoneLogin", "");
         string deviceId   = CrossDeviceInfo.Current.Id;
         string deviceInfo = CrossDeviceInfo.Current.Manufacturer + " " + CrossDeviceInfo.Current.Model + " " + CrossDeviceInfo.Current.Platform + " " + CrossDeviceInfo.Current.Version;
         HttpControler.ErrorLogSend(_login, deviceInfo, deviceId, "Current call dont exist. CallPage. muteCall " + ex.Message);
         MessagingCenter.Send <string, string>("Call", "CallState", "End");
     }
 }
 private bool OnTimerTick()
 {
     //return true;
     try
     {
         if (curCall.State == CallState.Paused)
         {
             IsPaused = true;
         }
         else
         {
             IsPaused = false;
         }
         if (Core.CallsNb > 0)
         {
             if (IsAccept)
             {
                 Duration += 1;
             }
             return(true);
         }
         else
         {
             //playSoundService.StopSystemSound();
             MessagingCenter.Send <string, string>("Call", "CallState", "End");
             return(false);
         }
     }
     catch (Exception ex)
     {
         //MessagingCenter.Send<string, string>("Call", "CallState", "End");
         string _login     = CrossSettings.Current.GetValueOrDefault("sipPhoneLogin", "");
         string deviceId   = CrossDeviceInfo.Current.Id;
         string deviceInfo = CrossDeviceInfo.Current.Manufacturer + " " + CrossDeviceInfo.Current.Model + " " + CrossDeviceInfo.Current.Platform + " " + CrossDeviceInfo.Current.Version;
         HttpControler.ErrorLogSend(_login, deviceInfo, deviceId, "Current call dont exist. CallPage. OnTimerTick " + ex.Message);
         return(false);
     }
 }
Beispiel #10
0
 private void OnCall(Core lc, Call lcall, CallState state, string message)
 {
     try
     {
         // Core.StopRinging();
         if (Core.CallsNb > 0)
         {
             if (Core.CurrentCall.State == CallState.IncomingReceived)
             {
                 if (FlagSleep == 0)
                 {
                     MessagingCenter.Send <string, string>("Call", "CallState", "Incoming");
                 }
                 else
                 {
                     //if (isNotifySend == 0)
                     //{
                     string userName = Core.CurrentCall.RemoteAddress.DisplayName;
                     notificationManager.ScheduleNotification("Своя Связь", "Входящий звонок " + userName);
                     isNotifySend = 1;
                     //}
                 }
             }
             else if (Core.CurrentCall.State == CallState.StreamsRunning)
             {
             }
         }
     }
     catch (Exception ex)
     {
         //UserDialogs.Instance.Alert(ex.Message);
         string _login     = CrossSettings.Current.GetValueOrDefault("sipPhoneLogin", "");
         string deviceId   = CrossDeviceInfo.Current.Id;
         string deviceInfo = CrossDeviceInfo.Current.Manufacturer + " " + CrossDeviceInfo.Current.Model + " " + CrossDeviceInfo.Current.Platform + " " + CrossDeviceInfo.Current.Version;
         HttpControler.ErrorLogSend(_login, deviceInfo, deviceId, "Call OnCall. MainPage. OnCall " + ex.Message);
         MessagingCenter.Send <string, string>("Call", "CallState", "End");
     }
 }
Beispiel #11
0
        public void startPage()
        {
            MessagingCenter.Subscribe <string, string>("HttpControler", "GetServerVersion", (sender, arg) => {
                checkVersion(arg.Trim());
            });
            HttpControler.GetServerVersion();
            string s        = CrossDeviceInfo.Current.DeviceName;
            string deviceId = CrossDeviceInfo.Current.Id;

            s = CrossDeviceInfo.Current.Model;
            s = CrossDeviceInfo.Current.Platform.ToString();

            Phone = CrossSettings.Current.GetValueOrDefault("sipPhoneLogin", "");
            _pass = CrossSettings.Current.GetValueOrDefault("sipPhonePass", "");

            VersionNumber = "Версия " + CrossDeviceInfo.Current.AppVersion;

            string curFCMToken = fCMService.GetToken();

            HttpControler.FCMTokenSend(Phone, curFCMToken, deviceId);

            //Phone = "leon2";
            //_pass = "******";


            RegStatus     = "Оффлайн";
            RegStatusIcon = "StatusOffline.png";
            if (Core.DefaultProxyConfig?.State == RegistrationState.Ok)
            {
                Core.EnsureRegistered();
                RegStatus     = "Онлайн";
                RegStatusIcon = "StatusOnline.png";
            }
            else
            {
                reconnect();
            }


            //Core.NatPolicy.StunServer = "stun.l.google.com:19302";
            //Core.NatPolicy.StunEnabled = true;
            //Core.NatPolicy.TlsTurnTransportEnabled = true;
            //Core.NatPolicy.TurnEnabled = true;



            IEnumerable <PayloadType> q   = Core.AudioPayloadTypes;
            List <PayloadType>        cur = new List <PayloadType>();
            int a = 0;

            foreach (PayloadType c in q)
            {
                a++;
                if (c.MimeType == "PCMU" || c.MimeType == "PCMA" || c.MimeType == "G729")
                {
                    if (c.MimeType == "G729")
                    {
                        c.RecvFmtp = "annexb=no";
                    }
                    cur.Add(c);
                }
                else
                {
                    c.Number = -1;
                    cur.Add(c);
                }
            }

            Core.AudioPayloadTypes = cur;

            q = Core.AudioPayloadTypes;

            foreach (PayloadType c in q)
            {
                a++;
            }

            Core.Ring                         = null;
            Core.Ringback                     = null;
            Core.RingerDevice                 = null;
            Core.RemoteRingbackTone           = null;
            Core.RingDuringIncomingEarlyMedia = false;
            //Core.PushNotificationEnabled = false;

            isNotifySend = 0;

            if (Core.CallsNb > 0)
            {
                isNotifySend = 1;
                MessagingCenter.Send <string, string>("Call", "CallState", "Incoming");
            }

            string isNotificationPermission = CrossSettings.Current.GetValueOrDefault("sipNotifyPer", "0");

            if (isNotificationPermission == "0")
            {
                checkNotifyPermission();
            }
        }
 public void sendCall()
 {
     IsResultTextVisible = false;
     CrossSettings.Current.AddOrUpdateValue("sipPhoneTmpLogin", Phone);
     HttpControler.register(Phone, "", "", "");
 }