public string ToXMLNoParent()
        {
            string localSocketStr  = (m_sipCDR.LocalSIPEndPoint != null) ? m_sipCDR.LocalSIPEndPoint.ToString() : null;
            string remoteSocketStr = (m_sipCDR.RemoteEndPoint != null) ? m_sipCDR.RemoteEndPoint.ToString() : null;
            string progressTimeStr = (m_sipCDR.ProgressTime != null) ? m_sipCDR.ProgressTime.Value.ToString("o") : null;
            string answerTimeStr   = (m_sipCDR.AnswerTime != null) ? m_sipCDR.AnswerTime.Value.ToString("o") : null;
            string hangupTimeStr   = (m_sipCDR.HangupTime != null) ? m_sipCDR.HangupTime.Value.ToString("o") : null;

            string cdrXML =
                "  <id>" + m_sipCDR.CDRId.ToString() + "</id>" + m_newLine +
                "  <owner>" + m_sipCDR.Owner + "</owner>" + m_newLine +
                "  <adminmemberid>" + m_sipCDR.AdminMemberId + "</adminmemberid>" + m_newLine +
                "  <direction>" + m_sipCDR.CallDirection + "</direction>" + m_newLine +
                "  <inserted>" + Inserted.ToString("o") + "</inserted>" + m_newLine +
                "  <created>" + m_sipCDR.Created.ToString("o") + "</created>" + m_newLine +
                "  <dsturi>" + SafeXML.MakeSafeXML(m_sipCDR.Destination.ToString()) + "</dsturi>" + m_newLine +
                "  <fromheader>" + SafeXML.MakeSafeXML(m_sipCDR.From.ToString()) + "</fromheader>" + m_newLine +
                "  <callid>" + m_sipCDR.CallId + "</callid>" + m_newLine +
                "  <localsocket>" + localSocketStr + "</localsocket>" + m_newLine +
                "  <remotesocket>" + remoteSocketStr + "</remotesocket>" + m_newLine +
                "  <bridgeid>" + m_sipCDR.BridgeId.ToString() + "</bridgeid>" + m_newLine +
                "  <inprogresstime>" + progressTimeStr + "</inprogresstime>" + m_newLine +
                "  <inprogressstatus>" + m_sipCDR.ProgressStatus + "</inprogressstatus>" + m_newLine +
                "  <inprogressreason>" + m_sipCDR.ProgressReasonPhrase + "</inprogressreason>" + m_newLine +
                "  <answeredtime>" + answerTimeStr + "</answeredtime>" + m_newLine +
                "  <answeredstatus>" + m_sipCDR.AnswerStatus + "</answeredstatus>" + m_newLine +
                "  <answeredreason>" + m_sipCDR.AnswerReasonPhrase + "</answeredreason>" + m_newLine +
                "  <hunguptime>" + hangupTimeStr + "</hunguptime>" + m_newLine +
                "  <hungupreason>" + m_sipCDR.HangupReason + "</hungupreason>" + m_newLine +
                "  <bridgeid>" + m_sipCDR.DialPlanContextID.ToString() + "</bridgeid>" + m_newLine;

            return(cdrXML);
        }
        public string ToXMLNoParent()
        {
            string registrarStr       = (m_registerServer != null) ? m_registerServer.ToString() : null;
            string registerContactStr = (m_registerContact != null) ? SafeXML.MakeSafeXML(m_registerContact.ToString()) : null;

            string providerXML =
                "   <id>" + m_id + "</id>" + m_newLine +
                "   <providertype>" + m_providerType + "<providertype>" + m_newLine +
                "   <owner>" + m_owner + "</owner>" + m_newLine +
                "   <adminmemberid>" + AdminMemberId + "</adminmemberid>" + m_newLine +
                "   <providername>" + m_providerName + "</providername>" + m_newLine +
                "   <providerusername>" + m_providerUsername + "</providerusername>" + m_newLine +
                "   <providerpassword>" + m_providerPassword + "</providerpassword>" + m_newLine +
                "   <providerserver>" + SafeXML.MakeSafeXML(m_providerServer.ToString()) + "</providerserver>" + m_newLine +
                "   <providerauthusername>" + m_providerAuthUsername + "</providerauthusername>" + m_newLine +
                "   <provideroutboundproxy>" + SafeXML.MakeSafeXML(m_providerOutboundProxy) + "</provideroutboundproxy>" + m_newLine +
                "   <providerfrom>" + SafeXML.MakeSafeXML(m_providerFrom) + "</providerfrom>" + m_newLine +
                "   <customheaders>" + SafeXML.MakeSafeXML(m_customHeaders) + "</customheaders>" + m_newLine +
                "   <registercontact>" + registerContactStr + "</registercontact>" + m_newLine +
                "   <registerexpiry>" + m_registerExpiry + "</registerexpiry>" + m_newLine +
                "   <registerserver>" + registrarStr + "</registerserver>" + m_newLine +
                "   <registerrealm>" + SafeXML.MakeSafeXML(m_registerRealm) + "</registerrealm>" + m_newLine +
                "   <registerenabled>" + m_registerEnabled + "</registerenabled>" + m_newLine +
                "   <registerenabledadmin>" + m_registerAdminEnabled + "</registerenabledadmin>" + m_newLine +
                "   <registerdisabledreason>" + SafeXML.MakeSafeXML(m_registerDisabledReason) + "</registerdisabledreason>" + m_newLine +
                "   <inserted>" + m_inserted.ToString("o") + "</inserted>" + m_newLine +
                "   <lastupdate>" + m_lastUpdate.ToString("o") + "</lastupdate>" + m_newLine +
                "   <isreadonly>" + m_isReadOnly + "</isreadonly>" + m_newLine +
                "   <sendmwisubscribe>" + m_sendMWISubscribe + "</sendmwisubscribe>" + m_newLine;

            return(providerXML);
        }
