Author: oej
Date: Thu Aug 21 09:01:57 2014
New Revision: 421672

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=421672
Log:
Not giving up yet.

Modified:
    team/oej/pgtips-srv-and-outbound-stuff-1.8/channels/chan_sip.c

Modified: team/oej/pgtips-srv-and-outbound-stuff-1.8/channels/chan_sip.c
URL: 
http://svnview.digium.com/svn/asterisk/team/oej/pgtips-srv-and-outbound-stuff-1.8/channels/chan_sip.c?view=diff&rev=421672&r1=421671&r2=421672
==============================================================================
--- team/oej/pgtips-srv-and-outbound-stuff-1.8/channels/chan_sip.c (original)
+++ team/oej/pgtips-srv-and-outbound-stuff-1.8/channels/chan_sip.c Thu Aug 21 
09:01:57 2014
@@ -5858,6 +5858,14 @@
 
                                ast_debug(3, "   ==> Settling with SRV entry 
%d:   %s Port %d\n", rec, hostn, port);
                        }
+                       /* If we didn't find SRV records, just go on with it 
and look for host names (A and AAAA records) . */
+                       if (srv_ret == 0) {
+                               if 
(ast_sockaddr_resolve_first_transport(&dialog->sa, hostn, 0, 
dialog->socket.type ? dialog->socket.type : SIP_TRANSPORT_UDP)) {
+                                       ast_log(LOG_WARNING, "No such host or 
domain: %s\n", peername);
+                                       return -1;
+                               }
+                       }
+                       
                } else {
 
                        if (ast_sockaddr_resolve_first_transport(&dialog->sa, 
hostn, 0, dialog->socket.type ? dialog->socket.type : SIP_TRANSPORT_UDP)) {
@@ -13910,6 +13918,9 @@
                        ast_log(LOG_WARNING, "Unable to allocate registration 
transaction (memory or socket error)\n");
                        return 0;
                }
+               /* If we have a port configured, do not activate SRV record 
lookup for this host */
+               p->portinuri = r->portconfigured;
+
                if (r->srvcontext) {
                        char hostname[MAXHOSTNAMELEN];
                        const char *host = &hostname[0];
@@ -13929,7 +13940,8 @@
                                /* Let's try with another host */
                                ast_string_field_set(r, hostname, host);
                                dosrvlookup = FALSE;
-                               ast_sockaddr_set_port(&p->sa, port);
+                               p->portinuri = TRUE;            /* Prevents DNS 
SRV lookup in create_addr */
+                               p->socket.port = port;
                                r->srvattempts++;
                                ast_debug(3, "  ---> REGISTER SRV failover #%d 
on domain %s to host %s port %d \n", r->srvattempts, r->regdomain, host, port);
                        }
@@ -13940,8 +13952,6 @@
                /* reset tag to consistent value from registry */
                ast_string_field_set(p, tag, r->localtag);
 
-               /* If we have a port configured, do not activate SRV record 
lookup for this host */
-               p->portinuri = r->portconfigured;
 
                if (p->do_history) {
                        append_history(p, "RegistryInit", "Account: %s@%s", 
r->username, r->hostname);


-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

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

Reply via email to