Index: channels/chan_sip.c =================================================================== --- channels/chan_sip.c (revision 314598) +++ channels/chan_sip.c (working copy) @@ -5016,8 +5016,9 @@ peername2 = ast_strdupa(opeer); AST_NONSTANDARD_RAW_ARGS(hostport, peername2, ':'); - if (hostport.port) + if (hostport.port) { dialog->portinuri = 1; + } dialog->timer_t1 = global_t1; /* Default SIP retransmission timer T1 (RFC 3261) */ dialog->timer_b = global_timer_b; /* Default SIP transaction timer B (RFC 3261) */ @@ -5051,14 +5052,13 @@ /* This address should be updated using dnsmgr */ ast_sockaddr_copy(&dialog->sa, addr); } else { - /* Let's see if we can find the host in DNS. First try DNS SRV records, then hostname lookup */ /*! \todo Fix this function. When we ask for SRV, we should check all transports In the future, we should first check NAPTR to find out transport preference */ hostn = peername; - /* Section 4.2 of RFC 3263 specifies that if a port number is specified, then + /* Section 4.2 of RFC 3263 specifies that if a port number is specified, then * an A record lookup should be used instead of SRV. */ if (!hostport.port && sip_cfg.srvlookup) { @@ -5073,6 +5073,7 @@ if (ast_sockaddr_resolve_first(&dialog->sa, hostn, 0)) { ast_log(LOG_WARNING, "No such host: %s\n", peername); + return -1; } if (srv_ret > 0) { @@ -5080,8 +5081,9 @@ } } - if (!dialog->socket.type) + if (!dialog->socket.type) { set_socket_transport(&dialog->socket, SIP_TRANSPORT_UDP); + } if (!dialog->socket.port) { dialog->socket.port = htons(ast_sockaddr_port(&bindaddr)); }