return <tt>true</tt> if the stun server should be automatically discovered,
     * otherwise false if serverOverride is enabled; serviceDomain is likely not reachable.
     */
    public boolean isAutoDiscoverStun()
    {
        return getAccountPropertyBoolean(ProtocolProviderFactory.AUTO_DISCOVER_STUN,!isServerOverridden());
    }

    /**
     * Sets the <tt>autoDiscoverStun</tt> property.
     *
     * @param autoDiscoverStun <tt>true</tt> to indicate that stun server should be auto-discovered, <tt>false</tt> -
     * otherwise.
     */
    public void setAutoDiscoverStun(boolean autoDiscoverStun)
    {
        putAccountProperty(ProtocolProviderFactory.AUTO_DISCOVER_STUN, autoDiscoverStun);
    }

    /**
     * Sets the <tt>useDefaultStunServer</tt> property.
     *
     * @param useDefaultStunServer <tt>true</tt> to indicate that default stun server should be used if no others are
     * available, <tt>false</tt> otherwise.
     */
    public void setUseDefaultStunServer(boolean useDefaultStunServer)
    {
        putAccountProperty(ProtocolProviderFactory.USE_DEFAULT_STUN_SERVER, useDefaultStunServer);
    }

    /**
     * Sets the <tt>autoDiscoverJingleNodes</tt> property.
     *
     * @param autoDiscoverJingleNodes <tt>true</tt> to indicate that relay server should be auto-discovered,
     * <tt>false</tt> - otherwise.
     */
    public void setAutoDiscoverJingleNodes(boolean autoDiscoverJingleNodes)
    {
        putAccountProperty(ProtocolProviderFactory.AUTO_DISCOVER_JINGLE_NODES, autoDiscoverJingleNodes);
    }

    /**
     * Indicates if the JingleNodes relay server should be automatically discovered.
     *
     * @return <tt>true</tt> if the relay server should be automatically discovered, otherwise
     * returns <tt>false</tt>.
     */
    public boolean isAutoDiscoverJingleNodes()
    {
        return getAccountPropertyBoolean(ProtocolProviderFactory.AUTO_DISCOVER_JINGLE_NODES, true);
    }

    /**
     * Sets the <tt>useJingleNodes</tt> property.
     *
     * @param isUseJingleNodes <tt>true</tt> to indicate that Jingle Nodes should be used for this account,
     * <tt>false</tt> - otherwise.
     */
    public void setUseJingleNodes(boolean isUseJingleNodes)
    {
        putAccountProperty(ProtocolProviderFactory.IS_USE_JINGLE_NODES, isUseJingleNodes);
    }

    /**
     * Indicates if JingleNodes relay should be used.
     *
     * @return <tt>true</tt> if JingleNodes should be used, <tt>false</tt> otherwise
     */
    public boolean isUseJingleNodes()
    {
        return getAccountPropertyBoolean(ProtocolProviderFactory.IS_USE_JINGLE_NODES, true);
    }

    /**
     * Indicates if UPnP should be used for this account.
     *
     * @return <tt>true</tt> if UPnP should be used for this account, otherwise returns
     * <tt>false</tt>
     */
    public boolean isUseUPNP()
    {
        return getAccountPropertyBoolean(ProtocolProviderFactory.IS_USE_UPNP, true);
    }

    /**
     * Sets the <tt>useUPNP</tt> property.
     *
     * @param isUseUPNP <tt>true</tt> to indicate that UPnP should be used for this account, <tt>false</tt> -
     * otherwise.
     */
    public void setUseUPNP(boolean isUseUPNP)
    {
        putAccountProperty(ProtocolProviderFactory.IS_USE_UPNP, isUseUPNP);
    }

    /**
     * Indicates if non-TLS is allowed for this account
     *
     * @return <tt>true</tt> if non-TLS is allowed for this account, otherwise returns
     * <tt>false</tt>
     */
    public boolean isAllowNonSecure()
    {
        return getAccountPropertyBoolean(ProtocolProviderFactory.IS_ALLOW_NON_SECURE, false);
    }

    /**
     * Sets the <tt>isAllowNonSecure</tt> property.
     *
     * @param isAllowNonSecure <tt>true</tt> to indicate that non-TLS is allowed for this account, <tt>false</tt> -
     * otherwise.
     */
    public void setAllowNonSecure(boolean isAllowNonSecure)
    {
        putAccountProperty(ProtocolProviderFactory.IS_ALLOW_NON_SECURE, isAllowNonSecure);
    }

    /**
     * Indicates if message carbons are allowed for this account
     *
     * @return <tt>true</tt> if message carbons are allowed for this account, otherwise returns
     * <tt>false</tt>
     */
    public boolean isCarbonDisabled()
    {
        return getAccountPropertyBoolean(ProtocolProviderFactory.IS_CARBON_DISABLED, false);
    }

    /**
     * Sets the <tt>IS_CARBON_DISABLED</tt> property.
     *
     * @param isCarbonEnabled <tt>true</tt> to indicate that message carbons are allowed for this account,
     * <tt>false</tt> - otherwise.
     */
    public void setDisableCarbon(boolean isCarbonEnabled)
    {
        putAccountProperty(ProtocolProviderFactory.IS_CARBON_DISABLED, isCarbonEnabled);
    }

    /**
     * Is resource auto generate enabled.
     *
     * @return true if resource is auto generated
     */
    public boolean isResourceAutoGenerated()
    {
        return getAccountPropertyBoolean(ProtocolProviderFactory.AUTO_GENERATE_RESOURCE, true);
    }

    /**
     * Set whether resource auto generation is enabled.
     *
     * @param resourceAutoGenerated <tt>true</tt> to indicate that the resource is to be auto generated,
     * <tt>false</tt> - otherwise.
     */
    public void setResourceAutoGenerated(boolean resourceAutoGenerated)
    {
        putAccountProperty(ProtocolProviderFactory.AUTO_GENERATE_RESOURCE, resourceAutoGenerated);
    }

    /**
     * Returns the default sms server.
     *
     * @return the account default sms server
     */
    public String getSmsServerAddress()
    {
        return getAccountPropertyString(ProtocolProviderFactory.SMS_SERVER_ADDRESS);
    }

    /**
     * Sets the default sms server.
     *
     * @param serverAddress the sms server to set as default
     */
    public void setSmsServerAddress(String serverAddress)
    {
        setOrRemoveIfEmpty(ProtocolProviderFactory.SMS_SERVER_ADDRESS, serverAddress);
    }

    /**
     * Returns the service name - the virtualHost (server) we are logging to if it is null which is
     * not supposed to be - we return for compatibility the string we used in the first release for
     * creating AccountID (Using this string is wrong, but used for compatibility for now)
     *
     * @param accountProperties Map
     * @return String
     */
    private static String getServiceName(Map<String, String> accountProperties)
    {
        // return accountProperties.get(ProtocolProviderFactory.SERVER_ADDRESS);
        String jid = accountProperties.get(ProtocolProviderFactory.USER_ID);
        if (jid!= null)
            return XmppStringUtils.parseDomain(jid);
        else
            return null;
    }

    /**
     * Returns the list of JingleNodes trackers/relays that this account is currently configured to
     * use.
     *
     * @return the list of JingleNodes trackers/relays that this account is currently configured to
     * use.
     */
    public List<JingleNodeDescriptor> getJingleNodes()
    {
        Map<String, String> accountProperties = getAccountProperties();
        List<JingleNodeDescriptor> serList = new ArrayList<>();

        for (int i = 0; i < JingleNodeDescriptor.MAX_JN_RELAY_COUNT; i++) {
            JingleNodeDescriptor node