This module assigns automatically delivery carrier on sale order creation or confirmation. You may also have a look at the module delivery_auto_refresh in delivery-carrier repository.