示例#3
0
        public string ToXMLNoParent()
        {
            string customerXML =
                "  <id>" + Id + "</id>" + m_newLine +
                "  <customerusername>" + CustomerUsername + "</customerusername>" + m_newLine +
                "  <customerpassword>" + CustomerPassword + "</customerpassword>" + m_newLine +
                "  <salt>" + Salt + "</salt>" + m_newLine +
                "  <emailaddress>" + EmailAddress + "</emailaddress>" + m_newLine +
                "  <firstname>" + SafeXML.MakeSafeXML(FirstName) + "</firstname>" + m_newLine +
                "  <lastname>" + SafeXML.MakeSafeXML(LastName) + "</lastname>" + m_newLine +
                "  <city>" + SafeXML.MakeSafeXML(City) + "</city>" + m_newLine +
                "  <country>" + Country + "</country>" + m_newLine +
                "  <adminid>" + AdminId + "</adminid>" + m_newLine +
                "  <adminmemberid>" + AdminMemberId + "</adminmemberid>" + m_newLine +
                "  <website>" + SafeXML.MakeSafeXML(WebSite) + "</website>" + m_newLine +
                "  <securityquestion>" + SecurityQuestion + "</securityquestion>" + m_newLine +
                "  <securityanswer>" + SafeXML.MakeSafeXML(SecurityAnswer) + "</securityanswer>" + m_newLine +
                "  <createdfromipaddress>" + CreatedFromIPAddress + "</createdfromipaddress>" + m_newLine +
                "  <inserted>" + Inserted.ToString() + "</inserted>" + m_newLine +
                "  <active>" + Active + "</active>" + m_newLine +
                "  <suspended>" + Suspended + "</suspended>" + m_newLine +
                "  <suspendedreason>" + SuspendedReason + "</suspendedreason>" + m_newLine +
                "  <executioncount>" + ExecutionCount + "</executioncount>" + m_newLine +
                "  <maxexecutioncount>" + MaxExecutionCount + "</maxexecutioncount>" + m_newLine +
                "  <authorisedapps>" + AuthorisedApps + "</authorisedapps>" + m_newLine +
                "  <invitecode>" + InviteCode + "</invitecode>" + m_newLine +
                "  <emailaddressconfirmed>" + EmailAddressConfirmed + "</emailaddressconfirmed>" +
                "  <apikey>" + APIKey + "</apikey>" +
                "  <servicelevel>" + ServiceLevel + "</servicelevel>";

            return(customerXML);
        }
