Esempio n. 1
0
        private string NormalizeRequestUri(int accId, string dest)
        {
            if (dest.IndexOf('@') != -1)
            {
                return(dest);
            }

            SIPUri uri = new SIPUri();

            uri.User = dest;

            Account account = GetAccount(accId);

            if (account == null)
            {
                return(dest);
            }

            uri.Host = account.Domain;
            return(uri.Uri);
        }
Esempio n. 2
0
        public bool AddAccount(Account account)
        {
            SIPUri uri = new SIPUri();

            uri.User = account.User;
            uri.Host = account.Domain;
            string userUri = uri.Uri;

            uri = new SIPUri {
                Host = account.Domain
            };
            string regUri = uri.Uri;

            string proxyUri = null;

            if (!account.IsDomainRegistration && !string.IsNullOrEmpty(account.Proxy))
            {
                uri.Host  = account.Proxy;
                proxyUri  = uri.Uri;
                proxyUri += ";hide";
            }

            int accId  = -1;
            int status = PJSIPInterop.sua_acc_add(userUri, regUri, account.User, account.Password,
                                                  account.Domain, proxyUri, account.IsRegistrationEnabled ? 1 : 0,
                                                  account.RegistrationExpire, account.IsAutoShowInboundVideo ? 1 : 0, ref accId);

            if (status != PJSIPInterop.OK)
            {
                return(false);
            }

            account.Id = accId;
            _accounts.Add(account);
            return(true);
        }