First of all, we must be precise in our terms. The term “outsourcing” only refers to the process of taking some function that was once performed within a firm and having an outside firm do that work. This does not necessarily have anything to do with absolute or comparative advantage since it can be done within the same country. The process that you seem to be referring to in this question is “offshoring.” When a firm engages in offshoring, it outsources some part of its operations, but it does so to a firm in another country. This is where comparative and absolute advantage come into play.
When firms offshore some part of their production, they typically do it because they can tell that the other country has an absolute advantage in that aspect of production. They can see that firms in the other country can perform the same work but can do it more cheaply. This is absolute advantage. Firms are less likely to be able to actually determine if the other country has a comparative advantage. Comparative advantage is more of a term of economic theory that is not so easily measured in real life and is not likely to play a large role in a firm’s decision making process.