示例#4
0
        public string ToXMLNoParent()
        {
            string hanupAtStr = (HangupAt != null) ? HangupAt.Value.ToString("o") : null;

            string dialogueXML =
                "  <id>" + SIPDialogue.Id + "</id>" + m_newLine +
                "  <owner>" + SIPDialogue.Owner + "</owner>" + m_newLine +
                "  <adminmemberid>" + SIPDialogue.AdminMemberId + "</adminmemberid>" + m_newLine +
                "  <localtag>" + SIPDialogue.LocalTag + "</localtag>" + m_newLine +
                "  <remotetag>" + SIPDialogue.RemoteTag + "</remotetag>" + m_newLine +
                "  <callid>" + SIPDialogue.CallId + "</callid>" + m_newLine +
                "  <cseq>" + SIPDialogue.CSeq + "</cseq>" + m_newLine +
                "  <bridgeid>" + SIPDialogue.BridgeId + "</bridgeid>" + m_newLine +
                "  <remotetarget>" + SafeXML.MakeSafeXML(SIPDialogue.RemoteTarget.ToString()) + "</remotetarget>" +
                m_newLine +
                "  <localuserfield>" + SafeXML.MakeSafeXML(SIPDialogue.LocalUserField.ToString()) +
                "</localuserfield>" + m_newLine +
                "  <remoteuserfield>" + SafeXML.MakeSafeXML(SIPDialogue.RemoteUserField.ToString()) +
                "</remoteuserfield>" + m_newLine +
                "  <routeset>" + SafeXML.MakeSafeXML(RouteSet) + "</routeset>" + m_newLine +
                "  <proxysipsocket>" + SafeXML.MakeSafeXML(ProxySIPSocket) + "</proxysipsocket>" + m_newLine +
                "  <cdrid>" + SIPDialogue.CDRId + "</cdrid>" + m_newLine +
                "  <calldurationlimit>" + SIPDialogue.CallDurationLimit + "</calldurationlimit>" + m_newLine +
                "  <inserted>" + Inserted.ToString("dd MMM yyyy HH:mm:ss zz") + "</inserted>" + m_newLine +
                "  <hangupat>" + hanupAtStr + "</hangupat>" + m_newLine +
                "  <transfermode>" + TransferMode + "</transfermode>" + m_newLine +
                "  <direction>" + Direction + "</direction>" + m_newLine +
                "  <sdp>" + SafeXML.MakeSafeXML(SDP) + "</sdp>" + m_newLine +
                "  <remotesdp>" + SafeXML.MakeSafeXML(RemoteSDP) + "</remotesdp>" + m_newLine +
                //"  <switchboardcallerdescription>" + SafeXML.MakeSafeXML(SIPDialogue.SwitchboardCallerDescription) + "</switchboardcallerdescription>" + m_newLine +
                //"  <switchboarddescription>" + SafeXML.MakeSafeXML(SIPDialogue.SwitchboardDescription) + "</switchboarddescription>" + m_newLine +
                "  <switchboardowner>" + SafeXML.MakeSafeXML(SIPDialogue.SwitchboardOwner) + "</switchboardowner>" +
                m_newLine +
                "  <switchboardlinename>" + SafeXML.MakeSafeXML(SIPDialogue.SwitchboardLineName) +
                "</switchboardlinename>" + m_newLine +
                "  <crmpersonname>" + SafeXML.MakeSafeXML(SIPDialogue.CRMPersonName) + "</crmpersonname>" + m_newLine +
                "  <crmcompanyname>" + SafeXML.MakeSafeXML(SIPDialogue.CRMCompanyName) + "</crmcompanyname>" +
                m_newLine +
                "  <crmpictureurl>" + SafeXML.MakeSafeXML(SIPDialogue.CRMPictureURL) + "</crmpicutureurl>" + m_newLine;

            return(dialogueXML);
        }
        public string ToXMLNoParent()
        {
            string lastRegisterTimeStr    = (m_lastRegisterTime != null) ? m_lastRegisterTime.Value.ToString("o") : null;
            string lastRegisterAttemptStr =
                (m_lastRegisterTime != null) ? m_lastRegisterAttempt.Value.ToString("o") : null;
            string nextRegistrationTimeStr = (m_nextRegistrationTime != DateTimeOffset.MaxValue)
                ? m_nextRegistrationTime.ToString("o")
                : null;
            string bindingExpiryStr = (m_bindingExpiry > 0) ? m_bindingExpiry.ToString() : null;
            string bindingURIStr    = (BindingURI != null) ? BindingURI.ToString() : null;
            string contactsListStr  = null;

            if (ContactsList != null)
            {
                foreach (SIPContactHeader contact in ContactsList)
                {
                    contactsListStr += contact.ToString();
                }
            }

            string providerBindingXML =
                "   <id>" + m_id + "</id>" + m_newLine +
                "   <providerid>" + m_providerId + "</providerid>" + m_newLine +
                "   <providername>" + ProviderName + "</providername>" + m_newLine +
                "   <owner>" + m_owner + "</owner>" + m_newLine +
                "   <adminmemberid>" + AdminMemberId + "</adminmemberid>" + m_newLine +
                "   <bindinguri>" + bindingURIStr + "</bindinguri>" + m_newLine +
                "   <cseq>" + CSeq + "</cseq>" + m_newLine +
                "   <contactheader>" + SafeXML.MakeSafeXML(contactsListStr) + "</contactheader>" + m_newLine +
                "   <registrationfailuremessage>" + SafeXML.MakeSafeXML(m_registrationFailureMessage) +
                "</registrationfailuremessage>" + m_newLine +
                "   <lastregistertime>" + lastRegisterTimeStr + "</lastregistertime>" + m_newLine +
                "   <lastregisterattempt>" + lastRegisterAttemptStr + "</lastregisterattempt>" + m_newLine +
                "   <nextregistrationtime>" + nextRegistrationTimeStr + "</nextregistrationtime>" + m_newLine +
                "   <bindingexpiry>" + bindingExpiryStr + "</bindingexpiry>" + m_newLine +
                "   <isregistered>" + m_isRegistered + "</isregistered>" + m_newLine +
                "   <registrarsipsocket>" + RegistrarSIPSocket + "</registrarsipsocket>" + m_newLine;

            return(providerBindingXML);
        }
        public string ToXMLNoParent()
        {
            string contactURIStr        = (m_contactURI != null) ? m_contactURI.ToString() : null;
            string mangledContactURIStr = (m_mangledContactURI != null) ? m_mangledContactURI.ToString() : null;

            string registrarBindingXML =
                "   <id>" + Id + "</id>" + m_newLine +
                "   <sipaccountid>" + SIPAccountId + "</sipaccountid>" + m_newLine +
                "   <sipaccountname>" + SIPAccountName + "</sipaccountname>" + m_newLine +
                "   <owner>" + Owner + "</owner>" + m_newLine +
                "   <adminmemberid>" + AdminMemberId + "</adminmemberid>" + m_newLine +
                "   <contacturi>" + contactURIStr + "</contacturi>" + m_newLine +
                "   <mangledcontacturi>" + mangledContactURIStr + "</mangledcontacturi>" + m_newLine +
                "   <expiry>" + Expiry + "</expiry>" + m_newLine +
                "   <useragent>" + SafeXML.MakeSafeXML(UserAgent) + "</useragent>" + m_newLine +
                "   <remotesipsocket>" + RemoteSIPSocket + "</remotesipsocket>" + m_newLine +
                "   <proxysipsocket>" + ProxySIPSocket + "</proxysipsocket>" + m_newLine +
                "   <registrarsipsocket>" + RegistrarSIPSocket + "</registrarsipsocket>" + m_newLine +
                "   <lastupdate>" + m_lastUpdate.ToString("o") + "</lastupdate>" + m_newLine +
                "   <expirytime>" + ExpiryTime.ToString("o") + "</expirytime>" + m_newLine;

            return(registrarBindingXML);
        }
