Exemple #1
0
        /// <summary>
        /// Contructor.
        /// </summary>
        public SoftPhoneUtils()
        {
            try
            {
                if (LicenseManager.Instance.LicenseType.ToString().Equals("Expired") || LicenseManager.Instance.LicenseType.ToString().Equals("Trial"))
                {
                    var userName = "******";
                    var key      = "UDoyMDMzLTEyLTI1LFVQOjIwMzMtMDEtMDEsTUNDOjUwMCxNUEw6NTAwLE1TTEM6NTAwLE1GQzo1MDAsRzcyOTp0cnVlLE1XUEM6NTAwLE1JUEM6NTAwfHFQZDBhQnhlaEFGaTlNMmV4cXZxaHUyVE5rMWh2S0FzaUZlVlowbFFseTZWZ3JKbmFMTXh3ZVV2elBGcEliTFpwNHZtZDArZlZwc2VkRGpjQWdKR3ZnPT0=";
                    LicenseManager.Instance.SetLicense(userName, key);
                }
            }
            catch (Exception e)
            {
                log.Error(e);
            }

            //Crear instancia softPhone. Rango 5000-10000
            softphone = SoftPhoneFactory.CreateSoftPhone(softPhoneRangeMin, softPhoneRangeMax);

            softphone.EnableCodec(0);
            softphone.EnableCodec(8);//PCMU(G711U)=> 0, PCMA(G711A)=> 8
            log.Info(softphone.Codecs);

            mediaSender = new PhoneCallAudioSender();
            connector   = new MediaConnector();
        }
        private void Nasluchuj()
        {
            softphone     = SoftPhoneFactory.CreateSoftPhone(zalogowanyUzytkownik.AdresIP, 4900, 5100);
            mediaSender   = new PhoneCallAudioSender();
            mediaReceiver = new PhoneCallAudioReceiver();
            connector     = new MediaConnector();
            var config = new DirectIPPhoneLineConfig(zalogowanyUzytkownik.AdresIP.ToString(), 5060);

            phoneLine = softphone.CreateDirectIPPhoneLine(config);
            phoneLine.Config.SRTPMode           = Ozeki.Common.SRTPMode.Prefer;
            phoneLine.RegistrationStateChanged += line_RegStateChanged;
            phoneLine.SIPAccount.UserName       = zalogowanyUzytkownik.login;
            phoneLine.SIPAccount.DisplayName    = zalogowanyUzytkownik.imie + " " + zalogowanyUzytkownik.nazwisko;
            System.Windows.Application.Current.Dispatcher.Invoke(() => { System.Windows.Application.Current.MainWindow.Title = "SuperIP Phone - " + zalogowanyUzytkownik.login + "@" + zalogowanyUzytkownik.AdresIP + ":" + phoneLine.SIPAccount.DomainServerPort; });//ustawienie nazwy okna
            softphone.IncomingCall += softphone_IncomingCall;
            phoneLine.InstantMessaging.MessageReceived += PhoneLine_InstantMessageReceived;
            softphone.RegisterPhoneLine(phoneLine);
            foreach (var kodek in softphone.Codecs)
            {
                softphone.EnableCodec(kodek.PayloadType);
            }
        }
 /// <summary>
 /// Enables a codec.
 /// </summary>
 /// <param name="payloadType">The payload type of the codec.</param>
 internal void EnableCodec(int payloadType)
 {
     softPhone.EnableCodec(payloadType);
 }
Exemple #4
0
 /// <summary>
 /// This method enables the codecs received as parameters.
 /// </summary>
 public void EnableCodec(int codec)
 {
     softphone.EnableCodec(codec);
 }