Optimized routing between communication networks