示例#7
0
        public string ToXMLNoParent()
        {
            string sipAccountXML =
                "  <id>" + m_id + "</id>" + m_newLine +
                "  <owner>" + m_owner + "</owner>" + m_newLine +
                "  <sipusername>" + m_sipUsername + "</sipusername>" + m_newLine +
                "  <sippassword>" + m_sipPassword + "</sippassword>" + m_newLine +
                "  <sipdomain>" + m_sipDomain + "</sipdomain>" + m_newLine +
                "  <sendnatkeepalives>" + m_sendNATKeepAlives + "</sendnatkeepalives>" + m_newLine +
                "  <isincomingonly>" + m_isIncomingOnly + "</isincomingonly>" + m_newLine +
                "  <outdialplanname>" + m_outDialPlanName + "</outdialplanname>" + m_newLine +
                "  <indialplanname>" + m_inDialPlanName + "</indialplanname>" + m_newLine +
                "  <isuserdisabled>" + m_isUserDisabled + "</isuserdisabled>" + m_newLine +
                "  <isadmindisabled>" + m_isAdminDisabled + "</isadmindisabled>" + m_newLine +
                "  <disabledreason>" + m_adminDisabledReason + "</disabledreason>" + m_newLine +
                "  <networkid>" + m_networkId + "</networkid>" + m_newLine +
                "  <ipaddressacl>" + SafeXML.MakeSafeXML(m_ipAddressACL) + "</ipaddressacl>" + m_newLine +
                "  <inserted>" + m_inserted.ToString("o") + "</inserted>" + m_newLine +
                "  <isswitchboardenabled>" + m_isSwitchboardEnabled + "</isswitchboardenabled>" + m_newLine +
                "  <dontmangleenabled>" + m_dontMangleEnabled + "</dontmangleenabled>" + m_newLine +
                "  <avatarurl>" + m_avatarURL + "</avatarurl>";

            return(sipAccountXML);
        }
