SIP proxy field is not used correctly
Issue generated from Tuleap's migration script. Originally submitted by: Raman Gupta (rocketraman)
A detailed description of the bug. Use following fields for description field:
* Environment:
Ring v1.0.0 on Linux Fedora 25
* Reproduce steps:
Using the hostname and proxy fields to connect to a domain mydomain.com and proxy server proxy.versature.com. The configuration should set up Ring to connect to proxy.versature.com, passing the mydomain.com in the subsequent SIP request(s).
* Expected result:
I would expect ring to connect successfully using this configuration. As a point of comparison, Zoiper will connect successfully.
* Actual result:
The actual result is that Ring attempts to make a SIP connection to the hostname, ignoring the proxy field. The debug logs at SIPLOGLEVEL=4 are:
[1496261573.159|18869|sipaccount.cpp:698 ] doRegister mydomain.com
[1496261573.159|18869|sipvoiplink.cpp:1220 ] try to resolve 'mydomain.com' (port: 0)
16:12:53.159 resolver.c Transmitting 38 bytes to NS 0 (127.0.0.1:53): DNS SRV query for \_sip.\_udp.mydomain.com: Success
16:12:53.190 \_sip.\_udp.redo DNS SRV resolution failed for \_sip.\_udp.mydomain.com: DNS "Name Error" (PJLIB\_UTIL\_EDNS\_NXDOMAIN)
16:12:53.190 \_sip.\_udp.redo DNS SRV resolution failed for \_sip.\_udp.mydomain.com, trying resolving A/AAAA record for mydomain.com
16:12:53.190 resolver.c Transmitting 28 bytes to NS 0 (127.0.0.1:53): DNS A query for mydomain.com: Success
16:12:53.190 resolver.c Transmitting 28 bytes to NS 0 (127.0.0.1:53): DNS AAAA query for mydomain.com: Success
[1496261573.220|18869|sipaccount.cpp:815 ] Creating transport
16:12:53.220 udp0x18cc530 SIP UDP transport started, published address is 192.168.1.6:5062
[1496261573.220|18869|siptransport.cpp:357 ] Created UDP transport on default : 0.0.0.0:5062
[1496261573.221|18869|siptransport.cpp:82 ] SipTransport@0x190acc0 {tr=0x1919ec8 {rc=2}}
[1496261573.221|18869|sip\_utils.cpp:87 ] Adding route proxy.versature.com
[1496261605.223|18869|sipaccount.cpp:1033 ] SIP registration failed, status=408 (Request Timeout)
[1496261605.223|18869|sipaccount.cpp:2018 ] Scheduling re-registration retry in 53 seconds..
[1496261658.316|18869|sip\_utils.cpp:87 ] Adding route proxy.versature.com
[1496261690.321|18869|sipaccount.cpp:1033 ] SIP registration failed, status=408 (Request Timeout)
[1496261690.321|18869|sipaccount.cpp:2018 ] Scheduling re-registration retry in 302 seconds..
IF the system is configured with _sip._udp SRV records on the domain provided in the hostname to point to the proxy, and the proxy field is left blank, then Ring successfully looks up the SRV record and connects to the proxy given there. Explicitly providing the proxy does not work as shown above.
The way I think it should work (and the way I think Zoiper works) is that you have a "domain/hostname" [1] setting and a "proxy" setting. The logic would be:
-
If proxy is set, Ring connects to the proxy and then passes username@domain in the SIP header.
-
If proxy is not set, then Ring looks for the proxy in the DNS SRV records for domain and if it exists, Ring connects to it and then passes username@domain to it.
-
Lastly, if the DNS SRV record does not exist, Ring attempts to connect to the A record of the domain/hostname setting, and again passes username@domain to it.
That way the auth information is completely configurable (username + domain) and the server that handles the request is completely configurable (proxy). The server to physically connect to is configurable either by DNS record on the domain, OR by explicit configuration in the proxy field.
[1] The "domain/hostname" config value would replace the current "hostname" config value.
The codepath to make the SIP connection as described above already exists -- its just that its impossible to configure the UI currently to trigger it. Given an SRV record of _sip._udp.mydomain.com pointing to proxy.versature.com port 5060, Ring makes a connection to proxy.versature.com and passes all information with domain @mydomain.com. Here is a trace https://pastebin.com/raw/5z39MRu8.