The joint distribution of sojourn times in finite semi-Markov processes