示例#8
0
        public static string ValidateAndClean(SIPAccount sipAccount)
        {
            if (sipAccount.Owner.IsNullOrBlank())
            {
                return("The owner must be specified when creating a new SIP account.");
            }
            if (sipAccount.SIPUsername.IsNullOrBlank())
            {
                return("The username must be specified when creating a new SIP account.");
            }
            if (sipAccount.SIPDomain.IsNullOrBlank())
            {
                return("The domain must be specified when creating a new SIP account.");
            }
            else if (sipAccount.SIPUsername.Length < USERNAME_MIN_LENGTH)
            {
                return("The username must be at least " + USERNAME_MIN_LENGTH + " characters long.");
            }
            else if (Regex.Match(sipAccount.SIPUsername, BANNED_SIPACCOUNT_NAMES).Success)
            {
                return("The username you have requested is not permitted.");
            }
            else if (Regex.Match(sipAccount.SIPUsername, "[^" + USERNAME_ALLOWED_CHARS + "]").Success)
            {
                return("The username had an invalid character, characters permitted are alpha-numeric and .-_.");
            }
            else if (sipAccount.SIPUsername.Contains(".") &&
                     (sipAccount.SIPUsername.Substring(sipAccount.SIPUsername.LastIndexOf(".") + 1).Trim().Length >= USERNAME_MIN_LENGTH &&
                      sipAccount.SIPUsername.Substring(sipAccount.SIPUsername.LastIndexOf(".") + 1).Trim() != sipAccount.Owner))
            {
                return("You are not permitted to create this username. Only user " + sipAccount.SIPUsername.Substring(sipAccount.SIPUsername.LastIndexOf(".") + 1).Trim() + " can create SIP accounts ending in " + sipAccount.SIPUsername.Substring(sipAccount.SIPUsername.LastIndexOf(".")).Trim() + ".");
            }
            else if (!sipAccount.IsIncomingOnly || !sipAccount.SIPPassword.IsNullOrBlank())
            {
                if (sipAccount.SIPPassword.IsNullOrBlank())
                {
                    return("A password must be specified.");
                }
                else if (sipAccount.SIPPassword.Length < PASSWORD_MIN_LENGTH || sipAccount.SIPPassword.Length > PASSWORD_MAX_LENGTH)
                {
                    return("The password field must be at least " + PASSWORD_MIN_LENGTH + " characters and no more than " + PASSWORD_MAX_LENGTH + " characters.");
                }
                else
                {
                    #region Check the password illegal characters.

                    char[] passwordChars = sipAccount.SIPPassword.ToCharArray();

                    bool illegalCharFound = false;
                    char illegalChar      = ' ';

                    foreach (char passwordChar in passwordChars)
                    {
                        if (Regex.Match(passwordChar.ToString(), "[a-zA-Z0-9]").Success)
                        {
                            continue;
                        }
                        else
                        {
                            bool validChar = false;
                            foreach (char allowedChar in NONAPLPHANUM_ALLOWED_PASSWORD_CHARS)
                            {
                                if (allowedChar == passwordChar)
                                {
                                    validChar = true;
                                    break;
                                }
                            }

                            if (validChar)
                            {
                                continue;
                            }
                            else
                            {
                                illegalCharFound = true;
                                illegalChar      = passwordChar;
                                break;
                            }
                        }
                    }

                    #endregion

                    if (illegalCharFound)
                    {
                        return("Your password has an invalid character " + illegalChar + " it can only contain a to Z, 0 to 9 and characters in this set " + SafeXML.MakeSafeXML(new String(NONAPLPHANUM_ALLOWED_PASSWORD_CHARS)) + ".");
                    }
                }
            }

            sipAccount.Owner       = sipAccount.Owner.Trim();
            sipAccount.SIPUsername = sipAccount.SIPUsername.Trim();
            sipAccount.SIPPassword = (sipAccount.SIPPassword.IsNullOrBlank()) ? null : sipAccount.SIPPassword.Trim();
            sipAccount.SIPDomain   = sipAccount.SIPDomain.Trim();

            return(null);
        }