Choose correct interface/ip automatically
If we run osmo-mgw in a setup where RTP streams are switched through more than a single interface will run into a problem. On startup osmo-mgw gets a statically configured IP-Address via VTY config. This IP-Address is returned with every MDCX/CRCX response. This works fine as long as all RTP traffic is passing through the configured interface.
In cases where a client tries to switch an RTP stream through an interface different from the configured one osmo-mgw still (binds to and) returns the IP-Address that has been configured. The problem is that the other side will then try to send the RTP traffic to that IP-Address, which will fail.
(e.g. osmo-mgw is bound to 126.96.36.199, 188.8.131.52 will be returned with any CRCX or MDCX, even when the remote host is connected through the interface with IP 184.108.40.206)
A solution could be to determine the correct interface/ip automatically. Then we could (bind to and) return the IP oft the interface that actually points to the remote side. All information we would need to do this is the IP-Address of the remote side. Then we can use osmo_sock_local_ip() from libosmocore to determine the IP we have to use.
However, this only works well if we can get the IP-Address of the remote side early with a CRCX message. Luckily this is the case with osmo-bsc, there we do a single phased connection assignment (one CRCX with remote IP, one response with local ip). For the other cases where we do not get the remote end IP with the CRCX we must fall back to the configured IP address.