This commit is contained in:
Thomas Ries 2019-05-10 14:52:31 +00:00
parent 44b0fddf07
commit 970f0b30a6
2 changed files with 11 additions and 3 deletions

View File

@ -382,11 +382,15 @@ sts=sip_obscure_callid(ticket);
*/
} else {
/* get the destination from the SIP URI */
/* 1) try SRV record */
/*&&&& Here, the SRV record lookup magic must go.
In a first implementation we may just try to get the lowest priority,
max weighted '_sip._udp.domain' entry and port number.
No load balancing and no failover are supported with this.
&&&*/
/* 2) if no SRV record found, resolve A record */
sts = get_ip_by_host(request->req_uri->host, &ticket->next_hop.sin_addr);
if (sts == STS_FAILURE) {
DEBUGC(DBCLASS_PROXY, "proxy_request: cannot resolve URI [%s]",

View File

@ -52,10 +52,14 @@ static int _resolve(char *name, int class, int type,
* dnamelen length of return buffer
* port port number of service
*/
int resolve_SRV(char *name, char *dname, int dnamelen, int *port) {
int resolve_SRV(char *name, int proto, char *dname, int dnamelen, int *port) {
char nname[256];
snprintf(nname, sizeof(nname), "_sip._udp.%s", name);
return _resolve(name, C_IN, T_SRV, dname, dnamelen, port);
if (proto == IPPROTO_TCP) {
snprintf(nname, sizeof(nname), "_sip._tcp.%s", name);
} else {
snprintf(nname, sizeof(nname), "_sip._udp.%s", name);
}
return _resolve(nname, C_IN, T_SRV, dname, dnamelen, port);
}
#if USE_NAPTR