Hello!

As Asterisk doesn't care about destinations used for each request if there is a DNS SRV set given by the DNS resolution (more than one server in the response) I would like to shrink the used destinations received from DNS SRV query to one server (as the SRV list is unchanged since years now regarding German Telekom).

I can do this like in the attached patch - but I didn't find any way so far to bring in a (new) option of transport configuration e.g. to this callback. Isn't there any way?


Thanks for any hint.
Michael
--- 1/res/res_pjsip/pjsip_resolver.c	2021-03-11 18:23:06.000000000 +0100
+++ 2/res/res_pjsip/pjsip_resolver.c	2021-04-02 10:32:35.541203000 +0200
@@ -273,6 +273,7 @@ static void sip_resolve_callback(const s
 	int idx, address_count = 0, have_naptr = 0, have_srv = 0;
 	unsigned short order = 0;
 	int strict_order = 0;
+	unsigned short enoughSrvRecords = 0;
 
 	ast_debug(2, "[%p] All parallel queries completed\n", resolve);
 
@@ -347,6 +348,11 @@ static void sip_resolve_callback(const s
 
 				/* SRV records just create new queries for AAAA+A, nothing fancy */
 				ast_debug(2, "[%p] SRV record received on target '%s'\n", resolve, ast_dns_query_get_name(query));
+				if (enoughSrvRecords) {
+					/* we prefer to have only one SRV record */
+					continue;
+					}
+				enoughSrvRecords++;
 
 				/* If an explicit IPv6 target transport has been requested look for only AAAA records */
 				if ((target->transport & PJSIP_TRANSPORT_IPV6) &&
-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev

Reply via email to