Social ability

Is it possible for people with ASD to choose when they are sociable. My husband and me don’t have a diagnosis although we have one or two traits, obsessive interests and fixations, not feeling comfortable in social situations but this could just be shyness and not ASD. . I find with people if I like them and get on particularly well with them then I can chat comfortably to them but this is rare.,Most people I chat to I find it hard to sustain a conversation and feel relaxed. This never comes across I come across as sociable and at ease. My husband can chat comfortably if he likes the person or the topic interests him but if he doesn’t like the person his with he will only speak to them if he needs to or has to. Is this an ASD trait?