To solve this dilemma, start with teaching them to sit for any attention, then when they are barking, if we distract them (maybe with by whistling or making
a smooching noise), they will look to us for attention and offer the behavior which has been previously rewarded — a calm, quiet sit.