Example #1
0
        public IAccount Register()
        {
            if (string.IsNullOrEmpty(_registrarDomain))
            {
                throw new ArgumentNullException("domain");
            }

            IAccountInternal account = CreateAccount();

            using (account.InitializationScope())
            {
                account.Credential = new NetworkCredential(_login, _password, "*");

                var sb = new SipUriBuilder();
                sb.AppendExtension(_login).AppendDomain(_registrarDomain);
                if (!string.IsNullOrEmpty(_port))
                {
                    sb.AppendPort(_port);
                }
                _transport = _transport ?? _localRegistry.SipTransport;
                if (_transport is TcpTransport)
                {
                    sb.AppendTransportSuffix(TransportType.Tcp);
                }
                else if (_transport is TlsTransport)
                {
                    sb.AppendTransportSuffix(TransportType.Tls);
                }
                account.AccountId = sb.ToString();

                sb.Clear();

                sb.AppendDomain(_registrarDomain);
                if (!string.IsNullOrEmpty(_port))
                {
                    sb.AppendPort(_port);
                }
                if (_transport is TcpTransport)
                {
                    sb.AppendTransportSuffix(TransportType.Tcp);
                }
                else if (_transport is TlsTransport)
                {
                    sb.AppendTransportSuffix(TransportType.Tls);
                }

                account.RegistrarUri = sb.ToString();
                account.SetTransport(_transport);
                account.PublishPresence = _publish;
                if (_regTimeout != default(int))
                {
                    account.RegistrationTimeout = _regTimeout;
                }
            }

            InternalRegister(account);
            return(account);
        }
Example #2
0
 public ICallBuilder Through(string port)
 {
     _sb.AppendPort(port);
     return(this);
 }
Example #3
0
 public IBuddyBuilder Through(string port)
 {
     _uriBuilder.AppendPort(port);
     return(this);
 }
Example #4
0
 public IMessageBuilder Through(string port)
 {
     _builder.AppendPort(port);
     return(this);
 }