you need to open the corresponding ports in your router and redirect them to the internal ip of the computer. osc uses udp so you'll need to specify that it's for the udp protocol not tcp
there's libraries that allow to auto open the ports in the router but it's not trivial and it doesn't always work